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

1 week ago
  1. 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,bl