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.
98 lines
2.1 KiB
98 lines
2.1 KiB
import dayjs from 'dayjs' |
|
|
|
const app = getApp<IAppOption>() |
|
|
|
Page({ |
|
data: { |
|
name: '', |
|
birthMonth: '', |
|
provinceId: '', |
|
cityId: '', |
|
|
|
provinceName: '', |
|
cityName: '', |
|
|
|
end: dayjs().format('YYYY-MM-DD'), |
|
|
|
PatientTel: '', |
|
|
|
userInfo: {}, |
|
}, |
|
onShow() { |
|
app.waitLogin({ type: 1 }).then(() => { |
|
app.getUserInfo(1).then((userInfo) => { |
|
this.setData({ |
|
name: userInfo.PatientName, |
|
birthMonth: userInfo.PatientBirth, |
|
provinceId: userInfo.PatientProvinceId, |
|
cityId: userInfo.PatientCityId, |
|
provinceName: userInfo.PatientProvince, |
|
cityName: userInfo.PatientCity, |
|
PatientTel: userInfo.PatientTel, |
|
userInfo, |
|
}) |
|
}) |
|
}) |
|
}, |
|
handleAreaChange(e: any) { |
|
const value = e.detail |
|
this.setData({ |
|
provinceId: value[0].value, |
|
cityId: value[1] ? value[1].value : '', |
|
provinceName: value[0].label, |
|
cityName: value[1] ? value[1].label : '', |
|
}) |
|
this.handleUpdate() |
|
}, |
|
handleUpdate() { |
|
const { name, birthMonth, provinceId, cityId } = this.data |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=wtx/account/update-info', |
|
data: { |
|
name, |
|
birthMonth, |
|
provinceId, |
|
cityId, |
|
}, |
|
}).then(() => { |
|
wx.showToast({ |
|
icon: 'none', |
|
title: '保存成功', |
|
}) |
|
}) |
|
}, |
|
handleTel() { |
|
wx.navigateTo({ |
|
url: '/patient/pages/changeTel/index', |
|
}) |
|
}, |
|
handleLoginOut() { |
|
wx.navigateTo({ |
|
url: '/patient/pages/loginOut/index', |
|
}) |
|
}, |
|
handleOut() { |
|
wx.showModal({ |
|
title: '确定退出登录吗?', |
|
confirmColor: 'rgba(246, 74, 58, 1)', |
|
success: (res) => { |
|
if (res.confirm) { |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=wtx/user/reg-logout', |
|
data: {}, |
|
}).then(() => { |
|
app.updateLoginInfo(() => { |
|
wx.reLaunch({ |
|
url: '/pages/index/index', |
|
}) |
|
}) |
|
}) |
|
} |
|
}, |
|
}) |
|
}, |
|
}) |
|
|
|
export {}
|
|
|