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 line
10 KiB

5 days ago
  1. 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