ea
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import { customEvent } from "../../utils/event"
|
||||
|
||||
Page({
|
||||
data: {
|
||||
showVipPopup: false,
|
||||
showCheckinPopup: false,
|
||||
menus: [
|
||||
{ key: 'feedback', title: '意见反馈', icon: '/static/images/my/my_icon_8.png' },
|
||||
{ key: 'privacy', title: '帮助中心', icon: '/static/images/my/my_icon_3.png' },
|
||||
{ key: 'privacy', title: '隐私协议', icon: '/static/images/my/my_icon_7.png' },
|
||||
],
|
||||
userinfo: {
|
||||
nickname: '创作小助手',
|
||||
id: '10010',
|
||||
avatar: 'https://cdn.zhuangb123.com/avatar/boy/a2cfe723-98ddc-12de-723b8f51b-71b1e3.jpeg',
|
||||
description: 'AI 创作,让想象力触手可及 ✨'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.setData({
|
||||
userinfo: wx.getStorageSync('userInfo')
|
||||
})
|
||||
customEvent.on('update:userinfo', this.onResetUserinfo)
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
customEvent.off('update:userinfo', this.onResetUserinfo)
|
||||
},
|
||||
onResetUserinfo() {
|
||||
this.setData({ userinfo: wx.getStorageSync('userInfo') })
|
||||
},
|
||||
handleEdit() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/myPackage/edit/index',
|
||||
})
|
||||
},
|
||||
handleCheckin() {
|
||||
this.setData({ showCheckinPopup: true })
|
||||
},
|
||||
handleCheckinClose() {
|
||||
this.setData({ showCheckinPopup: false })
|
||||
},
|
||||
handleCheckinRule() {
|
||||
wx.showToast({ title: '每日签到可领取金币', icon: 'none' })
|
||||
},
|
||||
handleAddCoin() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/myPackage/golb/index',
|
||||
})
|
||||
},
|
||||
handleOpenVip() {
|
||||
this.setData({ showVipPopup: true })
|
||||
},
|
||||
handleVipClose() {
|
||||
this.setData({ showVipPopup: false })
|
||||
},
|
||||
handleVipConfirm(e: WechatMiniprogram.CustomEvent) {
|
||||
this.setData({ showVipPopup: false })
|
||||
const plan = e.detail.plan
|
||||
wx.showToast({ title: plan ? '已选择' + plan.name : '立即开通', icon: 'none' })
|
||||
},
|
||||
handleMenuTap(e: WechatMiniprogram.TouchEvent) {
|
||||
const key = e.currentTarget.dataset.key
|
||||
const routeMap: Record<string, string> = {
|
||||
feedback: '/pages/myPackage/yjfk/index',
|
||||
privacy: '/pages/myPackage/ysxy/index',
|
||||
}
|
||||
const url = routeMap[String(key || '')]
|
||||
|
||||
if (url) {
|
||||
wx.navigateTo({ url })
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user