import{r as e,X as a,Y as l,Z as s,_ 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 k,A as w,R as x,$ as g,a0 as h,a1 as I,a2 as b,j as T,v as C,a3 as j,a4 as A}from"./index-DkGewvWo.js";import{_ as q}from"./u-navbar.CwZJfInl.js";import{o as z,r as L}from"./uni-app.es.Bo01BzMV.js";import{_ as B}from"./u-icon.x7ElsZU9.js";import{_ as N}from"./u-popup.C1usqomr.js";import{_ as S,a as U,b as V,c as $,d as D,e as F}from"./sc.S7-az16m.js";import{c as Q}from"./car.CcI8AEaV.js";import{q as R}from"./wrongQuestionBook.C0b3lmDY.js";import{_ as E}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.DDNs5qwz.js";import"./u-loading-icon.CdrBTsp-.js";const H=E({__name:"brushQuestions",setup(E){const H=e("1"),M=e(["单选题","多选题","判断题"]),O=e(0),X=e(0);let Y=Q(),Z=R();function G(e){console.log(window),H.value!=e&&(H.value=e)}const J=e(!1);function K(){J.value=!1}function P(){l({title:"正在加载"}),J.value=!0,x((()=>{t()}))}let W=e(!1),ee=e("");function ae(){W.value=!1,ee.value=""}async function le(){if(!ee.value)return uni.$u.toast("请输入内容");let e={content:ee.value,questionId:se.value.id};0==(await g(e)).errorcode&&(uni.$u.toast("提交成功,感谢您的反馈"),W.value=!1)}z((e=>{e.wrong?async function(e){let l={carType:Y.carInfo.carType,chapter:Y.carInfo.chapter,isHigh:"",stepType:Y.carInfo.stepType,type:e};await a(l)}(e.wrong):async function(){try{l({title:"正在加载..."});let e={carType:Y.carInfo.carType,stepType:Y.carInfo.stepType,volume:Y.carInfo.volume,types:Y.carInfo.types,sift:Y.carInfo.sift,contentType:Y.carInfo.contentType,knowType:Y.carInfo.knowType,chapter:Y.carInfo.chapter,city:Y.carInfo.city};const{data:a}=await s(e);t(),se.value=a.questionBank,oe(),te.value=a.quesIdList,ue.value=te.value.findIndex((e=>e==se.value.id))}catch(e){t()}}()}));const se=e({});let te=e([]),ue=e(0);function oe(){se.value.optionArr=[];["a","b","c","d","e","f"].forEach(((e,a)=>{let l="option"+e;if(se.value[l]){let s={key:e.toLocaleUpperCase(),text:se.value[l],index:a+1};se.value.optionArr.push(s)}})),3==se.value.types&&(se.value.optionArr[0].key="true",se.value.optionArr[1].key="false")}async function ne(e){if(2==se.value.types&&ie.value.ans&&(ie.value.answer||(ie.value.answer=ie.value.ans,await re()),se.value.answer!=ie.value.ans&&"next"!=ie.value.isNext))return ie.value.isNext="next",!1;ie.value={},ue.value=ue.value+e,se.value.optionArr=[],ce()}async function ce(){console.log(ue.value);let e=te.value[ue.value],a={carType:Y.carInfo.carType,questionId:e,sort:ue.value,stepType:Y.carInfo.stepType,tempId:se.value.questionDoTemp.id};const{data:l}=await h(a);se.value=l,ie.value.isNext="",oe()}const ie=e({});async function re(){let e={answer:ie.value.answer,carType:Y.carInfo.carType,questionId:se.value.id,result:ie.value.answer==se.value.answer?"0":"1",stepType:Y.carInfo.stepType,tempId:se.value.questionDoTemp.id};await I(e),ie.value.answer==se.value.answer?(console.log("答对了"),ie.value={},se.value.optionArr=[],O.value++,Z.lookList(se.value.id),console.log(Z.wrongList),ne(1)):(X.value++,Z.setList(se.value.id),console.log(Z.wrongList))}async function fe(){let e=1==se.value.isCollect?"0":"1";const a={carType:Y.carInfo.carType,isAdd:e,questionId:se.value.id,stepType:Y.carInfo.stepType};await b(a),se.value.isCollect=e,console.log(se.value.isCollect)}return(e,a)=>{const l=c,s=L(u("up-navbar"),q),t=T,x=C,g=L(u("up-icon"),B),h=j,I=L(u("up-popup"),N),b=L(u("up-textarea"),S),z=L(u("up-button"),U);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=>G(1))},{default:n((()=>[d("答题模式")])),_:1},8,["class"]),r(l,{class:f(["btn",{active:2==H.value}]),onClick:a[1]||(a[1]=e=>G(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==se.value.types,blue:3==se.value.types}])},{default:n((()=>[d(v(M.value[se.value.types-1]),1)])),_:1},8,["class"]),r(t,{class:"h1",onClick:a[2]||(a[2]=e=>function(e){const a=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(a)}(se.value.title))},{default:n((()=>[d(v(se.value.title),1)])),_:1})])),_:1}),se.value.img?(i(),o(l,{key:0,class:"imgBox",style:{width:"100%",padding:"0 0 30rpx 0"}},{default:n((()=>[r(x,{src:se.value.img,mode:"widthFix"},null,8,["src"])])),_:1})):p("",!0),r(l,{class:"option"},{default:n((()=>[(i(!0),y(m,null,_(se.value.optionArr,((e,a)=>(i(),o(l,{onClick:a=>async function(e){if(!ie.value.answer)if(2!=se.value.types)e.answer=e.key,ie.value=e,re();else if(2==se.value.types){if(ie.value.ans||(ie.value.ans=""),ie.value.ans.includes(e.key))return void(ie.value.ans=ie.value.ans.replace(e.key,""));ie.value.ans=(ie.value.ans+e.key).split("").sort().join("")}}(e)},{default:n((()=>[2!=se.value.types||ie.value.answer&&ie.value.answer!=se.value.answer?(i(),o(l,{key:1,class:"optionItem flex"},{default:n((()=>[ie.value.key||2==se.value.types?se.value.answer.includes(e.key)?(i(),o(g,{key:1,name:"checkmark-circle-fill",color:"#55ff7f",size:"20"})):(i(),o(g,{key:2,name:"close-circle-fill",color:"#ff0000",size:"20"})):(i(),o(l,{key:0,class:"icon"})),r(l,{class:"text"},{default:n((()=>[3!=se.value.types?(i(),o(t,{key:0},{default:n((()=>[d(v(e.key),1)])),_:2},1024)):p("",!0),d(" "+v(e.text),1)])),_:2},1024)])),_:2},1024)):(i(),o(l,{key:0,class:"optionItem flex"},{default:n((()=>{var a;return[(null==(a=ie.value.ans)?void 0:a.includes(e.key))?(i(),o(g,{key:0,name:"checkmark-circle-fill",color:"#55ff7f",size:"20"})):(i(),o(l,{key:1,class:"icon"})),r(l,{class:"text"},{default:n((()=>[r(t,null,{default:n((()=>[d(v(e.key),1)])),_:2},1024),d(" "+v(e.text),1)])),_:2},1024)]})),_:2},1024))])),_:2},1032,["onClick"])))),256))])),_:1}),ie.value.answer&&se.value.answer!=ie.value.answer?(i(),o(l,{key:1,class:"answerCss flex"},{default:n((()=>[r(l,{class:"ans"},{default:n((()=>[d("正确答案是 "),3==se.value.types?(i(),o(t,{key:0},{default:n((()=>[d(v("false"==se.value.answer?"错误":"正确"),1)])),_:1})):(i(),o(t,{key:1},{default:n((()=>[d(v(se.value.answer),1)])),_:1}))])),_:1}),r(l,{class:"ans"},{default:n((()=>[d("您的答案是 "),3==se.value.types?(i(),o(t,{key:0,class:"red"},{default:n((()=>[d(v("false"==ie.value.answer?"错误":"正确"),1)])),_:1})):(i(),o(t,{key:1,class:"red"},{default:n((()=>[d(v(ie.value.answer),1)])),_:1}))])),_:1})])),_:1})):p("",!0),r(l,{class:"btn_row flex-b"},{default:n((()=>[r(h,{class:f(["btn border",{disable:0==k(ue)}]),onClick:a[3]||(a[3]=e=>k(A)(ne(-1),500)),disabled:0==k(ue)},{default:n((()=>[d("上一题")])),_:1},8,["class","disabled"]),r(h,{class:f(["btn bg",{disable:k(ue)>=k(te).length-1}]),onClick:a[4]||(a[4]=e=>k(A)(ne(1),500)),disabled:k(ue)>=k(te).length-1},{default:n((()=>[d("下一题")])),_:1},8,["class","disabled"])])),_:1}),2==H.value||ie.value.answer&&ie.value.answer!=se.value.answer?(i(),o(l,{key:2,class:"analysis"},{default:n((()=>[r(l,{class:"tit"},{default:n((()=>[d("题目解析")])),_:1}),r(l,{class:"txt"},{default:n((()=>[d(v(se.value.resolving),1)])),_:1})])),_:1})):p("",!0)])),_:1}),r(l,{class:"bottomBar"},{default:n((()=>[r(l,{class:"ul"},{default:n((()=>[r(l,{class:"li"},{default:n((()=>[r(l,{class:"icon",style:{color:"#55ff7f"}},{default:n((()=>[d(v(O.value),1)])),_:1}),r(l,{class:"text"},{default:n((()=>[d("答对")])),_:1})])),_:1}),r(l,{class:"li"},{default:n((()=>[r(l,{class:"icon",style:{color:"#ff0000"}},{default:n((()=>[d(v(X.value),1)])),_:1}),r(l,{class:"text"},{default:n((()=>[d("答错")])),_:1})])),_:1}),r(l,{class:"li"},{default:n((()=>[r(l,{class:"icon"},{default:n((()=>[d(v(k(ue)+1)+"/",1),r(t,{style:{color:"#999","font-size":"24rpx"}},{default:n((()=>[d(v(k(te).length),1)])),_:1})])),_:1}),r(l,{class:"text"},{default:n((()=>[d("题目")])),_:1})])),_:1}),r(l,{class:"li",onClick:a[5]||(a[5]=e=>w(W)?W.value=!0:W=!0)},{default:n((()=>[r(l,{class:"icon"},{default:n((()=>[r(x,{src:V,mode:""})])),_:1}),r(l,{class:"text"},{default:n((()=>[d("反馈")])),_:1})])),_:1}),r(l,{class:"li",onClick:P},{default:n((()=>[r(l,{class:"icon"},{default:n((()=>[r(x,{src:$,mode:""})])),_:1}),r(l,{class:"text"},{default:n((()=>[d("答题卡")])),_:1})])),_:1}),r(l,{class:"li",onClick:fe},{default:n((()=>[r(l,{class:"icon"},{default:n((()=>["1"==se.value.isCollect?(i(),o(x,{key:0,src:D,mode:""})):(i(),o(x,{key:1,src:F,mode:""}))])),_:1}),r(l,{class:"text"},{default:n((()=>[d("收藏")])),_:1})])),_:1})])),_:1})])),_:1}),r(I,{show:J.value,onClose:K,onOpen:P,mode:"bottom",round:"20",closeable:""},{default:n((()=>[r(l,{class:"popupCon"},{default:n((()=>[r(l,{class:"h3"},{default:n((()=>[d("答题卡")])),_:1}),r(l,{class:"ulRow"},{default:n((()=>[r(l,{class:"ul"},{default:n((()=>[r(l,{class:"li"},{default:n((()=>[r(l,{class:"icon",style:{color:"#55ff7f"}},{default:n((()=>[d(v(O.value),1)])),_:1}),r(l,{class:"text"},{default:n((()=>[d("答对")])),_:1})])),_:1}),r(l,{class:"li"},{default:n((()=>[r(l,{class:"icon",style:{color:"#ff0000"}},{default:n((()=>[d(v(X.value),1)])),_:1}),r(l,{class:"text"},{default:n((()=>[d("答错")])),_:1})])),_:1}),r(l,{class:"li",style:{"margin-left":"auto"}},{default:n((()=>[r(l,{class:"icon"},{default:n((()=>[d(v(k(ue)+1)+"/",1),r(t,{style:{color:"#999","font-size":"24rpx"}},{default:n((()=>[d(v(k(te).length),1)])),_:1})])),_:1}),r(l,{class:"text"},{default:n((()=>[d("题目")])),_:1})])),_:1})])),_:1})])),_:1}),r(l,{class:"ul2"},{default:n((()=>[(i(!0),y(m,null,_(k(te),((e,a)=>(i(),o(l,{class:"li2",key:a,onClick:e=>async function(e,a){ie.value={},ue.value=a,se.value.optionArr=[],ce(),J.value=!1}(0,a)},{default:n((()=>[r(l,{class:f(["num",{active:a==k(ue)}])},{default:n((()=>[d(v(a+1),1)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})])),_:1},8,["show"]),r(I,{show:k(W),onClose:ae,mode:"bottom",round:"20rpx",closeable:""},{default:n((()=>[r(l,{class:"commtCon",style:{padding:"30rpx"}},{default:n((()=>[r(b,{modelValue:k(ee),"onUpdate:modelValue":a[6]||(a[6]=e=>w(ee)?ee.value=e:ee=e),modelModifiers:{trim:!0},placeholder:"请输入反馈内容",style:{"margin-top":"50rpx"},maxlength:"300"},null,8,["modelValue"]),r(z,{text:"提 交",style:{"margin-top":"20rpx"},type:"primary",onClick:le})])),_:1})])),_:1},8,["show"])])),_:1})}}},[["__scopeId","data-v-70e30afb"]]);export{H as default};