index.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const common_config = require("../../common/config.js");
  4. const api_index = require("../../api/index.js");
  5. const leiDa = () => "../../components/mpvueEcharts/leiDa.js";
  6. const unTable = () => "../components/unTable.js";
  7. var _this;
  8. const _sfc_main = {
  9. name: "testResults",
  10. components: {
  11. leiDa,
  12. unTable
  13. },
  14. data() {
  15. return {
  16. getBenDatas: null,
  17. avatarUrl: "",
  18. petName: "",
  19. showTestedPerson: false,
  20. baseUrl: common_config.baseUrl,
  21. name: "",
  22. time: "",
  23. totalScores: 0,
  24. symptomScore: [],
  25. symptomDescription: [],
  26. symptom: "",
  27. reference: [],
  28. scoreList: [],
  29. indicator: [],
  30. improvementSuggestions: "无",
  31. scoresList: [],
  32. resultId: "",
  33. subjectOrCognitiveId: "",
  34. testResult: 2,
  35. imgUrl: "",
  36. messageShare: 0,
  37. productList: [
  38. {
  39. name: "谢谢您的参与,阅读本报告时,请注意以下内容:"
  40. },
  41. {
  42. name: ". 本结果仅供参考,不可作为临床诊断的依据"
  43. },
  44. {
  45. name: ". 如结果与你自己或他人感知的有出入,可回忆在测试"
  46. },
  47. {
  48. name: "时是否有事情影响了你,或自己答题时是否有所顾虑"
  49. },
  50. {
  51. name: ". 如对报告有不理解的地方,建议向专业人员进行咨询"
  52. }
  53. ],
  54. showResultText: false,
  55. relevantList: [],
  56. scaleInfo: {},
  57. flag: "",
  58. treadStatu: false,
  59. //踩赞状态
  60. praiseStatu: false,
  61. //点赞状态
  62. treadId: "",
  63. praiseId: "",
  64. downloadBtn: {
  65. height: "80px !important",
  66. width: "250px !important",
  67. fontSize: "32px",
  68. color: "#FFFFFF",
  69. background: "#FF9710",
  70. border: "none"
  71. },
  72. returnBtn: {
  73. height: "80px !important",
  74. width: "250px !important",
  75. fontSize: "32px",
  76. color: "#FF9710",
  77. background: "#FFE6C7",
  78. border: "none"
  79. },
  80. shareBtn: {
  81. height: "80px !important",
  82. width: "80px !important",
  83. fontSize: "32px",
  84. color: "#FF9710",
  85. background: "#FFE6C7",
  86. border: "none"
  87. },
  88. // arrow_left_bold: this.$imageUrl.urls.arrow_left_bold, //左侧箭头图标
  89. likeNum: 0,
  90. //点赞数量
  91. notLikeNum: 0,
  92. //不喜欢数量
  93. commentNum: 0,
  94. //评论数量
  95. showContent: false
  96. //等接口返回数据初始化完成再
  97. };
  98. },
  99. onBackPress(event) {
  100. common_vendor.index.redirectTo({
  101. url: "/pages/tab/scaleTest/index"
  102. });
  103. return true;
  104. },
  105. onLoad(options) {
  106. _this = this;
  107. let bings = common_vendor.index.getStorageSync("beginTextData");
  108. if (bings) {
  109. let bing = JSON.parse(bings);
  110. _this.getBenDatas = bing;
  111. }
  112. if (options.resultId || options.scene) {
  113. if (options.messageShare == 1) {
  114. this.messageShare = options.messageShare;
  115. }
  116. _this.resultId = options.resultId || options.scene;
  117. _this.getScaleTestResults(_this.resultId);
  118. }
  119. },
  120. onShow() {
  121. this.showTestedPerson = this.petName && this.avatarUrl;
  122. },
  123. onReachBottom() {
  124. },
  125. methods: {
  126. navBackTest() {
  127. common_vendor.index.$emit("updateData", encodeURIComponent(JSON.stringify(this.getBenDatas)));
  128. common_vendor.index.navigateBack({
  129. delta: 2
  130. });
  131. },
  132. leftClick() {
  133. console.log("-this.messageShare------>", this.messageShare);
  134. if (this.messageShare == 1) {
  135. common_vendor.index.switchTab({
  136. url: "/pages/tab/scaleTest/index"
  137. });
  138. } else {
  139. common_vendor.index.navigateBack();
  140. }
  141. },
  142. navBack() {
  143. this.leftClick();
  144. },
  145. getScaleTestResults(id) {
  146. console.log("111:", (/* @__PURE__ */ new Date()).getTime());
  147. _this.$request.get({
  148. url: `${api_index.getRecordById}?id=${id}`,
  149. loadingTip: "加载中...",
  150. data: {}
  151. }).then(
  152. (res) => {
  153. var _a, _b;
  154. console.log("222:", (/* @__PURE__ */ new Date()).getTime());
  155. console.log("----测试结果--->", res);
  156. if (res.code == 200) {
  157. _this.testResult = parseInt(JSON.parse((_b = (_a = res.data) == null ? void 0 : _a.userRecordEntity) == null ? void 0 : _b.testResult)[0].version);
  158. _this.name = res.data.userRecordEntity.name;
  159. _this.flag = res.data.userRecordEntity.flag;
  160. _this.scaleInfo = res.data.userRecordEntity;
  161. let testDateTime = res.data.userRecordEntity.testDate;
  162. let yearMonthDay = testDateTime.replace("年", "/").replace("月", "/").replace("日", " ").replace("时", ":").replace("分", ":").replace("秒", "");
  163. _this.time = yearMonthDay;
  164. if (_this.testResult == 2) {
  165. _this.getDataList(res.data);
  166. } else {
  167. _this.scoresList = JSON.parse(res.data.userRecordEntity.testResult);
  168. _this.init(_this.scoresList[0].tableContext[0].value[0]);
  169. }
  170. this.showContent = true;
  171. } else if (res.code == 401)
  172. ;
  173. else
  174. ;
  175. }
  176. );
  177. },
  178. init(v) {
  179. _this.totalScores = Number(v);
  180. },
  181. getDataList(data) {
  182. let v = JSON.parse(data.userRecordEntity.testResult);
  183. _this.scoresList = v;
  184. console.log("-----传入的参数----->", v);
  185. v.forEach((items) => {
  186. var _a, _b, _c, _d, _e, _f;
  187. if (items.newTableContext.iconInfo != "") {
  188. let indicatorList = (_b = (_a = items == null ? void 0 : items.newTableContext) == null ? void 0 : _a.iconInfo) == null ? void 0 : _b.indicator;
  189. if (indicatorList.length > 0) {
  190. indicatorList.forEach((data2) => {
  191. _this.indicator.push({
  192. text: data2.text,
  193. max: Number(data2.max)
  194. });
  195. });
  196. }
  197. let referenceList = ((_d = (_c = items == null ? void 0 : items.newTableContext) == null ? void 0 : _c.iconInfo) == null ? void 0 : _d.reference) || [];
  198. if (referenceList.length > 0) {
  199. referenceList.forEach((data2) => {
  200. _this.reference.push(Number(data2));
  201. });
  202. }
  203. let scoreLists = (_f = (_e = items == null ? void 0 : items.newTableContext) == null ? void 0 : _e.iconInfo) == null ? void 0 : _f.scoreList;
  204. if (scoreLists.length > 0) {
  205. scoreLists.forEach((data2) => {
  206. _this.scoreList.push(Number(data2));
  207. });
  208. }
  209. console.log("==1111=====>", _this.indicator);
  210. console.log("==2222=====>", _this.reference);
  211. console.log("==3333=====>", _this.scoreList);
  212. }
  213. items.newTableContext.result.forEach((item) => {
  214. if (!item)
  215. return;
  216. if (item.name === "总分" || item.name === "压力综合指数") {
  217. _this.init(item.score);
  218. _this.symptom = item.symptom;
  219. }
  220. if (item.isTotalScoreExplain === "是") {
  221. _this.improvementSuggestions = item.symptom;
  222. }
  223. _this.symptomScore.push({
  224. name: item.name,
  225. score: item.score
  226. });
  227. this.symptomDescription.push(item);
  228. });
  229. if (this.symptomDescription && this.symptomDescription.length > 0) {
  230. this.showResultText = true;
  231. }
  232. console.log("0000-----000", _this.symptomDescription);
  233. });
  234. }
  235. }
  236. };
  237. if (!Array) {
  238. const _component_u_avatar = common_vendor.resolveComponent("u-avatar");
  239. const _component_leiDa = common_vendor.resolveComponent("leiDa");
  240. const _component_u_col = common_vendor.resolveComponent("u-col");
  241. const _component_u_row = common_vendor.resolveComponent("u-row");
  242. const _component_u_line = common_vendor.resolveComponent("u-line");
  243. (_component_u_avatar + _component_leiDa + _component_u_col + _component_u_row + _component_u_line)();
  244. }
  245. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  246. return common_vendor.e({
  247. a: $data.name
  248. }, $data.name ? {
  249. b: common_vendor.t($data.name)
  250. } : {}, {
  251. c: $data.time
  252. }, $data.time ? {
  253. d: common_vendor.t($data.time)
  254. } : {}, {
  255. e: common_vendor.p({
  256. size: "100",
  257. src: $data.avatarUrl
  258. }),
  259. f: $data.scoreList && $data.scoreList.length > 0
  260. }, $data.scoreList && $data.scoreList.length > 0 ? {} : {}, {
  261. g: common_vendor.p({
  262. reference: $data.reference,
  263. scoreList: $data.scoreList,
  264. indicator: $data.indicator
  265. }),
  266. h: $data.showResultText
  267. }, $data.showResultText ? {} : {}, {
  268. i: $data.showResultText
  269. }, $data.showResultText ? {
  270. j: common_vendor.f($data.symptomDescription, (list, j, i0) => {
  271. return common_vendor.e({
  272. a: common_vendor.t(list.name),
  273. b: list.score && list.score != "无"
  274. }, list.score && list.score != "无" ? {
  275. c: common_vendor.t(list.percent)
  276. } : {}, {
  277. d: list.symptom && list.symptom != "无"
  278. }, list.symptom && list.symptom != "无" ? {
  279. e: common_vendor.t(list.symptom)
  280. } : {}, {
  281. f: list.improvementSuggestions && list.improvementSuggestions != "无"
  282. }, list.improvementSuggestions && list.improvementSuggestions != "无" ? {
  283. g: common_vendor.t(list.improvementSuggestions)
  284. } : {}, {
  285. h: list.suggestion && list.suggestion != "无"
  286. }, list.suggestion && list.suggestion != "无" ? {
  287. i: common_vendor.t(list.suggestion)
  288. } : {}, {
  289. j
  290. });
  291. })
  292. } : {}, {
  293. k: common_vendor.p({
  294. span: "12"
  295. }),
  296. l: $data.showContent
  297. });
  298. }
  299. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1d4e5843"], ["__file", "E:/psy_web_share/scaleTestResults/testResults/index.vue"]]);
  300. tt.createPage(MiniProgramPage);