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:
2026-11-04 21:27:03 +08:00
parent 41bcb793da
commit b854d2873e
67 changed files with 430 additions and 227 deletions
+22 -2
View File
@@ -1,3 +1,4 @@
const { guardRecordEntries } = require('../../utils/record-access');
const { tryLoginRenewal } = require('../../utils/subscribe');
const announcementSession = require('../../utils/announcement-session');
const { itemsOf, totalOf } = require('../../utils/list-pagination');
@@ -10,11 +11,12 @@ const { api, getImageUrl } = require('../../utils/request');
const { diaryEntry } = require('../../utils/journal');
const { saveScrollPosition, resetScrollOnTabShow } = require('../../utils/scroll-pos');
Page(withDataCache({
Page(guardRecordEntries(withDataCache({
onLoginSubscribeTap: function() { return tryLoginRenewal(); },
onResize: function() { this.setData(getLayout()); },
data: {
showAnnouncement:false, announcement:null,
greetingDate:'', greetingText:'你好', greetingNote:'把今天的小美好,也留在这里。',
userId: null,
coupleId: null,
@@ -46,6 +48,7 @@ Page(withDataCache({
},
onLoad: function() {
this.updateGreeting();
this.setData(getLayout());
this.setData({
userId: wx.getStorageSync('userId'),
@@ -57,6 +60,7 @@ Page(withDataCache({
},
onShow: function() {
this.updateGreeting();
this._announcementActive=true;
this.loadAnnouncement();
resetScrollOnTabShow(this, 'index');
@@ -78,6 +82,18 @@ Page(withDataCache({
this.fetchIpLocation();
},
updateGreeting: function() {
const now = new Date(), hour = now.getHours();
const weekdays = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
let text, note;
if (hour < 5) { text='夜深了'; note='记下心里的小事,也别忘了早点休息。'; }
else if (hour < 11) { text='早上好'; note='新的一天,也有值得珍藏的小美好。'; }
else if (hour < 14) { text='中午好'; note='好好吃饭,慢慢收藏生活里的甜。'; }
else if (hour < 18) { text='下午好'; note='让忙碌暂停一会儿,记下此刻的心情。'; }
else { text='晚上好'; note='今天的故事,想留在哪一页?'; }
this.setData({greetingDate:(now.getMonth()+1)+'月'+now.getDate()+'日 '+weekdays[now.getDay()],greetingText:text,greetingNote:note});
},
onHide: function() { this._announcementActive=false; },
onUnload: function() { this._announcementActive=false; },
loadAnnouncement: function() {
@@ -241,6 +257,10 @@ Page(withDataCache({
},
loadStats: async function() {
if (!this.data.coupleId) {
this.setData({recentDiary:[],recentAlbums:[],upcomingMemory:null,statsLoading:false,statsError:false,stats:{timeline:0,album:0,diary:0,songs:0,checkin:0,pet:0}});
return;
}
this.setData({ statsLoading: !this._hasCachedData, statsError: false });
try {
const [timeline, album, diary, songs, checkin, pet] = await Promise.all([
@@ -368,4 +388,4 @@ Page(withDataCache({
imageUrl: '/images/share.png'
};
}
}, {"loadData": ["coupleInfo", "timelineList", "albumList", "diaryList", "songsList", "checkinList", "petInfo", "getBgConfig"]}));
}, {"loadData": ["coupleInfo", "timelineList", "albumList", "diaryList", "songsList", "checkinList", "petInfo", "getBgConfig"]}), ['goToDiary', 'goToTimeline', 'goToAlbum', 'goToSongs', 'goToCheckin', 'goToPet', 'goToPeriod', 'openJournalEntry', 'writeDiary', 'openAlbumPreview', 'openRecentDiary', 'showMore']));