feat(calendar): 更新日历接口并优化记录流程

- 将GetRecords接口替换为GetCalendar接口获取日历数据
- 重构首页日历数据显示逻辑,支持年月维度的数据获取
- 优化打卡记录流程,合并选酒和记量步骤为单一添加酒水步骤
- 移除登录页面的游客模式选项,简化首次启动逻辑
- 调整引导页逻辑,移除登录跳转改为直接进入首页
- 优化记录页面UI布局,添加状态栏安全距离适配
- 新增酒水列表管理功能,支持添加和删除已选酒水
- 更新依赖包HaveADrink至v1.0.3版本,同步API变更
This commit is contained in:
cg
2026-07-17 23:51:43 +08:00
parent a73bd79eb5
commit adf6b684b9
13 changed files with 520 additions and 451 deletions
+45 -4
View File
@@ -1,6 +1,6 @@
<template>
<view :class="themeClass" class="page-container card-page">
<view class="card-nav">
<view class="card-nav" :style="{ paddingTop: (statusBarHeight + 12) + 'px' }">
<view class="step-back" @click="goBack">
<text class="step-back-arrow"></text>
</view>
@@ -21,6 +21,9 @@
<button class="btn-secondary share-btn" @click="shareToFriend">
<text>分享给好友</text>
</button>
<button class="btn-text close-home-btn" @click="closeToHome">
<text>返回首页</text>
</button>
</view>
<canvas canvas-id="shareCanvas" class="export-canvas" :style="{width:'750px',height:'1600px'}"></canvas>
@@ -41,7 +44,9 @@ export default {
mixins: [themeMixin],
components: { DrinkCard },
data() {
const sysInfo = uni.getSystemInfoSync()
return {
statusBarHeight: sysInfo.statusBarHeight || 25,
record: null,
saving: false,
saved: false
@@ -410,8 +415,9 @@ export default {
shareToFriend() { uni.showToast({ title: '点击右上角分享', icon: 'none' }) },
goBack() {
console.log('goBack called, saved:', this.saved)
if (this.saved) {
uni.navigateBack()
this._doBack()
return
}
uni.showModal({
@@ -420,12 +426,34 @@ export default {
confirmText: '保存并离开',
cancelText: '直接离开',
success: async (res) => {
console.log('modal result:', res)
if (res.confirm) {
await this.saveToAlbum()
try { await this.saveToAlbum() } catch (e) { /* ignore */ }
}
uni.navigateBack()
this._doBack()
},
fail: (err) => {
console.error('showModal fail:', err)
this._doBack()
}
})
},
closeToHome() {
uni.switchTab({ url: '/pages/index/index' })
},
_doBack() {
console.log('_doBack called, pages:', getCurrentPages().length)
if (getCurrentPages().length > 1) {
uni.navigateBack({
fail: (err) => {
console.error('navigateBack fail:', err)
uni.reLaunch({ url: '/pages/index/index' })
}
})
} else {
console.log('no pages to go back to, reLaunch to index')
uni.reLaunch({ url: '/pages/index/index' })
}
}
},
onShareAppMessage() {
@@ -452,6 +480,7 @@ export default {
align-items: center;
gap: $sp-md;
padding: $sp-md $sp-lg;
padding-top: 0;
}
.step-back {
@@ -462,6 +491,7 @@ export default {
justify-content: center;
border-radius: $radius-full;
background: $bg-card;
flex-shrink: 0;
}
.step-back-arrow {
@@ -524,6 +554,17 @@ export default {
justify-content: center;
}
.close-home-btn {
width: 100%;
background: transparent;
border: none;
color: $text-tertiary;
font-size: $fs-sm;
padding: $sp-sm 0;
&::after { display: none; }
}
.export-canvas {
position: fixed;
left: -9999px;