feat: add account deletion, announcements and subscription renewal
Support personal records and persistent smoking visibility. Add upload quota preflight, file cleanup, privacy entry, image caching and revision-based page refresh across the backend, admin and mini program.
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
const { tryLoginRenewal } = require('../../utils/subscribe');
|
||||
const { itemsOf, startList, applyList, failList, finishList, withListPagination } = require('../../utils/list-pagination');
|
||||
const { withDataCache } = require('../../utils/page-cache');
|
||||
const { getLayout } = require('../../utils/layout');
|
||||
// pages/punch/punch.js - 情侣打卡
|
||||
const { api, getImageUrl } = require('../../utils/request');
|
||||
Page(withDataCache(withListPagination({
|
||||
onLoginSubscribeTap: function() { return tryLoginRenewal(); },
|
||||
onResize: function() { this.setData(getLayout()); },
|
||||
data: { loadError: false,
|
||||
checkins: [],
|
||||
checkins: [], smokingVisible: false, smokingKnown: false, smokingSaving: false, smokingError: false,
|
||||
coupleInfo: null,
|
||||
myAvatar: '', partnerAvatar: '',
|
||||
myName: '我', partnerName: 'TA',
|
||||
@@ -20,8 +22,20 @@ Page(withDataCache(withListPagination({
|
||||
this.loadCoupleInfo();
|
||||
this.loadData();
|
||||
},
|
||||
onShow: function() { this.loadCoupleInfo(); this.loadData(); },
|
||||
onShow: function() { this.loadSmokingPreference(); this.loadCoupleInfo(); this.loadData(); },
|
||||
|
||||
loadSmokingPreference: async function() {
|
||||
try { const auth=await api.checkAuth(); this.setData({smokingVisible:Number(auth.user.smoking_card_visible)!==0, smokingKnown:true, smokingError:false}); }
|
||||
catch(e) { this.setData({smokingError:true}); }
|
||||
},
|
||||
toggleSmoking: async function(e) {
|
||||
if (this.data.smokingSaving || !this.data.smokingKnown) return;
|
||||
const previous=this.data.smokingVisible;
|
||||
this.setData({smokingSaving:true});
|
||||
try { const result=await api.smokingCardVisible({visible:e.detail.value?1:0}); this.setData({smokingVisible:Number(result.card_visible)===1}); }
|
||||
catch(error) { this.setData({smokingVisible:previous}); wx.showToast({title:error.error||'保存失败,请重试',icon:'none'}); }
|
||||
finally { this.setData({smokingSaving:false}); }
|
||||
},
|
||||
onSmokingUpdated: function() { this.loadData(); },
|
||||
|
||||
onPullDownRefresh: async function() {
|
||||
@@ -120,4 +134,4 @@ Page(withDataCache(withListPagination({
|
||||
goBack: function() { wx.navigateBack(); },
|
||||
goHome: function() { wx.switchTab({ url: '/pages/index/index' }); },
|
||||
goProfile: function() { wx.switchTab({ url: '/pages/profile/profile' }); }
|
||||
}, 'loadData'), {"loadData": ["checkinList", "checkinStats", "coupleInfo"]}));
|
||||
}, 'loadData'), {"loadData": ["checkinList", "checkinStats", "coupleInfo"], "loadSmokingPreference":["checkAuth"], "loadCoupleInfo":["coupleInfo"]}));
|
||||
|
||||
Reference in New Issue
Block a user