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.

37 lines
720 B

4 days ago
const app = getApp()
1 week ago
Page({
data: {
userInfo: {} as any,
4 days ago
days: 0,
1 week ago
},
onShow() {
4 days ago
app.waitLogin().then(() => {
this.getMyInfo()
1 week ago
})
},
4 days ago
getMyInfo() {
1 week ago
wx.ajax({
method: 'GET',
4 days ago
url: '?r=psvt/patient/my-info',
1 week ago
}).then((res) => {
4 days ago
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)))
}
1 week ago
this.setData({
4 days ago
userInfo: res,
days,
1 week ago
})
})
},
routerTo(e: any) {
4 days ago
const { url } = e.currentTarget.dataset
wx.navigateTo({ url })
1 week ago
},
})
export {}