exam.vue 19 KB

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