exam.vue 18 KB

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