feat(mini): 各页面增加分享入口(好友/朋友圈)及设置页微调

This commit is contained in:
gouki
2026-08-10 23:03:16 +00:00
parent 738b5c4452
commit 52c0d3c774
14 changed files with 172 additions and 26 deletions
+13
View File
@@ -149,5 +149,18 @@ Page({
goFortune() { goFortune() {
wx.navigateTo({ url: '/pages/fortune/fortune' }); wx.navigateTo({ url: '/pages/fortune/fortune' });
},
onShareAppMessage() {
return {
title: '八字排盘 - 生辰八字查询',
path: '/pages/bazi/bazi'
};
},
onShareTimeline() {
return {
title: '八字排盘 - 生辰八字查询'
};
} }
}); });
@@ -104,5 +104,18 @@ Page({
// 未登录时引导回个人中心登录 // 未登录时引导回个人中心登录
goLogin() { goLogin() {
wx.navigateBack(); wx.navigateBack();
},
onShareAppMessage() {
return {
title: '生辰档案 - 老黄历',
path: '/pages/birth-profiles/birth-profiles'
};
},
onShareTimeline() {
return {
title: '生辰档案 - 老黄历'
};
} }
}); });
+13
View File
@@ -24,5 +24,18 @@ Page({
openDetail(e) { openDetail(e) {
const date = e.currentTarget.dataset.date; const date = e.currentTarget.dataset.date;
wx.navigateTo({ url: `/pages/day-detail/day-detail?date=${date}` }); wx.navigateTo({ url: `/pages/day-detail/day-detail?date=${date}` });
},
onShareAppMessage() {
return {
title: '我的收藏 - 老黄历',
path: '/pages/bookmarks/bookmarks'
};
},
onShareTimeline() {
return {
title: '我的收藏 - 老黄历'
};
} }
}); });
+12 -1
View File
@@ -82,5 +82,16 @@ Page({
} }
}, },
noop() {} onShareAppMessage() {
return {
title: '万年历 - 农历公历对照查询',
path: '/pages/calendar/calendar'
};
},
onShareTimeline() {
return {
title: '万年历 - 农历公历对照查询'
};
}
}); });
+20
View File
@@ -39,5 +39,25 @@ Page({
goBazi() { goBazi() {
wx.navigateTo({ url: '/pages/bazi/bazi' }); wx.navigateTo({ url: '/pages/bazi/bazi' });
},
onShareAppMessage() {
const { dayInfo } = this.data;
const title = dayInfo.lunarMonthName
? `${dayInfo.lunarMonthName}${dayInfo.lunarDayName} 黄历详情`
: '每日黄历详情';
return {
title,
path: `/pages/day-detail/day-detail?date=${this.data.date}`
};
},
onShareTimeline() {
const { dayInfo } = this.data;
return {
title: dayInfo.lunarMonthName
? `${dayInfo.lunarMonthName}${dayInfo.lunarDayName} 黄历详情`
: '每日黄历详情'
};
} }
}); });
+13
View File
@@ -60,5 +60,18 @@ Page({
const { boneYearIndex, boneMonthIndex, boneDayIndex, boneHourIndex } = this.data; const { boneYearIndex, boneMonthIndex, boneDayIndex, boneHourIndex } = this.data;
const result = calculateBoneWeight(boneYearIndex, boneMonthIndex + 1, boneDayIndex + 1, boneHourIndex); const result = calculateBoneWeight(boneYearIndex, boneMonthIndex + 1, boneDayIndex + 1, boneHourIndex);
this.setData({ boneResult: result }); this.setData({ boneResult: result });
},
onShareAppMessage() {
return {
title: '占卜工具 - 梅花易数称骨算命',
path: '/pages/divination/divination'
};
},
onShareTimeline() {
return {
title: '占卜工具 - 梅花易数称骨算命'
};
} }
}); });
+13
View File
@@ -43,5 +43,18 @@ Page({
goBazi() { goBazi() {
wx.switchTab({ url: '/pages/bazi/bazi' }); wx.switchTab({ url: '/pages/bazi/bazi' });
},
onShareAppMessage() {
return {
title: '每日运势 - 今日运势查询',
path: '/pages/fortune/fortune'
};
},
onShareTimeline() {
return {
title: '每日运势 - 今日运势查询'
};
} }
}); });
+13
View File
@@ -50,5 +50,18 @@ Page({
onHighlightLunarChange(e) { onHighlightLunarChange(e) {
this.setData({ highlightLunar: e.detail.value }); this.setData({ highlightLunar: e.detail.value });
this.saveSettings(); this.saveSettings();
},
onShareAppMessage() {
return {
title: '偏好设置 - 老黄历',
path: '/pages/preferences/preferences'
};
},
onShareTimeline() {
return {
title: '偏好设置 - 老黄历'
};
} }
}); });
+15 -2
View File
@@ -46,7 +46,7 @@ Page({
success: (loginRes) => { success: (loginRes) => {
if (!loginRes.code) { if (!loginRes.code) {
this.setData({ logging: false }); this.setData({ logging: false });
wx.showToast({ title: '微信登录失败', icon: 'none' }); wx.showToast({ title: '授权登录失败', icon: 'none' });
return; return;
} }
request({ request({
@@ -72,7 +72,7 @@ Page({
}, },
fail: () => { fail: () => {
this.setData({ logging: false }); this.setData({ logging: false });
wx.showToast({ title: '微信登录失败', icon: 'none' }); wx.showToast({ title: '授权登录失败', icon: 'none' });
} }
}); });
}, },
@@ -100,5 +100,18 @@ Page({
} else { } else {
wx.navigateTo({ url }); wx.navigateTo({ url });
} }
},
onShareAppMessage() {
return {
title: '老黄历 - 个人中心',
path: '/pages/settings/settings'
};
},
onShareTimeline() {
return {
title: '老黄历 - 个人中心'
};
} }
}); });
+9 -11
View File
@@ -8,25 +8,24 @@
<text>客</text> <text>客</text>
</view> </view>
<view> <view>
<text class="text-base font-medium">{{userInfo.nickname || '微信用户'}}</text> <text class="text-sm font-medium">{{userInfo.nickname || '授权用户'}}</text>
<text class="text-xs text-muted block">已登录,生辰档案云端同步</text> <text class="text-xs text-muted block">已登录,生辰档案云端同步</text>
</view> </view>
</view> </view>
<view class="btn-ghost text-muted" bindtap="logout">退出</view> <view class="btn-ghost text-muted" bindtap="logout">退出</view>
</view> </view>
<block wx:else> <view class="flex items-center justify-between" wx:else>
<view class="flex items-center gap-2 mb-2"> <view class="flex items-center gap-2">
<view class="avatar avatar-placeholder"> <view class="avatar avatar-placeholder">
<text>客</text> <text>客</text>
</view> </view>
<view> <view>
<text class="text-base font-medium">未登录</text> <text class="text-sm font-medium">未登录</text>
<text class="text-xs text-muted block">绑定的生辰仅保存在本机,登录后才生效</text> <text class="text-xs text-muted block">登录后生辰档案云端同步,换设备不丢失</text>
</view> </view>
</view> </view>
<view class="btn-primary text-center" bindtap="login">{{logging ? '登录中…' : '微信登录'}}</view> <view class="btn-primary btn-sm" bindtap="login">{{logging ? '登录中…' : '授权登录'}}</view>
<view class="text-xs text-muted text-center mt-2">登录后可将生辰档案同步到云端,换设备不丢失</view> </view>
</block>
</view> </view>
<!-- 我的数据 --> <!-- 我的数据 -->
@@ -76,10 +75,9 @@
<!-- 关于 --> <!-- 关于 -->
<view class="card"> <view class="card">
<view class="section-title">关于</view> <view class="section-title">关于</view>
<view class="text-sm text-muted"> <view class="text-xs text-muted">
<text>老黄历小程序 v{{version}}</text> <text>老黄历 v{{version}}</text>
<text class="block mt-1" wx:if="{{buildNumber !== '0'}}">构建 #{{buildNumber}} ({{commitSha}})</text> <text class="block mt-1" wx:if="{{buildNumber !== '0'}}">构建 #{{buildNumber}} ({{commitSha}})</text>
<text class="block mt-1">提供农历、黄历、八字、许愿等功能</text>
</view> </view>
</view> </view>
</view> </view>
+17 -10
View File
@@ -1,17 +1,17 @@
.container { .container {
padding: 20rpx; padding: 16rpx;
} }
.section-title { .section-title {
font-size: 28rpx; font-size: 26rpx;
font-weight: 600; font-weight: 600;
margin-bottom: 16rpx; margin-bottom: 8rpx;
color: #C41E3A; color: #C41E3A;
} }
.avatar { .avatar {
width: 96rpx; width: 72rpx;
height: 96rpx; height: 72rpx;
border-radius: 50%; border-radius: 50%;
} }
@@ -21,14 +21,21 @@
justify-content: center; justify-content: center;
background: #C41E3A; background: #C41E3A;
color: #FFFFFF; color: #FFFFFF;
font-size: 40rpx; font-size: 32rpx;
}
.btn-sm {
padding: 10rpx 28rpx;
font-size: 26rpx;
border-radius: 32rpx;
white-space: nowrap;
} }
.menu-item { .menu-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 24rpx 0; padding: 18rpx 0;
border-bottom: 1rpx solid #E8D5C4; border-bottom: 1rpx solid #E8D5C4;
} }
@@ -37,7 +44,7 @@
} }
.menu-label { .menu-label {
font-size: 28rpx; font-size: 26rpx;
} }
.menu-right { .menu-right {
@@ -47,11 +54,11 @@
} }
.menu-count { .menu-count {
font-size: 24rpx; font-size: 22rpx;
color: #9E8E7E; color: #9E8E7E;
} }
.menu-arrow { .menu-arrow {
color: #C9B8A6; color: #C9B8A6;
font-size: 36rpx; font-size: 32rpx;
} }
+11
View File
@@ -32,5 +32,16 @@ Page({
// 按日期排序 // 按日期排序
terms.sort((a, b) => new Date(a.date) - new Date(b.date)); terms.sort((a, b) => new Date(a.date) - new Date(b.date));
this.setData({ terms }); this.setData({ terms });
onShareAppMessage() {
return {
title: '二十四节气 - 节气查询',
path: '/pages/solar-terms/solar-terms'
};
},
onShareTimeline() {
return {
title: '二十四节气 - 节气查询'
};
} }
}); });
+7
View File
@@ -53,4 +53,11 @@ Page({
path: `/pages/wish-detail/wish-detail?id=${wish ? wish.id : ''}`, path: `/pages/wish-detail/wish-detail?id=${wish ? wish.id : ''}`,
}; };
}, },
onShareTimeline() {
const { wish } = this.data;
return {
title: wish ? `我的愿望:${wish.content.substring(0, 20)}...` : '快来许愿吧!'
};
}
}); });
+3 -2
View File
@@ -47,5 +47,6 @@
"editorSetting": { "editorSetting": {
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",
"tabSize": 2 "tabSize": 2
} },
} "isGameTourist": false
}