EditPaperPendingTrial.vue 84 KB

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