"use strict"; const common_vendor = require("../../../common/vendor.js"); const config_api = require("../../../config/api.js"); const store_modules_car = require("../../../store/modules/car.js"); const store_modules_wrongQuestionBook = require("../../../store/modules/wrongQuestionBook.js"); if (!Array) { const _easycom_up_navbar2 = common_vendor.resolveComponent("up-navbar"); const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon"); const _easycom_u_switch2 = common_vendor.resolveComponent("u-switch"); const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio"); const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group"); (_easycom_up_navbar2 + _easycom_u_icon2 + _easycom_u_switch2 + _easycom_up_radio2 + _easycom_up_radio_group2)(); } const _easycom_up_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js"; const _easycom_u_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_u_switch = () => "../../../uni_modules/uview-plus/components/u-switch/u-switch.js"; const _easycom_up_radio = () => "../../../uni_modules/uview-plus/components/u-radio/u-radio.js"; const _easycom_up_radio_group = () => "../../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js"; if (!Math) { (_easycom_up_navbar + _easycom_u_icon + _easycom_u_switch + _easycom_up_radio + _easycom_up_radio_group)(); } const _sfc_main = { __name: "wrongQuestion", setup(__props) { let usecarStore = store_modules_car.carStore(); let usewrongQuestion = store_modules_wrongQuestionBook.questionStore(); common_vendor.ref(false); const currentNav = common_vendor.ref(1); common_vendor.ref([]); function subMenuClick(item) { if (!item.total) return common_vendor.index.$u.toast("暂无题目"); usecarStore.setCar("chapter", item.param); common_vendor.index.navigateTo({ url: "/pages/exercises/brushQuestions/wrongQuestions?wrong=" + currentNav.value }); } function changeNav(val) { currentNav.value = val; countInfo.value = {}; subMenu.value = []; myWrongQuestionFn(); questionSubmenuFn(); } let countInfo = common_vendor.ref({}); async function myWrongQuestionFn() { const { data: res } = await config_api.myWrongQuestion({ stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType, city: usecarStore.carInfo.city, type: currentNav.value }); countInfo.value = res; console.log(res); } const subMenu = common_vendor.ref([]); async function questionSubmenuFn() { const { data: res } = await config_api.questionSubmenu({ stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType, type: currentNav.value }); subMenu.value = res; console.log(res); } common_vendor.onShow(() => { myWrongQuestionFn(); questionSubmenuFn(); }); function changeSwitch(val) { console.log(val); } let switchValue = common_vendor.computed({ get() { return usewrongQuestion.frequency ? true : false; }, set(val) { let num = val ? 1 : 0; usewrongQuestion.setFrequency(num); } }); let switchNum = common_vendor.computed({ get() { return usewrongQuestion.frequency; }, set(val) { usewrongQuestion.setFrequency(val); } }); function deleteAll() { common_vendor.index.showModal({ title: "确定要全部移除吗?", async success() { let obj = { "carType": usecarStore.carInfo.carType, "questionId": "", "stepType": usecarStore.carInfo.stepType, "type": currentNav.value }; await config_api.deleteWrongOrCol(obj); myWrongQuestionFn(); questionSubmenuFn(); } }); } function goPage(url, num) { if (!num) return common_vendor.index.$u.toast("暂无题目"); common_vendor.index.navigateTo({ url }); } return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.o(($event) => changeNav(1)), b: currentNav.value == 1 ? 1 : "", c: common_vendor.o(($event) => changeNav(2)), d: currentNav.value == 2 ? 1 : "", e: common_vendor.p({ leftText: " ", leftIconColor: "#fff", safeAreaInsetTop: true, autoBack: true, bgColor: "transparent" }), f: common_vendor.t(currentNav.value == 2 ? "收藏" : "错题"), g: common_vendor.t(currentNav.value == 2 ? "收藏" : "错题"), h: common_vendor.p({ name: "arrow-right", color: "#fff", size: "14" }), i: common_vendor.o(($event) => goPage("/pages/exercises/brushQuestions/wrongQuestions?wrong=" + currentNav.value, common_vendor.unref(countInfo).allCount)), j: common_vendor.t(common_vendor.unref(countInfo).allCount), k: common_vendor.t(currentNav.value == 2 ? "今日收藏" : "高频错题"), l: common_vendor.p({ name: "arrow-right", color: "#fff", size: "14" }), m: common_vendor.o(($event) => goPage("/pages/exercises/brushQuestions/wrongQuestions?wrong=" + currentNav.value + "&isHigh=1", common_vendor.unref(countInfo).highCount)), n: common_vendor.t(common_vendor.unref(countInfo).highCount), o: currentNav.value == 2 ? 1 : "", p: currentNav.value == 1 }, currentNav.value == 1 ? { q: common_vendor.o(changeSwitch), r: common_vendor.o(($event) => common_vendor.isRef(switchValue) ? switchValue.value = $event : switchValue = $event), s: common_vendor.p({ modelValue: common_vendor.unref(switchValue) }) } : {}, { t: subMenu.value.length }, subMenu.value.length ? common_vendor.e({ v: common_vendor.p({ name: "trash", color: "#ccc", size: "14" }), w: common_vendor.o(deleteAll), x: common_vendor.unref(switchValue) && currentNav.value == 1 }, common_vendor.unref(switchValue) && currentNav.value == 1 ? { y: common_vendor.p({ label: "答对1次就移除", name: 1 }), z: common_vendor.p({ label: "答对3次就移除", name: 3 }), A: common_vendor.o(($event) => common_vendor.isRef(switchNum) ? switchNum.value = $event : switchNum = $event), B: common_vendor.p({ modelValue: common_vendor.unref(switchNum) }) } : {}, { C: common_vendor.f(subMenu.value, (item, index, i0) => { return { a: common_vendor.t(index + 1), b: common_vendor.t(item.name), c: common_vendor.t(item.total), d: "dd551a5d-8-" + i0, e: index, f: common_vendor.o(($event) => subMenuClick(item), index) }; }), D: common_vendor.p({ name: "arrow-right", color: "#D9D9D9", size: "14" }) }) : {}); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-dd551a5d"]]); wx.createPage(MiniProgramPage);