EditPaperPendingTrial.vue 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593
  1. <template>
  2. <div
  3. id="editPaperApp"
  4. v-loading="loading"
  5. class="paper"
  6. element-loading-text="拼命加载中。。。"
  7. >
  8. <!-- <ckeditor v-model="examRemark"></ckeditor> -->
  9. <div class="edit-paper-top">
  10. <div class="edit-paper-top-inline">
  11. <div class="paper-top-div">
  12. <span class="paper-top-title">课程代码:</span>
  13. <span class="paper-top-value">{{ paper.course.code }}</span>
  14. </div>
  15. <div class="paper-top-div">
  16. <span class="paper-top-title">课程名称:</span>
  17. <span class="paper-top-value">{{ paper.course.name }}</span>
  18. </div>
  19. <div class="paper-top-div">
  20. <span class="paper-top-title">试卷名称:</span>
  21. <el-tooltip class="item" effect="dark" placement="top-start">
  22. <div slot="content">{{ paper.name }}</div>
  23. <input
  24. v-model="paper.name"
  25. class="paperName-input font_length"
  26. placeholder="试卷名称"
  27. />
  28. </el-tooltip>
  29. </div>
  30. <div class="paper-top-div">
  31. <span class="paper-top-title">试卷总分:</span>
  32. <span class="paper-top-value">{{ paper.totalScore }}</span>
  33. </div>
  34. <div class="paper-top-right-div">
  35. <el-button
  36. size="small"
  37. type="primary"
  38. style="margin-left: 10px"
  39. @click="back"
  40. ><i class="el-icon-arrow-left"></i> 返回</el-button
  41. >
  42. </div>
  43. <div v-show="isShowEditBtn()" class="paper-top-right-div">
  44. <el-dropdown class="button_left">
  45. <el-button type="primary" size="small">
  46. 更多 <i class="el-icon-arrow-down el-icon--right"></i>
  47. </el-button>
  48. <el-dropdown-menu slot="dropdown">
  49. <el-dropdown-item>
  50. <el-button type="primary" size="small" @click="openDialog"
  51. ><i class="el-icon-upload2"></i>上传音频
  52. </el-button>
  53. </el-dropdown-item>
  54. <el-dropdown-item>
  55. <el-button
  56. size="small"
  57. type="primary"
  58. @click="exportPaperAnswer()"
  59. ><i class="el-icon-download"></i>导出答案</el-button
  60. >
  61. </el-dropdown-item>
  62. <el-dropdown-item>
  63. <el-button type="primary" size="small" @click="openAnswerDialog"
  64. ><i class="el-icon-upload2"></i>导入答案
  65. </el-button>
  66. </el-dropdown-item>
  67. </el-dropdown-menu>
  68. </el-dropdown>
  69. </div>
  70. <div v-if="showCheckDuplicateBtn" class="paper-top-right-div">
  71. <el-button
  72. style="margin-left: 10px"
  73. type="primary"
  74. size="small"
  75. @click="checkDuplicate"
  76. >
  77. 进入查重
  78. </el-button>
  79. </div>
  80. <div class="paper-top-right-div">
  81. <el-button
  82. v-show="isShowEditBtn()"
  83. style="margin-left: 10px"
  84. size="small"
  85. type="danger"
  86. @click="deletePaper()"
  87. ><i class="el-icon-delete"></i>删除</el-button
  88. >
  89. </div>
  90. <div v-show="isShowEditBtn()" class="paper-top-right-div">
  91. <el-button
  92. style="margin-left: 10px"
  93. type="primary"
  94. size="small"
  95. @click="savePaper"
  96. >
  97. 保存
  98. </el-button>
  99. </div>
  100. <div v-show="isShowAuditBtn()" class="paper-top-right-div">
  101. <el-dropdown class="button_left">
  102. <el-button type="primary" size="small">
  103. 审核<i class="el-icon-arrow-down el-icon--right"></i>
  104. </el-button>
  105. <el-dropdown-menu slot="dropdown">
  106. <el-dropdown-item>
  107. <el-button
  108. size="mini"
  109. type="success"
  110. @click="auditPaper('PASS')"
  111. >
  112. <i class="el-icon-success"></i>通过
  113. </el-button>
  114. </el-dropdown-item>
  115. <el-dropdown-item>
  116. <el-button
  117. size="mini"
  118. type="danger"
  119. @click="auditPaper('NOT_PASS')"
  120. >
  121. <i class="el-icon-error"></i>不通过
  122. </el-button>
  123. </el-dropdown-item>
  124. </el-dropdown-menu>
  125. </el-dropdown>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="edit-paper-top2">
  130. <div class="edit-paper-top-inline">
  131. <div class="paper-top-left-div">
  132. <el-button type="primary" size="small" @click="showBasicDialog">
  133. 基础构成
  134. </el-button>
  135. </div>
  136. <div class="paper-top-left-div">
  137. <el-button type="primary" size="small" @click="showTypeDialog">
  138. 题型分布
  139. </el-button>
  140. </div>
  141. <div class="paper-top-left-div">
  142. <el-button type="primary" size="small" @click="showBlueDialog">
  143. 蓝图分布
  144. </el-button>
  145. </div>
  146. <div class="paper-top-left-div">
  147. <el-button type="primary" size="small" @click="showAuditDialog">
  148. 审核记录
  149. </el-button>
  150. </div>
  151. <div class="paper-top-right-div" @click="quesTagShowHide">
  152. <span class="paper-top-text-btn"
  153. >{{ quesTagShow ? "隐藏" : "显示" }}属性</span
  154. >
  155. </div>
  156. <div class="paper-top-right-div" @click="quesAnswerShowHide">
  157. <span class="paper-top-text-btn"
  158. >{{ quesAnswerShow ? "隐藏" : "显示" }}答案</span
  159. >
  160. </div>
  161. <div class="paper-top-right-div">
  162. <span
  163. >当前状态:{{ paper.auditStatus | paperAuditStatusFilter }}</span
  164. >
  165. </div>
  166. </div>
  167. </div>
  168. <div class="paperName">
  169. <div class="text-left">
  170. <div class="mainQues" style="margin-top: 20px; margin-left: 0px">
  171. <div class="mainQuesTitle">
  172. <span>考试说明:</span>
  173. <span>
  174. <el-button
  175. v-show="isShowEditBtn()"
  176. size="small"
  177. @click="openEditExamPaperRemark"
  178. >编辑</el-button
  179. >
  180. </span>
  181. <div style="width: 550px; margin-left: 20px; margin-top: 20px">
  182. <span v-html="paper.examRemark"></span>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. <div>
  189. <!-- 循环大题 -->
  190. <div
  191. v-for="(paperDetail, detailIndex) in paper.paperDetails"
  192. v-show="paperDetailShow(paperDetail)"
  193. :key="detailIndex"
  194. class="mainQues"
  195. >
  196. <div class="mainQuesTitleDiv">
  197. <div
  198. class="mainQuesTitle"
  199. @mouseover="quesMouseOver(paperDetail.id)"
  200. @mouseout="quesMouseOut(paperDetail.id)"
  201. >
  202. <span>{{ paperDetail.cnNum }}</span> <span>.</span>
  203. <span>{{ paperDetail.name }}</span>
  204. <span>
  205. ({{
  206. !paperDetail.title ? "本大题" : paperDetail.title + ","
  207. }}共{{ paperDetail.unitCount }}小题,满分{{
  208. paperDetail.score
  209. }}分)
  210. </span>
  211. <span :id="paperDetail.id" class="btnDiv">
  212. <span v-show="isShowEditBtn()">
  213. <el-button
  214. v-show="parentView == 'gen_paper'"
  215. size="small"
  216. @click="selectQues(paperDetail.id)"
  217. >选题
  218. </el-button>
  219. <el-button
  220. size="small"
  221. @click="openEditPaperDetail(paperDetail)"
  222. >编辑
  223. </el-button>
  224. <el-button
  225. v-if="showUp(paperDetail)"
  226. size="small"
  227. @click="movePaperDetail(paperDetail, 'up')"
  228. >上移
  229. </el-button>
  230. <el-button
  231. v-if="showDown(paperDetail)"
  232. size="small"
  233. @click="movePaperDetail(paperDetail, 'down')"
  234. >下移
  235. </el-button>
  236. <el-button
  237. size="small"
  238. type="danger"
  239. @click="deletePaperDetail(paperDetail.id)"
  240. >删除
  241. </el-button>
  242. </span>
  243. <el-button
  244. v-show="showButtons[detailIndex].up"
  245. size="small"
  246. icon="el-icon-arrow-up"
  247. @click.stop="hideContent(detailIndex)"
  248. ></el-button>
  249. <el-button
  250. v-show="!showButtons[detailIndex].up"
  251. size="small"
  252. icon="el-icon-arrow-down"
  253. @click.stop="showContent(detailIndex)"
  254. ></el-button>
  255. </span>
  256. <span v-question-audio v-html="paperDetail.description"></span>
  257. </div>
  258. <div v-show="quesTagShow" class="ques-tag-main">
  259. <div
  260. v-for="(paperDetailTag, tagIndex) in paperDetail.tags"
  261. :key="tagIndex"
  262. class="ques-tag-container"
  263. >
  264. <div class="ques-tag">
  265. <div class="ques-tag-title">{{ paperDetailTag.tag }}</div>
  266. <div>{{ paperDetailTag.content }}</div>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <!-- 循环小题 -->
  272. <div v-show="showQuestions[detailIndex].is_show">
  273. <div
  274. v-for="(paperDetailUnit, unitIndex) in paperDetail.paperDetailUnits"
  275. v-show="quesShow(paperDetailUnit.id)"
  276. :key="unitIndex"
  277. :class="{
  278. ques: true,
  279. duplicate:
  280. paperDetailUnit.question.checkDuplicateStatus ==
  281. 'TO_BE_DISPOSE',
  282. }"
  283. >
  284. <div
  285. class="quesSelect"
  286. @mouseover="quesMouseOver(paperDetailUnit.id)"
  287. @mouseout="quesMouseOut(paperDetailUnit.id)"
  288. >
  289. <div :id="paperDetailUnit.id" class="btnDiv">
  290. <span>{{ paperDetailUnit.question.bodyLengthText }}</span>
  291. <el-button
  292. v-if="
  293. paperDetailUnit.question.checkDuplicateStatus ==
  294. 'TO_BE_DISPOSE'
  295. "
  296. size="small"
  297. @click="checkDuplicateQuestion(paperDetailUnit.question.id)"
  298. >进入查重
  299. </el-button>
  300. <span v-show="isShowEditBtn()">
  301. <el-button
  302. size="small"
  303. @click="editQues(paperDetailUnit, paperDetailUnit.question)"
  304. >编辑
  305. </el-button>
  306. <el-button
  307. v-if="showUnitUp(paperDetail, paperDetailUnit.id)"
  308. size="small"
  309. @click="
  310. movePaperDetailUnit(
  311. paperDetail.id,
  312. paperDetailUnit.id,
  313. 'up'
  314. )
  315. "
  316. >上移
  317. </el-button>
  318. <el-button
  319. v-if="showUnitDown(paperDetail, paperDetailUnit.id)"
  320. size="small"
  321. @click="
  322. movePaperDetailUnit(
  323. paperDetail.id,
  324. paperDetailUnit.id,
  325. 'down'
  326. )
  327. "
  328. >下移
  329. </el-button>
  330. <el-button
  331. type="danger"
  332. size="small"
  333. @click="deleteQues(paperDetailUnit)"
  334. >删除
  335. </el-button>
  336. </span>
  337. <el-button
  338. v-show="
  339. isNested(paperDetailUnit.questionType) &&
  340. showSubButtons[detailIndex + '-' + unitIndex]
  341. "
  342. size="small"
  343. icon="el-icon-arrow-up"
  344. @click.stop="hideSubContent(detailIndex + '-' + unitIndex)"
  345. ></el-button>
  346. <el-button
  347. v-show="
  348. isNested(paperDetailUnit.questionType) &&
  349. !showSubButtons[detailIndex + '-' + unitIndex]
  350. "
  351. size="small"
  352. icon="el-icon-arrow-down"
  353. @click.stop="showSubContent(detailIndex + '-' + unitIndex)"
  354. ></el-button>
  355. </div>
  356. <div class="quesBody">
  357. <span class="ques-title">{{ paperDetailUnit.number }}.</span>
  358. <span
  359. v-question-audio
  360. class="ques-body"
  361. :hasAudio="paperDetailUnit.question.hasAudio"
  362. :questionId="paperDetailUnit.question.id"
  363. v-html="paperDetailUnit.question.quesBody"
  364. ></span>
  365. <span class="score-span">
  366. ({{ paperDetailUnit.score }}分)
  367. </span>
  368. </div>
  369. <div
  370. v-for="(quesOption, optionIndex) in paperDetailUnit.question
  371. .quesOptions"
  372. :key="optionIndex"
  373. class="quesOption"
  374. >
  375. <span class="ques-title"
  376. >{{ optionIndex | optionOrderWordFilter }}.
  377. </span>
  378. <span
  379. v-question-audio
  380. class="ques-body"
  381. :hasAudio="paperDetailUnit.question.hasAudio"
  382. :questionId="paperDetailUnit.question.id"
  383. v-html="quesOption.optionBody"
  384. ></span>
  385. </div>
  386. <div v-if="!isNested(paperDetailUnit.questionType)">
  387. <div v-show="quesAnswerShow">
  388. <span>答案:</span>
  389. <span v-html="paperDetailUnit.question.quesAnswer"></span>
  390. </div>
  391. </div>
  392. </div>
  393. <div v-show="quesTagShow" class="ques-tag-main">
  394. <div
  395. v-for="(questionTag, tagIndex) in paperDetailUnit.question.tags"
  396. :key="tagIndex"
  397. class="ques-tag-container"
  398. >
  399. <div class="ques-tag">
  400. <div class="ques-tag-title">{{ questionTag.tag }}</div>
  401. <div>{{ questionTag.content }}</div>
  402. </div>
  403. </div>
  404. </div>
  405. <div style="flex-basis: 100%"></div>
  406. <div
  407. v-show="showSubQuestions[detailIndex + '-' + unitIndex]"
  408. class="sub-ques-main-div"
  409. >
  410. <div
  411. v-for="(subQuestion, subIndex) in paperDetailUnit.question
  412. .subQuestions"
  413. v-show="quesShow(subQuestion.id)"
  414. :key="subIndex"
  415. class="subQues"
  416. >
  417. <div
  418. class="quesSelect"
  419. @mouseover="
  420. quesMouseOver(
  421. getSubQuesEditId(paperDetailUnit, subQuestion)
  422. )
  423. "
  424. @mouseout="
  425. quesMouseOut(getSubQuesEditId(paperDetailUnit, subQuestion))
  426. "
  427. >
  428. <div
  429. v-show="isShowEditBtn()"
  430. :id="getSubQuesEditId(paperDetailUnit, subQuestion)"
  431. class="btnDiv"
  432. >
  433. <el-button
  434. size="small"
  435. @click="editQues(paperDetailUnit, subQuestion)"
  436. >编辑
  437. </el-button>
  438. <el-button
  439. v-if="showUnitSubUp(paperDetailUnit, subQuestion.id)"
  440. size="small"
  441. @click="
  442. movePaperDetailUnitSub(
  443. paperDetailUnit.id,
  444. subQuestion.id,
  445. 'up'
  446. )
  447. "
  448. >上移
  449. </el-button>
  450. <el-button
  451. v-if="showUnitSubDown(paperDetailUnit, subQuestion.id)"
  452. size="small"
  453. @click="
  454. movePaperDetailUnitSub(
  455. paperDetailUnit.id,
  456. subQuestion.id,
  457. 'down'
  458. )
  459. "
  460. >下移
  461. </el-button>
  462. </div>
  463. <div class="quesBody">
  464. <span class="ques-title"
  465. >{{ subQuestion.subNumber }}.
  466. </span>
  467. <span v-question-audio v-html="subQuestion.quesBody"></span>
  468. <span
  469. >({{ paperDetailUnit.subScoreList[subIndex] }}分)</span
  470. >
  471. </div>
  472. <div v-if="!isMatchingQuestion(paperDetailUnit.questionType)">
  473. <div
  474. v-for="(
  475. subQuesOption, subOptIndex
  476. ) in subQuestion.quesOptions"
  477. :key="subOptIndex"
  478. class="quesOption"
  479. >
  480. <span class="ques-title"
  481. >{{ subOptIndex | optionOrderWordFilter }}.
  482. </span>
  483. <span
  484. v-question-audio
  485. v-html="subQuesOption.optionBody"
  486. ></span>
  487. </div>
  488. </div>
  489. <div v-show="quesAnswerShow">
  490. <span>答案:</span>
  491. <span v-html="subQuestion.quesAnswer"></span>
  492. </div>
  493. </div>
  494. <div v-show="quesTagShow" class="ques-tag-main">
  495. <div
  496. v-for="(subQuestionTag, tagIndex) in subQuestion.tags"
  497. :key="tagIndex"
  498. class="ques-tag-container"
  499. >
  500. <div class="ques-tag">
  501. <div class="ques-tag-title">{{ subQuestionTag.tag }}</div>
  502. <div>{{ subQuestionTag.content }}</div>
  503. </div>
  504. </div>
  505. </div>
  506. </div>
  507. </div>
  508. </div>
  509. </div>
  510. </div>
  511. </div>
  512. <div class="text-left">
  513. <!-- 编辑大题弹框 -->
  514. <el-dialog
  515. v-loading.body="detailLoading"
  516. width="560px"
  517. title="大题名称编辑"
  518. element-loading-text="保存中。。。"
  519. :visible.sync="paperDatailDialog"
  520. @close="closeQuesDialog"
  521. >
  522. <el-form
  523. :model="editpaperDetail"
  524. label-position="right"
  525. label-width="80px"
  526. >
  527. <el-row :gutter="10">
  528. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  529. <el-form-item label="大题名称" placeholder="大题名称">
  530. <el-input
  531. v-model="editpaperDetail.name"
  532. class="dialog_input_width"
  533. />
  534. </el-form-item>
  535. </el-col>
  536. </el-row>
  537. <el-row>
  538. <el-col>
  539. <el-form-item label="大题描述" placeholder="大题描述">
  540. <ckeditor v-model="editpaperDetail.description"></ckeditor>
  541. </el-form-item>
  542. </el-col>
  543. </el-row>
  544. <el-row>
  545. <el-form-item>
  546. <el-button
  547. type="primary"
  548. @click="savePaperDatail(editpaperDetail)"
  549. >保存</el-button
  550. >
  551. <el-button @click="closePaperDatailDialog()">取消</el-button>
  552. </el-form-item>
  553. </el-row>
  554. </el-form>
  555. </el-dialog>
  556. <!-- 编辑试题弹框 -->
  557. <el-dialog
  558. v-loading.body="dialogLoading"
  559. title="试题编辑"
  560. element-loading-text="保存中。。。"
  561. :visible.sync="quesDialog"
  562. @close="closeQuesDialog"
  563. >
  564. <el-form :model="quesModel" label-position="right" label-width="80px">
  565. <el-row :gutter="10">
  566. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  567. <el-form-item label="题型">
  568. <el-select
  569. v-model="quesModel.questionType"
  570. :disabled="true"
  571. placeholder="请输入题型"
  572. >
  573. <el-option
  574. v-for="item in questionTypes"
  575. :key="item.value"
  576. :label="item.label"
  577. :value="item.value"
  578. >
  579. </el-option>
  580. </el-select>
  581. </el-form-item>
  582. </el-col>
  583. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  584. <el-form-item label="分值">
  585. <el-input-number
  586. v-model="quesModel.score"
  587. placeholder="分值"
  588. :precision="1"
  589. :min="0"
  590. :disabled="isNested(quesModel.questionType)"
  591. ></el-input-number>
  592. </el-form-item>
  593. </el-col>
  594. </el-row>
  595. <!-- create by weiwenhai 添加难度,公开度,试题属性 -->
  596. <el-row :gutter="10">
  597. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  598. <el-form-item label="难度">
  599. <el-select
  600. v-model="quesModel.difficultyDegree"
  601. placeholder="请输入难度"
  602. :disabled="
  603. isNested(quesModel.questionType) ? true : updatePorperty
  604. "
  605. >
  606. <el-option
  607. v-for="item in difficultyDegreeList"
  608. :key="item.value"
  609. :label="item.label"
  610. :value="item.value"
  611. >
  612. </el-option>
  613. </el-select>
  614. </el-form-item>
  615. </el-col>
  616. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  617. <el-form-item label="公开度">
  618. <el-select
  619. v-model="quesModel.publicity"
  620. placeholder="请输入公开度"
  621. :disabled="updatePorperty"
  622. >
  623. <el-option
  624. v-for="item in publicityList"
  625. :key="item.value"
  626. :label="item.label"
  627. :value="item.value"
  628. >
  629. </el-option>
  630. </el-select>
  631. </el-form-item>
  632. </el-col>
  633. <el-col
  634. v-if="quesModel.questionType == 'TEXT_ANSWER_QUESTION'"
  635. :xs="10"
  636. :sm="10"
  637. :md="10"
  638. :lg="10"
  639. >
  640. <el-form-item label="作答类型">
  641. <el-select
  642. v-model="quesModel.answerType"
  643. :disabled="updatePorperty"
  644. >
  645. <el-option
  646. v-for="item in answerTypes"
  647. :key="item.value"
  648. :label="item.label"
  649. :value="item.value"
  650. >
  651. </el-option>
  652. </el-select>
  653. </el-form-item>
  654. </el-col>
  655. <el-col
  656. v-if="quesModel.questionType && !isNested(quesModel.questionType)"
  657. :xs="10"
  658. :sm="10"
  659. :md="10"
  660. :lg="10"
  661. >
  662. <el-form-item label="时长">
  663. <el-input-number
  664. v-model="quesModel.control.maxAnswerTime"
  665. size="small"
  666. :precision="0"
  667. :min="1"
  668. :disabled="updatePorperty"
  669. ></el-input-number>
  670. </el-form-item>
  671. </el-col>
  672. <el-col
  673. v-if="isMatchingQuestion(quesModel.questionType)"
  674. :xs="10"
  675. :sm="10"
  676. :md="10"
  677. :lg="10"
  678. >
  679. <el-form-item label="答题模式">
  680. <el-select
  681. v-model="quesModel.quesParam.matchingMode"
  682. :disabled="updatePorperty"
  683. >
  684. <el-option
  685. v-for="item in matchingModes"
  686. :key="item.value"
  687. :label="item.label"
  688. :value="item.value"
  689. >
  690. </el-option>
  691. </el-select>
  692. </el-form-item>
  693. </el-col>
  694. </el-row>
  695. <el-row :gutter="10">
  696. <el-col :xs="20" :sm="20" :md="20" :lg="20">
  697. <el-form-item label="属性列表">
  698. <el-tooltip
  699. v-for="(content, propIndex) in quesModel.quesProperties"
  700. :key="propIndex"
  701. placement="top"
  702. >
  703. <div slot="content">
  704. <span v-if="content.firstProperty != null"
  705. >一级属性:{{ content.firstProperty.name }}({{
  706. content.firstProperty.code
  707. }})</span
  708. ><br />
  709. <span v-if="content.secondProperty != null"
  710. >二级属性:{{ content.secondProperty.name }}({{
  711. content.secondProperty.code
  712. }})</span
  713. >
  714. </div>
  715. <span>
  716. <el-tag
  717. :key="content.id"
  718. style="margin-right: 5px"
  719. :closable="!updatePorperty"
  720. type="primary"
  721. @close="handleClose(content)"
  722. >
  723. {{ content.courseProperty.name }}
  724. </el-tag>
  725. </span>
  726. </el-tooltip>
  727. </el-form-item>
  728. </el-col>
  729. </el-row>
  730. <el-row>
  731. <el-col :span="6">
  732. <el-form-item label="属性名" label-width="60px">
  733. <el-select
  734. v-model="coursePropertyId"
  735. placeholder="属性名"
  736. class="property_with"
  737. :disabled="updatePorperty"
  738. @change="searchFirst"
  739. >
  740. <el-option label="请选择" value=""></el-option>
  741. <el-option
  742. v-for="item in coursePropertyList"
  743. :key="item.id"
  744. :label="item.name"
  745. :value="item.id"
  746. >
  747. </el-option>
  748. </el-select>
  749. </el-form-item>
  750. </el-col>
  751. <el-col :span="6">
  752. <el-form-item label="一级" label-width="48px">
  753. <el-select
  754. v-model="firstPropertyId"
  755. placeholder="一级"
  756. class="property_with"
  757. :disabled="updatePorperty"
  758. @change="searchSecond"
  759. >
  760. <el-option label="请选择" value=""></el-option>
  761. <el-option
  762. v-for="item in firstPropertyList"
  763. :key="item.id"
  764. :label="item.name + '(' + item.code + ')'"
  765. :value="item.id"
  766. >
  767. </el-option>
  768. </el-select>
  769. </el-form-item>
  770. </el-col>
  771. <el-col :span="6">
  772. <el-form-item label="二级" label-width="48px">
  773. <el-select
  774. v-model="secondPropertyId"
  775. placeholder="二级"
  776. class="property_with"
  777. :disabled="updatePorperty"
  778. >
  779. <el-option label="请选择" value=""></el-option>
  780. <el-option
  781. v-for="item in secondPropertyList"
  782. :key="item.id"
  783. :label="item.name + '(' + item.code + ')'"
  784. :value="item.id"
  785. >
  786. </el-option>
  787. </el-select>
  788. </el-form-item>
  789. </el-col>
  790. <el-col :span="6">
  791. <el-form-item>
  792. <el-button
  793. type="primary"
  794. style="margin-left: -50px"
  795. :disabled="updatePorperty"
  796. @click="insertProperty"
  797. ><i class="el-icon-plus"></i>新增属性
  798. </el-button>
  799. </el-form-item>
  800. </el-col>
  801. </el-row>
  802. <!-- end by weiwenhai -->
  803. <div>
  804. <el-row>
  805. <el-col>
  806. <el-form-item label="题目">
  807. <ckeditor v-model="quesModel.quesBody"></ckeditor>
  808. </el-form-item>
  809. </el-col>
  810. </el-row>
  811. <el-form-item
  812. v-for="(quesOption, optIndex) in quesModel.quesOptions"
  813. :key="optIndex"
  814. >
  815. <el-col :span="2">
  816. <div
  817. v-if="
  818. !quesModel.parentType ||
  819. !isMatchingQuestion(quesModel.parentType) ||
  820. !isInOtherSelect(optIndex, quesModel)
  821. "
  822. >
  823. <el-radio
  824. v-if="quesModel.questionType === 'SINGLE_ANSWER_QUESTION'"
  825. v-model="singleRightAnswer"
  826. :label="optIndex | optionOrderWordFilter"
  827. ></el-radio>
  828. <el-checkbox
  829. v-if="quesModel.questionType === 'MULTIPLE_ANSWER_QUESTION'"
  830. v-model="multipleRightAnswer"
  831. :label="optIndex | optionOrderWordFilter"
  832. ></el-checkbox>
  833. <span v-if="isMatchingQuestion(quesModel.questionType)">{{
  834. optIndex | optionOrderWordFilter
  835. }}</span>
  836. </div>
  837. <div
  838. v-if="
  839. quesModel.parentType &&
  840. isMatchingQuestion(quesModel.parentType) &&
  841. isInOtherSelect(optIndex, quesModel)
  842. "
  843. >
  844. <el-tooltip
  845. class="item"
  846. effect="dark"
  847. :content="otherSelect(optIndex, quesModel)"
  848. placement="top-start"
  849. >
  850. <el-radio
  851. v-if="quesModel.questionType === 'SINGLE_ANSWER_QUESTION'"
  852. v-model="singleRightAnswer"
  853. :disabled="true"
  854. :label="optIndex | optionOrderWordFilter"
  855. ></el-radio>
  856. <el-checkbox
  857. v-if="
  858. quesModel.questionType === 'MULTIPLE_ANSWER_QUESTION'
  859. "
  860. v-model="multipleRightAnswer"
  861. :disabled="true"
  862. :label="optIndex | optionOrderWordFilter"
  863. ></el-checkbox>
  864. <span v-if="isMatchingQuestion(quesModel.questionType)">{{
  865. optIndex | optionOrderWordFilter
  866. }}</span>
  867. </el-tooltip>
  868. </div>
  869. </el-col>
  870. <el-col
  871. v-if="
  872. !quesModel.parentType ||
  873. !isMatchingQuestion(quesModel.parentType)
  874. "
  875. :span="20"
  876. >
  877. <ckeditor v-model="quesOption.optionBody"></ckeditor>
  878. </el-col>
  879. <el-col
  880. v-if="
  881. quesModel.parentType &&
  882. isMatchingQuestion(quesModel.parentType)
  883. "
  884. :span="20"
  885. >
  886. <span v-html="quesOption.optionBody"></span>
  887. </el-col>
  888. <el-col
  889. v-if="
  890. !quesModel.parentType ||
  891. !isMatchingQuestion(quesModel.parentType)
  892. "
  893. :span="2"
  894. >
  895. <i
  896. class="el-icon-delete"
  897. title="删除"
  898. @click.prevent="removeQuesOption(quesOption)"
  899. ></i>
  900. </el-col>
  901. </el-form-item>
  902. <div
  903. v-if="
  904. quesModel.questionType == 'TEXT_ANSWER_QUESTION' ||
  905. quesModel.questionType == 'FILL_BLANK_QUESTION'
  906. "
  907. >
  908. <el-form-item label="答案">
  909. <ckeditor v-model="quesModel.quesAnswer"></ckeditor>
  910. </el-form-item>
  911. </div>
  912. <!-- 单选或多选 -->
  913. <div
  914. v-if="
  915. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  916. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
  917. "
  918. >
  919. <el-form-item label="答案">
  920. <span v-html="answer"></span>
  921. </el-form-item>
  922. </div>
  923. <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
  924. <el-row>
  925. <el-col>
  926. <el-form-item label="答案" prop="quesAnswer">
  927. <el-select
  928. v-model="quesModel.quesAnswer"
  929. placeholder="请选择"
  930. >
  931. <el-option
  932. v-for="op in options"
  933. :key="op"
  934. :label="op"
  935. :value="op"
  936. >
  937. </el-option>
  938. </el-select>
  939. </el-form-item>
  940. </el-col>
  941. </el-row>
  942. </div>
  943. </div>
  944. <div
  945. :class="{
  946. margin_left_30:
  947. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  948. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION',
  949. margin_left_40: !(
  950. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  951. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
  952. ),
  953. }"
  954. >
  955. <el-button
  956. v-if="
  957. (quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  958. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION' ||
  959. isMatchingQuestion(quesModel.questionType)) &&
  960. !isMatchingQuestion(quesModel.parentType)
  961. "
  962. type="primary"
  963. @click="addQuesOption"
  964. ><i class="el-icon-plus"></i> 新增选项
  965. </el-button>
  966. <el-button type="primary" @click="savePaperDetailUnit()"
  967. >保存</el-button
  968. >
  969. <el-button @click="closeQuesDialog">取消</el-button>
  970. </div>
  971. </el-form>
  972. </el-dialog>
  973. <!-- 考试说明弹框 -->
  974. <el-dialog title="考试说明编辑" :visible.sync="paperRemarkDialog">
  975. <el-form label-position="right" label-width="80px">
  976. <el-row :gutter="10">
  977. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  978. <el-form-item label="考试说明">
  979. <div style="width: 550px">
  980. <ckeditor
  981. v-model="examRemark"
  982. :display="display"
  983. :width="wValue"
  984. :height="hValue"
  985. ></ckeditor>
  986. </div>
  987. </el-form-item>
  988. </el-col>
  989. </el-row>
  990. <div style="margin-top: 20px; margin-left: 40%">
  991. <el-button type="primary" @click="savePaperRemark">保存</el-button>
  992. <el-button @click="closPaperRemark">取消</el-button>
  993. </div>
  994. </el-form>
  995. </el-dialog>
  996. <!-- 上传音频弹框 -->
  997. <el-dialog
  998. title="上传音频文件"
  999. :visible.sync="dialogRadioFile"
  1000. :before-close="closeAudioDialog"
  1001. >
  1002. <form
  1003. id="radioForm"
  1004. method="post"
  1005. action=""
  1006. enctype="multipart/form-data"
  1007. >
  1008. <input
  1009. id="radioFile"
  1010. name="files"
  1011. type="file"
  1012. value="上传音频文件"
  1013. webkitdirectory
  1014. />
  1015. <el-button type="warning" @click="checkFile">检查文件名</el-button>
  1016. <el-button
  1017. type="info"
  1018. :loading="uploadAudioLoading"
  1019. :disabled="isUpload || uploadAudioLoading"
  1020. @click="uploadAudioFile"
  1021. >
  1022. <span v-show="!uploadAudioLoading">开始上传</span>
  1023. <span v-show="uploadAudioLoading">正在上传中...</span>
  1024. </el-button>
  1025. </form>
  1026. <div v-if="checkResult" style="margin-top: 20px">
  1027. <span>检查结果:</span><br /><br />
  1028. <span v-show="message == 'OK!'" style="color: #13ce66">OK!</span>
  1029. <span v-show="message != 'OK!'" style="color: #ff4949">{{
  1030. message
  1031. }}</span>
  1032. </div>
  1033. </el-dialog>
  1034. <el-dialog
  1035. title="上传答案文件"
  1036. :visible.sync="dialogAnswerFile"
  1037. :before-close="closeAnswerDialog"
  1038. >
  1039. <form
  1040. id="answerForm"
  1041. method="post"
  1042. action=""
  1043. enctype="multipart/form-data"
  1044. >
  1045. <input
  1046. id="answerFile"
  1047. name="answerFiles"
  1048. type="file"
  1049. value="上传答案文件"
  1050. accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  1051. />
  1052. <el-button type="info" @click="downAnswerTemplate">
  1053. <span>下载模板</span>
  1054. </el-button>
  1055. <el-button
  1056. type="info"
  1057. :loading="uploadAnswerLoading"
  1058. :disabled="uploadAnswerLoading"
  1059. @click="uploadAnswerFile"
  1060. >
  1061. <span v-show="!uploadAnswerLoading">开始上传</span>
  1062. <span v-show="uploadAnswerLoading">正在上传中...</span>
  1063. </el-button>
  1064. </form>
  1065. <div style="margin-top: 20px">
  1066. <span v-show="answerMessage != ''" style="color: #ff4949">{{
  1067. answerMessage
  1068. }}</span>
  1069. </div>
  1070. </el-dialog>
  1071. <el-dialog title="基础构成" width="80%" :visible.sync="basicDialog">
  1072. <PaperBasicComposition
  1073. v-if="basicDialog"
  1074. :paper-id="paperId"
  1075. ></PaperBasicComposition>
  1076. </el-dialog>
  1077. <el-dialog title="题型分布" width="80%" :visible.sync="typeDialog">
  1078. <PaperQuestionType
  1079. v-if="typeDialog"
  1080. :paper-id="paperId"
  1081. ></PaperQuestionType>
  1082. </el-dialog>
  1083. <el-dialog title="蓝图分布" width="80%" :visible.sync="blueDialog">
  1084. <PaperBlue
  1085. v-if="blueDialog"
  1086. :paper-id="paperId"
  1087. :course-code="paper.course.code"
  1088. ></PaperBlue>
  1089. </el-dialog>
  1090. <el-dialog title="审核记录" width="80%" :visible.sync="auditInfoDialog">
  1091. <AuditInfo v-if="auditInfoDialog" :paper-id="paperId"></AuditInfo>
  1092. </el-dialog>
  1093. <el-dialog title="审核试卷" width="50%" :visible.sync="auditPaperDialog">
  1094. <AuditPaper
  1095. v-if="auditPaperDialog"
  1096. :paper-ids="selectedPaperIds"
  1097. :audit-result="auditResult"
  1098. @afterAudit="afterAudit"
  1099. ></AuditPaper>
  1100. </el-dialog>
  1101. </div>
  1102. </div>
  1103. </template>
  1104. <script>
  1105. import { QUESTION_API } from "@/constants/constants";
  1106. import { isEmptyStr, QUESTION_TYPES } from "../constants/constants";
  1107. import { mapState } from "vuex";
  1108. import ckeditor from "../component/ckeditor.vue";
  1109. import PaperBasicComposition from "./PaperBasicComposition.vue";
  1110. import PaperQuestionType from "./PaperQuestionType.vue";
  1111. import PaperBlue from "./PaperBlue.vue";
  1112. import AuditInfo from "./AuditInfo.vue";
  1113. import AuditPaper from "./AuditPaper.vue";
  1114. export default {
  1115. name: "EditPaperApp",
  1116. components: {
  1117. ckeditor,
  1118. PaperBasicComposition,
  1119. PaperQuestionType,
  1120. PaperBlue,
  1121. AuditInfo,
  1122. AuditPaper,
  1123. },
  1124. data() {
  1125. return {
  1126. showCheckDuplicateBtn: false,
  1127. selectedPaperIds: [],
  1128. auditPaperDialog: false,
  1129. auditResult: "",
  1130. auditInfoDialog: false,
  1131. blueDialog: false,
  1132. typeDialog: false,
  1133. basicDialog: false,
  1134. quesAnswerShow: true,
  1135. quesTagShow: true,
  1136. hValue: "100px",
  1137. wValue: "500px",
  1138. display: "block",
  1139. uploadAction: "",
  1140. fileList: [],
  1141. answerFileList: [],
  1142. paperId: "",
  1143. paperDetailId: "",
  1144. editPaperDetailUnit: "",
  1145. quesDialog: false,
  1146. paperDatailDialog: false,
  1147. paperRemarkDialog: false,
  1148. parentView: "",
  1149. paper: {
  1150. course: {
  1151. code: "",
  1152. name: "",
  1153. },
  1154. examRemark: "",
  1155. },
  1156. loading: false,
  1157. dialogLoading: false,
  1158. detailLoading: false,
  1159. uploadAudioLoading: false,
  1160. uploadAnswerLoading: false,
  1161. questionTypes: QUESTION_TYPES,
  1162. questionType: "",
  1163. quesModel: { quesProperties: [] },
  1164. editpaperDetail: {},
  1165. reduplicateQuestions: [],
  1166. reduplicateGroup: [],
  1167. reduplicateQuesColor: [],
  1168. singleRightAnswer: "", //接收单选答案
  1169. multipleRightAnswer: [], //接收多选答案
  1170. options: ["正确", "错误"],
  1171. duplicateLoading: false,
  1172. dialogRadioFile: false,
  1173. dialogAnswerFile: false,
  1174. isUpload: true,
  1175. isUploadAnswer: true,
  1176. message: "",
  1177. answerMessage: "",
  1178. checkResult: false,
  1179. checkResultAnswer: false,
  1180. fileNameList: [],
  1181. defaultColor: [
  1182. "Red",
  1183. "Blue",
  1184. "LimeGreen",
  1185. "GoldenRod",
  1186. "Black",
  1187. "BlueViolet",
  1188. "Chocolate",
  1189. "DarkCyan",
  1190. "HotPink",
  1191. "Orange",
  1192. "IndianRed",
  1193. "Indigo",
  1194. "Green",
  1195. "Aqua",
  1196. "CadetBlue",
  1197. "SkyBlue",
  1198. "SlateBlue",
  1199. "SlateGray",
  1200. "Tomato",
  1201. "VioletRed",
  1202. ],
  1203. difficultyDegreeList: [
  1204. { label: 0.1, value: 0.1 },
  1205. { label: 0.2, value: 0.2 },
  1206. { label: 0.3, value: 0.3 },
  1207. { label: 0.4, value: 0.4 },
  1208. { label: 0.5, value: 0.5 },
  1209. { label: 0.6, value: 0.6 },
  1210. { label: 0.7, value: 0.7 },
  1211. { label: 0.8, value: 0.8 },
  1212. { label: 0.9, value: 0.9 },
  1213. { label: 1.0, value: 1.0 },
  1214. ],
  1215. publicityList: [
  1216. { label: "公开", value: true },
  1217. { label: "非公开", value: false },
  1218. ],
  1219. answerTypes: [
  1220. { label: "文本", value: "DIVERSIFIED_TEXT" },
  1221. { label: "音频", value: "SINGLE_AUDIO" },
  1222. ],
  1223. matchingTypes: [
  1224. { label: "填词", value: 1 },
  1225. { label: "段落", value: 2 },
  1226. ],
  1227. matchingModes: [
  1228. { label: "单用", value: 1 },
  1229. { label: "复用", value: 2 },
  1230. ],
  1231. coursePropertyList: [],
  1232. coursePropertyId: "", //课程属性名
  1233. firstPropertyList: [], //一级属性集合
  1234. firstPropertyId: "", //一级属性id
  1235. secondPropertyList: [], //二级属性集合
  1236. secondPropertyId: "", //二级属性id
  1237. examRemark: "",
  1238. showQuestions: [],
  1239. showButtons: [],
  1240. showSubQuestions: {},
  1241. showSubButtons: {},
  1242. };
  1243. },
  1244. computed: {
  1245. ...mapState({
  1246. user: (state) => state.user,
  1247. }),
  1248. updatePorperty() {
  1249. return false;
  1250. },
  1251. answer() {
  1252. if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
  1253. return this.singleRightAnswer;
  1254. } else if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
  1255. var obj = this.multipleRightAnswer;
  1256. return obj.sort().toString();
  1257. }
  1258. return this.quesModel.quesAnswer;
  1259. },
  1260. },
  1261. created() {
  1262. let qt = sessionStorage.getItem("quesTagShow");
  1263. if (qt) {
  1264. this.quesTagShow = qt == "true";
  1265. }
  1266. let qa = sessionStorage.getItem("quesAnswerShow");
  1267. if (qa) {
  1268. this.quesAnswerShow = qa == "true";
  1269. }
  1270. document.getElementsByTagName("body")[0].style = "";
  1271. this.paperId = this.$route.params.id;
  1272. this.parentView = this.$route.params.parentView;
  1273. this.initPaper();
  1274. this.uploadAction = QUESTION_API + "/uploadRadio/" + this.paperId;
  1275. this.uploadHeaders = {
  1276. key: this.user.key,
  1277. token: this.user.token,
  1278. };
  1279. },
  1280. methods: {
  1281. showCheckDuplicate() {
  1282. if (this.paper.checkDuplicateStatus == "DISPOSED") {
  1283. this.showCheckDuplicateBtn = false;
  1284. } else {
  1285. for (let paperDetilData of this.paper.paperDetails) {
  1286. for (let unit of paperDetilData.paperDetailUnits) {
  1287. if (unit.question.checkDuplicateStatus == "TO_BE_DISPOSE") {
  1288. this.showCheckDuplicateBtn = true;
  1289. return;
  1290. }
  1291. }
  1292. }
  1293. this.showCheckDuplicateBtn = false;
  1294. }
  1295. },
  1296. checkDuplicate() {
  1297. this.$router.push({
  1298. name: "check_duplicate_info",
  1299. params: {
  1300. basePaperId: this.paper.id,
  1301. from: "paper",
  1302. },
  1303. });
  1304. },
  1305. checkDuplicateQuestion(questionId) {
  1306. this.$router.push({
  1307. name: "check_duplicate_info",
  1308. params: {
  1309. quesId: questionId,
  1310. basePaperId: this.paper.id,
  1311. from: "paper",
  1312. },
  1313. });
  1314. },
  1315. isShowEditBtn() {
  1316. if (
  1317. this.paper.creationBy == this.user.userId &&
  1318. this.paper.auditStatus == "WITHDRAW"
  1319. ) {
  1320. return true;
  1321. } else {
  1322. return false;
  1323. }
  1324. },
  1325. afterAudit() {
  1326. this.auditPaperDialog = false;
  1327. this.back();
  1328. },
  1329. auditPaper(pass) {
  1330. this.auditResult = pass;
  1331. this.selectedPaperIds = [];
  1332. this.selectedPaperIds.push(this.paperId);
  1333. this.auditPaperDialog = true;
  1334. },
  1335. isShowAuditBtn() {
  1336. if (
  1337. this.paper.auditStatus != "WITHDRAW" &&
  1338. this.paper.auditStatus != "NOT_PASS" &&
  1339. this.isMyAudit()
  1340. ) {
  1341. return true;
  1342. } else {
  1343. return false;
  1344. }
  1345. },
  1346. isMyAudit() {
  1347. if (
  1348. this.paper.auditStatus == "FIRST_PENDING_TRIAL" &&
  1349. this.user.auditAuthority == "FIRST"
  1350. ) {
  1351. return true;
  1352. }
  1353. if (
  1354. this.paper.auditStatus == "SECOND_PENDING_TRIAL" &&
  1355. this.user.auditAuthority == "SECOND"
  1356. ) {
  1357. return true;
  1358. }
  1359. if (
  1360. this.paper.auditStatus == "THIRD_PENDING_TRIAL" &&
  1361. this.user.auditAuthority == "THIRD"
  1362. ) {
  1363. return true;
  1364. }
  1365. return false;
  1366. },
  1367. showAuditDialog() {
  1368. this.auditInfoDialog = true;
  1369. },
  1370. showBlueDialog() {
  1371. this.blueDialog = true;
  1372. },
  1373. showTypeDialog() {
  1374. this.typeDialog = true;
  1375. },
  1376. showBasicDialog() {
  1377. this.basicDialog = true;
  1378. },
  1379. quesAnswerShowHide() {
  1380. this.quesAnswerShow = !this.quesAnswerShow;
  1381. sessionStorage.setItem("quesAnswerShow", this.quesAnswerShow);
  1382. },
  1383. quesTagShowHide() {
  1384. this.quesTagShow = !this.quesTagShow;
  1385. sessionStorage.setItem("quesTagShow", this.quesTagShow);
  1386. },
  1387. isMatchingQuestion(questionType) {
  1388. if (
  1389. questionType == "PARAGRAPH_MATCHING" ||
  1390. questionType == "BANKED_CLOZE"
  1391. ) {
  1392. return true;
  1393. } else {
  1394. return false;
  1395. }
  1396. },
  1397. isNested(questionType) {
  1398. if (
  1399. questionType == "PARAGRAPH_MATCHING" ||
  1400. questionType == "BANKED_CLOZE" ||
  1401. questionType == "CLOZE" ||
  1402. questionType == "READING_COMPREHENSION" ||
  1403. questionType == "LISTENING_QUESTION"
  1404. ) {
  1405. return true;
  1406. } else {
  1407. return false;
  1408. }
  1409. },
  1410. otherSelect(optIndex, quesModel) {
  1411. return "该选项被第" + quesModel.optionsSelected[optIndex + 1] + "题选用";
  1412. },
  1413. isInOtherSelect(optIndex, quesModel) {
  1414. if (quesModel.parentQuesParam.matchingMode != 1) {
  1415. return false;
  1416. }
  1417. if (!quesModel.optionsSelected) {
  1418. return false;
  1419. }
  1420. if (!quesModel.optionsSelected[optIndex + 1]) {
  1421. return false;
  1422. }
  1423. if (
  1424. quesModel.optionsSelected[optIndex + 1].includes(quesModel.subNumber)
  1425. ) {
  1426. return false;
  1427. }
  1428. return true;
  1429. },
  1430. movePaperDetailUnitSub(unitid, subid, vector) {
  1431. let vectorStr = vector == "up" ? "上移" : "下移";
  1432. this.$alert("您确定" + vectorStr + "吗?", "提示", {
  1433. confirmButtonText: "确定",
  1434. callback: (action) => {
  1435. if (action == "confirm") {
  1436. this.loading = true;
  1437. this.$http
  1438. .put(
  1439. QUESTION_API +
  1440. "/paperDetailUnit/sub/" +
  1441. unitid +
  1442. "/" +
  1443. subid +
  1444. "/" +
  1445. vector
  1446. )
  1447. .then(() => {
  1448. this.initPaper();
  1449. this.loading = true;
  1450. this.$notify({
  1451. message: vectorStr + "成功",
  1452. type: "success",
  1453. });
  1454. this.loading = false;
  1455. });
  1456. }
  1457. },
  1458. });
  1459. },
  1460. showUnitSubDown(unit, subid) {
  1461. if (unit.question.subQuestions.length <= 1) {
  1462. return false;
  1463. }
  1464. if (
  1465. subid !=
  1466. unit.question.subQuestions[unit.question.subQuestions.length - 1].id
  1467. ) {
  1468. return true;
  1469. } else {
  1470. return false;
  1471. }
  1472. },
  1473. showUnitSubUp(unit, subid) {
  1474. if (unit.question.subQuestions.length <= 1) {
  1475. return false;
  1476. }
  1477. if (subid != unit.question.subQuestions[0].id) {
  1478. return true;
  1479. } else {
  1480. return false;
  1481. }
  1482. },
  1483. movePaperDetailUnit(detailId, unitid, vector) {
  1484. let vectorStr = vector == "up" ? "上移" : "下移";
  1485. this.$alert("您确定" + vectorStr + "吗?", "提示", {
  1486. confirmButtonText: "确定",
  1487. callback: (action) => {
  1488. if (action == "confirm") {
  1489. this.loading = true;
  1490. this.$http
  1491. .put(
  1492. QUESTION_API +
  1493. "/paperDetailUnit/" +
  1494. detailId +
  1495. "/" +
  1496. unitid +
  1497. "/" +
  1498. vector
  1499. )
  1500. .then(() => {
  1501. this.initPaper();
  1502. this.loading = true;
  1503. this.$notify({
  1504. message: vectorStr + "成功",
  1505. type: "success",
  1506. });
  1507. this.loading = false;
  1508. });
  1509. }
  1510. },
  1511. });
  1512. },
  1513. showUnitDown(detail, unitid) {
  1514. if (detail.paperDetailUnits.length <= 1) {
  1515. return false;
  1516. }
  1517. if (
  1518. unitid != detail.paperDetailUnits[detail.paperDetailUnits.length - 1].id
  1519. ) {
  1520. return true;
  1521. } else {
  1522. return false;
  1523. }
  1524. },
  1525. showUnitUp(detail, unitid) {
  1526. if (detail.paperDetailUnits.length <= 1) {
  1527. return false;
  1528. }
  1529. if (unitid != detail.paperDetailUnits[0].id) {
  1530. return true;
  1531. } else {
  1532. return false;
  1533. }
  1534. },
  1535. movePaperDetail(detail, vector) {
  1536. let vectorStr = vector == "up" ? "上移" : "下移";
  1537. this.$alert("您确定" + vectorStr + "吗?", "提示", {
  1538. confirmButtonText: "确定",
  1539. callback: (action) => {
  1540. if (action == "confirm") {
  1541. this.loading = true;
  1542. this.$http
  1543. .put(
  1544. QUESTION_API +
  1545. "/paperDetail/" +
  1546. this.paperId +
  1547. "/" +
  1548. detail.id +
  1549. "/" +
  1550. vector
  1551. )
  1552. .then(() => {
  1553. this.initPaper();
  1554. this.loading = true;
  1555. this.$notify({
  1556. message: vectorStr + "成功",
  1557. type: "success",
  1558. });
  1559. this.loading = false;
  1560. });
  1561. }
  1562. },
  1563. });
  1564. },
  1565. showUp(detail) {
  1566. if (this.paper.paperDetails.length <= 1) {
  1567. return false;
  1568. }
  1569. if (detail.id != this.paper.paperDetails[0].id) {
  1570. return true;
  1571. } else {
  1572. return false;
  1573. }
  1574. },
  1575. showDown(detail) {
  1576. if (this.paper.paperDetails.length <= 1) {
  1577. return false;
  1578. }
  1579. if (
  1580. detail.id !=
  1581. this.paper.paperDetails[this.paper.paperDetails.length - 1].id
  1582. ) {
  1583. return true;
  1584. } else {
  1585. return false;
  1586. }
  1587. },
  1588. downAnswerTemplate() {
  1589. var key = this.user.key;
  1590. var token = this.user.token;
  1591. window.open(
  1592. QUESTION_API + "/paper/answer/template?$key=" + key + "&$token=" + token
  1593. );
  1594. },
  1595. openAnswerDialog() {
  1596. this.checkResultAnswer = false;
  1597. this.isUploadAnswer = true;
  1598. if (document.getElementById("answerFile")) {
  1599. document.getElementById("answerFile").value = "";
  1600. }
  1601. this.dialogAnswerFile = true;
  1602. this.answerFileList = [];
  1603. },
  1604. closeAnswerDialog() {
  1605. this.answerMessage = "";
  1606. this.dialogAnswerFile = this.uploadAnswerLoading;
  1607. },
  1608. uploadAnswerFile() {
  1609. this.answerMessage = "";
  1610. var fileList = document.getElementById("answerFile").files;
  1611. if (fileList.length == 0) {
  1612. this.answerMessage = "请选择文件!";
  1613. return;
  1614. }
  1615. let param = new FormData();
  1616. //循环添加到formData中
  1617. for (var i = 0; i < fileList.length; i++) {
  1618. var file = fileList[i];
  1619. param.append("dataFile", file, file.name);
  1620. }
  1621. let config = {
  1622. headers: { "Content-Type": "multipart/form-data" },
  1623. };
  1624. this.uploadAnswerLoading = true;
  1625. this.$http
  1626. .post(
  1627. QUESTION_API + "/paper/answer/import/" + this.paperId,
  1628. param,
  1629. config
  1630. )
  1631. .then(() => {
  1632. this.dialogAnswerFile = false;
  1633. this.uploadAnswerLoading = false;
  1634. this.checkResultAnswer = false;
  1635. this.isUploadAnswer = true;
  1636. document.getElementById("answerFile").value = "";
  1637. this.initPaper();
  1638. })
  1639. .catch((error) => {
  1640. this.answerMessage = error.response.data.desc;
  1641. document.getElementById("answerFile").value = "";
  1642. this.uploadAnswerLoading = false;
  1643. });
  1644. },
  1645. //隐藏大题下的所有小题
  1646. hideContent(index) {
  1647. this.showQuestions[index].is_show = false;
  1648. this.showButtons[index].up = false;
  1649. },
  1650. //展开大题下所有小题
  1651. showContent(index) {
  1652. this.showQuestions[index].is_show = true;
  1653. this.showButtons[index].up = true;
  1654. },
  1655. //隐藏大题下的所有小题
  1656. hideSubContent(index) {
  1657. this.showSubQuestions[index] = false;
  1658. this.showSubButtons[index] = false;
  1659. this.$forceUpdate();
  1660. },
  1661. //展开大题下所有小题
  1662. showSubContent(index) {
  1663. this.showSubQuestions[index] = true;
  1664. this.showSubButtons[index] = true;
  1665. this.$forceUpdate();
  1666. },
  1667. quesMouseOver(index) {
  1668. document.getElementById(index).style.visibility = "visible";
  1669. },
  1670. quesMouseOut(index) {
  1671. document.getElementById(index).style.visibility = "hidden";
  1672. },
  1673. selectQues(id) {
  1674. this.paperDetailId = id;
  1675. var courseCode = this.paper.course.code;
  1676. var courseName = this.paper.course.name;
  1677. this.$router.push({
  1678. path:
  1679. "/select_question/" +
  1680. this.paper.id +
  1681. "/" +
  1682. courseCode +
  1683. "/" +
  1684. encodeURIComponent(courseName) +
  1685. "/" +
  1686. this.paperDetailId +
  1687. "/" +
  1688. this.parentView,
  1689. });
  1690. },
  1691. //打开编辑大题题目弹窗
  1692. openEditPaperDetail(paperDetail) {
  1693. this.paperDatailDialog = true;
  1694. this.editpaperDetail = Object.assign({}, paperDetail); //浅拷贝
  1695. },
  1696. //关闭编辑大题题目弹窗
  1697. closePaperDatailDialog() {
  1698. this.paperDatailDialog = false;
  1699. this.editpaperDetail = {};
  1700. },
  1701. //保存大题题目信息
  1702. savePaperDatail(editpaperDetail) {
  1703. this.detailLoading = true;
  1704. var paperId = this.paper.id;
  1705. this.$http
  1706. .post(QUESTION_API + "/updatePaperDetail/" + paperId, editpaperDetail)
  1707. .then(() => {
  1708. this.$notify({
  1709. message: "保存成功",
  1710. type: "success",
  1711. });
  1712. this.detailLoading = false;
  1713. this.closePaperDatailDialog();
  1714. this.initPaper();
  1715. });
  1716. },
  1717. //初始化试卷
  1718. initPaper() {
  1719. const scrollPosition =
  1720. document.documentElement.scrollTop || document.body.scrollTop;
  1721. this.loading = true;
  1722. this.paper = {
  1723. course: {
  1724. code: "",
  1725. name: "",
  1726. },
  1727. };
  1728. this.$http
  1729. .get(QUESTION_API + "/paper/" + this.paperId)
  1730. .then((response) => {
  1731. this.paper = response.data;
  1732. //查询所有课程属性名
  1733. this.initCourseProperty(this.paper.course.code);
  1734. //将所有小题分为公开和非公开
  1735. if (this.paper.paperDetails && this.paper.paperDetails.length > 0) {
  1736. let dindx = 0;
  1737. for (let paperDetil of this.paper.paperDetails) {
  1738. this.showQuestions.push({ is_show: true });
  1739. this.showButtons.push({ up: true });
  1740. paperDetil.pubCount = 0;
  1741. paperDetil.noPubCount = 0;
  1742. if (
  1743. paperDetil.paperDetailUnits &&
  1744. paperDetil.paperDetailUnits.length > 0
  1745. ) {
  1746. let uindx = 0;
  1747. for (let paperDetilUt of paperDetil.paperDetailUnits) {
  1748. this.showSubQuestions[dindx + "-" + uindx] = true;
  1749. this.showSubButtons[dindx + "-" + uindx] = true;
  1750. if (!this.isNested(paperDetilUt.question.questionType)) {
  1751. //非套题
  1752. if (paperDetilUt.question.publicity) {
  1753. paperDetil.pubCount = paperDetil.pubCount + 1;
  1754. } else {
  1755. paperDetil.noPubCount = paperDetil.noPubCount + 1;
  1756. }
  1757. } else {
  1758. //循环所有子题
  1759. for (let ques of paperDetilUt.question.subQuestions) {
  1760. if (ques.publicity) {
  1761. paperDetil.pubCount = paperDetil.pubCount + 1;
  1762. } else {
  1763. paperDetil.noPubCount = paperDetil.noPubCount + 1;
  1764. }
  1765. }
  1766. }
  1767. uindx++;
  1768. }
  1769. }
  1770. dindx++;
  1771. }
  1772. }
  1773. this.showCheckDuplicate();
  1774. setTimeout(() => {
  1775. document.documentElement.scrollTop = document.body.scrollTop =
  1776. scrollPosition;
  1777. console.log(scrollPosition);
  1778. }, 1000);
  1779. this.loading = false;
  1780. });
  1781. },
  1782. //查询所有课程属性名
  1783. initCourseProperty(courseCode) {
  1784. this.$http
  1785. .get(QUESTION_API + "/courseProperty/enable/" + courseCode)
  1786. .then((response) => {
  1787. this.coursePropertyList = response.data;
  1788. });
  1789. },
  1790. //删除大题
  1791. deletePaperDetail(paperDetailsId) {
  1792. //先判断大题下面是否还有小题
  1793. var count = 0;
  1794. for (var i = 0, imax = this.paper.paperDetails.length; i < imax; i++) {
  1795. if (paperDetailsId == this.paper.paperDetails[i].id) {
  1796. if (this.paper.paperDetails[i].paperDetailUnits) {
  1797. count += this.paper.paperDetails[i].paperDetailUnits.length;
  1798. break;
  1799. }
  1800. }
  1801. }
  1802. if (count == 0) {
  1803. this.$alert("您确定删除吗?", "提示", {
  1804. confirmButtonText: "确定",
  1805. callback: (action) => {
  1806. if (action == "confirm") {
  1807. this.loading = true;
  1808. this.$http
  1809. .delete(
  1810. QUESTION_API +
  1811. "/paperDetail/" +
  1812. this.paperId +
  1813. "/" +
  1814. paperDetailsId
  1815. )
  1816. .then(() => {
  1817. this.initPaper();
  1818. this.loading = true;
  1819. this.$notify({
  1820. message: "删除成功",
  1821. type: "success",
  1822. });
  1823. this.loading = false;
  1824. });
  1825. }
  1826. },
  1827. });
  1828. } else {
  1829. this.$alert("大题下还有小题,不可删除!", "提示", {
  1830. confirmButtonText: "确定",
  1831. callback: () => {},
  1832. });
  1833. }
  1834. },
  1835. quesShow(id) {
  1836. if (this.reduplicateGroup.length < 1) {
  1837. return true;
  1838. }
  1839. for (var i = 0, imax = this.reduplicateGroup.length; i < imax; i++) {
  1840. if (id == this.reduplicateGroup[i]) {
  1841. return true;
  1842. }
  1843. }
  1844. return false;
  1845. },
  1846. //编辑题目
  1847. editQues(paperDetailUnit, question) {
  1848. console.log("question:", question);
  1849. this.coursePropertyId = "";
  1850. this.firstPropertyId = "";
  1851. this.secondPropertyId = "";
  1852. this.editPaperDetailUnit = paperDetailUnit;
  1853. this.quesModel = JSON.parse(JSON.stringify(question)); //深拷贝
  1854. if (!this.quesModel.control) {
  1855. this.quesModel.control = {};
  1856. }
  1857. this.quesModel.score = paperDetailUnit.score;
  1858. //如果是套题下面的小题编辑 ( paperDetailUnit的类型是套题,question的类型不是套题)
  1859. if (
  1860. this.isNested(paperDetailUnit.questionType) &&
  1861. question.questionType != paperDetailUnit.questionType
  1862. ) {
  1863. for (var i = 0; i < paperDetailUnit.question.subQuestions.length; i++) {
  1864. if (
  1865. paperDetailUnit.question.subQuestions[i].id == this.quesModel.id
  1866. ) {
  1867. this.quesModel.score = paperDetailUnit.subScoreList[i];
  1868. this.quesModel.parentType = paperDetailUnit.questionType;
  1869. this.quesModel.optionsSelected = paperDetailUnit.optionsSelected;
  1870. this.quesModel.parentQuesParam = paperDetailUnit.question.quesParam;
  1871. break;
  1872. }
  1873. }
  1874. }
  1875. if (isEmptyStr(this.quesModel.answerType)) {
  1876. this.quesModel.answerType = "DIVERSIFIED_TEXT";
  1877. }
  1878. if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
  1879. this.quesModel.quesBody = this.quesModel.quesBody.replace(
  1880. /______/g,
  1881. "###"
  1882. );
  1883. }
  1884. if (this.isNested(this.quesModel.questionType)) {
  1885. this.quesModel.quesBody = this.quesModel.quesBody.replace(
  1886. /___([1-9][0-9]*)___/g,
  1887. "##$1##"
  1888. );
  1889. }
  1890. this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
  1891. this.openQuesDialog();
  1892. },
  1893. //给singleRightAnswer和multipleRightAnswer赋值
  1894. assignAnswers() {
  1895. if (this.quesModel.quesOptions && this.quesModel.quesOptions.length > 0) {
  1896. this.singleRightAnswer = "";
  1897. this.multipleRightAnswer = [];
  1898. for (let i = 0; i < this.quesModel.quesOptions.length; i++) {
  1899. let option = this.quesModel.quesOptions[i];
  1900. if (
  1901. this.quesModel.questionType == "SINGLE_ANSWER_QUESTION" &&
  1902. option.isCorrect == 1
  1903. ) {
  1904. this.singleRightAnswer = String.fromCharCode(65 + i);
  1905. }
  1906. if (
  1907. this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION" &&
  1908. option.isCorrect == 1
  1909. ) {
  1910. this.multipleRightAnswer.push(String.fromCharCode(65 + i));
  1911. }
  1912. }
  1913. }
  1914. },
  1915. //打开修改试题编辑框
  1916. openQuesDialog() {
  1917. this.quesDialog = true;
  1918. },
  1919. //关闭试题编辑框
  1920. closeQuesDialog() {
  1921. this.quesDialog = false;
  1922. this.quesModel = {};
  1923. },
  1924. //删除属性
  1925. handleClose(tag) {
  1926. this.quesModel.quesProperties.splice(
  1927. this.quesModel.quesProperties.indexOf(tag),
  1928. 1
  1929. );
  1930. },
  1931. //查询一级属性
  1932. searchFirst() {
  1933. this.firstPropertyId = "";
  1934. this.secondPropertyId = "";
  1935. this.secondPropertyList = [];
  1936. if (this.coursePropertyId) {
  1937. for (let courseProperty of this.coursePropertyList) {
  1938. if (courseProperty.id == this.coursePropertyId) {
  1939. this.$http
  1940. .get(QUESTION_API + "/property/first/" + courseProperty.id)
  1941. .then((response) => {
  1942. this.firstPropertyList = response.data;
  1943. });
  1944. }
  1945. }
  1946. }
  1947. },
  1948. //查询二级属性
  1949. searchSecond() {
  1950. this.secondPropertyId = "";
  1951. if (this.firstPropertyId) {
  1952. this.$http
  1953. .get(QUESTION_API + "/property/second/" + this.firstPropertyId)
  1954. .then((response) => {
  1955. this.secondPropertyList = response.data;
  1956. });
  1957. }
  1958. },
  1959. //新增属性
  1960. insertProperty() {
  1961. if (!this.checkInsertPro()) {
  1962. return false;
  1963. }
  1964. var quesProperty = {
  1965. id: "",
  1966. courseProperty: {},
  1967. firstProperty: {},
  1968. secondProperty: {},
  1969. };
  1970. if (
  1971. this.quesModel.quesProperties == null ||
  1972. this.quesModel.quesProperties.length == 0
  1973. ) {
  1974. this.quesModel.quesProperties = [];
  1975. }
  1976. if (this.secondPropertyId) {
  1977. quesProperty.id =
  1978. this.coursePropertyId +
  1979. "-" +
  1980. this.firstPropertyId +
  1981. "-" +
  1982. this.secondPropertyId;
  1983. } else {
  1984. quesProperty.id = this.coursePropertyId + "-" + this.firstPropertyId;
  1985. }
  1986. for (let quesPro of this.quesModel.quesProperties) {
  1987. if (quesPro.id == quesProperty.id) {
  1988. this.$notify({
  1989. message: "该属性已存在,请重新选择",
  1990. type: "error",
  1991. });
  1992. return false;
  1993. }
  1994. }
  1995. for (let courseProperty of this.coursePropertyList) {
  1996. if (courseProperty.id == this.coursePropertyId) {
  1997. quesProperty.courseProperty = courseProperty;
  1998. }
  1999. }
  2000. //取到一级属性对象
  2001. for (let property of this.firstPropertyList) {
  2002. if (property.id == this.firstPropertyId) {
  2003. quesProperty.firstProperty = property;
  2004. }
  2005. }
  2006. //判断是否有二级属性
  2007. if (
  2008. this.secondPropertyList != undefined &&
  2009. this.secondPropertyList.length > 0
  2010. ) {
  2011. if (!this.secondPropertyId) {
  2012. this.$notify({
  2013. message: "请选择二级属性",
  2014. type: "error",
  2015. });
  2016. return false;
  2017. }
  2018. }
  2019. //取到二级属性对象
  2020. for (let property of this.secondPropertyList) {
  2021. if (property.id == this.secondPropertyId) {
  2022. quesProperty.secondProperty = property;
  2023. }
  2024. }
  2025. this.quesModel.quesProperties.push(quesProperty);
  2026. this.quesModel = Object.assign({}, this.quesModel);
  2027. //清空下拉框
  2028. this.coursePropertyId = "";
  2029. this.firstPropertyId = "";
  2030. this.secondPropertyId = "";
  2031. this.firstPropertyList = [];
  2032. this.secondPropertyList = [];
  2033. },
  2034. //新增属性验证
  2035. checkInsertPro() {
  2036. if (!this.coursePropertyId) {
  2037. this.$notify({
  2038. message: "请选择属性",
  2039. type: "error",
  2040. });
  2041. return false;
  2042. }
  2043. if (!this.firstPropertyId) {
  2044. this.$notify({
  2045. message: "请选择一级属性",
  2046. type: "error",
  2047. });
  2048. return false;
  2049. }
  2050. return true;
  2051. },
  2052. //删除选项
  2053. removeQuesOption(option) {
  2054. if (this.quesModel.quesOptions.length == 1) {
  2055. this.$notify({
  2056. message: "不能删除最后一个选项",
  2057. type: "error",
  2058. });
  2059. return;
  2060. }
  2061. this.singleRightAnswer = "";
  2062. this.multipleRightAnswer = [];
  2063. let index = this.quesModel.quesOptions.indexOf(option);
  2064. if (index !== -1) {
  2065. this.quesModel.quesOptions.splice(index, 1);
  2066. }
  2067. if (this.quesModel.quesOptions.length > 0) {
  2068. for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
  2069. var quesOption = this.quesModel.quesOptions[i];
  2070. quesOption["number"] = i + 1;
  2071. if (quesOption.isCorrect == 1) {
  2072. var answerOrderNum = String.fromCharCode(65 + i);
  2073. if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
  2074. this.singleRightAnswer = answerOrderNum;
  2075. }
  2076. if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
  2077. this.multipleRightAnswer.push(answerOrderNum);
  2078. }
  2079. }
  2080. }
  2081. }
  2082. },
  2083. //新增选项
  2084. addQuesOption() {
  2085. this.quesModel.quesOptions.push({
  2086. number: "",
  2087. optionBody: "",
  2088. isCorrect: "",
  2089. });
  2090. for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
  2091. this.quesModel.quesOptions[i]["number"] = i + 1;
  2092. }
  2093. },
  2094. savePaperDetailUnit() {
  2095. //跟新难度值
  2096. if (this.quesModel.difficultyDegree < 0.4) {
  2097. this.quesModel.difficulty = "难";
  2098. } else if (
  2099. this.quesModel.difficultyDegree > 0.3 &&
  2100. this.quesModel.difficultyDegree < 0.8
  2101. ) {
  2102. this.quesModel.difficulty = "中";
  2103. } else {
  2104. this.quesModel.difficulty = "易";
  2105. }
  2106. this.setRightAnswer();
  2107. if (/^\d+(?=\.{0,1}\d+$|$)/.test(this.quesModel.score)) {
  2108. console.log("正确");
  2109. } else {
  2110. this.$notify({
  2111. message: "分数只能为正数",
  2112. type: "error",
  2113. });
  2114. return;
  2115. }
  2116. if (this.paper.paperType == "GENERATE") {
  2117. this.$confirm(
  2118. "试题内容修改,会影响所有关联试卷,是否确定进行?",
  2119. "提示",
  2120. {
  2121. confirmButtonText: "确定",
  2122. cancelButtonText: "取消",
  2123. type: "warning",
  2124. }
  2125. ).then(() => {
  2126. this.submitPaperDetailUnit();
  2127. });
  2128. } else {
  2129. this.submitPaperDetailUnit();
  2130. }
  2131. },
  2132. submitPaperDetailUnit() {
  2133. let paperDetailUnitExp = {
  2134. id: this.editPaperDetailUnit.id,
  2135. question: this.quesModel,
  2136. score: this.quesModel.score,
  2137. };
  2138. if (
  2139. this.quesModel.quesOptions &&
  2140. this.quesModel.quesOptions.length == 0
  2141. ) {
  2142. this.$confirm("无选项将删除该试题, 是否继续?", "提示", {
  2143. confirmButtonText: "确定",
  2144. cancelButtonText: "取消",
  2145. type: "warning",
  2146. }).then(() => {
  2147. this.dialogLoading = true;
  2148. this.$http
  2149. .delete(
  2150. QUESTION_API +
  2151. "/paper/deleteQuestion/" +
  2152. this.editPaperDetailUnit.id +
  2153. "/" +
  2154. this.quesModel.id
  2155. )
  2156. .then((response) => {
  2157. if (response.data.length > 0) {
  2158. var deleteInfo =
  2159. "该试题被试卷:" +
  2160. response.data.join(" , ") +
  2161. "使用,不能删除";
  2162. this.$notify({
  2163. message: deleteInfo,
  2164. type: "error",
  2165. });
  2166. } else {
  2167. this.$notify({
  2168. message: "保存成功",
  2169. type: "success",
  2170. });
  2171. }
  2172. this.dialogLoading = false;
  2173. });
  2174. });
  2175. } else {
  2176. this.dialogLoading = true;
  2177. //校验音频重复
  2178. let audiomap = new Map();
  2179. let regex = new RegExp(
  2180. '<a id="[^<>]+" name="([^<>]+\\.mp3)"></a>',
  2181. "ig"
  2182. );
  2183. let ret = "";
  2184. let quesBodyStr = paperDetailUnitExp.question.quesBody;
  2185. if (quesBodyStr) {
  2186. while ((ret = regex.exec(quesBodyStr))) {
  2187. if (audiomap.get(ret[1])) {
  2188. this.dialogLoading = false;
  2189. this.$notify({
  2190. type: "error",
  2191. message: "题干中存在相同的音频文件",
  2192. });
  2193. return;
  2194. } else {
  2195. audiomap.set(ret[1], ret[1]);
  2196. }
  2197. }
  2198. }
  2199. let quesAnswerStr = paperDetailUnitExp.question.quesAnswer;
  2200. if (quesAnswerStr) {
  2201. while ((ret = regex.exec(quesAnswerStr))) {
  2202. if (audiomap.get(ret[1])) {
  2203. this.dialogLoading = false;
  2204. this.$notify({
  2205. type: "error",
  2206. message: "答案中存在相同的音频文件",
  2207. });
  2208. return;
  2209. } else {
  2210. audiomap.set(ret[1], ret[1]);
  2211. }
  2212. }
  2213. }
  2214. let quesOptions = paperDetailUnitExp.question.quesOptions;
  2215. if (quesOptions) {
  2216. for (let i = 0; i < quesOptions.length; i++) {
  2217. let quesOptionStr = quesOptions[i].optionBody;
  2218. while ((ret = regex.exec(quesOptionStr))) {
  2219. if (audiomap.get(ret[1])) {
  2220. this.dialogLoading = false;
  2221. this.$notify({
  2222. type: "error",
  2223. message: "选项中存在相同的音频文件",
  2224. });
  2225. return;
  2226. } else {
  2227. audiomap.set(ret[1], ret[1]);
  2228. }
  2229. }
  2230. }
  2231. }
  2232. paperDetailUnitExp.question.quesAnswer = this.answer;
  2233. this.$http
  2234. .put(QUESTION_API + "/paperDetailUnit", paperDetailUnitExp)
  2235. .then(() => {
  2236. this.$notify({
  2237. message: "保存成功",
  2238. type: "success",
  2239. });
  2240. this.dialogLoading = false;
  2241. this.closeQuesDialog();
  2242. this.initPaper();
  2243. })
  2244. .catch((err) => {
  2245. this.dialogLoading = false;
  2246. this.$notify({
  2247. type: "error",
  2248. message: err.response.data.desc,
  2249. });
  2250. });
  2251. }
  2252. },
  2253. //在正确的option上设置isCorrect=1
  2254. setRightAnswer() {
  2255. if (
  2256. !this.quesModel.quesOptions ||
  2257. this.quesModel.quesOptions.length == 0
  2258. ) {
  2259. return false;
  2260. }
  2261. for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
  2262. var option = this.quesModel.quesOptions[i];
  2263. var answerOrderNum = String.fromCharCode(65 + i);
  2264. if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
  2265. option["isCorrect"] =
  2266. answerOrderNum == this.singleRightAnswer ? 1 : 0;
  2267. }
  2268. if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
  2269. option["isCorrect"] =
  2270. this.multipleRightAnswer.indexOf(answerOrderNum) > -1 ? 1 : 0;
  2271. }
  2272. }
  2273. },
  2274. //删除试题
  2275. deleteQues(paperDetailUnit) {
  2276. let paperDetailUnitId = paperDetailUnit.id;
  2277. if (this.paper.paperType == "GENERATE") {
  2278. this.deleteQues01(paperDetailUnitId);
  2279. } else {
  2280. let questionId = paperDetailUnit.question.id;
  2281. this.deleteQues02(questionId, paperDetailUnitId);
  2282. }
  2283. },
  2284. deleteQues01(paperDetailUnitId) {
  2285. this.$alert("您确定删除吗?", "提示", {
  2286. confirmButtonText: "确定",
  2287. callback: (action) => {
  2288. if (action == "confirm") {
  2289. this.loading = true;
  2290. this.$http
  2291. .delete(QUESTION_API + "/paperDetailUnit/" + paperDetailUnitId)
  2292. .then(() => {
  2293. this.initPaper();
  2294. this.reduplicateGroup = [];
  2295. this.loading = true;
  2296. this.$notify({
  2297. message: "删除成功",
  2298. type: "success",
  2299. });
  2300. this.loading = false;
  2301. });
  2302. }
  2303. },
  2304. });
  2305. },
  2306. deleteQues02(questionId, paperDetailUnitId) {
  2307. this.$alert("您确定删除吗?", "提示", {
  2308. confirmButtonText: "确定",
  2309. callback: (action) => {
  2310. if (action == "confirm") {
  2311. this.loading = true;
  2312. this.$http
  2313. .delete(
  2314. QUESTION_API +
  2315. "/paper/deleteQuestion/" +
  2316. paperDetailUnitId +
  2317. "/" +
  2318. questionId
  2319. )
  2320. .then((response) => {
  2321. if (response.data.length > 0) {
  2322. var deleteInfo =
  2323. "该试题被试卷:" +
  2324. response.data.join(" , ") +
  2325. "使用,不能删除";
  2326. this.$notify({
  2327. message: deleteInfo,
  2328. type: "error",
  2329. });
  2330. } else {
  2331. this.initPaper();
  2332. this.reduplicateGroup = [];
  2333. this.loading = true;
  2334. this.$notify({
  2335. message: "保存成功",
  2336. type: "success",
  2337. });
  2338. }
  2339. this.loading = false;
  2340. });
  2341. }
  2342. },
  2343. });
  2344. },
  2345. exportPaperAnswer() {
  2346. var key = this.user.key;
  2347. var token = this.user.token;
  2348. window.open(
  2349. QUESTION_API +
  2350. "/paper/answer/export/" +
  2351. this.paperId +
  2352. "?$key=" +
  2353. key +
  2354. "&$token=" +
  2355. token
  2356. );
  2357. },
  2358. getSubQuesEditId(paperDetailUnit, subQuestion) {
  2359. return paperDetailUnit.question.id + "_" + subQuestion.subNumber;
  2360. },
  2361. //打开考试说明编辑框
  2362. openEditExamPaperRemark() {
  2363. if (this.paper.examRemark) {
  2364. this.examRemark = this.paper.examRemark;
  2365. } else {
  2366. this.examRemark = "";
  2367. }
  2368. this.paperRemarkDialog = true;
  2369. },
  2370. //保存考试说明
  2371. savePaperRemark() {
  2372. this.paper.examRemark = this.examRemark;
  2373. this.savePaper();
  2374. this.paperRemarkDialog = false;
  2375. },
  2376. //关闭考试说明编辑框
  2377. closPaperRemark() {
  2378. this.examRemark = "";
  2379. this.paperRemarkDialog = false;
  2380. },
  2381. //保存试卷
  2382. savePaper() {
  2383. this.loading = true;
  2384. this.$http
  2385. .put(QUESTION_API + "/paper", this.paper)
  2386. .then(() => {
  2387. this.$notify({
  2388. message: "保存成功",
  2389. type: "success",
  2390. });
  2391. this.loading = false;
  2392. this.initPaper();
  2393. })
  2394. .catch((error) => {
  2395. this.loading = false;
  2396. this.$notify({
  2397. type: "error",
  2398. message: error.response.data.desc,
  2399. });
  2400. });
  2401. },
  2402. //删除试卷
  2403. deletePaper() {
  2404. this.$confirm("确认删除试卷吗?", "提示", {
  2405. type: "warning",
  2406. }).then(() => {
  2407. this.loading = true;
  2408. this.selectedPaperIds = [];
  2409. this.selectedPaperIds.push(this.paper.id);
  2410. this.$http
  2411. .post(
  2412. QUESTION_API + "/paper/audit/delete",
  2413. new URLSearchParams({ paperIds: this.selectedPaperIds })
  2414. )
  2415. .then(
  2416. () => {
  2417. this.$notify({
  2418. message: "删除成功",
  2419. type: "success",
  2420. });
  2421. this.back();
  2422. },
  2423. (error) => {
  2424. this.$notify({
  2425. message: error.response.data.desc,
  2426. type: "error",
  2427. });
  2428. this.loading = false;
  2429. }
  2430. );
  2431. });
  2432. },
  2433. //打开上传音频弹框
  2434. openDialog() {
  2435. this.checkResult = false;
  2436. this.isUpload = true;
  2437. if (document.getElementById("radioFile")) {
  2438. document.getElementById("radioFile").value = "";
  2439. }
  2440. this.dialogRadioFile = true;
  2441. this.fileList = [];
  2442. },
  2443. //关闭音频弹框
  2444. closeAudioDialog() {
  2445. this.dialogRadioFile = this.uploadAudioLoading;
  2446. },
  2447. //返回
  2448. back() {
  2449. if (sessionStorage.getItem("question_back") == "true") {
  2450. this.$router.push({
  2451. path: "/questions/" + this.parentView + "/0",
  2452. });
  2453. } else {
  2454. this.$router.push({
  2455. path: "/questions/" + this.parentView + "/1",
  2456. });
  2457. }
  2458. },
  2459. paperDetailShow(paperDetail) {
  2460. if (this.reduplicateGroup.length == 0) {
  2461. return true;
  2462. }
  2463. let paperDetailUnits = paperDetail.paperDetailUnits;
  2464. for (let i = 0, imax = paperDetailUnits.length; i < imax; i++) {
  2465. for (var j = 0, jmax = this.reduplicateGroup.length; j < jmax; j++) {
  2466. if (paperDetailUnits[i].id == this.reduplicateGroup[j]) {
  2467. return true;
  2468. }
  2469. }
  2470. }
  2471. return false;
  2472. },
  2473. //上传文件检查
  2474. checkFile() {
  2475. this.fileNameList = [];
  2476. //读取选取的文件夹里面的文件
  2477. this.checkResult = true;
  2478. var files = document.getElementById("radioFile").files;
  2479. if (files.length == 0) {
  2480. this.message = "请选择音频文件夹!";
  2481. return;
  2482. }
  2483. var size = 0;
  2484. var isGo = false;
  2485. //取到所有文件的文件名
  2486. for (var i = 0; i < files.length; i++) {
  2487. this.fileNameList.push(files[i].name);
  2488. if (files[i].size > 5 * 1024 * 1024) {
  2489. isGo = true;
  2490. break;
  2491. }
  2492. size = files[i].size + size;
  2493. }
  2494. if (isGo) {
  2495. this.message = "上传单个文件不能超过5M";
  2496. this.isUpload = true;
  2497. }
  2498. if (size > 50 * 1024 * 1024) {
  2499. this.message = "上传文件总和不能超过50M";
  2500. this.isUpload = true;
  2501. return;
  2502. }
  2503. this.$http
  2504. .post(
  2505. QUESTION_API + "/checkRadioFile/" + this.paperId,
  2506. this.fileNameList
  2507. )
  2508. .then((response) => {
  2509. console.log("response:", response);
  2510. this.message = response.data.errorMsg;
  2511. if (this.message == "OK") {
  2512. this.message = "OK!";
  2513. this.isUpload = false;
  2514. } else {
  2515. this.isUpload = true;
  2516. }
  2517. })
  2518. .catch((error) => {
  2519. console.log(error);
  2520. });
  2521. },
  2522. //读取文件
  2523. uploadAudioFile() {
  2524. let param = new FormData();
  2525. var fileList = document.getElementById("radioFile").files;
  2526. //循环添加到formData中
  2527. for (var i = 0; i < fileList.length; i++) {
  2528. var file = fileList[i];
  2529. param.append("files", file, file.name);
  2530. }
  2531. let config = {
  2532. headers: { "Content-Type": "multipart/form-data" },
  2533. };
  2534. this.$http
  2535. .post(QUESTION_API + "/uploadRadio/" + this.paperId, param, config)
  2536. .then(() => {
  2537. this.dialogRadioFile = false;
  2538. this.uploadAudioLoading = false;
  2539. this.checkResult = false;
  2540. this.isUpload = true;
  2541. document.getElementById("radioFile").value = "";
  2542. this.initPaper();
  2543. })
  2544. .catch((error) => {
  2545. this.message = error.response.data.desc;
  2546. this.uploadAudioLoading = false;
  2547. });
  2548. },
  2549. },
  2550. };
  2551. </script>
  2552. <style scoped src="../styles/EditPaper.css">
  2553. .property_with {
  2554. width: 100px;
  2555. }
  2556. .ck-toolbar {
  2557. z-index: 9999;
  2558. }
  2559. #app {
  2560. background-color: white !important;
  2561. }
  2562. </style>
  2563. <style scoped src="../styles/Common.css"></style>