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.
108 lines
2.8 KiB
108 lines
2.8 KiB
const app = getApp<IAppOption>() |
|
|
|
Page({ |
|
data: { |
|
doctor: {}, |
|
hospital: {}, |
|
toastShow: false, |
|
toastType: '', |
|
toastParams: {}, |
|
}, |
|
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: '/doc/pages/privacyAgreement/index', |
|
}) |
|
}, |
|
handleFollow() { |
|
this.setData({ toastShow: true, toastType: 'follow', toastParams: { close: true } }) |
|
}, |
|
handleFeedback() { |
|
this.setData({ toastShow: true, toastType: 'doctor-feedback', toastParams: { close: true } }) |
|
}, |
|
handleToastClose() { |
|
this.setData({ toastShow: false, toastType: '' }) |
|
}, |
|
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', |
|
} |
|
}, |
|
})
|
|
|