exam.vue 18 KB

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