|
|
import{r as e,_ as a,$ as l,a0 as s,a1 as t,b as u,c as o,w as n,i as c,o as i,d as r,k as f,e as d,t as v,m as p,f as y,g as _,F as m,u as w,C as k,a2 as x,a3 as g,a4 as h,a5 as I,j as T,v as b,a6 as C,a7 as j}from"./index-IX2tYR8R.js";import{_ as A}from"./u-navbar.BTvKBpLV.js";import{o as q,r as z}from"./uni-app.es.Bc5t55A8.js";import{_ as L}from"./u-icon.sW6sruaF.js";import{_ as B}from"./u-popup.CPuol-R0.js";import{_ as N,a as S,b as U,c as V,d as $,e as D}from"./sc.fc7k8zE2.js";import{c as F}from"./car.C_k88K1b.js";import{q as Q}from"./wrongQuestionBook.Beoh-3Vq.js";import{_ as E}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.weuqoXTS.js";import"./u-loading-icon.pEvsKDSP.js";const H=E({__name:"brushQuestions",setup(E){const H=e("1"),M=e(["单选题","多选题","判断题"]),R=e(0),G=e(0);let J=F(),K=Q();function O(e){console.log(window),H.value!=e&&(H.value=e)}const P=e(!1);function W(){P.value=!1}function X(){l({title:"正在加载"}),P.value=!0,setTimeout((()=>{t()}),1800)}let Y=e(!1),Z=e("");function ee(){Y.value=!1,Z.value=""}async function ae(){if(!Z.value)return uni.$u.toast("请输入内容");let e={content:Z.value,questionId:le.value.id};0==(await x(e)).errorcode&&(uni.$u.toast("提交成功,感谢您的反馈"),Y.value=!1)}q((e=>{e.wrong?async function(e){let l={carType:J.carInfo.carType,chapter:J.carInfo.chapter,isHigh:"",stepType:J.carInfo.stepType,type:e};await a(l)}(e.wrong):async function(){try{l({title:"正在加载..."});let e={carType:J.carInfo.carType,stepType:J.carInfo.stepType,volume:J.carInfo.volume,types:J.carInfo.types,sift:J.carInfo.sift,contentType:J.carInfo.contentType,knowType:J.carInfo.knowType,chapter:J.carInfo.chapter,city:J.carInfo.city};const{data:a}=await s(e);t(),le.value=a.questionBank,ue(),se.value=a.quesIdList,te.value=se.value.findIndex((e=>e==le.value.id))}catch(e){t()}}()}));const le=e({});let se=e([]),te=e(0);function ue(){le.value.optionArr=[];["a","b","c","d","e","f"].forEach(((e,a)=>{let l="option"+e;if(le.value[l]){let s={key:e.toLocaleUpperCase(),text:le.value[l],index:a+1};le.value.optionArr.push(s)}})),3==le.value.types&&(le.value.optionArr[0].key="true",le.value.optionArr[1].key="false")}async function oe(e){if(2==le.value.types&&ce.value.ans&&(ce.value.answer||(ce.value.answer=ce.value.ans,await ie()),le.value.answer!=ce.value.ans&&"next"!=ce.value.isNext))return ce.value.isNext="next",!1;ce.value={},te.value=te.value+e,le.value.optionArr=[],ne()}async function ne(){console.log(te.value);let e=se.value[te.value],a={carType:J.carInfo.carType,questionId:e,sort:te.value,stepType:J.carInfo.stepType,tempId:le.value.questionDoTemp.id};const{data:l}=await g(a);le.value=l,ce.value.isNext="",ue()}const ce=e({});async function ie(){let e={answer:ce.value.answer,carType:J.carInfo.carType,questionId:le.value.id,result:ce.value.answer==le.value.answer?"0":"1",stepType:J.carInfo.stepType,tempId:le.value.questionDoTemp.id};await h(e),ce.value.answer==le.value.answer?(console.log("答对了"),ce.value={},le.value.optionArr=[],R.value++,K.lookList(le.value.id),console.log(K.wrongList),oe(1)):(G.value++,K.setList(le.value.id),console.log(K.wrongList))}async function re(){let e=1==le.value.isCollect?"0":"1";const a={carType:J.carInfo.carType,isAdd:e,questionId:le.value.id,stepType:J.carInfo.stepType};await I(a),le.value.isCollect=e,console.log(le.value.isCollect)}return(e,a)=>{const l=c,s=z(u("up-navbar"),A),t=T,x=b,g=z(u("up-icon"),L),h=C,I=z(u("up-popup"),B),q=z(u("up-textarea"),N),F=z(u("up-button"),S);return i(),o(l,{class:"content"},{default:n((()=>[r(s,{leftText:" ",title:"",safeAreaInsetTop:!1,autoBack:!0},{center:n((()=>[r(l,{class:"u-nav-slot flex"},{default:n((()=>[r(l,{class:f(["btn",{active:1==H.value}]),onClick:a[0]||(a[0]=e=>O(1))},{default:n((()=>[d("答题模式")])),_:1},8,["class"]),r(l,{class:f(["btn",{active:2==H.value}]),onClick:a[1]||(a[1]=e=>O(2))},{default:n((()=>[d("背题模式")])),_:1},8,["class"])])),_:1})])),_:1}),r(l,{class:"con padding"},{default:n((()=>[r(l,{class:"h1_row"},{default:n((()=>[r(t,{class:f(["tag",{red:2==le.value.ty
|