feat: require couple binding and refine miniapp settings
Gate record features and storage entry points with invitation guidance; enforce record access in the backend. Add homepage greetings, right-swipe profile dismissal, and move the smoking switch to settings. Simplify API base configuration and remove the unused legacy tab bar component.
This commit is contained in:
@@ -6,6 +6,7 @@ const { guardStorageSpace } = require('../../utils/storage-guard');
|
||||
Page({
|
||||
onResize: function() { this.setData(getLayout()); },
|
||||
data: {
|
||||
smokingVisible:true, smokingKnown:false, smokingSaving:false, smokingError:false,
|
||||
showBgModal: false,
|
||||
bgPreview: '',
|
||||
bgFilePath: '',
|
||||
@@ -41,6 +42,7 @@ Page({
|
||||
},
|
||||
|
||||
onShow: async function() {
|
||||
this.loadSmokingPreference();
|
||||
this.setData({ bindingKnown: false, bindingError:false });
|
||||
try {
|
||||
var info = await api.coupleInfo();
|
||||
@@ -59,6 +61,19 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
loadSmokingPreference: async function() {
|
||||
try { const auth=await api.checkAuth(); this.setData({smokingVisible:Number(auth.user.smoking_card_visible)!==0,smokingKnown:true,smokingError:false}); }
|
||||
catch(error) { 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}); }
|
||||
},
|
||||
|
||||
goBind: function() {
|
||||
getApp().globalData.openProfileBind = true;
|
||||
wx.switchTab({ url: '/pages/profile/profile' });
|
||||
|
||||
Reference in New Issue
Block a user