refactor(mini): 个人中心改为登录+二级菜单结构
Publish Mini Program Dev Version / publish (push) Successful in 1m8s
Publish Mini Program Dev Version / publish (push) Successful in 1m8s
- 个人中心仅保留登录管理、我的数据/功能菜单与关于信息 - 新增偏好设置二级页 preferences(原偏好设置统一收敛至此) - 新增我的收藏二级页 bookmarks,支持删除与跳转日详情 - 生辰管理拆分为二级页 birth-profiles,未登录时提示引导登录 - 八字页入口改为直达生辰管理页;修复 fortune 非 tabBar 页误用 switchTab
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
Page({
|
||||
data: {
|
||||
bookmarks: []
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.loadBookmarks();
|
||||
},
|
||||
|
||||
loadBookmarks() {
|
||||
const bookmarks = wx.getStorageSync('lunar-bookmarks') || [];
|
||||
this.setData({ bookmarks });
|
||||
},
|
||||
|
||||
removeBookmark(e) {
|
||||
const date = e.currentTarget.dataset.date;
|
||||
const bookmarks = this.data.bookmarks.filter(b => b.date !== date);
|
||||
wx.setStorageSync('lunar-bookmarks', bookmarks);
|
||||
this.setData({ bookmarks });
|
||||
wx.showToast({ title: '已删除', icon: 'success' });
|
||||
},
|
||||
|
||||
// 点击收藏项跳转到当日详情
|
||||
openDetail(e) {
|
||||
const date = e.currentTarget.dataset.date;
|
||||
wx.navigateTo({ url: `/pages/day-detail/day-detail?date=${date}` });
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的收藏",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<view class="container">
|
||||
<view class="card">
|
||||
<view class="section-title">我的收藏</view>
|
||||
<view class="bookmark-list" wx:if="{{bookmarks.length > 0}}">
|
||||
<view class="bookmark-item" wx:for="{{bookmarks}}" wx:key="date" bindtap="openDetail" data-date="{{item.date}}">
|
||||
<view class="flex justify-between items-center">
|
||||
<view>
|
||||
<text class="text-base font-medium">{{item.date}}</text>
|
||||
<text class="text-xs text-muted block">{{item.lunarDate}}</text>
|
||||
</view>
|
||||
<view class="btn-ghost text-unlucky" catchtap="removeBookmark" data-date="{{item.date}}">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="empty-tip" wx:else>
|
||||
<text class="text-sm text-muted">暂无收藏</text>
|
||||
<text class="text-xs text-muted block mt-1">在日期详情页点击「收藏」即可添加</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,24 @@
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
margin-bottom: 16rpx;
|
||||
color: #C41E3A;
|
||||
}
|
||||
|
||||
.bookmark-item {
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1rpx solid #E8D5C4;
|
||||
}
|
||||
|
||||
.bookmark-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
Reference in New Issue
Block a user