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

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 -5
View File
@@ -1,6 +1,7 @@
const { withDataCache } = require('../../utils/page-cache');
const { getLayout } = require('../../utils/layout');
const { api, getImageUrl } = require('../../utils/request');
Page({
Page(withDataCache({
noop: function() {},
onResize: function() { this.setData(getLayout()); },
data: { loadError: false,
@@ -28,10 +29,14 @@ Page({
this.loadComments();
},
onShow: function() {
if (this.data.diaryId) { this.loadDiary(); this.loadComments(); }
},
loadDiary: async function() {
if (this._pageLoading) return;
this._pageLoading = true;
this.setData({loading:true, loadError:false});
this.setData({loading: !this._hasCachedData, loadError:false});
try {
var data = await api.diaryDetail(this.data.diaryId);
data = this._formatDiary(data);
@@ -68,6 +73,7 @@ Page({
},
loadComments: async function() {
this.setData({ commentsError: false });
try {
var data = await api.diaryCommentList({ diary_id: this.data.diaryId });
if (data && data.length > 0) {
@@ -82,7 +88,7 @@ Page({
});
}
this.setData({ comments: data || [] });
} catch (e) { console.error(e); }
} catch (e) { this.setData({ commentsError: true }); console.error(e); }
},
onShareTap: function() {
@@ -226,5 +232,5 @@ Page({
},
goBack: function() { wx.navigateBack(); },
goHome: function() { wx.redirectTo({ url: '/pages/index/index' }); }
});
goHome: function() { wx.switchTab({ url: '/pages/index/index' }); }
}, {"loadDiary": ["diaryDetail"], "loadComments": ["diaryCommentList"]}));