You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
835 B

const app = getApp()
Page({
data: {
userInfo: {} as any,
days: 0,
},
onShow() {
app.waitLogin().then(() => {
this.getMyInfo()
})
},
getMyInfo() {
wx.ajax({
method: 'GET',
url: '?r=psvt/patient/my-info',
}).then((res) => {
let days = 0
if (res.firstOpenTime) {
const first = new Date(res.firstOpenTime.replace(/-/g, '/'))
const now = new Date()
days = Math.max(1, Math.ceil((now.getTime() - first.getTime()) / (1000 * 60 * 60 * 24)))
}
this.setData({
userInfo: res,
days,
})
})
},
routerTo(e: any) {
const { url } = e.currentTarget.dataset
wx.navigateTo({ url })
},
handlePDev() {
wx.showToast({
title: '功能开发中,敬请期待',
icon: 'none',
})
},
})
export {}