武田基因病B开发环境
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.
 
 
 

100 lines
2.2 KiB

const app = getApp<IAppOption>()
import { parseScene } from '@/utils/util'
Page({
data: {
PatientId: '',
RelationType: '',
resetBind: false,
reload: false,
mpPatientInfo: {},
ignoreAgreement: {},
userInfo: {} as any,
},
onLoad(options) {
console.log("DEBUGPRINT[148]: index.ts:14: options=", options)
const { pId } = parseScene(options.scene) as { pId: string }
console.log("DEBUGPRINT[149]: index.ts:16: pId=", pId)
this.setData({
PatientId: pId,
ignoreAgreement: options.ignoreAgreement,
})
},
onShow() {
app.waitLogin().then(() => {
if (app.globalData.initLoginInfo.isLogin === 1 && app.globalData.initLoginInfo.loginType === 2) {
wx.reLaunch({
url: '/doctor/pages/index/index',
})
return
}
app.getUserInfo().then(() => {
this.getMpPatientInfo()
})
})
},
getMpPatientInfo() {
wx.ajax({
method: 'GET',
url: '?r=wtx/account/mp-patient-info',
data: {
PatientId: this.data.PatientId,
},
loading: true,
}).then((res) => {
let RelationType = res.HasSelf == 1 ? '2' : ''
if (!res.isLogin) {
wx.navigateTo({
url: `/patient/pages/login/index?back=1`,
})
}
this.setData({
mpPatientInfo: res,
RelationType: res.HasSelf ? '2' : RelationType,
reload: true,
})
})
},
handleHome() {
wx.reLaunch({
url: '/pages/start/index',
})
},
handleResetBind() {
this.setData({
resetBind: true,
})
},
handleSwitchType(e) {
const { type } = e.currentTarget.dataset
this.setData({
RelationType: type,
})
},
handleSubmit() {
const { PatientId, RelationType } = this.data
if (!RelationType) {
wx.showToast({
title: '请选择身份',
icon: 'none',
})
return
}
wx.ajax({
method: 'POST',
url: '?r=wtx/account/bind-patient',
data: {
PatientId,
RelationType,
},
loading: true,
}).then(() => {
app.globalData.waitBindDoctorId = ''
app.updateLoginInfo(() => {
wx.reLaunch({
url: '/pages/start/index',
})
})
})
},
})