信达小程序
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.
 
 
 

139 lines
2.9 KiB

const app = getApp();
Component({
properties: {
show: {
type: Boolean,
value: false,
},
type: String,
params: {
type: Object,
value() {
return {};
},
},
},
observers: {
show(val) {
if (val) {
app.zdGetTheme().then((res) => {
this.setData({
theme: res,
});
});
if (this.data.params.timeOut) {
let time = this.data.params.timeOut;
const timerFunc = () => {
if (time <= 0) {
this.setData({
timeOut: '',
});
clearInterval(this.timer);
return;
}
this.setData({
timeOut: `${time}s`,
});
--time;
};
timerFunc();
this.timer = setInterval(timerFunc, 1000);
}
if (['storyLead', 'storyStar', 'storyShare'].includes(this.data.type)) {
this.getSettingInfo();
}
}
this.setData({
zdUserInfo: app.globalData.zdUserInfo,
});
},
type(val) {
if (val === 'healthCare') {
this.getOpenPatientList();
}
},
},
data: {
imageUrl: '',
protocol: true,
timeOut: '',
settingsInfo: {},
zdUserInfo: {},
openPatientList: {},
},
lifetimes: {
attached() {
this.setData({
imageUrl: app.globalData.imageUrl,
Timestamp: app.globalData.Timestamp,
});
},
},
methods: {
timer: null as any,
handleOk() {
if (this.data.timeOut) {
return;
}
this.triggerEvent('ok', { protocol: this.data.protocol });
},
handleCancel(e = { currentTarget: { dataset: { key: '' } } }) {
const { key } = e.currentTarget.dataset;
if (this.timer) {
clearInterval(this.timer);
this.setData({
timeOut: '',
});
}
this.triggerEvent('cancel', { key });
},
handleTaskCancel() {
this.triggerEvent('taskCancel');
},
handleJump() {
this.triggerEvent('jump');
},
handleDel() {
this.triggerEvent('del');
},
routerTo(e) {
const { path } = e.currentTarget.dataset;
wx.navigateTo({
url: path,
});
this.handleCancel();
},
getSettingInfo() {
wx.ajax({
method: 'GET',
url: '?r=xd/drugs/setting-info',
data: {},
}).then((res) => {
this.setData({
settingsInfo: res,
});
});
},
getOpenPatientList() {
wx.ajax({
method: 'GET',
url: '?r=xd/nrdl/open-patient-list',
data: {},
}).then((res) => {
this.setData({
openPatientList: res,
});
});
},
handleProtocolChange() {
this.setData({
protocol: !this.data.protocol,
});
},
handleAdlQuestion() {
wx.navigateTo({
url: '/pages/repositoryDetail/index?id=9',
});
},
},
});