import dayjs from 'dayjs' const app = getApp() Page({ data: { url: '', type: '', period: '', toastShow: false, toastType: '', toastParams: {} as any, }, onLoad(options) { this.setData({ toastShow: false, type: options.type, url: options.url ? decodeURIComponent(options.url) : '', period: options.period === '2' ? '2' : '3', }) app.zdWaitLogin().then(() => { if (options.url) return if (options.es === '201503') { app.globalData.IsAliQiWei = 1 } const { UserType } = app.globalData.zdUserInfo if (!UserType || UserType < 3) { app.zdPermissionVerification(3, 13, `/patient/pages/webview/index`).then(() => {}) return } this.getAdl() }) }, getAdl() { wx.ajax({ method: 'GET', url: '?r=zd/adl/index', data: {}, }).then((res) => { const newRecord = res.newRecord const days = dayjs().diff(newRecord.CreateTime, 'day') if (!newRecord.Id || days >= 30) { this.setData({ toastShow: true, toastType: 'aldAlertTest', toastParams: {}, }) } else { this.getDetail() } }) }, handleToastOk() { const { toastType } = this.data if (toastType === 'aldAlertTest') { wx.navigateTo({ url: '/patient/pages/adl/index?m_d=2', }) } }, handleToastCancel(_e = null) { wx.navigateBack({ fail() { wx.reLaunch({ url: '/patient/pages/index/index', }) }, }) this.setData({ toastShow: false, toastType: '', toastParams: '', }) }, getDetail() { wx.ajax({ method: 'GET', url: '?r=zd/weiyi/url', data: { type: this.data.type, period: this.data.period, }, }).then((res) => { this.setData({ url: res.url, }) }) }, })