feat(logs): add quick record flow and reason tags
This commit is contained in:
@@ -189,6 +189,17 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="quit-slip-entry" :style="hpVisualStyle" @tap="openSmokeDialog">
|
||||
<view class="quit-slip-copy">
|
||||
<text class="quit-slip-title">如果刚刚没扛住,先记下来</text>
|
||||
<text class="quit-slip-desc">用快速记录留下时间和诱因,比“等会再说”更能帮你找回节奏。</text>
|
||||
</view>
|
||||
<view class="quit-slip-action">
|
||||
<text class="quit-slip-action-main">快速记录</text>
|
||||
<text class="quit-slip-action-sub">一根 / 当前时间</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="quit-dream-entry" @tap="gotoDreamGoals">
|
||||
<view class="quit-dream-left">
|
||||
<text class="quit-dream-icon">🎯</text>
|
||||
@@ -372,9 +383,9 @@
|
||||
</view>
|
||||
|
||||
<smoke-record-dialog
|
||||
v-if="!isQuitMode"
|
||||
v-model:show="showDialog"
|
||||
:type="dialogType"
|
||||
:quick-mode="true"
|
||||
@submit="handleSubmit"
|
||||
/>
|
||||
</view>
|
||||
@@ -918,20 +929,30 @@ async function handleSubmit(submitData) {
|
||||
try {
|
||||
if (dialogType.value === 'smoke') {
|
||||
await api.createLog(submitData)
|
||||
timerBaseSeconds.value = 0
|
||||
timerSeconds.value = 0
|
||||
startTimer()
|
||||
uni.showToast({ title: '记录成功', icon: 'success' })
|
||||
if (isQuitMode.value) {
|
||||
await fetchQuitHomeData()
|
||||
uni.showToast({ title: '已记下这次波动', icon: 'success' })
|
||||
} else {
|
||||
timerBaseSeconds.value = 0
|
||||
timerSeconds.value = 0
|
||||
startTimer()
|
||||
uni.showToast({ title: '记录成功', icon: 'success' })
|
||||
}
|
||||
} else {
|
||||
await api.createResistedLog({
|
||||
smoke_time: submitData.smoke_time,
|
||||
smoke_at: submitData.smoke_at,
|
||||
remark: submitData.remark,
|
||||
reason_tags: submitData.reason_tags,
|
||||
level: submitData.level,
|
||||
num: submitData.num
|
||||
})
|
||||
uni.showToast({ title: '已记下这次忍住', icon: 'success' })
|
||||
}
|
||||
if (isQuitMode.value) {
|
||||
await fetchAchievement()
|
||||
return
|
||||
}
|
||||
await fetchRecordHomeData()
|
||||
} catch (e) {
|
||||
console.error('handleSubmit error:', e)
|
||||
@@ -1567,6 +1588,60 @@ onShareAppMessage(() => ({
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.quit-slip-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: linear-gradient(135deg, var(--hp-soft, #def7ec) 0%, rgba(255, 255, 255, 0.96) 100%);
|
||||
border: 1rpx solid rgba(15, 23, 42, 0.06);
|
||||
box-shadow: 0 10rpx 24rpx rgba(15, 23, 42, 0.05);
|
||||
}
|
||||
|
||||
.quit-slip-copy {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quit-slip-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.quit-slip-desc {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.quit-slip-action {
|
||||
flex-shrink: 0;
|
||||
padding: 16rpx 18rpx;
|
||||
border-radius: 18rpx;
|
||||
background: linear-gradient(180deg, var(--hp-accent, #14936d) 0%, var(--hp-deep, #0f766e) 100%);
|
||||
box-shadow: 0 14rpx 26rpx rgba(20, 147, 109, 0.2);
|
||||
}
|
||||
|
||||
.quit-slip-action-main {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.quit-slip-action-sub {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 19rpx;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
}
|
||||
|
||||
.quit-milestone-list {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
Reference in New Issue
Block a user