testResult.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_adv = require("../api/adv.js");
  4. var api_test = require("../api/test.js");
  5. require("../common/request.js");
  6. const _sfc_main = {
  7. data() {
  8. return {
  9. advImgs: [],
  10. advs: [],
  11. reportId: null,
  12. statusBarHeight: common_vendor.index.getStorageSync("menuInfo").statusBarHeight,
  13. report: null
  14. };
  15. },
  16. onLoad(option) {
  17. this.reportId = option.reportId;
  18. this.getTestReport();
  19. },
  20. onShow() {
  21. this.getAdvList();
  22. },
  23. methods: {
  24. shareImg() {
  25. var data = { reportId: this.reportId };
  26. api_test.getTestReportImg(data).then((res) => {
  27. if (res.code == 200) {
  28. console.log(res);
  29. wx.downloadFile({
  30. url: res.img,
  31. success: (res1) => {
  32. console.log(res1);
  33. wx.showShareImageMenu({
  34. path: res1.tempFilePath
  35. });
  36. },
  37. fail: (res2) => {
  38. console.log(res2);
  39. }
  40. });
  41. }
  42. }, (err) => {
  43. });
  44. },
  45. handleAdvClick(index) {
  46. var ad = this.advs[index];
  47. console.log(ad.advUrl);
  48. if (ad.showType == 1) {
  49. common_vendor.index.setStorageSync("url", ad.advUrl);
  50. common_vendor.index.navigateTo({
  51. url: "h5"
  52. });
  53. } else if (ad.showType == 2) {
  54. common_vendor.index.navigateTo({
  55. url: ad.advUrl
  56. });
  57. } else if (ad.showType == 3) {
  58. common_vendor.index.setStorageSync("content", ad.content);
  59. common_vendor.index.navigateTo({
  60. url: "content"
  61. });
  62. }
  63. },
  64. getAdvList() {
  65. var that = this;
  66. var data = {
  67. advType: 3
  68. };
  69. api_adv.getAdvList(data).then((res) => {
  70. if (res.code == 200) {
  71. that.advImgs = [];
  72. that.advs = res.data;
  73. that.advs.forEach(function(element) {
  74. if (element.imageUrl != null && element.imageUrl != "") {
  75. that.advImgs.push(element.imageUrl);
  76. }
  77. });
  78. console.log(that.advImgs);
  79. } else {
  80. common_vendor.index.showToast({
  81. icon: "none",
  82. title: "\u8BF7\u6C42\u5931\u8D25"
  83. });
  84. }
  85. });
  86. },
  87. getTestReport() {
  88. var data = { reportId: this.reportId };
  89. api_test.getTestReport(data).then((res) => {
  90. if (res.code == 200) {
  91. this.report = res.report;
  92. }
  93. }, (err) => {
  94. });
  95. },
  96. goBack() {
  97. common_vendor.index.navigateBack();
  98. }
  99. }
  100. };
  101. if (!Array) {
  102. const _easycom_u_swiper2 = common_vendor.resolveComponent("u-swiper");
  103. _easycom_u_swiper2();
  104. }
  105. const _easycom_u_swiper = () => "../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
  106. if (!Math) {
  107. _easycom_u_swiper();
  108. }
  109. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  110. return common_vendor.e({
  111. a: $data.report != null
  112. }, $data.report != null ? common_vendor.e({
  113. b: JSON.parse($data.report.patientJson).avatar == null ? "https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/22cb9518a55040dea74d8f730551a7a2.jpg" : JSON.parse($data.report.patientJson).avatar,
  114. c: common_vendor.t(JSON.parse($data.report.patientJson).sex == 1 ? "\u7537" : "\u5973"),
  115. d: common_vendor.t(JSON.parse($data.report.patientJson).age),
  116. e: common_vendor.t($data.report.createTime),
  117. f: common_vendor.t($data.report.testResult),
  118. g: common_vendor.t($data.report.testResult),
  119. h: common_vendor.f(JSON.parse($data.report.conditioningPlanJson), (item, index, i0) => {
  120. return common_vendor.e({
  121. a: common_vendor.t(item.name),
  122. b: common_vendor.t(item.value.replace(/\\n/g, "<br>")),
  123. c: index < JSON.parse($data.report.conditioningPlanJson).length - 2
  124. }, index < JSON.parse($data.report.conditioningPlanJson).length - 2 ? {} : {});
  125. }),
  126. i: $data.advImgs.length > 0
  127. }, $data.advImgs.length > 0 ? {
  128. j: common_vendor.o($options.handleAdvClick),
  129. k: common_vendor.p({
  130. list: $data.advImgs,
  131. circular: true
  132. })
  133. } : {}) : {}, {
  134. l: common_vendor.o(($event) => $options.shareImg())
  135. });
  136. }
  137. 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/testResult.vue"]]);
  138. wx.createPage(MiniProgramPage);