同步小程序与管理端更新,完善抽烟记录和解绑冷静期

This commit is contained in:
2026-10-09 22:15:51 +08:00
parent a68a4ef411
commit b10fc3c4ac
149 changed files with 3794 additions and 589 deletions
+11 -6
View File
@@ -1,7 +1,8 @@
const { withDataCache } = require('../../utils/page-cache');
const { getLayout } = require('../../utils/layout');
// pages/punch/punch.js - 情侣打卡
const { api, getImageUrl } = require('../../utils/request');
Page({
Page(withDataCache({
onResize: function() { this.setData(getLayout()); },
data: { loadError: false,
checkins: [],
@@ -20,7 +21,11 @@ Page({
},
onShow: function() { this.loadCoupleInfo(); this.loadData(); },
onSmokingUpdated: function() { this.loadData(); },
onPullDownRefresh: async function() {
const smoking = this.selectComponent && this.selectComponent("#smoking");
if (smoking) await smoking.load(true);
await this.loadCoupleInfo();
await this.loadData();
wx.stopPullDownRefresh();
@@ -29,7 +34,7 @@ Page({
// 从接口加载情侣头像和名称
loadCoupleInfo: function() {
var self = this;
api.coupleInfo().then(function(info) {
return api.coupleInfo().then(function(info) {
self._applyCoupleInfo(info);
}).catch(function(e) { console.error(e); });
},
@@ -52,7 +57,7 @@ Page({
loadData: async function() {
if (this._pageLoading) return;
this._pageLoading = true;
this.setData({loading:true, loadError:false});
this.setData({loading: !this._hasCachedData, loadError:false});
try {
const [res, stats] = await Promise.all([
api.checkinList(),
@@ -112,6 +117,6 @@ Page({
},
goBack: function() { wx.navigateBack(); },
goHome: function() { wx.redirectTo({ url: '/pages/index/index' }); },
goProfile: function() { wx.redirectTo({ url: '/pages/profile/profile' }); }
});
goHome: function() { wx.switchTab({ url: '/pages/index/index' }); },
goProfile: function() { wx.switchTab({ url: '/pages/profile/profile' }); }
}, {"loadData": ["checkinList", "checkinStats", "coupleInfo"]}));