浏览代码

fix: 修复编辑就诊人时,状态没有及时更新的问题

carver 2 年之前
父节点
当前提交
d2d5e5e7fa

+ 267 - 267
antbuilder/industry/hospitalV2/components/deposit/index.js

@@ -1,296 +1,296 @@
-import { settradePayRe, getDischargeSettlementDetails, getsubscribeID } from './service';
-import history from '../../utils/history';
-import { debounce } from '../../utils/index';
-import { reportCmPV_YL } from '../../utils/cloudMonitorHelper';
-import { tradeResult } from '../../service/common';
+import {
+	settradePayRe,
+	getDischargeSettlementDetails,
+	getsubscribeID,
+} from "./service";
+import history from "../../utils/history";
+import { debounce } from "../../utils/index";
+import { reportCmPV_YL } from "../../utils/cloudMonitorHelper";
+import { tradeResult } from "../../service/common";
 Component({
-  data: {
-    jsonData: {
-      Inpatient: {}
-    },
-    moneyArray: ['¥100', '¥200', '¥300', '¥500', '¥1000', '¥2000'],
-    selectedMoney: null,
-    money: null,
-    inpatientId: '',
-    // 住院人的id
-    selectIndex: 0,
-    // 默认选择的住院人的index
-    isReady: false,
-    attention: ''
-  },
+	data: {
+		jsonData: {
+			Inpatient: {},
+		},
+		moneyArray: ["¥100", "¥200", "¥300", "¥500", "¥1000", "¥2000"],
+		selectedMoney: null,
+		money: null,
+		inpatientId: "",
+		// 住院人的id
+		selectIndex: 0,
+		// 默认选择的住院人的index
+		isReady: false,
+		attention: "",
+	},
 
-  didMount() {
-    const {
-      inpatientId,
-      attention
-    } = this.$page.data.query || {};
-    this.setData({
-      inpatientId,
-      attention
-    });
-    this.subscribeMsg();
-    /* 服务预警,押金缴纳 */
+	didMount() {
+		const { inpatientId, attention } = this.$page.data.query || {};
+		this.setData({
+			inpatientId,
+			attention,
+		});
+		// this.subscribeMsg();
+		/* 服务预警,押金缴纳 */
 
-    reportCmPV_YL({
-      title: '押金缴纳'
-    });
-  },
+		reportCmPV_YL({
+			title: "押金缴纳",
+		});
+	},
 
-  methods: {
-    subscribeMsg() {
-      const pluginId = 2021001155639035;
-      my.loadPlugin({
-        plugin: `${pluginId}@*`,
-        success: () => {
-          this.setData({
-            isReady: true
-          }); // 储存插件实列
-          // eslint-disable-next-line no-undef
+	methods: {
+		subscribeMsg() {
+			const pluginId = 2021001155639035;
+			my.loadPlugin({
+				plugin: `${pluginId}@*`,
+				success: () => {
+					this.setData({
+						isReady: true,
+					}); // 储存插件实列
+					// eslint-disable-next-line no-undef
 
-          const pluginInstance = requirePlugin(`dynamic-plugin://${pluginId}`);
-          this.requestSubscribeMessage = pluginInstance.requestSubscribeMessage;
-        }
-      });
-    },
+					const pluginInstance = requirePlugin(`dynamic-plugin://${pluginId}`);
+					this.requestSubscribeMessage = pluginInstance.requestSubscribeMessage;
+				},
+			});
+		},
 
-    pageScrollToFn(scrollTop) {
-      my.pageScrollTo({
-        scrollTop
-      });
-    },
+		pageScrollToFn(scrollTop) {
+			my.pageScrollTo({
+				scrollTop,
+			});
+		},
 
-    // 当input框失焦时候,自动返回顶部
-    onBlurChange() {
-      this.pageScrollToFn(0);
-    },
+		// 当input框失焦时候,自动返回顶部
+		onBlurChange() {
+			this.pageScrollToFn(0);
+		},
 
-    // 由于唤起支付弹窗时候,会遮挡掉支付按钮,所以对页面做了自动滚动处理
-    onFocusChange() {
-      setTimeout(() => {
-        this.pageScrollToFn(100);
-      }, 100);
-    },
+		// 由于唤起支付弹窗时候,会遮挡掉支付按钮,所以对页面做了自动滚动处理
+		onFocusChange() {
+			setTimeout(() => {
+				this.pageScrollToFn(100);
+			}, 100);
+		},
 
-    async getJsonData(info) {
-      const {
-        inpatientId
-      } = this.data;
+		async getJsonData(info) {
+			const { inpatientId } = this.data;
 
-      try {
-        // 分为两种情况,第一种当从住院人列表跳转过来的时候,有住院人id,第二种是从首页跳转过来,无住院人id
-        if (!inpatientId) {
-          const infoDetail = info && info.length > 0;
-          this.setData({
-            jsonData: {
-              Inpatient: infoDetail ? info[0] : {}
-            },
-            inpatientId: infoDetail ? info[0].inpatientId : ''
-          });
-        } else {
-          const res = await getDischargeSettlementDetails({
-            inpatientId
-          });
-          this.choosePatient(res);
-        }
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    },
+			try {
+				// 分为两种情况,第一种当从住院人列表跳转过来的时候,有住院人id,第二种是从首页跳转过来,无住院人id
+				if (!inpatientId) {
+					const infoDetail = info && info.length > 0;
+					this.setData({
+						jsonData: {
+							Inpatient: infoDetail ? info[0] : {},
+						},
+						inpatientId: infoDetail ? info[0].inpatientId : "",
+					});
+				} else {
+					const res = await getDischargeSettlementDetails({
+						inpatientId,
+					});
+					this.choosePatient(res);
+				}
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
 
-    onGetDatas(info) {
-      if (!info || info.length === 0) {
-        my.alert({
-          content: this.data.attention || '请绑定住院人',
-          success: () => {
-            my.navigateBack();
-          }
-        });
-        return false;
-      }
+		onGetDatas(info) {
+			if (!info || info.length === 0) {
+				my.alert({
+					content: this.data.attention || "请绑定住院人",
+					success: () => {
+						my.navigateBack();
+					},
+				});
+				return false;
+			}
 
-      this.getJsonData(info);
-    },
+			this.getJsonData(info);
+		},
 
-    selectMoney(event) {
-      this.setData({
-        selectedMoney: event.target.dataset.index,
-        money: parseInt(this.data.moneyArray[event.target.dataset.index].replace('¥', ''))
-      }, () => {
-        this.payMoney();
-      });
-    },
+		selectMoney(event) {
+			this.setData(
+				{
+					selectedMoney: event.target.dataset.index,
+					money: parseInt(
+						this.data.moneyArray[event.target.dataset.index].replace("¥", "")
+					),
+				},
+				() => {
+					this.payMoney();
+				}
+			);
+		},
 
-    changeMoney: debounce((event, that) => {
-      let {
-        value: money
-      } = event.detail;
-      const defaultValue = money === '';
-      const diff = money.indexOf('.') !== -1;
-      money = money.replace(/\s*/g, '');
+		changeMoney: debounce((event, that) => {
+			let { value: money } = event.detail;
+			const defaultValue = money === "";
+			const diff = money.indexOf(".") !== -1;
+			money = money.replace(/\s*/g, "");
 
-      if (diff) {
-        const diffLength = money.indexOf('.');
+			if (diff) {
+				const diffLength = money.indexOf(".");
 
-        if (money.slice(diffLength).length > 3) {
-          return;
-        }
+				if (money.slice(diffLength).length > 3) {
+					return;
+				}
 
-        if (money.length > diffLength + 1 && money[money.length - 1] !== '0') {
-          money = Number(money);
-        } else if (money[money.length - 1] != 0) {
-          money = `${Number(money)}.`;
-        }
-      } else {
-        money = Number(money);
-      }
+				if (money.length > diffLength + 1 && money[money.length - 1] !== "0") {
+					money = Number(money);
+				} else if (money[money.length - 1] != 0) {
+					money = `${Number(money)}.`;
+				}
+			} else {
+				money = Number(money);
+			}
 
-      that.setData({
-        money: defaultValue ? '' : money
-      });
-    }, 100),
+			that.setData({
+				money: defaultValue ? "" : money,
+			});
+		}, 100),
 
-    popOverClose() {
-      // 关闭弹出框
-      this.$page.$popModal.hidePopover();
-    },
+		popOverClose() {
+			// 关闭弹出框
+			this.$page.$popModal.hidePopover();
+		},
 
-    /**
-     * 选择住院人
-    */
-    choosePatient(info) {
-      const {
-        hospitalizationRecordList
-      } = this.$page.$popModal.data;
-      const selectIndex = hospitalizationRecordList.findIndex(item => info.inpatientId === item.inpatientId); // 获取用户id
+		/**
+		 * 选择住院人
+		 */
+		choosePatient(info) {
+			const { hospitalizationRecordList } = this.$page.$popModal.data;
+			const selectIndex = hospitalizationRecordList.findIndex(
+				(item) => info.inpatientId === item.inpatientId
+			); // 获取用户id
 
-      this.setData({
-        jsonData: {
-          Inpatient: info
-        },
-        inpatientId: info.inpatientId,
-        selectIndex
-      });
-      this.$page.$popModal.hidePopover();
-    },
+			this.setData({
+				jsonData: {
+					Inpatient: info,
+				},
+				inpatientId: info.inpatientId,
+				selectIndex,
+			});
+			this.$page.$popModal.hidePopover();
+		},
 
-    /**
-     * 增加住院人
-    */
-    addPatient() {
-      history.push({
-        title: '添加住院人',
-        pageType: 'add-inpatient-information',
-        query: {
-          color: '#000',
-          backBtnColor: '#000',
-          background: '#fff'
-        }
-      });
-      this.$page.$popModal.hidePopover();
-    },
+		/**
+		 * 增加住院人
+		 */
+		addPatient() {
+			history.push({
+				title: "添加住院人",
+				pageType: "add-inpatient-information",
+				query: {
+					color: "#000",
+					backBtnColor: "#000",
+					background: "#fff",
+				},
+			});
+			this.$page.$popModal.hidePopover();
+		},
 
-    onAdmissionRegistration() {
-      this.$page.$popModal.showPopover({
-        title: '选择住院人',
-        popupPosition: 'bottom',
-        onButtonClose: () => this.popOverClose(),
-        // 弹出框关闭
-        onChoosePatient: info => this.choosePatient(info),
-        // 选择就诊人
-        onAddPatient: () => this.addPatient() // 添加就诊人
+		onAdmissionRegistration() {
+			this.$page.$popModal.showPopover({
+				title: "选择住院人",
+				popupPosition: "bottom",
+				onButtonClose: () => this.popOverClose(),
+				// 弹出框关闭
+				onChoosePatient: (info) => this.choosePatient(info),
+				// 选择就诊人
+				onAddPatient: () => this.addPatient(), // 添加就诊人
+			});
+		},
 
-      });
-    },
+		// 订阅插件要用时,请放开注释
+		requestSubscribeMessageFn(subscribeID) {
+			const that = this;
+			return new Promise((resolve) => {
+				my.requestSubscribeMessage({
+					// 模板id列表,最多3个
+					entityIds: [subscribeID],
 
-    // 订阅插件要用时,请放开注释
-    requestSubscribeMessageFn(subscribeID) {
-      const that = this;
-      return new Promise(resolve => {
-        this.requestSubscribeMessage({
-          // 模板id列表,最多3个
-          entityIds: [subscribeID],
+					callback() {
+						that.setTrade();
+						resolve(true);
+					},
+				});
+			});
+		},
 
-          callback() {
-            that.setTrade();
-            resolve(true);
-          }
+		// 支付前先要订阅
+		async payMoney() {
+			try {
+				const subscribeID = await getsubscribeID();
+				await this.requestSubscribeMessageFn(subscribeID.depositTemplateId);
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
 
-        });
-      });
-    },
+		// 支付弹窗
+		async setTrade() {
+			const { money, inpatientId } = this.data;
 
-    // 支付前先要订阅
-    async payMoney() {
-      try {
-        const subscribeID = await getsubscribeID();
-        await this.requestSubscribeMessageFn(subscribeID.depositTemplateId);
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    },
+			try {
+				if (money) {
+					const {
+						tradeNo: tradeNO,
+						outTradeNo,
+						depositId,
+					} = await settradePayRe({
+						amount: money,
+						inpatientId,
+					});
+					my.tradePay({
+						tradeNO,
+						success: async (res) => {
+							// 4000 订单处理失败
+							// 6001 用途中途取消支付
+							// 6002 网络链接出错
+							if (
+								res.resultCode === "4000" ||
+								res.resultCode === "6002" ||
+								res.resultCode === "6001"
+							) {
+								// 支付失败
+								my.showToast({
+									type: "fail",
+									content: res.memo || "订单支付失败",
+								});
+							} else {
+								// 其他情况调用接口确认
+								const payRes = await tradeResult({
+									tradeNo: tradeNO,
+									outTradeNo,
+									resultCode: res.resultCode,
+								});
 
-    // 支付弹窗
-    async setTrade() {
-      const {
-        money,
-        inpatientId
-      } = this.data;
-
-      try {
-        if (money) {
-          const {
-            tradeNo: tradeNO,
-            outTradeNo,
-            depositId
-          } = await settradePayRe({
-            amount: money,
-            inpatientId
-          });
-          my.tradePay({
-            tradeNO,
-            success: async res => {
-              // 4000 订单处理失败
-              // 6001 用途中途取消支付
-              // 6002 网络链接出错
-              if (res.resultCode === '4000' || res.resultCode === '6002' || res.resultCode === '6001') {
-                // 支付失败
-                my.showToast({
-                  type: 'fail',
-                  content: res.memo || '订单支付失败'
-                });
-              } else {
-                // 其他情况调用接口确认
-                const payRes = await tradeResult({
-                  tradeNo: tradeNO,
-                  outTradeNo,
-                  resultCode: res.resultCode
-                });
-
-                if (payRes.status === 'TRADE_SUCCESS') {
-                  history.push({
-                    query: {
-                      depositId,
-                      color: '#000',
-                      backBtnColor: '#000',
-                      background: '#fff'
-                    },
-                    title: '押金缴纳详情',
-                    pageType: 'pay-result'
-                  });
-                } else {
-                  my.showToast({
-                    type: 'fail',
-                    content: res.memo || '订单支付失败'
-                  });
-                }
-              }
-            }
-          });
-        }
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    }
-
-  }
-});
+								if (payRes.status === "TRADE_SUCCESS") {
+									history.push({
+										query: {
+											depositId,
+											color: "#000",
+											backBtnColor: "#000",
+											background: "#fff",
+										},
+										title: "押金缴纳详情",
+										pageType: "pay-result",
+									});
+								} else {
+									my.showToast({
+										type: "fail",
+										content: res.memo || "订单支付失败",
+									});
+								}
+							}
+						},
+					});
+				}
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
+	},
+});

+ 84 - 62
antbuilder/industry/hospitalV2/components/patient-detail-edit/index.js

@@ -1,69 +1,91 @@
-import { querySingle, patientUpdate } from '../patient-detail/service';
-import history from '../../utils/history';
+import { querySingle, patientUpdate } from "../patient-detail/service";
+import history from "../../utils/history";
+import EventHub from "../../../abMall/utils/eventEmitter";
+
 Component({
-  props: {},
-  data: {
-    patient: {
-      balance: 0,
-      id: '',
-      name: '',
-      age: '',
-      sex: '',
-      phoneNumber: '',
-      birthDay: '',
-      idCardNo: '',
-      relationShip: '',
-      bindCardNum: '',
-      medicCards: []
-    }
-  },
+	props: {},
+	data: {
+		patient: {
+			balance: 0,
+			id: "",
+			name: "",
+			age: "",
+			sex: "",
+			phoneNumber: "",
+			birthDay: "",
+			idCardNo: "",
+			relationShip: "",
+			bindCardNum: "",
+			medicCards: [],
+		},
+	},
 
-  didMount() {
-    this.querySingle();
-  },
+	didMount() {
+		this.querySingle();
+		this.onEventChange();
+	},
 
-  methods: {
-    querySingle() {
-      const {
-        query = {
-          id: ''
-        }
-      } = this.$page.data;
-      my.showLoading();
-      querySingle({
-        id: query.id
-      }).then(data => {
-        this.setData({
-          patient: data
-        });
-        my.hideLoading();
-      });
-    },
+	didUnmount() {
+		this.onEventRemove();
+	},
 
-    // 修改关系
-    onChange(e) {
-      this.setData({
-        'patient.relationShip': e.name
-      });
-    },
+	methods: {
+		onEventChange() {
+			const _this = this;
+			EventHub.addEventListener("onPatienDetailUpdate", (payload) => {
+				if (payload) {
+					_this.querySingle();
+				}
+			});
+		},
+		onEventRemove() {
+			const _this = this;
+			EventHub.removeEventListener("onPatienDetailUpdate", (payload) => {
+				if (payload) {
+					_this.querySingle();
+				}
+			});
+		},
+		querySingle() {
+			const {
+				query = {
+					id: "",
+				},
+			} = this.$page.data;
+			my.showLoading();
+			querySingle({
+				id: query.id,
+			}).then((data) => {
+				this.setData({
+					patient: data,
+				});
+				my.hideLoading();
+			});
+		},
 
-    onChangePhone() {
-      history.push({
-        query: {
-          id: this.data.patient.id
-        },
-        title: '修改手机号',
-        pageType: 'patient-detail-phone'
-      });
-    },
+		// 修改关系
+		onChange(e) {
+			this.setData({
+				"patient.relationShip": e.name,
+			});
+		},
 
-    onSubmit() {
-      patientUpdate({
-        id: this.data.patient.id,
-        name: this.data.patient.name,
-        relationShip: this.data.patient.relationShip
-      }).then(my.navigateBack);
-    }
+		onChangePhone() {
+			history.push({
+				query: {
+					id: this.data.patient.id,
+				},
+				title: "修改手机号",
+				pageType: "patient-detail-phone",
+			});
+		},
 
-  }
-});
+		onSubmit() {
+			patientUpdate({
+				id: this.data.patient.id,
+				name: this.data.patient.name,
+				relationShip: this.data.patient.relationShip,
+			}).then(my.navigateBack);
+		},
+	},
+});

+ 44 - 43
antbuilder/industry/hospitalV2/components/patient-detail-phone/index.js

@@ -1,48 +1,49 @@
-import { patientUpdate } from '../patient-detail/service';
-import getEncryptStr from '../../utils/getEncryptStr';
+import { patientUpdate } from "../patient-detail/service";
+import getEncryptStr from "../../utils/getEncryptStr";
+import EventHub from "../../../abMall/utils/eventEmitter";
 Component({
-  props: {},
-  data: {
-    phone: ''
-  },
+	props: {},
+	data: {
+		phone: "",
+	},
 
-  didMount() {},
+	didMount() {},
 
-  methods: {
-    onInput(e) {
-      this.setData({
-        phone: e.detail.value
-      });
-    },
+	methods: {
+		onInput(e) {
+			this.setData({
+				phone: e.detail.value,
+			});
+		},
 
-    async onSave() {
-      const {
-        query = {
-          id: ''
-        }
-      } = this.$page.data;
-      const phoneNumber = this.data.phone;
+		async onSave() {
+			const {
+				query = {
+					id: "",
+				},
+			} = this.$page.data;
+			const phoneNumber = this.data.phone;
 
-      if (/^[1]([3-9])[0-9]{9}$/.test(phoneNumber)) {
-        patientUpdate({
-          id: query.id,
-          phoneNumber: await getEncryptStr(this.data.phone)
-        }).then(() => {
-          my.navigateBack();
-        });
-      } else {
-        my.showToast({
-          type: 'fail',
-          content: '手机号错误',
-          duration: 3000,
-          success: () => {
-            this.setData({
-              phone: ''
-            });
-          }
-        });
-      }
-    }
-
-  }
-});
+			if (/^[1]([3-9])[0-9]{9}$/.test(phoneNumber)) {
+				patientUpdate({
+					id: query.id,
+					phoneNumber: await getEncryptStr(this.data.phone),
+				}).then(() => {
+					EventHub.dispatchEvent("onPatienDetailUpdate", true);
+					my.navigateBack();
+				});
+			} else {
+				my.showToast({
+					type: "fail",
+					content: "手机号错误",
+					duration: 3000,
+					success: () => {
+						this.setData({
+							phone: "",
+						});
+					},
+				});
+			}
+		},
+	},
+});

+ 75 - 79
antbuilder/industry/hospitalV2/utils/history.js

@@ -1,89 +1,85 @@
 import { prefixPagePath, industryEntry } from "../../../core/utils";
-import { queryToUrl } from './index';
-import masConfig from '../mas.config.json';
-export const getEntryPage = pull => `${industryEntry}/${masConfig['industry-name']}/pages/${pull ? 'page-pull' : 'page-no-pull'}/index`;
+import { queryToUrl } from "./index";
+import masConfig from "../mas.config.json";
+export const getEntryPage = (pull) =>
+	`${industryEntry}/${masConfig["industry-name"]}/pages/${
+		pull ? "page-pull" : "page-no-pull"
+	}/index`;
 
 const history = (() => {
-  const storage = ({
-    pageType,
-    componentData
-  }) => {
-    if (!getApp().globalData.pageTemp) {
-      getApp().globalData.pageTemp = {};
-    }
+	const storage = ({ pageType, componentData }) => {
+		if (!getApp().globalData.pageTemp) {
+			getApp().globalData.pageTemp = {};
+		}
 
-    getApp().globalData.pageTemp[pageType] = componentData;
-  }; // eslint-disable-next-line max-len
-  // /components/industry-component/volunteer/pages/page-no-pull/index?title=标题&pageType=volunteer-projects
+		getApp().globalData.pageTemp[pageType] = componentData;
+	}; // eslint-disable-next-line max-len
+	// /components/industry-component/volunteer/pages/page-no-pull/index?title=标题&pageType=volunteer-projects
 
+	const url = ({ pageType, query, title, pull, header }) =>
+		`${getEntryPage(
+			pull
+		)}?title=${title}&pageType=${pageType}&header=${header}${queryToUrl(
+			query
+		)}`; // pageType 指定渲染的组件
+	// data 数据,用于复杂类型的传递
+	// query 可以通过分享出去的链接重新回到该页面,简单的query数据
+	// title 页面标题和分享出去的标题
+	// pull 页面是否允许下拉
 
-  const url = ({
-    pageType,
-    query,
-    title,
-    pull,
-    header
-  }) => `${getEntryPage(pull)}?title=${title}&pageType=${pageType}&header=${header}${queryToUrl(query)}`; // pageType 指定渲染的组件
-  // data 数据,用于复杂类型的传递
-  // query 可以通过分享出去的链接重新回到该页面,简单的query数据
-  // title 页面标题和分享出去的标题
-  // pull 页面是否允许下拉
+	return {
+		push({
+			pageType,
+			componentData,
+			query = {},
+			title,
+			pull = false,
+			header = "show",
+		}) {
+			storage({
+				pageType,
+				componentData,
+			});
+			my.navigateTo({
+				url: url({
+					pageType,
+					query,
+					title,
+					pull,
+					header,
+				}),
+			});
+		},
 
+		replace({
+			pageType,
+			componentData,
+			query = {},
+			title,
+			pull,
+			header = "show",
+		}) {
+			storage({
+				pageType,
+				componentData,
+			});
+			my.redirectTo({
+				url: url({
+					pageType,
+					query,
+					title,
+					pull,
+					header,
+				}),
+			});
+		},
 
-  return {
-    push({
-      pageType,
-      componentData,
-      query = {},
-      title,
-      pull = false,
-      header = 'show'
-    }) {
-      storage({
-        pageType,
-        componentData
-      });
-      my.navigateTo({
-        url: url({
-          pageType,
-          query,
-          title,
-          pull,
-          header
-        })
-      });
-    },
-
-    replace({
-      pageType,
-      componentData,
-      query = {},
-      title,
-      pull,
-      header = 'show'
-    }) {
-      storage({
-        pageType,
-        componentData
-      });
-      my.redirectTo({
-        url: url({
-          pageType,
-          query,
-          title,
-          pull,
-          header
-        })
-      });
-    },
-
-    toH5(_url) {
-      my.navigateTo({
-        url: `${prefixPagePath}/h5/index?url=${_url}`
-      });
-    }
-
-  };
+		toH5(_url) {
+			my.navigateTo({
+				url: `${prefixPagePath}/h5/index?url=${_url}`,
+			});
+		},
+	};
 })();
 
-export default history;
+export default history;

+ 66 - 76
antbuilder/industry/hospitalV2/utils/page.js

@@ -1,83 +1,73 @@
-import { createPublish } from 'applet-page-component';
-import { queryToUrl } from './index';
+import { createPublish } from "applet-page-component";
+import { queryToUrl } from "./index";
 
-const getOptions = () => ({ ...createPublish(),
-  data: {
-    pageType: undefined,
-    componentData: undefined,
-    query: {},
-    title: '',
-    header: 'show',
-    background: '#1677FF',
-    color: '#fff',
-    backBtnColor: '#000000'
-  },
+const getOptions = () => ({
+	...createPublish(),
+	data: {
+		pageType: undefined,
+		componentData: undefined,
+		query: {},
+		title: "",
+		header: "show",
+		background: "#1677FF",
+		color: "#fff",
+		backBtnColor: "#000000",
+	},
 
-  onReadyHeader({
-    height
-  }) {
-    const {
-      componentData = {}
-    } = this.data;
-    componentData.headerHeight = height;
-    this.setData({
-      componentData: { ...componentData
-      }
-    });
-  },
+	onReadyHeader({ height }) {
+		const { componentData = {} } = this.data;
+		componentData.headerHeight = height;
+		this.setData({
+			componentData: { ...componentData },
+		});
+	},
 
-  onLoad(query) {
-    const {
-      title,
-      pageType,
-      header = 'show',
-      background,
-      color,
-      backBtnColor,
-      ...other
-    } = query;
-    title && my.setNavigationBar({
-      title,
-      backgroundColor: background || '#1677FF'
-    });
-    const {
-      globalData
-    } = getApp();
-    const {
-      pageTemp = {}
-    } = globalData;
-    const componentData = pageTemp[pageType] || {};
-    this.setData({
-      title,
-      header,
-      pageType,
-      componentData,
-      query: other,
-      background: background || '#1677FF',
-      color: color || '#fff',
-      backBtnColor: backBtnColor || false
-    });
-  },
+	onLoad(query) {
+		const {
+			title,
+			pageType,
+			header = "show",
+			background,
+			color,
+			backBtnColor,
+			...other
+		} = query;
+		title &&
+			my.setNavigationBar({
+				title,
+				backgroundColor: background || "#1677FF",
+			});
+		const { globalData } = getApp();
+		const { pageTemp = {} } = globalData;
+		const componentData = pageTemp[pageType] || {};
+		this.setData({
+			title,
+			header,
+			pageType,
+			componentData,
+			query: other,
+			background: background || "#1677FF",
+			color: color || "#fff",
+			backBtnColor: backBtnColor || false,
+		});
+	},
 
-  onUnload() {
-    if (getApp().globalData.pageTemp) {
-      delete getApp().globalData.pageTemp[this.data.pageType];
-    }
-  },
-
-  // 分享
-  onShareAppMessage() {
-    const {
-      pageType,
-      query,
-      title
-    } = this.data;
-    return {
-      title,
-      path: `${this.route}?pageType=${pageType}&title=${title}${queryToUrl(query)}`
-    };
-  }
+	onUnload() {
+		if (getApp().globalData.pageTemp) {
+			delete getApp().globalData.pageTemp[this.data.pageType];
+		}
+	},
 
+	// 分享
+	onShareAppMessage() {
+		const { pageType, query, title } = this.data;
+		return {
+			title,
+			path: `${this.route}?pageType=${pageType}&title=${title}${queryToUrl(
+				query
+			)}`,
+		};
+	},
 });
 
-export default getOptions;
+export default getOptions;