exam.vue 18 KB

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