index.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const api_index = require("../../api/index.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. scaleInfoNew: {},
  8. scaleInfo: {
  9. name: ""
  10. },
  11. isCheck: false,
  12. type: null,
  13. topimg: "../../static/images/topImg.png",
  14. // scalName: '抑郁测试「简单评估版」',
  15. scaleDes: "测一测?",
  16. scaleNumber: "43.8W人测试过",
  17. scaleimg1: "../../static/images/1.jpg",
  18. scaleimg2: "../../static/images/2.jpg",
  19. scaleimg3: "../../static/images/3.jpg",
  20. //量表
  21. flag: "",
  22. //分享人的id
  23. uid: "",
  24. //来源
  25. source: "",
  26. //模态框是否弹出的标志
  27. modalFlag: false,
  28. questionNum: 0
  29. };
  30. },
  31. onLoad() {
  32. console.log(this.$route.query.flag);
  33. console.log(this.$route.query.uid);
  34. console.log(this.$route.query.source);
  35. this.flag = this.$route.query.flag;
  36. this.uid = this.$route.query.uid;
  37. this.source = this.$route.query.source;
  38. this.selectScale();
  39. },
  40. methods: {
  41. selectScale() {
  42. this.$request.get({
  43. url: `${api_index.getScaleTitle}/${this.flag}?uid=${this.uid}&source=${this.source}`,
  44. loadingTip: "加载中...",
  45. data: {}
  46. }).then((res) => {
  47. this.questionNum = res.data.questionNum;
  48. this.scaleInfo = res.data.subjectEntityDto2List[0];
  49. this.scaleInfoNew = res.data.ScaleDetailsEntity;
  50. });
  51. },
  52. checkChange(e) {
  53. if (e.detail.value.length == 0) {
  54. this.isCheck = false;
  55. } else {
  56. this.isCheck = true;
  57. }
  58. },
  59. toggle() {
  60. this.$refs.popup.open();
  61. },
  62. close() {
  63. this.$refs.popup.close();
  64. },
  65. //同意条框进行进入
  66. agreeFun() {
  67. this.modalFlag = false;
  68. common_vendor.index.navigateTo({
  69. url: `/examWidght/examWidght/index?flag=${this.flag}&uid=${this.uid}&source=${this.source}`
  70. });
  71. },
  72. //不同意方法
  73. unAgreeFun() {
  74. this.modalFlag = false;
  75. },
  76. startTest() {
  77. console.log(this.isCheck);
  78. if (this.isCheck) {
  79. common_vendor.index.navigateTo({
  80. url: `/examWidght/examWidght/index?flag=${this.flag}&uid=${this.uid}&source=${this.source}`
  81. });
  82. } else {
  83. this.modalFlag = true;
  84. }
  85. },
  86. goHistory() {
  87. common_vendor.index.navigateTo({
  88. url: "/paymentPage/queryByPhone/index"
  89. });
  90. },
  91. formatArr(str) {
  92. return str ? JSON.parse(str) : [];
  93. },
  94. formatObj(obj) {
  95. let key = Object.keys(obj)[0];
  96. return obj[key];
  97. },
  98. // 分割名言警句
  99. getMyjj(str, i) {
  100. return str ? str.split("——")[i] : "";
  101. }
  102. }
  103. };
  104. if (!Array) {
  105. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  106. const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  107. (_easycom_uni_icons2 + _easycom_uni_popup2)();
  108. }
  109. const _easycom_uni_icons = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.js";
  110. const _easycom_uni_popup = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.js";
  111. if (!Math) {
  112. (_easycom_uni_icons + _easycom_uni_popup)();
  113. }
  114. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  115. return common_vendor.e({
  116. a: common_vendor.o((...args) => $options.goHistory && $options.goHistory(...args)),
  117. b: common_vendor.t($data.scaleInfoNew.scaleName),
  118. c: common_vendor.t($data.scaleInfoNew.testNum),
  119. d: common_vendor.t($data.scaleInfoNew.evaluationIntroduction),
  120. e: common_vendor.t($data.questionNum),
  121. f: common_vendor.t(Math.ceil($data.questionNum * 0.25)),
  122. g: $data.questionNum > 30
  123. }, $data.questionNum > 30 ? {} : {}, {
  124. h: $data.scaleInfoNew.celebrityAphorism
  125. }, $data.scaleInfoNew.celebrityAphorism ? common_vendor.e({
  126. i: common_vendor.t($options.getMyjj($data.scaleInfoNew.celebrityAphorism, 0)),
  127. j: $options.getMyjj($data.scaleInfoNew.celebrityAphorism, 1)
  128. }, $options.getMyjj($data.scaleInfoNew.celebrityAphorism, 1) ? {
  129. k: common_vendor.t($options.getMyjj($data.scaleInfoNew.celebrityAphorism, 1))
  130. } : {}) : {}, {
  131. l: common_vendor.f($options.formatArr($data.scaleInfoNew.relatedQuestion), (item, k0, i0) => {
  132. return {
  133. a: common_vendor.t(item)
  134. };
  135. }),
  136. m: common_vendor.t($data.scaleInfoNew.evaluationTheory),
  137. n: common_vendor.t($data.scaleInfoNew.evaluationTheoryAttention),
  138. o: common_vendor.f($options.formatArr($data.scaleInfoNew.obtained), (item, k0, i0) => {
  139. return {
  140. a: common_vendor.t(Object.keys(item)[0]),
  141. b: common_vendor.t($options.formatObj(item))
  142. };
  143. }),
  144. p: common_vendor.f($options.formatArr($data.scaleInfoNew.suitCrowd), (item, k0, i0) => {
  145. return {
  146. a: common_vendor.t(item)
  147. };
  148. }),
  149. q: common_vendor.f($options.formatArr($data.scaleInfoNew.reportContent), (item, index, i0) => {
  150. return {
  151. a: common_vendor.t(index + 1),
  152. b: common_vendor.t(item),
  153. c: index < $options.formatArr($data.scaleInfoNew.reportContent).length - 1
  154. };
  155. }),
  156. r: $data.scaleInfoNew.reference && $data.scaleInfoNew.reference.length > 0
  157. }, $data.scaleInfoNew.reference && $data.scaleInfoNew.reference.length > 0 ? {
  158. s: common_vendor.f($options.formatArr($data.scaleInfoNew.reference), (item, index, i0) => {
  159. return {
  160. a: common_vendor.t(index + 1),
  161. b: common_vendor.t(item)
  162. };
  163. })
  164. } : {}, {
  165. t: common_vendor.o((...args) => $options.checkChange && $options.checkChange(...args)),
  166. v: common_vendor.o(($event) => $options.toggle()),
  167. w: common_vendor.o(($event) => $options.startTest()),
  168. x: common_vendor.o(($event) => $options.close()),
  169. y: common_vendor.p({
  170. type: "clear",
  171. size: "30"
  172. }),
  173. z: common_vendor.o(($event) => $options.close()),
  174. A: common_vendor.sr("popup", "8e07d3cc-0"),
  175. B: common_vendor.p({
  176. type: "bottom",
  177. ["background-color"]: "#fff"
  178. }),
  179. C: common_vendor.o(($event) => $options.toggle()),
  180. D: common_vendor.o(($event) => $options.agreeFun()),
  181. E: common_vendor.o(($event) => $options.unAgreeFun()),
  182. F: $data.modalFlag
  183. });
  184. }
  185. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/psy_web_share/pages/index/index.vue"]]);
  186. tt.createPage(MiniProgramPage);