const app = getApp() Page({ data: { doctor: {}, hospital: {}, }, onLoad() { const SystemInfo = app.globalSystemInfo if (SystemInfo) { const { top, bottom } = SystemInfo.capsulePosition this.setData({ top, bottom, }) } }, onShow() { app.waitLogin().then((_res) => { app.mpBehavior({ doctor: true, PageName: 'PG_DOCTORMY' }) this.getDetail() }) }, getDetail() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/account/info', data: {}, }).then((res) => { let weekName = '' if (res.doctor.ClinicType == 2) { weekName = res.doctor.Clinic } else { weekName = (res.doctor.Clinic ? res.doctor.Clinic : []) .map((subItem: { weekday: string | number; timeType: string | number }) => { const week = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] const timeDay = { 1: '上午', 2: '下午' } return `${week[Number(subItem.weekday) - 1]}${timeDay[subItem.timeType]}` }) .join(',') } this.setData({ doctor: { weekName, ...res.doctor, }, hospital: res.hospital, }) }) }, handleRouter(e) { const { url } = e.currentTarget.dataset if (url === '/doctor/pages/d_invite/index') { app.mpBehavior({ doctor: true, PageName: 'BTN_DOCTORMYPAGEINVITEDPATIENTS' }) } if (url === '/doctor/pages/d_userInfo/index') { app.mpBehavior({ doctor: true, PageName: 'BTN_DOCTORMYPAGEPERSONALINFO' }) } wx.navigateTo({ url, }) }, handlePrivacy() { wx.navigateTo({ url: '/pages/privacyAgreement/index', }) }, handleFollow() { wx.navigateTo({ url: '/pages/thePublic/index', }) }, handleFeedback() { wx.navigateTo({ url: '/pages/comIns/index', }) }, handleLogout() { wx.showModal({ title: '确认退出?', confirmColor: 'rgba(22, 121, 203, 1)', success: (res) => { if (res.confirm) { wx.ajax({ method: 'POST', url: '?r=igg4/doctor/account/reg-logout', data: {}, }).then((_res) => { app.globalData.loginType = 1 app.globalData.anyWhere = true app.globalData.first = true wx.reLaunch({ url: '/pages/login/index', }) }) } }, }) }, onShareAppMessage() { return { title: '重症肌无力加油站,重拾生活掌控感!', path: '/doctor/pages/d_my/index', } }, })