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']));
+5
View File
@@ -5,6 +5,11 @@
<view class="home-fixed-header"><view class="home-fixed-heading" style="height:{{barHeight}}px;padding-right:{{navSide}}px;"><text class="j-eyebrow">OUR LITTLE WORLD</text><view class="home-handwritten-title"><text class="j-page-title">让所有的爱有迹可循</text></view></view></view>
<scroll-view class="page-bg home-scroll" scroll-y show-scrollbar="{{false}}" refresher-enabled="{{true}}" refresher-triggered="{{refreshing}}" bindrefresherrefresh="onRefresh" bindscroll="onScroll" scroll-top="{{scrollTop}}">
<view class="j-body home-body">
<view class="home-greeting">
<text class="home-greeting-date">{{greetingDate}}</text>
<text class="home-greeting-title">{{greetingText}},{{partner1Name && partner1Name !== '?' ? partner1Name : '亲爱的'}}</text>
<text class="home-greeting-note">{{greetingNote}}</text>
</view>
<page-state wx:if="{{homeError}}" kind="error" title="首页加载失败" description="请检查网络后重新加载" action="重试" bind:action="loadData" />
<page-state wx:elif="{{!relationshipKnown}}" kind="loading" title="正在打开你的空间" />
<view wx:else class="j-cover">
+8
View File
@@ -57,3 +57,11 @@
.home-has-background .home-couple-panel { padding:24rpx; border:1rpx solid rgba(233,221,208,.65); border-radius:24rpx; background:rgba(255,253,248,.82); }
.notice-overlay {position:fixed;inset:0;z-index:12000;display:flex;align-items:center;justify-content:center;background:rgba(49,36,42,.46);padding:48rpx;box-sizing:border-box;}.notice-dialog{width:100%;max-width:640rpx;background:#FFFCF8;border-radius:36rpx;padding:44rpx;box-sizing:border-box;}.notice-label{display:block;color:#9B7B83;font-size:22rpx;}.notice-title{display:block;font-size:36rpx;color:#64424D;margin:16rpx 0 28rpx;}.notice-content{max-height:50vh;white-space:pre-wrap;font-size:28rpx;line-height:1.8;color:#5F5557;}.notice-dismiss{margin-top:32rpx;background:#667E75;color:#fff;border-radius:20rpx;font-size:28rpx;}
/* 首页问候沿用手账字体与柔和玫瑰色,随正文一起滚动。 */
.home-greeting { margin:0 0 48rpx; padding:0 4rpx; }
.home-greeting-date { display:block; color:#9C747F; font-size:24rpx; line-height:1.6; letter-spacing:1rpx; }
.home-greeting-title { display:block; color:#A44E6B; font-size:44rpx; line-height:1.45; margin-top:8rpx; overflow-wrap:break-word; word-break:break-all; }
.home-greeting-note { display:block; color:#948179; font-size:25rpx; line-height:1.7; margin-top:10rpx; }
.home-has-background .home-greeting { background:rgba(255,253,248,.86); border-radius:24rpx; padding:24rpx 28rpx; }
@media (max-width:350px) { .home-greeting-title { font-size:38rpx; } }