You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
7.2 KiB

1 week ago
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const config_api = require("../../../config/api.js");
  4. const store_modules_car = require("../../../store/modules/car.js");
  5. const store_modules_wrongQuestionBook = require("../../../store/modules/wrongQuestionBook.js");
  6. if (!Array) {
  7. const _easycom_up_navbar2 = common_vendor.resolveComponent("up-navbar");
  8. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  9. const _easycom_u_switch2 = common_vendor.resolveComponent("u-switch");
  10. const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
  11. const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
  12. (_easycom_up_navbar2 + _easycom_u_icon2 + _easycom_u_switch2 + _easycom_up_radio2 + _easycom_up_radio_group2)();
  13. }
  14. const _easycom_up_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
  15. const _easycom_u_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js";
  16. const _easycom_u_switch = () => "../../../uni_modules/uview-plus/components/u-switch/u-switch.js";
  17. const _easycom_up_radio = () => "../../../uni_modules/uview-plus/components/u-radio/u-radio.js";
  18. const _easycom_up_radio_group = () => "../../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
  19. if (!Math) {
  20. (_easycom_up_navbar + _easycom_u_icon + _easycom_u_switch + _easycom_up_radio + _easycom_up_radio_group)();
  21. }
  22. const _sfc_main = {
  23. __name: "wrongQuestion",
  24. setup(__props) {
  25. let usecarStore = store_modules_car.carStore();
  26. let usewrongQuestion = store_modules_wrongQuestionBook.questionStore();
  27. common_vendor.ref(false);
  28. const currentNav = common_vendor.ref(1);
  29. common_vendor.ref([]);
  30. function subMenuClick(item) {
  31. if (!item.total)
  32. return common_vendor.index.$u.toast("暂无题目");
  33. usecarStore.setCar("chapter", item.param);
  34. common_vendor.index.navigateTo({
  35. url: "/pages/exercises/brushQuestions/wrongQuestions?wrong=" + currentNav.value
  36. });
  37. }
  38. function changeNav(val) {
  39. currentNav.value = val;
  40. countInfo.value = {};
  41. subMenu.value = [];
  42. myWrongQuestionFn();
  43. questionSubmenuFn();
  44. }
  45. let countInfo = common_vendor.ref({});
  46. async function myWrongQuestionFn() {
  47. const { data: res } = await config_api.myWrongQuestion({ stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType, city: usecarStore.carInfo.city, type: currentNav.value });
  48. countInfo.value = res;
  49. console.log(res);
  50. }
  51. const subMenu = common_vendor.ref([]);
  52. async function questionSubmenuFn() {
  53. const { data: res } = await config_api.questionSubmenu({ stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType, type: currentNav.value });
  54. subMenu.value = res;
  55. console.log(res);
  56. }
  57. common_vendor.onShow(() => {
  58. myWrongQuestionFn();
  59. questionSubmenuFn();
  60. });
  61. function changeSwitch(val) {
  62. console.log(val);
  63. }
  64. let switchValue = common_vendor.computed({
  65. get() {
  66. return usewrongQuestion.frequency ? true : false;
  67. },
  68. set(val) {
  69. let num = val ? 1 : 0;
  70. usewrongQuestion.setFrequency(num);
  71. }
  72. });
  73. let switchNum = common_vendor.computed({
  74. get() {
  75. return usewrongQuestion.frequency;
  76. },
  77. set(val) {
  78. usewrongQuestion.setFrequency(val);
  79. }
  80. });
  81. function deleteAll() {
  82. common_vendor.index.showModal({
  83. title: "确定要全部移除吗?",
  84. async success() {
  85. let obj = {
  86. "carType": usecarStore.carInfo.carType,
  87. "questionId": "",
  88. "stepType": usecarStore.carInfo.stepType,
  89. "type": currentNav.value
  90. };
  91. await config_api.deleteWrongOrCol(obj);
  92. myWrongQuestionFn();
  93. questionSubmenuFn();
  94. }
  95. });
  96. }
  97. function goPage(url, num) {
  98. if (!num)
  99. return common_vendor.index.$u.toast("暂无题目");
  100. common_vendor.index.navigateTo({
  101. url
  102. });
  103. }
  104. return (_ctx, _cache) => {
  105. return common_vendor.e({
  106. a: common_vendor.o(($event) => changeNav(1)),
  107. b: currentNav.value == 1 ? 1 : "",
  108. c: common_vendor.o(($event) => changeNav(2)),
  109. d: currentNav.value == 2 ? 1 : "",
  110. e: common_vendor.p({
  111. leftText: " ",
  112. leftIconColor: "#fff",
  113. safeAreaInsetTop: true,
  114. autoBack: true,
  115. bgColor: "transparent"
  116. }),
  117. f: common_vendor.t(currentNav.value == 2 ? "收藏" : "错题"),
  118. g: common_vendor.t(currentNav.value == 2 ? "收藏" : "错题"),
  119. h: common_vendor.p({
  120. name: "arrow-right",
  121. color: "#fff",
  122. size: "14"
  123. }),
  124. i: common_vendor.o(($event) => goPage("/pages/exercises/brushQuestions/wrongQuestions?wrong=" + currentNav.value, common_vendor.unref(countInfo).allCount)),
  125. j: common_vendor.t(common_vendor.unref(countInfo).allCount),
  126. k: common_vendor.t(currentNav.value == 2 ? "今日收藏" : "高频错题"),
  127. l: common_vendor.p({
  128. name: "arrow-right",
  129. color: "#fff",
  130. size: "14"
  131. }),
  132. m: common_vendor.o(($event) => goPage("/pages/exercises/brushQuestions/wrongQuestions?wrong=" + currentNav.value + "&isHigh=1", common_vendor.unref(countInfo).highCount)),
  133. n: common_vendor.t(common_vendor.unref(countInfo).highCount),
  134. o: currentNav.value == 2 ? 1 : "",
  135. p: currentNav.value == 1
  136. }, currentNav.value == 1 ? {
  137. q: common_vendor.o(changeSwitch),
  138. r: common_vendor.o(($event) => common_vendor.isRef(switchValue) ? switchValue.value = $event : switchValue = $event),
  139. s: common_vendor.p({
  140. modelValue: common_vendor.unref(switchValue)
  141. })
  142. } : {}, {
  143. t: subMenu.value.length
  144. }, subMenu.value.length ? common_vendor.e({
  145. v: common_vendor.p({
  146. name: "trash",
  147. color: "#ccc",
  148. size: "14"
  149. }),
  150. w: common_vendor.o(deleteAll),
  151. x: common_vendor.unref(switchValue) && currentNav.value == 1
  152. }, common_vendor.unref(switchValue) && currentNav.value == 1 ? {
  153. y: common_vendor.p({
  154. label: "答对1次就移除",
  155. name: 1
  156. }),
  157. z: common_vendor.p({
  158. label: "答对3次就移除",
  159. name: 3
  160. }),
  161. A: common_vendor.o(($event) => common_vendor.isRef(switchNum) ? switchNum.value = $event : switchNum = $event),
  162. B: common_vendor.p({
  163. modelValue: common_vendor.unref(switchNum)
  164. })
  165. } : {}, {
  166. C: common_vendor.f(subMenu.value, (item, index, i0) => {
  167. return {
  168. a: common_vendor.t(index + 1),
  169. b: common_vendor.t(item.name),
  170. c: common_vendor.t(item.total),
  171. d: "dd551a5d-8-" + i0,
  172. e: index,
  173. f: common_vendor.o(($event) => subMenuClick(item), index)
  174. };
  175. }),
  176. D: common_vendor.p({
  177. name: "arrow-right",
  178. color: "#D9D9D9",
  179. size: "14"
  180. })
  181. }) : {});
  182. };
  183. }
  184. };
  185. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-dd551a5d"]]);
  186. wx.createPage(MiniProgramPage);