信达小程序
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.

94 lines
1.9 KiB

1 month ago
import dayjs from 'dayjs'
const app = getApp<IAppOption>()
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',
})
4 weeks ago
app.zdWaitLogin().then(() => {
1 month ago
if (options.url) return
if (options.es === '201503') {
app.globalData.IsAliQiWei = 1
1 month ago
}
4 weeks ago
const { UserType } = app.globalData.zdUserInfo
1 month ago
if (!UserType || UserType < 3) {
4 weeks ago
app.zdPermissionVerification(3, 13, `/patient/pages/webview/index`).then(() => {})
1 month ago
return
}
this.getAdl()
})
},
getAdl() {
wx.ajax({
method: 'GET',
4 weeks ago
url: '?r=zd/adl/index',
1 month ago
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({
4 weeks ago
url: '/patient/pages/adl/index?m_d=2',
1 month ago
})
}
},
handleToastCancel(_e = null) {
wx.navigateBack({
fail() {
wx.reLaunch({
4 weeks ago
url: '/patient/pages/index/index',
1 month ago
})
},
})
this.setData({
toastShow: false,
toastType: '',
toastParams: '',
})
},
getDetail() {
wx.ajax({
method: 'GET',
4 weeks ago
url: '?r=zd/weiyi/url',
1 month ago
data: {
type: this.data.type,
period: this.data.period,
},
}).then((res) => {
this.setData({
url: res.url,
})
})
},
})