onlineHomework.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250
  1. <template>
  2. <div>
  3. <LinkTitlesCustom
  4. :current-paths="['考试管理', '考试信息', '在线作业设置']"
  5. />
  6. <section class="content">
  7. <div class="box box-info">
  8. <!-- 正文信息 -->
  9. <div class="box-body">
  10. <el-form
  11. ref="form"
  12. :inline="true"
  13. :rules="rules"
  14. :model="form"
  15. inline-message
  16. label-position="right"
  17. >
  18. <div style="margin-bottom: 10px">
  19. <el-button type="primary" size="small" @click="saveExam"
  20. >保 存</el-button
  21. >
  22. <el-button
  23. type="primary"
  24. size="small"
  25. icon="el-icon-arrow-left"
  26. @click="back"
  27. >返 回</el-button
  28. >
  29. </div>
  30. <el-tabs ref="tabs" v-model="activeName" type="border-card">
  31. <!-- 基础信息 -->
  32. <el-tab-pane label="基础信息" name="tab1">
  33. <el-row v-if="examId != 'add'">
  34. <el-form-item
  35. label="ID"
  36. prop="id"
  37. :label-width="style.label_width_tab1"
  38. >
  39. <el-input
  40. v-model="form.id"
  41. class="input"
  42. :disabled="true"
  43. maxlength="20"
  44. ></el-input>
  45. </el-form-item>
  46. </el-row>
  47. <el-row v-if="examId != 'add'">
  48. <el-form-item
  49. label="考试编码"
  50. placeholder="请输入考试编码"
  51. prop="code"
  52. :label-width="style.label_width_tab1"
  53. >
  54. <el-input
  55. v-model="form.code"
  56. class="input"
  57. :disabled="true"
  58. maxlength="20"
  59. ></el-input>
  60. </el-form-item>
  61. </el-row>
  62. <el-row v-else>
  63. <el-form-item
  64. label="考试编码"
  65. placeholder="请输入考试编码"
  66. prop="code"
  67. :label-width="style.label_width_tab1"
  68. >
  69. <el-input
  70. v-model="form.name"
  71. class="input"
  72. :disabled="true"
  73. maxlength="20"
  74. ></el-input>
  75. </el-form-item>
  76. </el-row>
  77. <el-row>
  78. <el-form-item
  79. label="考试名称"
  80. placeholder="请输入考试名称"
  81. prop="name"
  82. :label-width="style.label_width_tab1"
  83. >
  84. <el-input
  85. v-model="form.name"
  86. class="input"
  87. maxlength="20"
  88. ></el-input>
  89. </el-form-item>
  90. </el-row>
  91. <el-row>
  92. <el-form-item
  93. label="考试类型"
  94. :label-width="style.label_width_tab1"
  95. >
  96. <el-select
  97. v-model="form.examType"
  98. class="input"
  99. :disabled="true"
  100. placeholder="请选择"
  101. >
  102. <el-option
  103. v-for="item in examTypeList"
  104. :key="item.value"
  105. :label="item.label"
  106. :value="item.value"
  107. ></el-option>
  108. </el-select>
  109. </el-form-item>
  110. </el-row>
  111. <el-row>
  112. <el-form-item
  113. label="状态"
  114. :label-width="style.label_width_tab1"
  115. >
  116. <el-radio-group v-model="form.enable" class="input">
  117. <el-radio label="true">启用</el-radio>
  118. <el-radio label="false">禁用</el-radio>
  119. </el-radio-group>
  120. </el-form-item>
  121. </el-row>
  122. <el-row v-if="1 == 2">
  123. <el-form-item
  124. label="是否可以考试"
  125. :label-width="style.label_width_tab1"
  126. >
  127. <el-radio-group v-model="form.examLimit" class="input">
  128. <el-radio label="true">否</el-radio>
  129. <el-radio label="false">是</el-radio>
  130. </el-radio-group>
  131. </el-form-item>
  132. </el-row>
  133. <el-row>
  134. <el-form-item
  135. label="考试时间"
  136. prop="examDatetimeRange"
  137. :label-width="style.label_width_tab1"
  138. >
  139. <el-date-picker
  140. v-model="examDatetimeRange"
  141. class="input"
  142. type="datetimerange"
  143. range-separator="至"
  144. start-placeholder="开始日期"
  145. end-placeholder="结束日期"
  146. value-format="yyyy-MM-dd HH:mm:ss"
  147. :clearable="false"
  148. ></el-date-picker>
  149. </el-form-item>
  150. </el-row>
  151. <el-row>
  152. <el-form-item
  153. label="开启环境检测"
  154. :label-width="style.label_width_tab1"
  155. >
  156. <el-switch
  157. v-model="form.properties.CHECK_ENVIRONMENT"
  158. on-text="是"
  159. off-text="否"
  160. ></el-switch>
  161. </el-form-item>
  162. </el-row>
  163. <el-row>
  164. <el-form-item
  165. label="开放微信小程序作答"
  166. :label-width="style.label_width_tab1"
  167. >
  168. <el-switch
  169. v-model="form.properties.WEIXIN_ANSWER_ENABLED"
  170. :disabled="!rootOrgWenXinAnswerEnabled"
  171. on-text="是"
  172. off-text="否"
  173. ></el-switch>
  174. </el-form-item>
  175. </el-row>
  176. <el-row v-show="false">
  177. <el-form-item
  178. label="开启特殊设置"
  179. :label-width="style.label_width_tab1"
  180. >
  181. <el-switch
  182. v-model="form.specialSettingsEnabled"
  183. on-text="是"
  184. off-text="否"
  185. ></el-switch>
  186. </el-form-item>
  187. </el-row>
  188. <el-row>
  189. <el-form-item
  190. v-show="form.specialSettingsEnabled"
  191. label="特殊设置方式"
  192. :label-width="style.label_width_tab1"
  193. >
  194. <el-radio-group
  195. v-model="form.specialSettingsType"
  196. class="input"
  197. >
  198. <el-radio label="ORG_BASED">机构特殊设置</el-radio>
  199. <el-radio label="STAGE_BASED">场次特殊设置</el-radio>
  200. </el-radio-group>
  201. </el-form-item>
  202. </el-row>
  203. <el-row>
  204. <el-form-item
  205. v-show="form.specialSettingsEnabled"
  206. label="无特殊设置时禁止考试"
  207. :label-width="style.label_width_tab1"
  208. >
  209. <el-switch
  210. v-model="form.properties.LIMITED_IF_NO_SPECIAL_SETTINGS"
  211. on-text="是"
  212. off-text="否"
  213. ></el-switch>
  214. </el-form-item>
  215. </el-row>
  216. <el-row>
  217. <el-form-item
  218. label="开启IP访问设置"
  219. :label-width="style.label_width_tab1"
  220. >
  221. <el-switch
  222. v-model="form.properties.IP_LIMIT"
  223. on-text="是"
  224. off-text="否"
  225. ></el-switch>
  226. </el-form-item>
  227. </el-row>
  228. </el-tab-pane>
  229. <!-- 周期设置 -->
  230. <el-tab-pane label="周期设置" name="tab8">
  231. <el-row>
  232. <el-form-item
  233. label="是否开启周期设置"
  234. :label-width="style.label_width_tab4"
  235. >
  236. <el-radio-group
  237. v-model="form.properties.EXAM_CYCLE_ENABLED"
  238. class="input"
  239. @change="examCycleEnabledChange"
  240. >
  241. <el-radio label="true">开启</el-radio>
  242. <el-radio label="false">不开启</el-radio>
  243. </el-radio-group></el-form-item
  244. >
  245. </el-row>
  246. <el-row v-if="form.properties.EXAM_CYCLE_ENABLED == 'true'">
  247. <el-form-item
  248. label="日期循环设置"
  249. prop="examCycleWeekArr"
  250. :label-width="style.label_width_tab4"
  251. >
  252. <el-checkbox-group
  253. v-model="examCycleWeekArr"
  254. style="width: 680px; display: -webkit-inline-box"
  255. >
  256. <el-checkbox :label="1">星期一</el-checkbox>
  257. <el-checkbox :label="2">星期二</el-checkbox>
  258. <el-checkbox :label="3">星期三</el-checkbox>
  259. <el-checkbox :label="4">星期四</el-checkbox>
  260. <el-checkbox :label="5">星期五</el-checkbox>
  261. <el-checkbox :label="6">星期六</el-checkbox>
  262. <el-checkbox :label="7">星期日</el-checkbox>
  263. </el-checkbox-group></el-form-item
  264. >
  265. </el-row>
  266. <template v-if="form.properties.EXAM_CYCLE_ENABLED == 'true'">
  267. <el-row>
  268. <el-col :span="14">
  269. <el-form-item
  270. label="时间分段设置"
  271. :label-width="style.label_width_tab4"
  272. prop="examCycleTimeRangeArr"
  273. >
  274. </el-form-item>
  275. </el-col>
  276. <el-col :span="10" style="line-height: 48px; height: 40px">
  277. <i
  278. class="el-icon-circle-plus"
  279. style="color: #00a4ff; font-size: 24px"
  280. @click="addCycleTimeRange"
  281. ></i>
  282. </el-col>
  283. </el-row>
  284. <el-row
  285. v-for="(item, index) in examCycleTimeRangeArr"
  286. :key="'tr' + index"
  287. >
  288. <el-col :span="14">
  289. <el-form-item
  290. :label-width="style.label_width_tab4"
  291. :label="index + 1 + '.'"
  292. >
  293. <el-time-picker
  294. v-model="item.timeRange"
  295. class="input"
  296. style="width: 100%"
  297. is-range
  298. start-placeholder="开始时间"
  299. range-separator="至"
  300. end-placeholder="结束时间"
  301. format="HH:mm"
  302. value-format="HH:mm"
  303. :clearable="false"
  304. size="small"
  305. ></el-time-picker>
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="10" style="line-height: 48px; height: 40px">
  309. <i
  310. class="el-icon-remove"
  311. style="color: #00a4ff; font-size: 24px"
  312. @click="removeExamCycleTimeRange(index)"
  313. ></i>
  314. </el-col>
  315. </el-row>
  316. </template>
  317. </el-tab-pane>
  318. <!-- 控制设置 -->
  319. <el-tab-pane label="控制设置" name="tab2">
  320. <el-row>
  321. <el-form-item
  322. label="考试时长"
  323. prop="duration"
  324. :label-width="style.label_width_tab2"
  325. >
  326. <el-input
  327. v-model.trim.number="form.duration"
  328. maxlength="5"
  329. auto-complete="off"
  330. class="input"
  331. >
  332. <template slot="append">分钟</template>
  333. </el-input>
  334. </el-form-item>
  335. </el-row>
  336. <el-row>
  337. <el-form-item
  338. label="考试次数"
  339. prop="examTimes"
  340. :label-width="style.label_width_tab2"
  341. >
  342. <el-input
  343. v-model.trim.number="form.examTimes"
  344. maxlength="5"
  345. auto-complete="off"
  346. class="input"
  347. >
  348. <template slot="append">次</template>
  349. </el-input>
  350. </el-form-item>
  351. </el-row>
  352. <el-row>
  353. <el-form-item
  354. label="交卷冻结时间"
  355. prop="FREEZE_TIME"
  356. :label-width="style.label_width_tab2"
  357. >
  358. <el-input
  359. v-model.trim.number="form.properties.FREEZE_TIME"
  360. maxlength="5"
  361. auto-complete="off"
  362. class="input"
  363. >
  364. <template slot="append">分钟</template>
  365. </el-input>
  366. <el-radio-group
  367. v-model="form.properties.FREEZE_TIME_TYPE"
  368. style="margin-left: 30px"
  369. >
  370. <el-radio label="DURATION">按实际考试时长</el-radio>
  371. <el-radio label="BEGINTIME">按考试开始时间</el-radio>
  372. </el-radio-group>
  373. </el-form-item>
  374. </el-row>
  375. <el-row>
  376. <el-form-item
  377. label="断点续考时间"
  378. prop="EXAM_RECONNECT_TIME"
  379. :label-width="style.label_width_tab2"
  380. >
  381. <el-input
  382. v-model.trim.number="form.properties.EXAM_RECONNECT_TIME"
  383. maxlength="5"
  384. auto-complete="off"
  385. class="input"
  386. >
  387. <template slot="append">分钟</template>
  388. </el-input>
  389. </el-form-item>
  390. </el-row>
  391. <el-row>
  392. <el-form-item
  393. label="断点续考次数"
  394. prop="MAX_INTERRUPT_NUM"
  395. :label-width="style.label_width_tab2"
  396. >
  397. <el-input
  398. v-model.trim.number="form.properties.MAX_INTERRUPT_NUM"
  399. maxlength="5"
  400. auto-complete="off"
  401. class="input"
  402. >
  403. <template slot="append">次</template>
  404. </el-input>
  405. </el-form-item>
  406. </el-row>
  407. <el-row>
  408. <el-form-item
  409. label="切屏次数限制"
  410. prop="MAX_SWITCH_SCREEN_COUNT"
  411. :label-width="style.label_width_tab2"
  412. >
  413. <el-tooltip
  414. :disabled="!maxSwitchScreenCountDisabled"
  415. placement="top"
  416. >
  417. <div slot="content">
  418. 此设置不可用。考生端配置-防作弊设置中计算切屏次数未开启
  419. </div>
  420. <el-input
  421. v-model.trim.number="
  422. form.properties.MAX_SWITCH_SCREEN_COUNT
  423. "
  424. maxlength="5"
  425. auto-complete="off"
  426. class="input"
  427. :disabled="maxSwitchScreenCountDisabled"
  428. >
  429. <template slot="append">次</template>
  430. </el-input>
  431. </el-tooltip>
  432. </el-form-item>
  433. </el-row>
  434. </el-tab-pane>
  435. <el-tab-pane label="显示设置" name="tab3">
  436. <el-row>
  437. <el-form-item
  438. label="考生承诺书"
  439. :label-width="style.label_width_tab3"
  440. >
  441. <el-radio-group
  442. v-model="form.properties.SHOW_UNDERTAKING"
  443. class="input"
  444. >
  445. <el-radio label="true">开启</el-radio>
  446. <el-radio label="false">关闭</el-radio>
  447. </el-radio-group>
  448. </el-form-item>
  449. </el-row>
  450. <el-row v-if="show_ckeditor">
  451. <el-form-item
  452. label="承诺书说明"
  453. :label-width="style.label_width_tab3"
  454. >
  455. <ckeditor
  456. v-model="form.properties.UNDERTAKING"
  457. extrabuttons="Font,FontSize,TextColor"
  458. ></ckeditor>
  459. </el-form-item>
  460. </el-row>
  461. <el-row v-if="show_ckeditor">
  462. <el-form-item
  463. label="考前说明"
  464. :label-width="style.label_width_tab3"
  465. >
  466. <ckeditor
  467. v-model="form.properties.BEFORE_EXAM_REMARK"
  468. extrabuttons="Font,FontSize,TextColor"
  469. ></ckeditor>
  470. </el-form-item>
  471. </el-row>
  472. <el-row v-if="show_ckeditor">
  473. <el-form-item
  474. label="考后说明"
  475. :label-width="style.label_width_tab3"
  476. >
  477. <ckeditor
  478. v-model="form.properties.AFTER_EXAM_REMARK"
  479. extrabuttons="Font,FontSize,TextColor"
  480. ></ckeditor>
  481. </el-form-item>
  482. </el-row>
  483. <el-row>
  484. <el-form-item
  485. label="展示作弊说明"
  486. :label-width="style.label_width_tab3"
  487. >
  488. <el-radio-group
  489. v-model="form.properties.SHOW_CHEATING_REMARK"
  490. class="input"
  491. >
  492. <el-radio label="true">开启</el-radio>
  493. <el-radio label="false">关闭</el-radio>
  494. </el-radio-group>
  495. </el-form-item>
  496. </el-row>
  497. <el-row v-if="show_ckeditor">
  498. <el-form-item
  499. label="作弊说明"
  500. :label-width="style.label_width_tab3"
  501. >
  502. <ckeditor
  503. v-model="form.properties.CHEATING_REMARK"
  504. extrabuttons="Font,FontSize,TextColor"
  505. ></ckeditor>
  506. </el-form-item>
  507. </el-row>
  508. <el-row>
  509. <el-form-item
  510. label="单选题补充说明"
  511. :label-width="style.label_width_tab3"
  512. >
  513. <el-input
  514. v-model="form.properties.SINGLE_ANSWER_REMARK"
  515. maxlength="20"
  516. :disabled="!form.properties.SINGLE_EDIT"
  517. auto-complete="off"
  518. class="input"
  519. ></el-input>
  520. </el-form-item>
  521. <el-form-item label>
  522. <el-switch
  523. v-model="form.properties.SINGLE_EDIT"
  524. on-text="启用"
  525. off-text="禁用"
  526. ></el-switch>
  527. </el-form-item>
  528. </el-row>
  529. <el-row>
  530. <el-form-item
  531. label="多选题补充说明"
  532. :label-width="style.label_width_tab3"
  533. >
  534. <el-input
  535. v-model="form.properties.MUTIPLE_ANSWER_REMARK"
  536. maxlength="20"
  537. :disabled="!form.properties.MUTIPLE_EDIT"
  538. auto-complete="off"
  539. class="input"
  540. ></el-input>
  541. </el-form-item>
  542. <el-form-item label>
  543. <el-switch
  544. v-model="form.properties.MUTIPLE_EDIT"
  545. on-text="启用"
  546. off-text="禁用"
  547. ></el-switch>
  548. </el-form-item>
  549. </el-row>
  550. <el-row>
  551. <el-form-item
  552. label="判断题补充说明"
  553. :label-width="style.label_width_tab3"
  554. >
  555. <el-input
  556. v-model="form.properties.BOOL_ANSWER_REMARK"
  557. maxlength="20"
  558. :disabled="!form.properties.BOOL_EDIT"
  559. class="input"
  560. auto-complete="off"
  561. ></el-input>
  562. </el-form-item>
  563. <el-form-item label>
  564. <el-switch
  565. v-model="form.properties.BOOL_EDIT"
  566. on-text="启用"
  567. off-text="禁用"
  568. ></el-switch>
  569. </el-form-item>
  570. </el-row>
  571. <el-row>
  572. <el-form-item
  573. label="填空题补充说明"
  574. :label-width="style.label_width_tab3"
  575. >
  576. <el-input
  577. v-model="form.properties.FILL_BLANK_REMARK"
  578. maxlength="20"
  579. :disabled="!form.properties.FILL_BLANK_EDIT"
  580. class="input"
  581. auto-complete="off"
  582. ></el-input>
  583. </el-form-item>
  584. <el-form-item label>
  585. <el-switch
  586. v-model="form.properties.FILL_BLANK_EDIT"
  587. on-text="启用"
  588. off-text="禁用"
  589. ></el-switch>
  590. </el-form-item>
  591. </el-row>
  592. <el-row>
  593. <el-form-item
  594. label="客观题成绩显示"
  595. :label-width="style.label_width_tab3"
  596. >
  597. <el-radio-group
  598. v-model="form.properties.IS_OBJ_SCORE_VIEW"
  599. class="input"
  600. >
  601. <el-radio label="true">开启</el-radio>
  602. <el-radio label="false">关闭</el-radio>
  603. </el-radio-group>
  604. </el-form-item>
  605. </el-row>
  606. </el-tab-pane>
  607. <el-tab-pane label="阅卷设置" name="tab5">
  608. <el-row>
  609. <el-form-item
  610. label="阅卷方式"
  611. :label-width="style.label_width_tab5"
  612. >
  613. <el-radio-group
  614. v-model="form.properties.MARKING_TYPE"
  615. :disabled="form.started"
  616. class="input"
  617. >
  618. <el-radio label="ALL">全部评阅</el-radio>
  619. <el-radio label="OBJECT_SCORE_MAX">客观分最高</el-radio>
  620. <el-radio label="LAST_SUBMIT">最后一次提交</el-radio>
  621. </el-radio-group>
  622. </el-form-item>
  623. </el-row>
  624. </el-tab-pane>
  625. <el-tab-pane label="其它" name="tab7">
  626. <el-row>
  627. <el-form-item
  628. label="是否推送成绩"
  629. :label-width="style.label_width_tab7"
  630. >
  631. <el-radio-group v-model="form.properties.PUSH_SCORE">
  632. <el-radio label="true">是</el-radio>
  633. <el-radio label="false">否</el-radio>
  634. </el-radio-group>
  635. </el-form-item>
  636. </el-row>
  637. </el-tab-pane>
  638. </el-tabs>
  639. </el-form>
  640. </div>
  641. </div>
  642. </section>
  643. </div>
  644. </template>
  645. <script>
  646. import { mapState } from "vuex";
  647. import { EXAM_TYPE, EXAM_WORK_API, CORE_API } from "@/constants/constants.js";
  648. import moment from "moment";
  649. import ckeditor from "@/components/ckeditor.vue";
  650. import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
  651. let _this = null;
  652. let validateExamCycleTimeRange = (rule, value, callback) => {
  653. if (_this.examCycleTimeRangeArr.length == 0) {
  654. callback(new Error("请至少设置一个时间段"));
  655. } else {
  656. callback();
  657. }
  658. };
  659. let validateExamCycleWeek = (rule, value, callback) => {
  660. if (_this.examCycleWeekArr.length == 0) {
  661. callback(new Error("请至少勾选一个日期"));
  662. } else {
  663. callback();
  664. }
  665. };
  666. let validateCode = (rule, value, callback) => {
  667. if (_this.examId == "add") {
  668. _this.form.code = _this.form.name;
  669. }
  670. let code = _this.form.code;
  671. if (code == "") {
  672. callback(new Error("请输入考试编码"));
  673. if (!_this.toActiveName) {
  674. _this.toActiveName = "tab1";
  675. _this.activeName = "tab1";
  676. }
  677. } else {
  678. callback();
  679. }
  680. };
  681. let validateName = (rule, value, callback) => {
  682. let name = _this.form.name;
  683. if (name == "") {
  684. callback(new Error("请输入考试名称"));
  685. if (!_this.toActiveName) {
  686. _this.toActiveName = "tab1";
  687. _this.activeName = "tab1";
  688. }
  689. } else {
  690. callback();
  691. }
  692. };
  693. let validateExamDatetimeRange = (rule, value, callback) => {
  694. let examDatetimeRange = _this.examDatetimeRange;
  695. if (!examDatetimeRange) {
  696. callback(new Error("请输入考试时间"));
  697. if (!_this.toActiveName) {
  698. _this.toActiveName = "tab1";
  699. _this.activeName = "tab1";
  700. }
  701. } else {
  702. callback();
  703. }
  704. };
  705. let validateDuration = (rule, value, callback) => {
  706. let duration = _this.form.duration;
  707. if (duration === "") {
  708. callback(new Error("请输入考试时长"));
  709. if (!_this.toActiveName) {
  710. _this.toActiveName = "tab2";
  711. _this.activeName = "tab2";
  712. }
  713. } else if (!duration.toString().match(/^[1-9]\d*|0$/)) {
  714. callback(new Error("只能是非负整数"));
  715. if (!_this.toActiveName) {
  716. _this.toActiveName = "tab2";
  717. _this.activeName = "tab2";
  718. }
  719. } else {
  720. callback();
  721. }
  722. };
  723. let validateExamTimes = (rule, value, callback) => {
  724. let examTimes = _this.form.examTimes;
  725. if (examTimes === "") {
  726. callback(new Error("请输入考试次数"));
  727. if (!_this.toActiveName) {
  728. _this.toActiveName = "tab2";
  729. _this.activeName = "tab2";
  730. }
  731. } else if (!examTimes.toString().match(/^[1-9]\d*$/)) {
  732. callback(new Error("只能是正整数"));
  733. if (!_this.toActiveName) {
  734. _this.toActiveName = "tab2";
  735. _this.activeName = "tab2";
  736. }
  737. } else {
  738. callback();
  739. }
  740. };
  741. let validateFreezeTime = (rule, value, callback) => {
  742. let freezeTime = _this.form.properties.FREEZE_TIME;
  743. let duration = _this.form.duration;
  744. if (freezeTime === "") {
  745. callback(new Error("请输入交卷冻结时长"));
  746. if (!_this.toActiveName) {
  747. _this.toActiveName = "tab2";
  748. _this.activeName = "tab2";
  749. }
  750. } else if (!freezeTime.toString().match(/^[1-9]\d*|0$/)) {
  751. callback(new Error("只能是非负整数"));
  752. if (!_this.toActiveName) {
  753. _this.toActiveName = "tab2";
  754. _this.activeName = "tab2";
  755. }
  756. } else if (duration != "" && parseInt(freezeTime) > parseInt(duration)) {
  757. callback(new Error("交卷冻结时长不能大于考试时长"));
  758. if (!_this.toActiveName) {
  759. _this.toActiveName = "tab2";
  760. _this.activeName = "tab2";
  761. }
  762. } else {
  763. callback();
  764. }
  765. };
  766. let validateExamReconnectTime = (rule, value, callback) => {
  767. let examReconnectTime = _this.form.properties.EXAM_RECONNECT_TIME;
  768. if (examReconnectTime === "") {
  769. callback(new Error("请输入断点续考时间"));
  770. if (!_this.toActiveName) {
  771. _this.toActiveName = "tab2";
  772. _this.activeName = "tab2";
  773. }
  774. } else if (!examReconnectTime.toString().match(/^[1-9]\d*$/)) {
  775. callback(new Error("只能是正整数"));
  776. if (!_this.toActiveName) {
  777. _this.toActiveName = "tab2";
  778. _this.activeName = "tab2";
  779. }
  780. } else if (examReconnectTime < 3) {
  781. callback(new Error("最小设置值为3"));
  782. if (!_this.toActiveName) {
  783. _this.toActiveName = "tab2";
  784. _this.activeName = "tab2";
  785. }
  786. } else {
  787. callback();
  788. }
  789. };
  790. let validateMaxInterruptNum = (rule, value, callback) => {
  791. let examReconnectTime = _this.form.properties.MAX_INTERRUPT_NUM;
  792. if (examReconnectTime === "") {
  793. callback();
  794. } else if (!examReconnectTime.toString().match(/^[0-9]\d*$/)) {
  795. callback(new Error("只能是非负整数"));
  796. if (!_this.toActiveName) {
  797. _this.toActiveName = "tab2";
  798. _this.activeName = "tab2";
  799. }
  800. } else {
  801. callback();
  802. }
  803. };
  804. let validateMaxSwitchScreenCount = (rule, value, callback) => {
  805. let examReconnectTime = _this.form.properties.MAX_SWITCH_SCREEN_COUNT;
  806. if (examReconnectTime === "") {
  807. callback();
  808. } else if (!examReconnectTime.toString().match(/^[0-9]\d*$/)) {
  809. callback(new Error("只能是非负整数"));
  810. if (!_this.toActiveName) {
  811. _this.toActiveName = "tab2";
  812. _this.activeName = "tab2";
  813. }
  814. } else {
  815. callback();
  816. }
  817. };
  818. export default {
  819. components: {
  820. ckeditor,
  821. LinkTitlesCustom,
  822. },
  823. data() {
  824. return {
  825. style: {
  826. label_width_tab1: "160px",
  827. label_width_tab2: "110px",
  828. label_width_tab3: "120px",
  829. label_width_tab4: "170px",
  830. label_width_tab5: "80px",
  831. label_width_tab6: "120px",
  832. label_width_tab7: "150px",
  833. },
  834. examCycleTimeRangeArr: [],
  835. examCycleWeekArr: [1, 2, 3, 4, 5, 6, 7],
  836. activeName: "tab1",
  837. toActiveName: null,
  838. examDatetimeRange: [],
  839. show_ckeditor: false,
  840. is_face_verify_diabled: true,
  841. is_face_enable_diabled: true,
  842. rootOrgWenXinAnswerEnabled: false,
  843. IDENTIFICATION_OF_LIVING_BODY_SCHEME: "S1",
  844. maxSwitchScreenCountDisabled: true,
  845. form: {
  846. started: false,
  847. name: "",
  848. code: "",
  849. examType: "ONLINE_HOMEWORK",
  850. examTimes: 1,
  851. beginTime: null,
  852. endTime: null,
  853. duration: 120,
  854. enable: "true",
  855. examLimit: "false",
  856. specialSettingsEnabled: false,
  857. specialSettingsType: "ORG_BASED",
  858. properties: {
  859. IS_OBJ_SCORE_VIEW: "true",
  860. IS_STRANGER_ENABLE: "false",
  861. MAX_INTERRUPT_NUM: "",
  862. MAX_SWITCH_SCREEN_COUNT: "",
  863. EXAM_RECONNECT_TIME: 30,
  864. FREEZE_TIME: 0,
  865. FREEZE_TIME_TYPE: "DURATION",
  866. BEFORE_EXAM_REMARK: "",
  867. AFTER_EXAM_REMARK: "",
  868. SHOW_CHEATING_REMARK: "true",
  869. CHEATING_REMARK: "",
  870. SINGLE_EDIT: "false",
  871. MUTIPLE_EDIT: "false",
  872. BOOL_EDIT: "false",
  873. FILL_BLANK_EDIT: "false",
  874. SINGLE_ANSWER_REMARK: "",
  875. MUTIPLE_ANSWER_REMARK: "",
  876. FILL_BLANK_REMARK: "",
  877. BOOL_ANSWER_REMARK: "",
  878. IS_FACE_ENABLE: "false",
  879. IS_FACE_CHECK: "false",
  880. SNAPSHOT_INTERVAL: 30,
  881. WARN_THRESHOLD: 50,
  882. MARKING_TYPE: "ALL",
  883. IP_LIMIT: "false",
  884. IP_ADDRESSES: null,
  885. LIVING_WARN_THRESHOLD: 50,
  886. IS_FACE_VERIFY: "false",
  887. FACE_VERIFY_START_MINUTE: 5,
  888. FACE_VERIFY_END_MINUTE: 10,
  889. PUSH_SCORE: "false",
  890. CHECK_ENVIRONMENT: "false",
  891. WEIXIN_ANSWER_ENABLED: "false",
  892. ADD_FACE_VERIFY_OUT_FREEZE_TIME: "false",
  893. OUT_FREEZE_TIME_FACE_VERIFY_START_MINUTE: 10,
  894. OUT_FREEZE_TIME_FACE_VERIFY_END_MINUTE: 30,
  895. LIMITED_IF_NO_SPECIAL_SETTINGS: "false",
  896. EXAM_CYCLE_ENABLED: "false",
  897. EXAM_CYCLE_WEEK: "",
  898. EXAM_CYCLE_TIME_RANGE: "",
  899. SHOW_UNDERTAKING: "false",
  900. UNDERTAKING: "",
  901. },
  902. },
  903. examTypeList: EXAM_TYPE,
  904. examId: "",
  905. rootOrgId: null,
  906. rules: {
  907. code: [{ required: true, validator: validateCode, trigger: "blur" }],
  908. name: [{ required: true, validator: validateName, trigger: "blur" }],
  909. examDatetimeRange: [
  910. {
  911. required: true,
  912. validator: validateExamDatetimeRange,
  913. trigger: "blur",
  914. },
  915. ],
  916. duration: [
  917. { required: true, validator: validateDuration, trigger: "blur" },
  918. ],
  919. examTimes: [
  920. { required: true, validator: validateExamTimes, trigger: "blur" },
  921. ],
  922. FREEZE_TIME: [
  923. { required: true, validator: validateFreezeTime, trigger: "blur" },
  924. ],
  925. EXAM_RECONNECT_TIME: [
  926. {
  927. required: true,
  928. validator: validateExamReconnectTime,
  929. trigger: "blur",
  930. },
  931. ],
  932. MAX_INTERRUPT_NUM: [
  933. {
  934. required: false,
  935. validator: validateMaxInterruptNum,
  936. trigger: "blur",
  937. },
  938. ],
  939. MAX_SWITCH_SCREEN_COUNT: [
  940. {
  941. required: false,
  942. validator: validateMaxSwitchScreenCount,
  943. trigger: "blur",
  944. },
  945. ],
  946. examCycleWeekArr: [
  947. {
  948. required: true,
  949. validator: validateExamCycleWeek,
  950. trigger: "change",
  951. },
  952. ],
  953. examCycleTimeRangeArr: [
  954. {
  955. required: true,
  956. validator: validateExamCycleTimeRange,
  957. trigger: "change",
  958. },
  959. ],
  960. },
  961. };
  962. },
  963. computed: {
  964. ...mapState({ user: (state) => state.user }),
  965. },
  966. created() {
  967. _this = this;
  968. this.examId = this.$route.params.id;
  969. this.init();
  970. },
  971. methods: {
  972. examCycleEnabledChange(val) {
  973. if (val == "true") {
  974. this.examCycleWeekArr = [1, 2, 3, 4, 5, 6, 7];
  975. this.addCycleTimeRange();
  976. } else {
  977. this.examCycleTimeRangeArr = [];
  978. this.examCycleWeekArr = [];
  979. }
  980. },
  981. getEndTimeStr() {
  982. return "23:59";
  983. },
  984. getNowTimeStr() {
  985. let now = new Date();
  986. let hour = now.getHours();
  987. if (hour < 10) {
  988. hour = "0" + hour;
  989. }
  990. let minute = now.getMinutes();
  991. if (minute < 10) {
  992. minute = "0" + minute;
  993. }
  994. return hour + ":" + minute;
  995. },
  996. removeExamCycleTimeRange(index) {
  997. if (this.examCycleTimeRangeArr.length == 1) {
  998. this.$notify({
  999. type: "warning",
  1000. message: "不能删除最后一个分段",
  1001. });
  1002. return;
  1003. }
  1004. this.examCycleTimeRangeArr.splice(index, 1);
  1005. this.$refs.form.validateField("examCycleTimeRangeArr");
  1006. },
  1007. addCycleTimeRange() {
  1008. if (this.examCycleTimeRangeArr.length >= 12) {
  1009. this.$notify({
  1010. type: "warning",
  1011. message: "时间分段不得超过12条",
  1012. });
  1013. return;
  1014. }
  1015. this.examCycleTimeRangeArr.push({
  1016. timeRange: [this.getNowTimeStr(), this.getEndTimeStr()],
  1017. });
  1018. this.$refs.form.validateField("examCycleTimeRangeArr");
  1019. },
  1020. faceEnableChange() {
  1021. if (this.form.properties.IS_FACE_ENABLE == "false") {
  1022. this.form.properties.IS_STRANGER_ENABLE = "false";
  1023. this.form.properties.IS_FACE_CHECK = "false";
  1024. this.form.properties.IS_FACE_VERIFY = "false";
  1025. this.form.properties.ADD_FACE_VERIFY_OUT_FREEZE_TIME = "false";
  1026. }
  1027. },
  1028. init() {
  1029. if (this.examId != "add") {
  1030. let url = EXAM_WORK_API + "/exam/" + this.examId;
  1031. this.$httpWithMsg.get(url).then((response) => {
  1032. let body = response.data;
  1033. this.rootOrgId = body.rootOrgId;
  1034. body.properties = this.form.properties;
  1035. this.form = Object.assign(this.form, response.data);
  1036. this.form.enable = this.form.enable ? "true" : "false";
  1037. this.form.examLimit = this.form.examLimit ? "true" : "false";
  1038. this.examDatetimeRange = [this.form.beginTime, this.form.endTime];
  1039. console.log("getOnlineHomework(); form: ", this.form);
  1040. let url = EXAM_WORK_API + "/exam/allProperties/" + this.examId;
  1041. this.$httpWithMsg.get(url).then((response) => {
  1042. this.form.properties = Object.assign(
  1043. this.form.properties,
  1044. response.data
  1045. );
  1046. this.form.properties.SINGLE_EDIT =
  1047. this.form.properties.SINGLE_EDIT === "true";
  1048. this.form.properties.MUTIPLE_EDIT =
  1049. this.form.properties.MUTIPLE_EDIT === "true";
  1050. this.form.properties.BOOL_EDIT =
  1051. this.form.properties.BOOL_EDIT === "true";
  1052. this.form.properties.FILL_BLANK_EDIT =
  1053. this.form.properties.FILL_BLANK_EDIT === "true";
  1054. this.form.properties.CHECK_ENVIRONMENT =
  1055. this.form.properties.CHECK_ENVIRONMENT === "true";
  1056. this.form.properties.WEIXIN_ANSWER_ENABLED =
  1057. this.form.properties.WEIXIN_ANSWER_ENABLED === "true";
  1058. this.form.properties.LIMITED_IF_NO_SPECIAL_SETTINGS =
  1059. this.form.properties.LIMITED_IF_NO_SPECIAL_SETTINGS === "true";
  1060. this.form.properties.IP_LIMIT =
  1061. this.form.properties.IP_LIMIT === "true";
  1062. if (this.form.properties.EXAM_CYCLE_TIME_RANGE) {
  1063. this.examCycleTimeRangeArr = JSON.parse(
  1064. this.form.properties.EXAM_CYCLE_TIME_RANGE
  1065. );
  1066. }
  1067. if (this.form.properties.EXAM_CYCLE_WEEK) {
  1068. this.examCycleWeekArr = JSON.parse(
  1069. this.form.properties.EXAM_CYCLE_WEEK
  1070. );
  1071. }
  1072. this.show_ckeditor = true;
  1073. this.checkRootOrgPrivileges();
  1074. });
  1075. });
  1076. } else {
  1077. let now = moment().format("YYYY-MM-DD HH:mm:ss");
  1078. this.examDatetimeRange = [now, now];
  1079. this.show_ckeditor = true;
  1080. this.checkRootOrgPrivileges();
  1081. }
  1082. },
  1083. checkRootOrgPrivileges: function () {
  1084. let url =
  1085. CORE_API +
  1086. "/rolePrivilege/checkRootOrgPrivileges?privilegeCodes=FACE_CHECK,IDENTIFICATION_OF_LIVING_BODY";
  1087. this.$httpWithMsg.post(url).then((response) => {
  1088. let res = response.data;
  1089. if (!res.FACE_CHECK) {
  1090. this.form.properties.IS_FACE_ENABLE = "false";
  1091. this.form.properties.IS_STRANGER_ENABLE = "false";
  1092. this.form.properties.IS_FACE_CHECK = "false";
  1093. this.form.properties.IS_FACE_VERIFY = "false";
  1094. this.form.properties.ADD_FACE_VERIFY_OUT_FREEZE_TIME = "false";
  1095. this.is_face_enable_diabled = true;
  1096. } else {
  1097. this.is_face_enable_diabled = false;
  1098. }
  1099. if (!res.IDENTIFICATION_OF_LIVING_BODY) {
  1100. this.is_face_verify_diabled = true;
  1101. this.form.properties.IS_FACE_VERIFY = "false";
  1102. this.form.properties.ADD_FACE_VERIFY_OUT_FREEZE_TIME = "false";
  1103. } else {
  1104. this.is_face_verify_diabled = false;
  1105. }
  1106. });
  1107. let url2 =
  1108. CORE_API +
  1109. "/org/property/" +
  1110. this.user.rootOrgId +
  1111. "/WEIXIN_ANSWER_ENABLED";
  1112. this.$httpWithMsg.get(url2).then((response) => {
  1113. let res = response.data;
  1114. this.rootOrgWenXinAnswerEnabled = res == true;
  1115. if (!this.rootOrgWenXinAnswerEnabled) {
  1116. this.form.properties.WEIXIN_ANSWER_ENABLED = false;
  1117. }
  1118. });
  1119. let that = this;
  1120. this.getOrgProperty(
  1121. "IDENTIFICATION_OF_LIVING_BODY_SCHEME",
  1122. function (res) {
  1123. that.form.IDENTIFICATION_OF_LIVING_BODY_SCHEME = res;
  1124. }
  1125. );
  1126. this.getOrgProperty("PREVENT_CHEATING_CONFIG", function (res) {
  1127. if (res && res.indexOf("RECORD_SWITCH_SCREEN") != -1) {
  1128. that.maxSwitchScreenCountDisabled = false;
  1129. }
  1130. });
  1131. },
  1132. getOrgProperty: function (propkey, callback) {
  1133. let url =
  1134. CORE_API + "/org/property/" + this.user.rootOrgId + "/" + propkey;
  1135. this.$httpWithMsg.get(url).then((response) => {
  1136. let res = response.data;
  1137. callback(res);
  1138. });
  1139. },
  1140. compare: function (x, y) {
  1141. if (x < y) {
  1142. return -1;
  1143. } else if (x > y) {
  1144. return 1;
  1145. } else {
  1146. return 0;
  1147. }
  1148. },
  1149. saveExam: function () {
  1150. this.toActiveName = null;
  1151. this.form.beginTime = this.examDatetimeRange[0];
  1152. this.form.endTime = this.examDatetimeRange[1];
  1153. this.form.properties.EXAM_CYCLE_TIME_RANGE = JSON.stringify(
  1154. this.examCycleTimeRangeArr
  1155. );
  1156. this.examCycleWeekArr.sort(this.compare);
  1157. this.form.properties.EXAM_CYCLE_WEEK = JSON.stringify(
  1158. this.examCycleWeekArr
  1159. );
  1160. if (!this.checkCkeditorVals()) {
  1161. return false;
  1162. }
  1163. let url = EXAM_WORK_API + "/exam";
  1164. this.$refs.form.validate((valid) => {
  1165. if (valid) {
  1166. if (this.examId != "add") {
  1167. this.$httpWithMsg.put(url, this.form).then((response) => {
  1168. if (200 != response.status) {
  1169. this.$notify({
  1170. type: "error",
  1171. message: response.body.desc,
  1172. });
  1173. return;
  1174. }
  1175. this.$notify({
  1176. type: "success",
  1177. message: "保存成功",
  1178. });
  1179. });
  1180. } else {
  1181. this.form.code = this.form.name;
  1182. this.$httpWithMsg.post(url, this.form).then((response) => {
  1183. console.log(response);
  1184. this.$notify({
  1185. type: "success",
  1186. message: "新增成功",
  1187. });
  1188. this.examId = response.data.id;
  1189. this.form.id = this.examId;
  1190. this.$router.push({
  1191. path: "/examwork/onlineHomework/" + response.data.id,
  1192. });
  1193. });
  1194. }
  1195. } else {
  1196. return false;
  1197. }
  1198. });
  1199. },
  1200. checkCkeditorVals() {
  1201. if (
  1202. this.form.properties.SHOW_UNDERTAKING == "true" &&
  1203. !this.form.properties.UNDERTAKING
  1204. ) {
  1205. this.$notify({
  1206. type: "warning",
  1207. message: "请输入承诺书说明",
  1208. });
  1209. this.activeName = "tab3";
  1210. return false;
  1211. }
  1212. return true;
  1213. },
  1214. back() {
  1215. this.$router.push({ path: "/examwork/examInfo" });
  1216. },
  1217. },
  1218. };
  1219. </script>
  1220. <style scoped>
  1221. .input {
  1222. width: 440px;
  1223. }
  1224. .input >>> .el-input__inner {
  1225. -webkit-appearance: button;
  1226. }
  1227. </style>