exam.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <template>
  2. <view class="phone-kaoshi-page">
  3. <!-- 导航区域 -->
  4. <customNavbarVue :title="data.ksName" :show-back-btn="true" @back="handleBack"></customNavbarVue>
  5. <!-- 第一行 -->
  6. <view class="kaoshi-page-title">
  7. <view v-if="activeSt" class="title-types">{{dlName}}</view>
  8. <!-- 倒计时 -->
  9. <view v-if="!!data.endSecond">
  10. <uni-countdown :show-day="false" :showHour="true" :showMinute="true" :second="data.endSecond"
  11. @timeup="onTimeUp" :start="startCountDown"></uni-countdown>
  12. </view>
  13. </view>
  14. <view class="kaoshi-shiti-content">
  15. <!-- 内容区域 -->
  16. <!-- 试题区域 -->
  17. <view v-if="activeSt">
  18. <template v-if="activeSt.stTypeId == 1">
  19. <!-- 单选 -->
  20. <danxuan :question="activeSt" :key="activeSt.stId"></danxuan>
  21. </template>
  22. <template v-if="activeSt.stTypeId == 2">
  23. <!-- 多选 -->
  24. <duoxuan :question="activeSt" :key="activeSt.stId"></duoxuan>
  25. </template>
  26. <template v-if="activeSt.stTypeId == 3">
  27. <!-- 判断 -->
  28. <panduan :question="activeSt" :key="activeSt.stId"></panduan>
  29. </template>
  30. <template v-if="activeSt.stTypeId == 4">
  31. <!-- 填空 -->
  32. <tiankong :question="activeSt" :key="activeSt.stId"></tiankong>
  33. </template>
  34. </view>
  35. </view>
  36. <view class="kaoshi-bottom-box">
  37. <button class="phone-green-btn bj-btn" hover-class="none" type="default" size="mini"
  38. @click="handleBiaoji">{{activeSt && activeSt.marked ? '取标':'标记'}}</button>
  39. <view @click="showAnswerCard" class="shiti-num-box">
  40. <icon class="shiti-num-icon" :style="{ backgroundImage: 'url(' + data.imgsArr.shitiNumIcon + ')' }">
  41. </icon>
  42. <text
  43. class="active-num">{{activeSt ? activeSt.onlyNum: 0}}</text>/<text>{{data.StListForSearch.length}}</text>
  44. </view>
  45. <button class="phone-green-btn save-btn" hover-class="none" type="default" size="mini"
  46. @click="handleSave(true)">保存</button>
  47. </view>
  48. <template v-if="activeSt">
  49. <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-prev"
  50. @click="handlePrev" v-if="!isFistStId">上一题</button>
  51. <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
  52. @click="handleNext" v-if="!isLastStId">下一题</button>
  53. <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
  54. @click="handleJiaojuan" v-if="isLastStId">交卷</button>
  55. </template>
  56. <!-- 答题卡 -->
  57. <uni-popup ref="popupRef" background-color="#fff" :animation="false" :is-mask-click="false" :mask-click="false">
  58. <view class="answer-card-popup">
  59. <customNavbarVue title="答题卡" :show-back-btn="true" @back="handlePopupBack"></customNavbarVue>
  60. <view class="card-content-box">
  61. <view class="answer-card-content" v-for="(paragraph,paragraphIndex) in questionData"
  62. :key="paragraphIndex">
  63. <view class="paragraph-title">
  64. {{paragraph.name}}
  65. </view>
  66. <view class="paragraph-qa" v-for="(qa,qaIndex) in paragraph.qas" :key="qaIndex"
  67. :class="getQaClass(qa)" @click="answerCardItemClick(qa)">{{qa.onlyNum}}
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </uni-popup>
  73. <!-- 摄像头 -->
  74. <template v-if="data.zhuapai && data.zhuapai > 0">
  75. <!-- 抓拍 -->
  76. <zhuapaiVue ref="zhuapaiRef" @error="zpError" @success="zpSuccess" key="2" @progress="onProgress">
  77. </zhuapaiVue>
  78. </template>
  79. <!-- 交卷确认 -->
  80. <answerQueren ref="answerQrRef" @confirm="handleQuerenConfirm"></answerQueren>
  81. <!-- 考试得分 -->
  82. <submitScoreVue ref="subScoreRef" @confirm="handleScoreConfirm" @close="handleScoreClose"></submitScoreVue>
  83. <!-- 切屏确认弹窗 -->
  84. <qiepingDlVue ref="qiepingDlRef" :content="messageContent" title="注意" okBtn="知道了"></qiepingDlVue>
  85. </view>
  86. </template>
  87. <script setup>
  88. import cacheManager from '@/utils/cacheManager.js';
  89. import {
  90. ref,
  91. reactive,
  92. computed,
  93. watch,
  94. nextTick
  95. } from "vue";
  96. import zhuapaiVue from "@/components/zhuapaiConfirm/zhuapai.vue";
  97. import zhuapaiConfirm from "@/components/zhuapaiConfirm/index.vue";
  98. import answerQueren from "@/components/zhuapaiConfirm/answerQueren.vue";
  99. import submitScoreVue from "@/components/zhuapaiConfirm/submitScore.vue";
  100. import customNavbarVue from "@/components/custom-navbar/custom-navbar.vue";
  101. import {
  102. onLoad,
  103. onShow,
  104. onHide
  105. } from "@dcloudio/uni-app";
  106. import * as ksApi from "@/api/kaoshi.js"
  107. import danxuan from "@/components/questions/danxuan.vue";
  108. import duoxuan from "@/components/questions/duoxuan.vue";
  109. import tiankong from "@/components/questions/tiankong.vue";
  110. import panduan from "@/components/questions/panduan.vue";
  111. import {
  112. useQuestionTools
  113. } from "@/components/questions/useQuestionTools.js";
  114. import {
  115. useKaoShiCache
  116. } from "./examTools"
  117. import qiepingDlVue from "@/components/dialog/qiepingDl.vue";
  118. import {
  119. useQiePing
  120. } from "@/utils/useQieping.js"
  121. const {
  122. checkDanxuanReply,
  123. checkDuoxuanReply,
  124. checkPanduanReply,
  125. checkTiankongReply,
  126. getLetterByIndex
  127. } = useQuestionTools();
  128. const {
  129. saveCacheKs,
  130. getCacheKs,
  131. removeCacheKs
  132. } = useKaoShiCache();
  133. const {
  134. init: qiepingInit
  135. } = useQiePing();
  136. function debounce(func, wait) {
  137. let timeout;
  138. return function (...args) {
  139. const context = this;
  140. clearTimeout(timeout);
  141. timeout = setTimeout(() => {
  142. func.apply(context, args);
  143. }, wait);
  144. };
  145. }
  146. const handleBack = debounce(() => {
  147. console.log('back')
  148. const pages = getCurrentPages();
  149. if (pages.length > 1) {
  150. uni.navigateBack()
  151. } else {
  152. history.back();
  153. }
  154. },1000)
  155. onLoad((option) => {
  156. data.ksId = option.ksId;
  157. data.zhuapai = option.zhuapai;
  158. data.userKaozhengId = option.userKaozhengId;
  159. data.from = option.from;
  160. data.imgsArr.shitiNumIcon = cacheManager.get('projectImg').shiti_num_icon;
  161. setTimeout(() => {
  162. initKaoshi();
  163. }, 1000)
  164. /* if (data.zhuapai && data.zhuapai != 0) {
  165. // 考试前确认摄像头
  166. nextTick(() => {
  167. initBeforKaoshi();
  168. })
  169. } else {
  170. initKaoshi();
  171. } */
  172. })
  173. const popupRef = ref(null)
  174. const zhuapaiRef = ref(null)
  175. const qiepingRef = ref(null)
  176. const zhuapaiConfirmRef = ref(null)
  177. const answerQrRef = ref(null);
  178. const startCountDown = ref(false);
  179. const subScoreRef = ref(null);
  180. const messageContent = ref('');
  181. const qiepingDlRef = ref(null);
  182. const timer1 = ref(null);
  183. const data = reactive({
  184. ksId: null,
  185. operId: null,
  186. ksName: '',
  187. stTotal: 0,
  188. stScore: 0,
  189. biaoji: {},
  190. endSecond: 0,
  191. pageSize: 0,
  192. toggleScreenFlag: 0,
  193. toggleScreenSecond: 0,
  194. zhuapai: 0,
  195. duanluo: [],
  196. StListForSearch: [],
  197. from: '',
  198. hisId: '',
  199. userKaozhengId: '',
  200. imgsArr: {
  201. shitiNumIcon: '',
  202. },
  203. })
  204. const markDB = ref([]);
  205. const questionData = ref([]);
  206. const progress = reactive({
  207. dlIndex: 0,
  208. dtIndex: 0
  209. })
  210. const dlName = computed(() => {
  211. if (data.StListForSearch && activeSt.value) {
  212. return data.StListForSearch[activeSt.value.onlyNum - 1].paragraphName
  213. } else {
  214. return ''
  215. }
  216. })
  217. watch(() => data.duanluo, (newVal) => {
  218. // 计算已答试题数量
  219. }, {
  220. deep: true
  221. })
  222. const activeSt = computed(() => {
  223. if (questionData.value.length) {
  224. return questionData.value.length && questionData.value[progress.dlIndex].qas[progress.dtIndex];
  225. } else {
  226. return null
  227. }
  228. })
  229. const isFistStId = computed(() => {
  230. if (data.StListForSearch.length) {
  231. return data.StListForSearch[0].stId == activeSt.value.stId
  232. } else {
  233. return false
  234. }
  235. });
  236. const isLastStId = computed(() => {
  237. if (data.StListForSearch.length) {
  238. return data.StListForSearch[data.StListForSearch.length - 1].stId == activeSt.value.stId
  239. } else {
  240. return false
  241. }
  242. });
  243. function handleScoreClose() {
  244. handleBack()
  245. }
  246. // 考试得分相关 start
  247. function handleScoreConfirm() {
  248. uni.redirectTo({
  249. url: `/pages/client/Chengji/ksScoreShijuan?hisId=${data.hisId}&from=kaoshi`
  250. })
  251. }
  252. // 考试得分相关 end
  253. // 保存相关
  254. function handleSave(showToast) {
  255. if (timer1.value) {
  256. uni.showToast({
  257. title: '请勿连续保存',
  258. icon: 'none'
  259. })
  260. return
  261. }
  262. timer1.value = setTimeout(() => {
  263. clearTimeout(timer1.value);
  264. }, 10 * 1000);
  265. console.log(questionData.value)
  266. const result = []
  267. const option = {
  268. force: false,
  269. operId: data.operId,
  270. replyList: []
  271. }
  272. questionData.value.forEach(dl => {
  273. dl.qas.forEach(st => {
  274. const opt = {
  275. stId: st.stId,
  276. reply: st.reply,
  277. }
  278. result.push(opt)
  279. option.replyList.push(opt)
  280. })
  281. })
  282. // 保存试题答案
  283. saveCacheKs(data.operId, {
  284. replyList: result,
  285. position: {
  286. dlIndex: progress.dlIndex,
  287. dtIndex: progress.dtIndex
  288. }
  289. })
  290. // 保存答题进度
  291. ksApi.getClientKsSave(option).then(res => {
  292. if (res.data && showToast) {
  293. uni.showToast({
  294. title: '保存成功',
  295. })
  296. }
  297. })
  298. }
  299. // 交卷相关功能 start
  300. function checkJiaojuan() {
  301. const result = []
  302. let count = 0;
  303. let total = 0;
  304. questionData.value.forEach(dl => {
  305. dl.qas.forEach(st => {
  306. const opt = {
  307. stId: st.stId,
  308. reply: st.reply,
  309. stTypeId: st.stTypeId
  310. }
  311. result.push(opt)
  312. })
  313. })
  314. result.forEach(item => {
  315. total++;
  316. if (item.stTypeId == 1 && !checkDanxuanReply(item)) {
  317. count++;
  318. }
  319. if (item.stTypeId == 2 && !checkDuoxuanReply(item)) {
  320. count++;
  321. }
  322. if (item.stTypeId == 3 && !checkPanduanReply(item)) {
  323. count++;
  324. }
  325. if (item.stTypeId == 4 && !checkTiankongReply(item)) {
  326. count++;
  327. }
  328. })
  329. return {
  330. total,
  331. count,
  332. }
  333. }
  334. function handleJiaojuan() {
  335. const result = checkJiaojuan()
  336. console.log(result)
  337. if (result.count) {
  338. // 提示
  339. answerQrRef.value.showDialog({
  340. answercartsCount: result.total - result.count,
  341. answercartsTotal: result.total,
  342. })
  343. } else {
  344. handleSubmit()
  345. }
  346. }
  347. function handleQuerenConfirm() {
  348. handleSubmit()
  349. }
  350. function handleSubmit(force = false) {
  351. const result = {
  352. force,
  353. operId: data.operId,
  354. replyList: []
  355. };
  356. console.log(questionData.value)
  357. // uni.showLoading({
  358. // title: '提交中'
  359. // })
  360. questionData.value.forEach(dl => {
  361. dl.qas.forEach(st => {
  362. const opt = {
  363. stId: st.stId,
  364. reply: st.reply
  365. }
  366. result.replyList.push(opt)
  367. })
  368. })
  369. ksApi.getClientKsSubmit(result).then(res => {
  370. if (res.code == 0) {
  371. subScoreRef.value.showDialog(res.data);
  372. data.hisId = res.data.hisId;
  373. // 清空缓存
  374. removeCacheKs(data.operId);
  375. }
  376. }).finally(err => {
  377. // uni.hideLoading()
  378. })
  379. }
  380. function onTimeUp() {
  381. handleSubmit();
  382. }
  383. // 交卷相关功能 end
  384. // 切屏功能 start
  385. function qiepingToast(count) {
  386. messageContent.value = `已离开${count}次。${data.toggleScreenFlag}次将自动交卷!`
  387. qiepingDlRef.value.handleShow()
  388. }
  389. function forceSubmit() {
  390. // 强制交卷
  391. console.log('强制交卷')
  392. handleSubmit(true)
  393. }
  394. function qpZhuapai() {
  395. // 重新开启抓拍
  396. zhuapaiRef.value && zhuapaiRef.value.showVideoBtn();
  397. }
  398. // 切屏功能 end
  399. // 摄像头抓拍相关功能 start
  400. function zpSuccess() {}
  401. function zpError() {
  402. uni.showToast({
  403. title: '抓拍图片异常',
  404. icon: 'none',
  405. duration: 3000,
  406. mask: true, // 防止触摸穿透
  407. complete: handleBack
  408. })
  409. }
  410. // 摄像头抓拍相关功能 end
  411. // 摄像头确认相关功能 start
  412. function onProgress() {
  413. uni.showToast({
  414. icon: 'none',
  415. title: '摄像头运行环境异常,请重新进入考试',
  416. duration: 3000,
  417. mask: true, // 防止触摸穿透
  418. complete: handleBack
  419. })
  420. }
  421. function zpConfirmSuccess() {
  422. initKaoshi();
  423. }
  424. function zpConfirmError() {
  425. handleBack()
  426. }
  427. function zpConfirmCancel() {
  428. handleBack()
  429. }
  430. // 摄像头确认相关功能 end
  431. function getQaClass(qa) {
  432. if (qa.marked && qa.marked === true) {
  433. return 'paragraph-qa-block-mark';
  434. } else {
  435. if (qa.stTypeId == 1) {
  436. if (checkDanxuanReply(qa)) {
  437. return 'paragraph-qa-block-done';
  438. } else {
  439. return 'paragraph-qa-block-init';
  440. }
  441. } else if (qa.stTypeId == 2) {
  442. if (checkDuoxuanReply(qa)) {
  443. return 'paragraph-qa-block-done';
  444. } else {
  445. return 'paragraph-qa-block-init';
  446. }
  447. } else if (qa.stTypeId == 3) {
  448. if (checkPanduanReply(qa)) {
  449. return 'paragraph-qa-block-done';
  450. } else {
  451. return 'paragraph-qa-block-init';
  452. }
  453. } else if (qa.stTypeId == 4) {
  454. if (checkTiankongReply(qa)) {
  455. return 'paragraph-qa-block-done';
  456. } else {
  457. return 'paragraph-qa-block-init';
  458. }
  459. }
  460. }
  461. }
  462. function skipQuestion(dlIndex, dtIndex) {
  463. progress.dlIndex = dlIndex;
  464. progress.dtIndex = dtIndex;
  465. handlePopupBack()
  466. }
  467. function answerCardItemClick(qa) {
  468. const actQa = data.StListForSearch.find(item => item.stId == qa.stId);
  469. skipQuestion(actQa.dlIndex, actQa.dtIndex)
  470. }
  471. /*function handleBack () {
  472. const pages = getCurrentPages();
  473. if (pages.length > 1) {
  474. uni.navigateBack()
  475. } else {
  476. history.back();
  477. }
  478. }*/
  479. function showAnswerCard() {
  480. popupRef.value.open('top')
  481. }
  482. function handlePopupBack() {
  483. popupRef.value && popupRef.value.close()
  484. }
  485. function handlePrev() {
  486. const qa = data.StListForSearch.find(item => item.stId == activeSt.value.stId);
  487. const index = qa.onlyNum - 1;
  488. if (index > 0) {
  489. const result = data.StListForSearch[index - 1];
  490. progress.dlIndex = result.dlIndex;
  491. progress.dtIndex = result.dtIndex
  492. }
  493. }
  494. function handleNext() {
  495. const qa = data.StListForSearch.find(item => item.stId == activeSt.value.stId);
  496. const index = qa.onlyNum - 1;
  497. if (index < data.StListForSearch.length) {
  498. const result = data.StListForSearch[index + 1];
  499. progress.dlIndex = result.dlIndex;
  500. progress.dtIndex = result.dtIndex
  501. }
  502. }
  503. function formatDuanluoList(dlData) {
  504. let uIndex = 0; // 试题onlyNum
  505. let iDuanluo = 0; // 段落onlyNum
  506. let result = [];
  507. for (const duanluo of data.duanluo) {
  508. let paragraph = {
  509. qas: [],
  510. };
  511. paragraph.name = duanluo.name;
  512. let iQa = 0; // 当前试题序号
  513. let order = 0; // 当前题型中第几题
  514. for (const iDanxuan of duanluo.danxuan) {
  515. iDanxuan.type = 'danxuan';
  516. iDanxuan.marked = data.biaoji[iDanxuan.stId] ? true : false;
  517. iDanxuan.onlyNum = uIndex + 1;
  518. iDanxuan.order = order;
  519. iDanxuan.iQa = iQa;
  520. paragraph.qas.push(iDanxuan);
  521. uIndex++;
  522. order++;
  523. iQa++;
  524. data.StListForSearch.push({
  525. stId: iDanxuan.stId,
  526. paragraphName: paragraph.name,
  527. dlIndex: iDuanluo,
  528. dtIndex: iDanxuan.iQa,
  529. onlyNum: iDanxuan.onlyNum
  530. })
  531. }
  532. order = 0;
  533. for (const iDuoxuan of duanluo.duoxuan) {
  534. iDuoxuan.type = 'duoxuan';
  535. iDuoxuan.marked = data.biaoji[iDuoxuan.stId] ? true : false;
  536. iDuoxuan.onlyNum = uIndex + 1;
  537. iDuoxuan.order = order;
  538. paragraph.qas.push(iDuoxuan);
  539. iDuoxuan.iQa = iQa;
  540. iDuoxuan.reply = [];
  541. uIndex++;
  542. order++;
  543. iQa++;
  544. data.StListForSearch.push({
  545. stId: iDuoxuan.stId,
  546. paragraphName: paragraph.name,
  547. dlIndex: iDuanluo,
  548. dtIndex: iDuoxuan.iQa,
  549. onlyNum: iDuoxuan.onlyNum
  550. })
  551. }
  552. order = 0;
  553. for (const iPanduan of duanluo.panduan) {
  554. iPanduan.type = 'panduan';
  555. iPanduan.marked = data.biaoji[iPanduan.stId] ? true : false;
  556. iPanduan.onlyNum = uIndex + 1;
  557. iPanduan.order = order;
  558. paragraph.qas.push(iPanduan);
  559. iPanduan.iQa = iQa;
  560. uIndex++;
  561. order++;
  562. iQa++;
  563. data.StListForSearch.push({
  564. stId: iPanduan.stId,
  565. paragraphName: paragraph.name,
  566. dlIndex: iDuanluo,
  567. dtIndex: iPanduan.iQa,
  568. onlyNum: iPanduan.onlyNum
  569. })
  570. }
  571. order = 0;
  572. for (const iTiankong of duanluo.tiankong) {
  573. iTiankong.type = 'tiankong';
  574. iTiankong.marked = data.biaoji[iTiankong.stId] ? true : false;
  575. iTiankong.onlyNum = uIndex + 1;
  576. iTiankong.order = order;
  577. paragraph.qas.push(iTiankong);
  578. iTiankong.iQa = iQa;
  579. iTiankong.reply = new Array(iTiankong.count).fill('');;
  580. uIndex++;
  581. order++;
  582. iQa++;
  583. data.StListForSearch.push({
  584. stId: iTiankong.stId,
  585. paragraphName: paragraph.name,
  586. dlIndex: iDuanluo,
  587. dtIndex: iTiankong.iQa,
  588. onlyNum: iTiankong.onlyNum
  589. })
  590. }
  591. iDuanluo++;
  592. questionData.value.push(paragraph)
  593. console.log('1', questionData.value)
  594. console.log('2', data.StListForSearch)
  595. }
  596. }
  597. function handleBiaoji() {
  598. activeSt.value.marked = !activeSt.value.marked;
  599. data.biaoji[activeSt.value.stId] = activeSt.value.marked
  600. ksApi.getClientKaoshiBiaoji({
  601. operId: data.operId,
  602. biaoji: JSON.stringify(data.biaoji)
  603. }).catch(err => {
  604. handleBack()
  605. })
  606. }
  607. function formatKaoshiData() {
  608. const historyData = getCacheKs(data.operId);
  609. if (historyData) {
  610. const {
  611. replyList,
  612. position
  613. } = historyData;
  614. if (replyList) {
  615. questionData.value.forEach(dl => {
  616. dl.qas.forEach(st => {
  617. st.reply = replyList.find(item => item.stId == st.stId).reply
  618. })
  619. })
  620. }
  621. if (position) {
  622. progress.dlIndex = position.dlIndex;
  623. progress.dtIndex = position.dtIndex;
  624. }
  625. }
  626. }
  627. // 摄像头确认初始化
  628. function initBeforKaoshi() {
  629. zhuapaiConfirmRef.value.showDialog()
  630. }
  631. function initKaoshi() {
  632. ksApi.getClientKsStart({
  633. ksId: data.ksId,
  634. userKaozhengId: data.userKaozhengId
  635. }).then(res => {
  636. const {
  637. ksId,
  638. operId,
  639. ksName,
  640. stTotal,
  641. stScore,
  642. biaoji,
  643. endSecond,
  644. pageSize,
  645. toggleScreenFlag,
  646. toggleScreenSecond,
  647. zhuapai,
  648. duanluoList
  649. } = res.data;
  650. data.ksId = ksId;
  651. data.operId = operId;
  652. data.ksName = ksName;
  653. data.stTotal = stTotal;
  654. data.stScore = stScore;
  655. data.biaoji = biaoji ? JSON.parse(biaoji) : {};
  656. data.endSecond = endSecond;
  657. data.pageSize = pageSize;
  658. data.toggleScreenFlag = toggleScreenFlag;
  659. data.toggleScreenSecond = toggleScreenSecond;
  660. data.zhuapai = zhuapai;
  661. data.duanluo = duanluoList;
  662. formatDuanluoList(data.duanluo);
  663. // 设置缓存
  664. formatKaoshiData();
  665. // 设置抓拍监听
  666. if (data.zhuapai && data.zhuapai > 0) {
  667. zhuapaiRef.value.init({
  668. zhuapai: zhuapai,
  669. operId: operId
  670. });
  671. }
  672. // 设置切屏
  673. qiepingInit({
  674. zhuapaiFlag: !!data.zhuapai,
  675. toggleScreenFlag: toggleScreenFlag,
  676. toggleScreenSecond: toggleScreenSecond,
  677. ksId: data.ksId
  678. }, {
  679. zhuapai: qpZhuapai,
  680. forceSubmit,
  681. qiepingToast
  682. })
  683. uni.setNavigationBarTitle({
  684. title: data.ksName
  685. });
  686. startCountDown.value = true;
  687. }).catch(err => {
  688. handleBack()
  689. })
  690. }
  691. </script>