123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_test = require("../api/test.js");
- require("../common/request.js");
- const _sfc_main = {
- data() {
- return {
- scrollTop: 0,
- formJson: null,
- tempId: null,
- patient: null,
- items: {},
- msgs: [],
- index: 0,
- item: null
- };
- },
- onLoad(option) {
- this.tempId = option.tempId;
- var that = this;
- common_vendor.index.$on("refreshOrderPatient", (res) => {
- that.patient = res;
- });
- },
- onShow() {
- this.getTestTempDetails();
- this.getTestDetails();
- },
- onShareAppMessage(res) {
- if (this.$isLogin()) {
- return {
- title: "\u5065\u5EB7\u4F53\u8D28\u68C0\u6D4B",
- path: "/pages_index/test?tempId=" + this.tempId,
- imageUrl: "https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png"
- };
- }
- },
- onShareTimeline(res) {
- if (this.utils.isLogin()) {
- return {
- title: "\u5065\u5EB7\u4F53\u8D28\u68C0\u6D4B",
- imageUrl: "https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png"
- };
- }
- },
- methods: {
- getTestDetails() {
- let data = { tempId: this.tempId };
- api_test.getTestDetails(data).then((res) => {
- if (res.code == 200) {
- common_vendor.index.setNavigationBarTitle({
- title: res.data.name + "\u81EA\u6D4B"
- });
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u6C42\u5931\u8D25"
- });
- }
- }, (rej) => {
- });
- },
- addMsg(type, content) {
- var msg = { type, content };
- this.msgs.push(msg);
- var that = this;
- common_vendor.index.createSelectorQuery().select(".msgs").boundingClientRect((res) => {
- const scrollH = res.height;
- that.scrollTop = scrollH;
- console.log(that.scrollTop);
- }).exec();
- },
- optionClick(item, option) {
- if (this.patient == null) {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u9009\u62E9\u4F53\u9A8C\u8005"
- });
- return;
- }
- item.option = option.name;
- console.log(item.option);
- this.addMsg(2, option.name);
- this.index++;
- if (this.index <= this.items.length - 1) {
- this.item = this.items[this.index];
- this.addMsg(1, this.item.title);
- } else {
- this.submit();
- }
- },
- getTestTempDetails() {
- var data = { tempId: this.tempId };
- api_test.getTestTempDetails(data).then((res) => {
- if (res.code == 200) {
- this.items = res.items;
- if (this.items.length > 0) {
- this.item = this.items[0];
- this.addMsg(1, this.item.title);
- }
- }
- }, (err) => {
- });
- },
- addPatient() {
- common_vendor.index.navigateTo({
- url: "/pages_user/patient"
- });
- },
- submit() {
- var data = {
- tempId: this.tempId,
- patientId: this.patient.patientId,
- formJson: JSON.stringify(this.items)
- };
- api_test.doReport(data).then((res) => {
- if (res.code == 200) {
- common_vendor.index.redirectTo({
- url: "/pages_index/testResult?reportId=" + res.reportId
- });
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.patient == null
- }, $data.patient == null ? {
- b: common_vendor.o(($event) => $options.addPatient())
- } : {}, {
- c: $data.patient != null
- }, $data.patient != null ? common_vendor.e({
- d: common_vendor.t($data.patient.patientName),
- e: $data.patient.sex == 1
- }, $data.patient.sex == 1 ? {} : {}, {
- f: $data.patient.sex == 2
- }, $data.patient.sex == 2 ? {} : {}, {
- g: common_vendor.t(_ctx.$getAge($data.patient.birthday)),
- h: common_vendor.t(_ctx.$parseIdCard($data.patient.idCard)),
- i: common_vendor.o(($event) => $options.addPatient())
- }) : {}, {
- j: common_vendor.f($data.msgs, (item, index, i0) => {
- return common_vendor.e({
- a: item.type == 1
- }, item.type == 1 ? {
- b: common_vendor.t(item.content)
- } : {}, {
- c: item.type == 2
- }, item.type == 2 ? {
- d: common_vendor.t(item.content)
- } : {});
- }),
- k: $data.scrollTop,
- l: $data.item != null
- }, $data.item != null ? {
- m: common_vendor.t($data.item.title),
- n: common_vendor.f(JSON.parse($data.item.scoreJson), (option, k0, i0) => {
- return {
- a: common_vendor.t(option.name),
- b: common_vendor.o(($event) => $options.optionClick($data.item, option))
- };
- })
- } : {});
- }
- var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_index/test.vue"]]);
- _sfc_main.__runtimeHooks = 6;
- wx.createPage(MiniProgramPage);
|