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.
 
 
 

1 lines
10 KiB

import{r as e,_ as a,y as l,b as s,c as t,w as u,i as n,o,d as c,k as i,e as r,t as f,m as d,f as v,g as p,F as _,u as y,C as m,a2 as k,a5 as w,j as x,v as g,a6 as h,a7 as b}from"./index-IX2tYR8R.js";import{_ as C}from"./u-navbar.BTvKBpLV.js";import{o as j,r as T}from"./uni-app.es.Bc5t55A8.js";import{_ as I}from"./u-icon.sW6sruaF.js";import{_ as A}from"./u-popup.CPuol-R0.js";import{_ as z,a as $,b as q,c as B,d as F,e as H}from"./sc.fc7k8zE2.js";import{q as N}from"./wrongQuestionBook.Beoh-3Vq.js";import{c as O}from"./car.C_k88K1b.js";import{_ as S}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.weuqoXTS.js";import"./u-loading-icon.pEvsKDSP.js";const U=S({__name:"wrongQuestions",setup(S){let U=N();const V=e("1"),Q=e(["单选题","多选题","判断题"]),W=e(0),E=e(0);let L=O();function M(e){console.log(window),V.value!=e&&(V.value=e)}const R=e(!1);function D(){R.value=!1}function G(){R.value=!0}let J=e(!1),K=e("");function P(){J.value=!1,K.value=""}async function X(){if(!K.value)return uni.$u.toast("请输入内容");let e={content:K.value,questionId:Z.value.id};0==(await k(e)).errorcode&&(uni.$u.toast("提交成功,感谢您的反馈"),J.value=!1)}let Y=e(1);j((e=>{let s=e.isHigh?e.isHigh:"";e.wrong&&(Y.value=e.wrong,async function(e,s){let t={carType:L.carInfo.carType,chapter:L.carInfo.chapter,isHigh:s,stepType:L.carInfo.stepType,type:e};const{data:u}=await a(t);if(!u.length)return uni.$u.toast("暂无错题"),void setTimeout((()=>l()),1500);Z.value=u[0],ee.value=u,le()}(e.wrong,s))}));const Z=e({});let ee=e([]),ae=e(0);function le(){Z.value.optionArr=[];["a","b","c","d","e","f"].forEach(((e,a)=>{let l="option"+e;if(Z.value[l]){let s={key:e.toLocaleUpperCase(),text:Z.value[l],index:a+1};Z.value.optionArr.push(s)}})),3==Z.value.types&&(Z.value.optionArr[0].key="true",Z.value.optionArr[1].key="false")}async function se(e){if(2==Z.value.types&&ue.value.ans){if(ue.value.answer||(ue.value.answer=ue.value.ans),Z.value.answer!=ue.value.ans&&"next"!=ue.value.isNext)return ue.value.isNext="next",E.value++,!1;if(ue.value.answer==Z.value.answer&&(W.value++,1==Y.value&&U.deleteWrongOrColFn(Z.value.id).then((()=>{ee.value.splice(ae.value,1),ae.value>=ee.value.length-1&&(ae.value=0),0!=e&&(te(),uni.$u.toast("题目已删除"))})),0==e))return}ue.value={},ae.value=ae.value+e,te()}async function te(){if(!ee.value.length)return uni.$u.toast("已全部刷完"),void setTimeout((()=>{l()}),1500);Z.value=ee.value[ae.value],ue.value={},ue.value.isNext="",le()}const ue=e({});async function ne(){let e=1==Z.value.isCollect?"0":"1";const a={carType:L.carInfo.carType,isAdd:e,questionId:Z.value.id,stepType:L.carInfo.stepType};await w(a),Z.value.isCollect=e,console.log(Z.value.isCollect)}return(e,a)=>{const l=n,k=T(s("up-navbar"),C),w=x,j=g,N=T(s("up-icon"),I),O=h,S=T(s("up-popup"),A),L=T(s("up-textarea"),z),le=T(s("up-button"),$);return o(),t(l,{class:"content"},{default:u((()=>[c(k,{leftText:" ",title:"",safeAreaInsetTop:!1,autoBack:!0},{center:u((()=>[c(l,{class:"u-nav-slot flex"},{default:u((()=>[c(l,{class:i(["btn",{active:1==V.value}]),onClick:a[0]||(a[0]=e=>M(1))},{default:u((()=>[r("答题模式")])),_:1},8,["class"]),c(l,{class:i(["btn",{active:2==V.value}]),onClick:a[1]||(a[1]=e=>M(2))},{default:u((()=>[r("背题模式")])),_:1},8,["class"])])),_:1})])),_:1}),c(l,{class:"con padding"},{default:u((()=>[c(l,{class:"h1_row"},{default:u((()=>[c(w,{class:i(["tag",{red:2==Z.value.types,blue:3==Z.value.types}])},{default:u((()=>[r(f(Q.value[Z.value.types-1]),1)])),_:1},8,["class"]),c(w,{class:"h1",onClick:a[2]||(a[2]=e=>function(e){const a=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(a)}(Z.value.title))},{default:u((()=>[r(f(Z.value.title),1)])),_:1})])),_:1}),Z.value.img?(o(),t(l,{key:0,class:"imgBox",style:{width:"100%",padding:"0 0 30rpx 0"}},{default:u((()=>[c(j,{src:Z.value.img,mode:"widthFix"},null,8,["src"])])),_:1})):d("",!0),c(l,{class:"option"},{default:u((()=>[(o(!0),v(_,null,p(Z.value.optionArr,((e,a)=>(o(),t(l,{onClick:a=>async function(e){if(!ue.value.answer)if(2!=Z.value.types)e.answer=e.key,ue.value=e,ue.value.answer==Z.value.answer?(W.value++,1==Y.value&&U.deleteWrongOrColFn(Z.value.id).then((()=>{ee.value.splice(ae.value,1),ae.value>=ee.value.length-1&&(ae.value=0),te(),uni.$u.toast("题目已删除")}))):E.value++;else if(2==Z.value.types){if(ue.value.ans||(ue.value.ans=""),ue.value.ans.includes(e.key))return void(ue.value.ans=ue.value.ans.replace(e.key,""));ue.value.ans=(ue.value.ans+e.key).split("").sort().join("")}}(e)},{default:u((()=>[2!=Z.value.types||ue.value.answer&&ue.value.answer!=Z.value.answer?(o(),t(l,{key:1,class:"optionItem flex"},{default:u((()=>[ue.value.key||2==Z.value.types?Z.value.answer.includes(e.key)?(o(),t(N,{key:1,name:"checkmark-circle-fill",color:"#55ff7f",size:"20"})):(o(),t(N,{key:2,name:"close-circle-fill",color:"#ff0000",size:"20"})):(o(),t(l,{key:0,class:"icon"})),c(l,{class:"text"},{default:u((()=>[3!=Z.value.types?(o(),t(w,{key:0},{default:u((()=>[r(f(e.key),1)])),_:2},1024)):d("",!0),r(" "+f(e.text),1)])),_:2},1024)])),_:2},1024)):(o(),t(l,{key:0,class:"optionItem flex"},{default:u((()=>{var a;return[(null==(a=ue.value.ans)?void 0:a.includes(e.key))?(o(),t(N,{key:0,name:"checkmark-circle-fill",color:"#55ff7f",size:"20"})):(o(),t(l,{key:1,class:"icon"})),c(l,{class:"text"},{default:u((()=>[c(w,null,{default:u((()=>[r(f(e.key),1)])),_:2},1024),r(" "+f(e.text),1)])),_:2},1024)]})),_:2},1024))])),_:2},1032,["onClick"])))),256))])),_:1}),ue.value.answer&&Z.value.answer!=ue.value.answer?(o(),t(l,{key:1,class:"answerCss flex"},{default:u((()=>[c(l,{class:"ans"},{default:u((()=>[r("正确答案是 "),3==Z.value.types?(o(),t(w,{key:0},{default:u((()=>[r(f("false"==Z.value.answer?"错误":"正确"),1)])),_:1})):(o(),t(w,{key:1},{default:u((()=>[r(f(Z.value.answer),1)])),_:1}))])),_:1}),c(l,{class:"ans"},{default:u((()=>[r("您的答案是 "),3==Z.value.types?(o(),t(w,{key:0,class:"red"},{default:u((()=>[r(f("false"==ue.value.answer?"错误":"正确"),1)])),_:1})):(o(),t(w,{key:1,class:"red"},{default:u((()=>[r(f(ue.value.answer),1)])),_:1}))])),_:1})])),_:1})):d("",!0),c(l,{class:"btn_row flex-b"},{default:u((()=>[c(O,{class:i(["btn border",{disable:0==y(ae)}]),onClick:a[3]||(a[3]=e=>y(b)(se(-1),500)),disabled:0==y(ae)},{default:u((()=>[r("上一题")])),_:1},8,["class","disabled"]),y(ae)==y(ee).length-1?(o(),t(O,{key:0,class:i(["btn bg",{disable:ue.value.answer}]),onClick:a[4]||(a[4]=e=>y(b)(se(0),500)),disabled:ue.value.answer},{default:u((()=>[r("提交最后一题")])),_:1},8,["class","disabled"])):(o(),t(O,{key:1,class:i(["btn bg",{disable:y(ae)>=y(ee).length-1}]),onClick:a[5]||(a[5]=e=>y(b)(se(1),500)),disabled:y(ae)>=y(ee).length-1},{default:u((()=>[r("下一题")])),_:1},8,["class","disabled"]))])),_:1}),2==V.value||ue.value.answer&&ue.value.answer!=Z.value.answer?(o(),t(l,{key:2,class:"analysis"},{default:u((()=>[c(l,{class:"tit"},{default:u((()=>[r("题目解析")])),_:1}),c(l,{class:"txt"},{default:u((()=>[r(f(Z.value.resolving),1)])),_:1})])),_:1})):d("",!0)])),_:1}),c(l,{class:"bottomBar"},{default:u((()=>[c(l,{class:"ul"},{default:u((()=>[c(l,{class:"li"},{default:u((()=>[c(l,{class:"icon",style:{color:"#55ff7f"}},{default:u((()=>[r(f(W.value),1)])),_:1}),c(l,{class:"text"},{default:u((()=>[r("答对")])),_:1})])),_:1}),c(l,{class:"li"},{default:u((()=>[c(l,{class:"icon",style:{color:"#ff0000"}},{default:u((()=>[r(f(E.value),1)])),_:1}),c(l,{class:"text"},{default:u((()=>[r("答错")])),_:1})])),_:1}),c(l,{class:"li"},{default:u((()=>[c(l,{class:"icon"},{default:u((()=>[r(f(y(ae)+1)+"/",1),c(w,{style:{color:"#999","font-size":"24rpx"}},{default:u((()=>[r(f(y(ee).length),1)])),_:1})])),_:1}),c(l,{class:"text"},{default:u((()=>[r("题目")])),_:1})])),_:1}),c(l,{class:"li",onClick:a[6]||(a[6]=e=>m(J)?J.value=!0:J=!0)},{default:u((()=>[c(l,{class:"icon"},{default:u((()=>[c(j,{src:q,mode:""})])),_:1}),c(l,{class:"text"},{default:u((()=>[r("反馈")])),_:1})])),_:1}),c(l,{class:"li",onClick:G},{default:u((()=>[c(l,{class:"icon"},{default:u((()=>[c(j,{src:B,mode:""})])),_:1}),c(l,{class:"text"},{default:u((()=>[r("答题卡")])),_:1})])),_:1}),c(l,{class:"li",onClick:ne},{default:u((()=>[c(l,{class:"icon"},{default:u((()=>["1"==Z.value.isCollect?(o(),t(j,{key:0,src:F,mode:""})):(o(),t(j,{key:1,src:H,mode:""}))])),_:1}),c(l,{class:"text"},{default:u((()=>[r("收藏")])),_:1})])),_:1})])),_:1})])),_:1}),c(S,{show:R.value,onClose:D,onOpen:G,mode:"bottom",round:"20",closeable:""},{default:u((()=>[c(l,{class:"popupCon"},{default:u((()=>[c(l,{class:"h3"},{default:u((()=>[r("答题卡")])),_:1}),c(l,{class:"ulRow"},{default:u((()=>[c(l,{class:"ul"},{default:u((()=>[c(l,{class:"li"},{default:u((()=>[c(l,{class:"icon",style:{color:"#55ff7f"}},{default:u((()=>[r(f(W.value),1)])),_:1}),c(l,{class:"text"},{default:u((()=>[r("答对")])),_:1})])),_:1}),c(l,{class:"li"},{default:u((()=>[c(l,{class:"icon",style:{color:"#ff0000"}},{default:u((()=>[r(f(E.value),1)])),_:1}),c(l,{class:"text"},{default:u((()=>[r("答错")])),_:1})])),_:1}),c(l,{class:"li",style:{"margin-left":"auto"}},{default:u((()=>[c(l,{class:"icon"},{default:u((()=>[r(f(y(ae)+1)+"/",1),c(w,{style:{color:"#999","font-size":"24rpx"}},{default:u((()=>[r(f(y(ee).length),1)])),_:1})])),_:1}),c(l,{class:"text"},{default:u((()=>[r("题目")])),_:1})])),_:1})])),_:1})])),_:1}),c(l,{class:"ul2"},{default:u((()=>[(o(!0),v(_,null,p(y(ee),((e,a)=>(o(),t(l,{class:"li2",key:a,onClick:e=>async function(e,a){ue.value={},ae.value=a,te(),R.value=!1}(0,a)},{default:u((()=>[c(l,{class:i(["num",{active:a==y(ae)}])},{default:u((()=>[r(f(a+1),1)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})])),_:1},8,["show"]),c(S,{show:y(J),onClose:P,mode:"bottom",round:"20rpx",closeable:""},{default:u((()=>[c(l,{class:"commtCon",style:{padding:"30rpx"}},{default:u((()=>[c(L,{modelValue:y(K),"onUpdate:modelValue":a[7]||(a[7]=e=>m(K)?K.value=e:K=e),modelModifiers:{trim:!0},placeholder:"请输入反馈内容",style:{"margin-top":"50rpx"},maxlength:"300"},null,8,["modelValue"]),c(le,{text:"提 交",style:{"margin-top":"20rpx"},type:"primary",onClick:X})])),_:1})])),_:1},8,["show"])])),_:1})}}},[["__scopeId","data-v-10a6ed04"]]);export{U as default};