Files
xuanzhi-wx/pages/profile/index.js

132 lines
2.9 KiB
JavaScript

const { ROUTES, openStaticRoute } = require('../../utils/static-ux/route-map')
function createProfilePageData() {
return {
title: '我的',
userCard: {
avatarText: '?',
title: '点击登录',
subtitle: '登录后查看你的学习资产',
settingsText: '设',
route: ROUTES.tabs.login
},
vipCard: {
icon: '会员',
title: '开通会员',
subtitle: '解锁更多学习资料、AI 仪表与阅读辅助能力',
actionText: '成为会员',
route: `${ROUTES.tcm.placeholder}?kind=membership`
},
assetItems: [
{
key: 'notes',
icon: '记',
title: '我的笔记',
count: 0,
route: `${ROUTES.tcm.assets}?kind=notes`
},
{
key: 'bookshelf',
icon: '架',
title: '我的书架',
count: 0,
route: `${ROUTES.tcm.assets}?kind=bookshelf`
},
{
key: 'favorites',
icon: '藏',
title: '我的收藏',
count: 0,
route: `${ROUTES.tcm.assets}?kind=favorites`
},
{
key: 'history',
icon: '史',
title: '浏览历史',
count: 0,
route: `${ROUTES.tcm.assets}?kind=history`
}
],
recentRecord: {
title: '最近记录',
emptyTitle: '还没有回访记录',
emptyDescription: '去典籍阅读或 AI 页完成一次学习,记录会出现在这里。',
actionText: '去首页看看',
route: ROUTES.tabs.home
},
moreItems: [
{
key: 'learning-center',
title: '学习中心',
route: ROUTES.learning.center
},
{
key: 'ai-history',
title: 'AI历史',
route: ROUTES.tcm.aiHistory
},
{
key: 'feedback',
title: '意见反馈',
route: `${ROUTES.tcm.placeholder}?kind=feedback`
},
{
key: 'share',
title: '分享 APP',
route: `${ROUTES.tcm.placeholder}?kind=share`
},
{
key: 'about',
title: '关于我们',
route: `${ROUTES.tcm.placeholder}?kind=about`
},
{
key: 'settings',
title: '设置',
route: `${ROUTES.tcm.placeholder}?kind=settings`
}
]
}
}
function showNavigate(route) {
if (openStaticRoute(route, wx)) {
return
}
if (typeof wx?.showToast === 'function') {
wx.showToast({
title: '页面建设中',
icon: 'none'
})
}
}
Page({
data: createProfilePageData(),
handleUserTap() {
showNavigate(ROUTES.tabs.login)
},
handleVipTap() {
showNavigate(`${ROUTES.tcm.placeholder}?kind=membership`)
},
handleAssetTap(event) {
showNavigate(event.currentTarget.dataset.route)
},
handleRecentTap() {
openStaticRoute(ROUTES.tabs.home, wx)
},
handleMoreTap(event) {
showNavigate(event.currentTarget.dataset.route)
}
})
module.exports = {
createProfilePageData
}