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.
115 lines
2.5 KiB
115 lines
2.5 KiB
const app = getApp<IAppOption>() |
|
|
|
Page({ |
|
data: { |
|
doctor: {}, |
|
hospital: {}, |
|
qrCode: '', |
|
|
|
posterUrl: '', |
|
params: {}, |
|
}, |
|
onLoad() { |
|
const SystemInfo = app.globalSystemInfo |
|
if (SystemInfo) { |
|
const { bottom } = SystemInfo.capsulePosition |
|
this.setData({ |
|
bottom, |
|
}) |
|
} |
|
app.waitLogin().then((_res) => { |
|
app.mpBehavior({ doctor:true, PageName: 'PG_DoctorCode' }) |
|
wx.showLoading({ |
|
title: '加载中', |
|
}) |
|
|
|
this.getDetail() |
|
}) |
|
}, |
|
getDetail() { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=zd/doctor/account/info', |
|
data: {}, |
|
}).then((res) => { |
|
this.setData({ |
|
doctor: res.doctor, |
|
hospital: res.hospital, |
|
}) |
|
this.getPrepare(res.doctor.Id) |
|
}) |
|
}, |
|
getPrepare(id) { |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=poster/prepare', |
|
data: { |
|
posterId: 'doctor_mini', |
|
doctorId: id, |
|
}, |
|
}).then((res) => { |
|
this.setData({ |
|
params: res, |
|
}) |
|
}) |
|
}, |
|
getQrCode() { |
|
this.setData({ |
|
qrCode: `${app.globalData.url}?r=zd/doctor/account/mp-info&loginState=${app.globalData.loginState}`, |
|
}) |
|
}, |
|
handleDownload() { |
|
wx.showToast({ |
|
title: '请长按海报图片进行保存', |
|
icon: 'none', |
|
}) |
|
// wx.showLoading({ |
|
// title: '加载中', |
|
// }) |
|
// wx.downloadFile({ |
|
// url: this.data.posterUrl, |
|
// success: (res) => { |
|
// if (res.statusCode === 200) { |
|
// wx.saveImageToPhotosAlbum({ |
|
// filePath: res.tempFilePath, |
|
// success: () => { |
|
// wx.hideLoading() |
|
// wx.showToast({ |
|
// title: '保存成功,请到相册中查看', |
|
// }) |
|
// }, |
|
// fail: () => { |
|
// wx.hideLoading() |
|
// wx.showToast({ |
|
// icon: 'none', |
|
// title: '保存失败,请稍后重试', |
|
// }) |
|
// }, |
|
// }) |
|
// } else { |
|
// wx.hideLoading() |
|
// wx.showToast({ |
|
// icon: 'none', |
|
// title: '下载失败,请稍后重试', |
|
// }) |
|
// } |
|
// }, |
|
// fail: () => { |
|
// wx.hideLoading() |
|
// wx.showToast({ |
|
// icon: 'none', |
|
// title: '下载失败,请稍后重试', |
|
// }) |
|
// }, |
|
// }) |
|
}, |
|
handlePosterFinish(e: any) { |
|
this.setData({ |
|
posterUrl: e.detail, |
|
}) |
|
wx.hideLoading() |
|
}, |
|
handleBack() { |
|
wx.navigateBack() |
|
}, |
|
})
|
|
|