EditPaper.vue 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084
  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.difficultyDegree }}</span>
  33. </div>
  34. <div>
  35. <el-button type="primary" size="small" @click="savePaper">
  36. 保存
  37. </el-button>
  38. <el-button type="danger" size="small" @click="deletePaper(paper.id)">
  39. <i class="el-icon-delete"></i> 删除
  40. </el-button>
  41. <el-dropdown class="button_left">
  42. <el-button type="primary" size="small">
  43. 更多 <i class="el-icon-arrow-down el-icon--right"></i>
  44. </el-button>
  45. <el-dropdown-menu slot="dropdown">
  46. <el-dropdown-item>
  47. <el-button
  48. v-show="parentView == 'gen_paper'"
  49. type="danger"
  50. size="small"
  51. @click="recoveryPaper(paper.id)"
  52. ><i class="el-icon-delete"></i>回收
  53. </el-button>
  54. </el-dropdown-item>
  55. <el-dropdown-item>
  56. <el-button
  57. type="primary"
  58. :loading="duplicateLoading"
  59. size="small"
  60. @click="getreduplicateQuestions"
  61. ><i class="el-icon-zoom-in"></i>查重
  62. </el-button>
  63. </el-dropdown-item>
  64. <el-dropdown-item>
  65. <el-button
  66. v-show="parentView == 'import_paper'"
  67. type="primary"
  68. size="small"
  69. @click="openDialog"
  70. ><i class="el-icon-upload2"></i>上传音频
  71. </el-button>
  72. </el-dropdown-item>
  73. <el-dropdown-item>
  74. <el-button
  75. size="small"
  76. type="primary"
  77. @click="exportPaperAnswer()"
  78. ><i class="el-icon-download"></i>导出答案</el-button
  79. >
  80. </el-dropdown-item>
  81. <el-dropdown-item>
  82. <el-button
  83. v-show="parentView == 'import_paper'"
  84. type="primary"
  85. size="small"
  86. @click="openAnswerDialog"
  87. ><i class="el-icon-upload2"></i>导入答案
  88. </el-button>
  89. </el-dropdown-item>
  90. </el-dropdown-menu>
  91. </el-dropdown>
  92. <el-button
  93. size="small"
  94. type="primary"
  95. style="margin-left: 10px"
  96. @click="back"
  97. ><i class="el-icon-arrow-left"></i> 返回</el-button
  98. >
  99. </div>
  100. </div>
  101. </div>
  102. <div class="paperName">
  103. <div>
  104. <br />
  105. <h3 class="text-center">{{ paper.course.name }}&nbsp;试卷</h3>
  106. <h5 class="text-center">
  107. <span v-show="paper.hasAudio">(含音频试卷)</span>
  108. </h5>
  109. <br />
  110. <h4 class="text-center">(课程代码&nbsp;{{ paper.course.code }})</h4>
  111. <br />
  112. </div>
  113. <div class="text-left">
  114. <el-table :data="paper.paperDetails" border style="width: 100%">
  115. <el-table-column header-align="center" label="大题名称">
  116. <template slot-scope="scope">
  117. <span>{{ scope.row.name }}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column header-align="center" label="大题总分">
  121. <template slot-scope="scope">
  122. <span>{{ scope.row.score }}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column header-align="center" label="小题数量">
  126. <template slot-scope="scope">
  127. <span>{{ scope.row.unitCount }}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column header-align="center" label="公开数量">
  131. <template slot-scope="scope">
  132. <span>{{ scope.row.pubCount }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column header-align="center" label="非公开数量">
  136. <template slot-scope="scope">
  137. <span>{{ scope.row.noPubCount }}</span>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <div class="mainQues" style="margin-top: 20px; margin-left: 0px">
  142. <div class="mainQuesTitle">
  143. <span>考试说明:</span>
  144. <span>
  145. <el-button size="small" @click="openEditExamPaperRemark"
  146. >编辑</el-button
  147. >
  148. </span>
  149. <div style="width: 550px; margin-left: 20px; margin-top: 20px">
  150. <span v-html="paper.examRemark"></span>
  151. </div>
  152. </div>
  153. </div>
  154. <!-- end by wwh -->
  155. <div>
  156. <h1>本试卷满分{{ paper.totalScore }}分。</h1>
  157. </div>
  158. <br />
  159. </div>
  160. </div>
  161. <div>
  162. <!-- 循环大题 -->
  163. <div
  164. v-for="(paperDetail, detailIndex) in paper.paperDetails"
  165. v-show="paperDetailShow(paperDetail)"
  166. :key="detailIndex"
  167. class="mainQues"
  168. >
  169. <div
  170. class="mainQuesTitle"
  171. @mouseover="quesMouseOver(paperDetail.id)"
  172. @mouseout="quesMouseOut(paperDetail.id)"
  173. >
  174. <span>{{ paperDetail.cnNum }}</span> <span>.</span>
  175. <span>{{ paperDetail.name }}</span>
  176. <span>
  177. ({{ !paperDetail.title ? "本大题" : paperDetail.title + "," }}共{{
  178. paperDetail.unitCount
  179. }}小题,满分{{ paperDetail.score }}分)
  180. </span>
  181. <span :id="paperDetail.id" class="btnDiv">
  182. <el-button
  183. v-show="parentView == 'gen_paper'"
  184. size="small"
  185. @click="selectQues(paperDetail.id)"
  186. >选题
  187. </el-button>
  188. <el-button size="small" @click="openEditPaperDetail(paperDetail)"
  189. >编辑
  190. </el-button>
  191. <el-button
  192. v-if="showUp(paperDetail)"
  193. size="small"
  194. @click="movePaperDetail(paperDetail, 'up')"
  195. >上移
  196. </el-button>
  197. <el-button
  198. v-if="showDown(paperDetail)"
  199. size="small"
  200. @click="movePaperDetail(paperDetail, 'down')"
  201. >下移
  202. </el-button>
  203. <el-button
  204. size="small"
  205. type="danger"
  206. @click="deletePaperDetail(paperDetail.id)"
  207. >删除
  208. </el-button>
  209. <el-button
  210. v-show="showButtons[detailIndex].up"
  211. size="small"
  212. icon="el-icon-arrow-up"
  213. @click.stop="hideContent(detailIndex)"
  214. ></el-button>
  215. <el-button
  216. v-show="!showButtons[detailIndex].up"
  217. size="small"
  218. icon="el-icon-arrow-down"
  219. @click.stop="showContent(detailIndex)"
  220. ></el-button>
  221. </span>
  222. </div>
  223. <!-- 循环小题 -->
  224. <div v-show="showQuestions[detailIndex].is_show">
  225. <div
  226. v-for="(paperDetailUnit, unitIndex) in paperDetail.paperDetailUnits"
  227. v-show="quesShow(paperDetailUnit.id)"
  228. :key="unitIndex"
  229. class="ques"
  230. >
  231. <reduplicate_mark
  232. :id="paperDetailUnit.id"
  233. :show="reduplicateMarkShow(paperDetailUnit.id)"
  234. :fill-color="reduplicateMarkColor(paperDetailUnit.id)"
  235. :checked="reduplicateMarkCheck(paperDetailUnit.id)"
  236. @reduplicate_mark_check="reduplicate_mark_check"
  237. >
  238. </reduplicate_mark>
  239. <div
  240. class="quesSelect"
  241. @mouseover="quesMouseOver(paperDetailUnit.id)"
  242. @mouseout="quesMouseOut(paperDetailUnit.id)"
  243. >
  244. <div :id="paperDetailUnit.id" class="btnDiv">
  245. <el-button
  246. size="small"
  247. @click="editQues(paperDetailUnit, paperDetailUnit.question)"
  248. >编辑
  249. </el-button>
  250. <el-button
  251. type="danger"
  252. size="small"
  253. @click="deleteQues(paperDetailUnit)"
  254. >删除
  255. </el-button>
  256. </div>
  257. <div class="quesBody">
  258. <span class="ques-title">{{ paperDetailUnit.number }}.</span>
  259. <span
  260. v-question-audio
  261. class="ques-body"
  262. :hasAudio="paperDetailUnit.question.hasAudio"
  263. :questionId="paperDetailUnit.question.id"
  264. v-html="paperDetailUnit.question.quesBody"
  265. ></span>
  266. <span class="score-span">
  267. ({{ paperDetailUnit.score }}分)
  268. </span>
  269. </div>
  270. <div
  271. v-for="(quesOption, optionIndex) in paperDetailUnit.question
  272. .quesOptions"
  273. :key="optionIndex"
  274. class="quesOption"
  275. >
  276. <span class="ques-title"
  277. >{{ optionIndex | optionOrderWordFilter }}.
  278. </span>
  279. <span
  280. v-question-audio
  281. class="ques-body"
  282. :hasAudio="paperDetailUnit.question.hasAudio"
  283. :questionId="paperDetailUnit.question.id"
  284. v-html="quesOption.optionBody"
  285. ></span>
  286. </div>
  287. </div>
  288. <br />
  289. <div
  290. v-for="(subQuestion, subIndex) in paperDetailUnit.question
  291. .subQuestions"
  292. v-show="quesShow(subQuestion.id)"
  293. :key="subIndex"
  294. class="subQues"
  295. >
  296. <reduplicate_mark
  297. :show="reduplicateMarkShow(subQuestion.id)"
  298. ></reduplicate_mark>
  299. <div
  300. class="quesSelect"
  301. @mouseover="
  302. quesMouseOver(getSubQuesEditId(paperDetailUnit, subQuestion))
  303. "
  304. @mouseout="
  305. quesMouseOut(getSubQuesEditId(paperDetailUnit, subQuestion))
  306. "
  307. >
  308. <div
  309. :id="getSubQuesEditId(paperDetailUnit, subQuestion)"
  310. class="btnDiv"
  311. >
  312. <el-button
  313. size="small"
  314. @click="editQues(paperDetailUnit, subQuestion)"
  315. >编辑
  316. </el-button>
  317. </div>
  318. <div class="quesBody">
  319. <span class="ques-title"
  320. >{{ subQuestion.quesParams.number }}.
  321. </span>
  322. <span v-html="subQuestion.quesBody"></span>
  323. <span
  324. >({{ paperDetailUnit.subScoreList[subIndex] }}分)</span
  325. >
  326. </div>
  327. <div
  328. v-for="(
  329. subQuesOption, subOptIndex
  330. ) in subQuestion.quesOptions"
  331. :key="subOptIndex"
  332. class="quesOption"
  333. >
  334. <span class="ques-title"
  335. >{{ subOptIndex | optionOrderWordFilter }}.
  336. </span>
  337. <span v-html="subQuesOption.optionBody"></span>
  338. </div>
  339. <br />
  340. </div>
  341. </div>
  342. </div>
  343. <br />
  344. </div>
  345. </div>
  346. </div>
  347. <div class="text-left">
  348. <!-- 编辑大题弹框 -->
  349. <el-dialog
  350. v-loading.body="detailLoading"
  351. width="360px"
  352. title="大题名称编辑"
  353. element-loading-text="保存中。。。"
  354. :visible.sync="paperDatailDialog"
  355. @close="closeQuesDialog"
  356. >
  357. <el-form
  358. :model="editpaperDetail"
  359. label-position="right"
  360. label-width="80px"
  361. >
  362. <el-row :gutter="10">
  363. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  364. <el-form-item label="大题名称" placeholder="大题名称">
  365. <el-input
  366. v-model="editpaperDetail.name"
  367. class="dialog_input_width"
  368. />
  369. </el-form-item>
  370. </el-col>
  371. </el-row>
  372. <el-row>
  373. <el-form-item>
  374. <el-button
  375. type="primary"
  376. @click="savePaperDatail(editpaperDetail)"
  377. >保存</el-button
  378. >
  379. <el-button @click="closePaperDatailDialog()">取消</el-button>
  380. </el-form-item>
  381. </el-row>
  382. </el-form>
  383. </el-dialog>
  384. <!-- 编辑试题弹框 -->
  385. <el-dialog
  386. v-loading.body="dialogLoading"
  387. title="试题编辑"
  388. element-loading-text="保存中。。。"
  389. :visible.sync="quesDialog"
  390. @close="closeQuesDialog"
  391. >
  392. <el-form :model="quesModel" label-position="right" label-width="80px">
  393. <el-row :gutter="10">
  394. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  395. <el-form-item label="题型">
  396. <el-select
  397. v-model="quesModel.questionType"
  398. :disabled="true"
  399. placeholder="请输入题型"
  400. >
  401. <el-option
  402. v-for="item in questionTypes"
  403. :key="item.value"
  404. :label="item.label"
  405. :value="item.value"
  406. >
  407. </el-option>
  408. </el-select>
  409. </el-form-item>
  410. </el-col>
  411. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  412. <el-form-item label="分值">
  413. <el-input
  414. v-model="quesModel.score"
  415. placeholder="分值"
  416. :disabled="quesModel.questionType == 'NESTED_ANSWER_QUESTION'"
  417. ></el-input>
  418. </el-form-item>
  419. </el-col>
  420. </el-row>
  421. <!-- create by weiwenhai 添加难度,公开度,试题属性 -->
  422. <el-row :gutter="10">
  423. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  424. <el-form-item label="难度">
  425. <el-select
  426. v-model="quesModel.difficultyDegree"
  427. placeholder="请输入难度"
  428. :disabled="
  429. quesModel.questionType == 'NESTED_ANSWER_QUESTION'
  430. ? true
  431. : updatePorperty
  432. "
  433. >
  434. <el-option
  435. v-for="item in difficultyDegreeList"
  436. :key="item.value"
  437. :label="item.label"
  438. :value="item.value"
  439. >
  440. </el-option>
  441. </el-select>
  442. </el-form-item>
  443. </el-col>
  444. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  445. <el-form-item label="公开度">
  446. <el-select
  447. v-model="quesModel.publicity"
  448. placeholder="请输入公开度"
  449. :disabled="updatePorperty"
  450. >
  451. <el-option
  452. v-for="item in publicityList"
  453. :key="item.value"
  454. :label="item.label"
  455. :value="item.value"
  456. >
  457. </el-option>
  458. </el-select>
  459. </el-form-item>
  460. </el-col>
  461. <el-col
  462. v-if="quesModel.questionType == 'TEXT_ANSWER_QUESTION'"
  463. :xs="10"
  464. :sm="10"
  465. :md="10"
  466. :lg="10"
  467. >
  468. <el-form-item label="作答类型">
  469. <el-select
  470. v-model="quesModel.answerType"
  471. :disabled="updatePorperty"
  472. >
  473. <el-option
  474. v-for="item in answerTypes"
  475. :key="item.value"
  476. :label="item.label"
  477. :value="item.value"
  478. >
  479. </el-option>
  480. </el-select>
  481. </el-form-item>
  482. </el-col>
  483. </el-row>
  484. <el-row :gutter="10">
  485. <el-col :xs="20" :sm="20" :md="20" :lg="20">
  486. <el-form-item label="属性列表">
  487. <el-tooltip
  488. v-for="(content, propIndex) in quesModel.quesProperties"
  489. :key="propIndex"
  490. placement="top"
  491. >
  492. <div slot="content">
  493. <span v-if="content.firstProperty != null"
  494. >一级属性:{{ content.firstProperty.name }}({{
  495. content.firstProperty.code
  496. }})</span
  497. ><br />
  498. <span
  499. v-if="
  500. content.secondProperty != null &&
  501. content.secondProperty.code
  502. "
  503. >二级属性:{{ content.secondProperty.name }}({{
  504. content.secondProperty.code
  505. }})</span
  506. >
  507. </div>
  508. <span>
  509. <el-tag
  510. :key="content.id"
  511. style="margin-right: 5px"
  512. :closable="!updatePorperty"
  513. type="primary"
  514. @close="handleClose(content)"
  515. >
  516. {{ content.coursePropertyName }}
  517. </el-tag>
  518. </span>
  519. </el-tooltip>
  520. </el-form-item>
  521. </el-col>
  522. </el-row>
  523. <el-row>
  524. <el-col :span="6">
  525. <el-form-item label="属性名" label-width="60px">
  526. <el-select
  527. v-model="coursePropertyName"
  528. placeholder="属性名"
  529. class="property_with"
  530. :disabled="updatePorperty"
  531. @change="searchFirst"
  532. >
  533. <el-option label="请选择" value=""></el-option>
  534. <el-option
  535. v-for="item in coursePropertyList"
  536. :key="item.name"
  537. :label="item.name"
  538. :value="item.name"
  539. >
  540. </el-option>
  541. </el-select>
  542. </el-form-item>
  543. </el-col>
  544. <el-col :span="6">
  545. <el-form-item label="一级" label-width="48px">
  546. <el-select
  547. v-model="firstPropertyId"
  548. placeholder="一级"
  549. class="property_with"
  550. :disabled="updatePorperty"
  551. @change="searchSecond"
  552. >
  553. <el-option label="请选择" value=""></el-option>
  554. <el-option
  555. v-for="item in firstPropertyList"
  556. :key="item.id"
  557. :label="item.name + '(' + item.code + ')'"
  558. :value="item.id"
  559. >
  560. </el-option>
  561. </el-select>
  562. </el-form-item>
  563. </el-col>
  564. <el-col :span="6">
  565. <el-form-item label="二级" label-width="48px">
  566. <el-select
  567. v-model="secondPropertyId"
  568. placeholder="二级"
  569. class="property_with"
  570. :disabled="updatePorperty"
  571. >
  572. <el-option label="请选择" value=""></el-option>
  573. <el-option
  574. v-for="item in secondPropertyList"
  575. :key="item.id"
  576. :label="item.name + '(' + item.code + ')'"
  577. :value="item.id"
  578. >
  579. </el-option>
  580. </el-select>
  581. </el-form-item>
  582. </el-col>
  583. <el-col :span="6">
  584. <el-form-item>
  585. <el-button
  586. type="primary"
  587. style="margin-left: -50px"
  588. :disabled="updatePorperty"
  589. @click="insertProperty"
  590. ><i class="el-icon-plus"></i>新增属性
  591. </el-button>
  592. </el-form-item>
  593. </el-col>
  594. </el-row>
  595. <!-- end by weiwenhai -->
  596. <div>
  597. <el-row>
  598. <el-col>
  599. <el-form-item label="题目">
  600. <ckeditor v-model="quesModel.quesBody"></ckeditor>
  601. </el-form-item>
  602. </el-col>
  603. </el-row>
  604. <el-form-item
  605. v-for="(quesOption, optIndex) in quesModel.quesOptions"
  606. :key="optIndex"
  607. >
  608. <el-col :span="2">
  609. <el-radio
  610. v-if="quesModel.questionType === 'SINGLE_ANSWER_QUESTION'"
  611. v-model="singleRightAnswer"
  612. :label="optIndex | optionOrderWordFilter"
  613. ></el-radio>
  614. <el-checkbox
  615. v-if="quesModel.questionType === 'MULTIPLE_ANSWER_QUESTION'"
  616. v-model="multipleRightAnswer"
  617. :label="optIndex | optionOrderWordFilter"
  618. ></el-checkbox>
  619. </el-col>
  620. <el-col :span="20">
  621. <ckeditor v-model="quesOption.optionBody"></ckeditor>
  622. </el-col>
  623. <el-col :span="2">
  624. <i
  625. class="el-icon-delete"
  626. title="删除"
  627. @click.prevent="removeQuesOption(quesOption)"
  628. ></i>
  629. </el-col>
  630. </el-form-item>
  631. <div
  632. v-if="
  633. quesModel.questionType != 'NESTED_ANSWER_QUESTION' &&
  634. quesModel.questionType != 'SINGLE_ANSWER_QUESTION' &&
  635. quesModel.questionType != 'MULTIPLE_ANSWER_QUESTION' &&
  636. quesModel.questionType != 'BOOL_ANSWER_QUESTION'
  637. "
  638. >
  639. <el-form-item label="答案">
  640. <ckeditor v-model="quesModel.quesAnswer"></ckeditor>
  641. </el-form-item>
  642. </div>
  643. <!-- 单选或多选 -->
  644. <div
  645. v-if="
  646. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  647. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
  648. "
  649. >
  650. <el-form-item label="答案">
  651. <span v-html="answer"></span>
  652. </el-form-item>
  653. </div>
  654. <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
  655. <el-row>
  656. <el-col>
  657. <el-form-item label="答案" prop="quesAnswer">
  658. <el-select
  659. v-model="quesModel.quesAnswer"
  660. placeholder="请选择"
  661. >
  662. <el-option
  663. v-for="op in options"
  664. :key="op"
  665. :label="op"
  666. :value="op"
  667. >
  668. </el-option>
  669. </el-select>
  670. </el-form-item>
  671. </el-col>
  672. </el-row>
  673. </div>
  674. </div>
  675. <div
  676. :class="{
  677. margin_left_30:
  678. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  679. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION',
  680. margin_left_40: !(
  681. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  682. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
  683. ),
  684. }"
  685. >
  686. <el-button
  687. v-if="
  688. quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
  689. quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
  690. "
  691. type="primary"
  692. @click="addQuesOption"
  693. ><i class="el-icon-plus"></i> 新增选项
  694. </el-button>
  695. <el-button type="primary" @click="savePaperDetailUnit()"
  696. >保存</el-button
  697. >
  698. <el-button @click="closeQuesDialog">取消</el-button>
  699. </div>
  700. </el-form>
  701. </el-dialog>
  702. <!-- 考试说明弹框 -->
  703. <el-dialog title="考试说明编辑" :visible.sync="paperRemarkDialog">
  704. <el-form label-position="right" label-width="80px">
  705. <el-row :gutter="10">
  706. <el-col :xs="10" :sm="10" :md="10" :lg="10">
  707. <el-form-item label="考试说明">
  708. <div style="width: 550px">
  709. <ckeditor
  710. v-model="examRemark"
  711. :display="display"
  712. :width="wValue"
  713. :height="hValue"
  714. ></ckeditor>
  715. </div>
  716. </el-form-item>
  717. </el-col>
  718. </el-row>
  719. <div style="margin-top: 20px; margin-left: 40%">
  720. <el-button type="primary" @click="savePaperRemark">保存</el-button>
  721. <el-button @click="closPaperRemark">取消</el-button>
  722. </div>
  723. </el-form>
  724. </el-dialog>
  725. <!-- 上传音频弹框 -->
  726. <el-dialog
  727. title="上传音频文件"
  728. :visible.sync="dialogRadioFile"
  729. :before-close="closeAudioDialog"
  730. >
  731. <form
  732. id="radioForm"
  733. method="post"
  734. action=""
  735. enctype="multipart/form-data"
  736. >
  737. <input
  738. id="radioFile"
  739. name="files"
  740. type="file"
  741. value="上传音频文件"
  742. webkitdirectory
  743. />
  744. <el-button type="warning" @click="checkFile">检查文件名</el-button>
  745. <el-button
  746. type="info"
  747. :loading="uploadAudioLoading"
  748. :disabled="isUpload || uploadAudioLoading"
  749. @click="uploadAudioFile"
  750. >
  751. <span v-show="!uploadAudioLoading">开始上传</span>
  752. <span v-show="uploadAudioLoading">正在上传中...</span>
  753. </el-button>
  754. </form>
  755. <div v-if="checkResult" style="margin-top: 20px">
  756. <span>检查结果:</span><br /><br />
  757. <span v-show="message == 'OK!'" style="color: #13ce66">OK!</span>
  758. <span v-show="message != 'OK!'" style="color: #ff4949">{{
  759. message
  760. }}</span>
  761. </div>
  762. </el-dialog>
  763. <el-dialog
  764. title="上传答案文件"
  765. :visible.sync="dialogAnswerFile"
  766. :before-close="closeAnswerDialog"
  767. >
  768. <form
  769. id="answerForm"
  770. method="post"
  771. action=""
  772. enctype="multipart/form-data"
  773. >
  774. <input
  775. id="answerFile"
  776. name="answerFiles"
  777. type="file"
  778. value="上传答案文件"
  779. accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  780. />
  781. <el-button type="info" @click="downAnswerTemplate">
  782. <span>下载模板</span>
  783. </el-button>
  784. <el-button
  785. type="info"
  786. :loading="uploadAnswerLoading"
  787. :disabled="uploadAnswerLoading"
  788. @click="uploadAnswerFile"
  789. >
  790. <span v-show="!uploadAnswerLoading">开始上传</span>
  791. <span v-show="uploadAnswerLoading">正在上传中...</span>
  792. </el-button>
  793. </form>
  794. <div style="margin-top: 20px">
  795. <span v-show="answerMessage != ''" style="color: #ff4949">{{
  796. answerMessage
  797. }}</span>
  798. </div>
  799. </el-dialog>
  800. </div>
  801. </div>
  802. </template>
  803. <script>
  804. import { QUESTION_API } from "@/constants/constants";
  805. import { isEmptyStr, QUESTION_TYPES } from "../constants/constants";
  806. import { mapState } from "vuex";
  807. import reduplicate_mark from "../component/reduplicate_mark.vue";
  808. import randomColor from "randomcolor";
  809. import ckeditor from "../component/ckeditor.vue";
  810. export default {
  811. name: "EditPaperApp",
  812. components: {
  813. reduplicate_mark,
  814. ckeditor,
  815. },
  816. data() {
  817. return {
  818. hValue: "100px",
  819. wValue: "500px",
  820. display: "block",
  821. uploadAction: "",
  822. fileList: [],
  823. answerFileList: [],
  824. paperId: "",
  825. paperDetailId: "",
  826. editPaperDetailUnit: "",
  827. quesDialog: false,
  828. paperDatailDialog: false,
  829. paperRemarkDialog: false,
  830. parentView: "",
  831. paper: {
  832. course: {
  833. code: "",
  834. name: "",
  835. },
  836. examRemark: "",
  837. },
  838. loading: false,
  839. dialogLoading: false,
  840. detailLoading: false,
  841. uploadAudioLoading: false,
  842. uploadAnswerLoading: false,
  843. questionTypes: QUESTION_TYPES,
  844. questionType: "",
  845. quesModel: { quesProperties: [] },
  846. editpaperDetail: {},
  847. reduplicateQuestions: [],
  848. reduplicateGroup: [],
  849. reduplicateQuesColor: [],
  850. singleRightAnswer: "", //接收单选答案
  851. multipleRightAnswer: [], //接收多选答案
  852. options: ["正确", "错误"],
  853. duplicateLoading: false,
  854. dialogRadioFile: false,
  855. dialogAnswerFile: false,
  856. isUpload: true,
  857. isUploadAnswer: true,
  858. message: "",
  859. answerMessage: "",
  860. checkResult: false,
  861. checkResultAnswer: false,
  862. fileNameList: [],
  863. defaultColor: [
  864. "Red",
  865. "Blue",
  866. "LimeGreen",
  867. "GoldenRod",
  868. "Black",
  869. "BlueViolet",
  870. "Chocolate",
  871. "DarkCyan",
  872. "HotPink",
  873. "Orange",
  874. "IndianRed",
  875. "Indigo",
  876. "Green",
  877. "Aqua",
  878. "CadetBlue",
  879. "SkyBlue",
  880. "SlateBlue",
  881. "SlateGray",
  882. "Tomato",
  883. "VioletRed",
  884. ],
  885. difficultyDegreeList: [
  886. { label: 0.1, value: 0.1 },
  887. { label: 0.2, value: 0.2 },
  888. { label: 0.3, value: 0.3 },
  889. { label: 0.4, value: 0.4 },
  890. { label: 0.5, value: 0.5 },
  891. { label: 0.6, value: 0.6 },
  892. { label: 0.7, value: 0.7 },
  893. { label: 0.8, value: 0.8 },
  894. { label: 0.9, value: 0.9 },
  895. { label: 1.0, value: 1.0 },
  896. ],
  897. publicityList: [
  898. { label: "公开", value: true },
  899. { label: "非公开", value: false },
  900. ],
  901. answerTypes: [
  902. { label: "文本", value: "DIVERSIFIED_TEXT" },
  903. { label: "音频", value: "SINGLE_AUDIO" },
  904. ],
  905. coursePropertyList: [],
  906. coursePropertyName: "", //课程属性名
  907. firstPropertyList: [], //一级属性集合
  908. firstPropertyId: "", //一级属性id
  909. secondPropertyList: [], //二级属性集合
  910. secondPropertyId: "", //二级属性id
  911. examRemark: "",
  912. showQuestions: [],
  913. showButtons: [],
  914. };
  915. },
  916. computed: {
  917. ...mapState({
  918. user: (state) => state.user,
  919. }),
  920. updatePorperty() {
  921. return false;
  922. },
  923. answer() {
  924. if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
  925. return this.singleRightAnswer;
  926. } else if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
  927. var obj = this.multipleRightAnswer;
  928. return obj.sort().toString();
  929. }
  930. return this.quesModel.quesAnswer;
  931. },
  932. },
  933. created() {
  934. // $("body").attr("style", "");
  935. document.getElementsByTagName("body")[0].style = "";
  936. this.paperId = this.$route.params.id;
  937. this.parentView = this.$route.params.parentView;
  938. this.initPaper();
  939. this.getreduplicateQuestions();
  940. this.uploadAction = QUESTION_API + "/uploadRadio/" + this.paperId;
  941. this.uploadHeaders = {
  942. key: this.user.key,
  943. token: this.user.token,
  944. };
  945. },
  946. methods: {
  947. recoveryPaper(paperid) {
  948. this.$confirm("确认回收试卷吗?", "提示", {
  949. type: "warning",
  950. }).then(() => {
  951. this.loading = true;
  952. this.$http
  953. .put(QUESTION_API + "/paper_storage/recovery/" + paperid)
  954. .then(
  955. () => {
  956. this.loading = false;
  957. this.$notify({
  958. message: "操作成功",
  959. type: "success",
  960. });
  961. this.back();
  962. },
  963. (response) => {
  964. this.loading = false;
  965. this.$notify({
  966. message: response.response.data.desc,
  967. type: "error",
  968. });
  969. }
  970. );
  971. });
  972. },
  973. movePaperDetail(detail, vector) {
  974. let vectorStr = vector == "up" ? "上移" : "下移";
  975. this.$alert("您确定" + vectorStr + "吗?", "提示", {
  976. confirmButtonText: "确定",
  977. callback: (action) => {
  978. if (action == "confirm") {
  979. this.loading = true;
  980. this.$httpWithMsg
  981. .put(
  982. QUESTION_API +
  983. "/paperDetail/" +
  984. this.paperId +
  985. "/" +
  986. detail.id +
  987. "/" +
  988. vector
  989. )
  990. .then(() => {
  991. this.initPaper();
  992. this.loading = true;
  993. this.$notify({
  994. message: vectorStr + "成功",
  995. type: "success",
  996. });
  997. })
  998. .finally(() => (this.loading = false));
  999. }
  1000. },
  1001. });
  1002. },
  1003. showUp(detail) {
  1004. if (this.paper.paperDetails.length <= 1) {
  1005. return false;
  1006. }
  1007. if (detail.id != this.paper.paperDetails[0].id) {
  1008. return true;
  1009. } else {
  1010. return false;
  1011. }
  1012. },
  1013. showDown(detail) {
  1014. if (this.paper.paperDetails.length <= 1) {
  1015. return false;
  1016. }
  1017. if (
  1018. detail.id !=
  1019. this.paper.paperDetails[this.paper.paperDetails.length - 1].id
  1020. ) {
  1021. return true;
  1022. } else {
  1023. return false;
  1024. }
  1025. },
  1026. downAnswerTemplate() {
  1027. var key = this.user.key;
  1028. var token = this.user.token;
  1029. window.open(
  1030. QUESTION_API + "/paper/answer/template?$key=" + key + "&$token=" + token
  1031. );
  1032. },
  1033. openAnswerDialog() {
  1034. this.checkResultAnswer = false;
  1035. this.isUploadAnswer = true;
  1036. if (document.getElementById("answerFile")) {
  1037. document.getElementById("answerFile").value = "";
  1038. }
  1039. this.dialogAnswerFile = true;
  1040. this.answerFileList = [];
  1041. },
  1042. closeAnswerDialog() {
  1043. this.answerMessage = "";
  1044. this.dialogAnswerFile = this.uploadAnswerLoading;
  1045. },
  1046. uploadAnswerFile() {
  1047. this.answerMessage = "";
  1048. var fileList = document.getElementById("answerFile").files;
  1049. if (fileList.length == 0) {
  1050. this.answerMessage = "请选择文件!";
  1051. return;
  1052. }
  1053. let param = new FormData();
  1054. //循环添加到formData中
  1055. for (var i = 0; i < fileList.length; i++) {
  1056. var file = fileList[i];
  1057. param.append("dataFile", file, file.name);
  1058. }
  1059. let config = {
  1060. headers: { "Content-Type": "multipart/form-data" },
  1061. };
  1062. this.uploadAnswerLoading = true;
  1063. this.$http
  1064. .post(
  1065. QUESTION_API + "/paper/answer/import/" + this.paperId,
  1066. param,
  1067. config
  1068. )
  1069. .then(() => {
  1070. this.dialogAnswerFile = false;
  1071. this.uploadAnswerLoading = false;
  1072. this.checkResultAnswer = false;
  1073. this.isUploadAnswer = true;
  1074. document.getElementById("answerFile").value = "";
  1075. this.initPaper();
  1076. })
  1077. .catch((error) => {
  1078. this.answerMessage = error.response.data.desc;
  1079. document.getElementById("answerFile").value = "";
  1080. this.uploadAnswerLoading = false;
  1081. });
  1082. },
  1083. //隐藏大题下的所有小题
  1084. hideContent(index) {
  1085. console.log("up");
  1086. this.showQuestions[index].is_show = false;
  1087. this.showButtons[index].up = false;
  1088. },
  1089. //展开大题下所有小题
  1090. showContent(index) {
  1091. console.log("down");
  1092. this.showQuestions[index].is_show = true;
  1093. this.showButtons[index].up = true;
  1094. },
  1095. quesMouseOver(index) {
  1096. document.getElementById(index).style.visibility = "visible";
  1097. },
  1098. quesMouseOut(index) {
  1099. document.getElementById(index).style.visibility = "hidden";
  1100. },
  1101. selectQues(id) {
  1102. this.paperDetailId = id;
  1103. var courseCode = this.paper.course.code;
  1104. var courseName = this.paper.course.name;
  1105. this.$router.push({
  1106. path:
  1107. "/select_question/" +
  1108. this.paper.id +
  1109. "/" +
  1110. courseCode +
  1111. "/" +
  1112. encodeURIComponent(courseName) +
  1113. "/" +
  1114. this.paperDetailId +
  1115. "/" +
  1116. this.parentView,
  1117. });
  1118. },
  1119. //打开编辑大题题目弹窗
  1120. openEditPaperDetail(paperDetail) {
  1121. this.paperDatailDialog = true;
  1122. this.editpaperDetail = Object.assign({}, paperDetail); //浅拷贝
  1123. },
  1124. //关闭编辑大题题目弹窗
  1125. closePaperDatailDialog() {
  1126. this.paperDatailDialog = false;
  1127. this.editpaperDetail = {};
  1128. },
  1129. //保存大题题目信息
  1130. savePaperDatail(editpaperDetail) {
  1131. this.detailLoading = true;
  1132. var paperId = this.paper.id;
  1133. this.$http
  1134. .post(QUESTION_API + "/updatePaperDetail/" + paperId, editpaperDetail)
  1135. .then(() => {
  1136. this.$notify({
  1137. message: "保存成功",
  1138. type: "success",
  1139. });
  1140. this.detailLoading = false;
  1141. this.closePaperDatailDialog();
  1142. this.initPaper();
  1143. });
  1144. },
  1145. //初始化试卷
  1146. initPaper() {
  1147. const scrollPosition =
  1148. document.documentElement.scrollTop || document.body.scrollTop;
  1149. this.loading = true;
  1150. this.paper = {
  1151. course: {
  1152. code: "",
  1153. name: "",
  1154. },
  1155. };
  1156. this.$http
  1157. .get(QUESTION_API + "/paper/" + this.paperId)
  1158. .then((response) => {
  1159. this.paper = response.data;
  1160. //查询所有课程属性名
  1161. this.initCourseProperty(this.paper.course.code);
  1162. //将所有小题分为公开和非公开
  1163. if (this.paper.paperDetails && this.paper.paperDetails.length > 0) {
  1164. for (let paperDetil of this.paper.paperDetails) {
  1165. this.showQuestions.push({ is_show: true });
  1166. this.showButtons.push({ up: true });
  1167. paperDetil.pubCount = 0;
  1168. paperDetil.noPubCount = 0;
  1169. if (
  1170. paperDetil.paperDetailUnits &&
  1171. paperDetil.paperDetailUnits.length > 0
  1172. ) {
  1173. for (let paperDetilUt of paperDetil.paperDetailUnits) {
  1174. if (
  1175. paperDetilUt.question.questionType !=
  1176. "NESTED_ANSWER_QUESTION"
  1177. ) {
  1178. //非套题
  1179. if (paperDetilUt.question.publicity) {
  1180. paperDetil.pubCount = paperDetil.pubCount + 1;
  1181. } else {
  1182. paperDetil.noPubCount = paperDetil.noPubCount + 1;
  1183. }
  1184. } else {
  1185. //循环所有子题
  1186. for (let ques of paperDetilUt.question.subQuestions) {
  1187. if (ques.publicity) {
  1188. paperDetil.pubCount = paperDetil.pubCount + 1;
  1189. } else {
  1190. paperDetil.noPubCount = paperDetil.noPubCount + 1;
  1191. }
  1192. }
  1193. }
  1194. }
  1195. }
  1196. }
  1197. }
  1198. setTimeout(() => {
  1199. document.documentElement.scrollTop = document.body.scrollTop =
  1200. scrollPosition;
  1201. console.log(scrollPosition);
  1202. }, 1000);
  1203. this.loading = false;
  1204. });
  1205. },
  1206. //查询所有课程属性名
  1207. initCourseProperty(courseCode) {
  1208. this.$http
  1209. .get(QUESTION_API + "/courseProperty/enable/" + courseCode)
  1210. .then((response) => {
  1211. this.coursePropertyList = response.data;
  1212. });
  1213. },
  1214. //删除大题
  1215. deletePaperDetail(paperDetailsId) {
  1216. //先判断大题下面是否还有小题
  1217. var count = 0;
  1218. for (var i = 0, imax = this.paper.paperDetails.length; i < imax; i++) {
  1219. if (paperDetailsId == this.paper.paperDetails[i].id) {
  1220. if (this.paper.paperDetails[i].paperDetailUnits) {
  1221. count += this.paper.paperDetails[i].paperDetailUnits.length;
  1222. break;
  1223. }
  1224. }
  1225. }
  1226. if (count == 0) {
  1227. this.$alert("您确定删除吗?", "提示", {
  1228. confirmButtonText: "确定",
  1229. callback: (action) => {
  1230. if (action == "confirm") {
  1231. this.loading = true;
  1232. this.$httpWithMsg
  1233. .delete(
  1234. QUESTION_API +
  1235. "/paperDetail/" +
  1236. this.paperId +
  1237. "/" +
  1238. paperDetailsId
  1239. )
  1240. .then(() => {
  1241. this.initPaper();
  1242. this.loading = true;
  1243. this.$notify({
  1244. message: "删除成功",
  1245. type: "success",
  1246. });
  1247. })
  1248. .finally(() => (this.loading = false));
  1249. }
  1250. },
  1251. });
  1252. } else {
  1253. this.$alert("大题下还有小题,不可删除!", "提示", {
  1254. confirmButtonText: "确定",
  1255. callback: () => {},
  1256. });
  1257. }
  1258. },
  1259. quesShow(id) {
  1260. if (this.reduplicateGroup.length < 1) {
  1261. return true;
  1262. }
  1263. for (var i = 0, imax = this.reduplicateGroup.length; i < imax; i++) {
  1264. if (id == this.reduplicateGroup[i]) {
  1265. return true;
  1266. }
  1267. }
  1268. return false;
  1269. },
  1270. reduplicateMarkShow(id) {
  1271. var found = false;
  1272. for (var i = 0, imax = this.reduplicateQuestions.length; i < imax; i++) {
  1273. for (
  1274. var j = 0, jmax = this.reduplicateQuestions[i].length;
  1275. j < jmax;
  1276. j++
  1277. ) {
  1278. if (this.reduplicateQuestions[i][j] == id) {
  1279. found = true;
  1280. break;
  1281. }
  1282. }
  1283. if (found) {
  1284. break;
  1285. }
  1286. }
  1287. return found;
  1288. },
  1289. reduplicateMarkColor(id) {
  1290. for (var i = 0, imax = this.reduplicateQuestions.length; i < imax; i++) {
  1291. for (
  1292. var j = 0, jmax = this.reduplicateQuestions[i].length;
  1293. j < jmax;
  1294. j++
  1295. ) {
  1296. if (this.reduplicateQuestions[i][j] == id) {
  1297. return this.reduplicateQuesColor[i];
  1298. }
  1299. }
  1300. }
  1301. },
  1302. reduplicateMarkCheck(id) {
  1303. for (var i = 0, imax = this.reduplicateGroup.length; i < imax; i++) {
  1304. if (id == this.reduplicateGroup[i]) {
  1305. return true;
  1306. }
  1307. }
  1308. return false;
  1309. },
  1310. reduplicate_mark_check(id, checked) {
  1311. console.log(checked);
  1312. console.log(this.reduplicateQuestions);
  1313. console.log(id);
  1314. if (!checked) {
  1315. for (
  1316. var i = 0, imax = this.reduplicateQuestions.length;
  1317. i < imax;
  1318. i++
  1319. ) {
  1320. for (
  1321. var j = 0, jmax = this.reduplicateQuestions[i].length;
  1322. j < jmax;
  1323. j++
  1324. ) {
  1325. if (this.reduplicateQuestions[i][j] == id) {
  1326. this.reduplicateGroup = [];
  1327. for (
  1328. var k = 0, kmax = this.reduplicateQuestions[i].length;
  1329. k < kmax;
  1330. k++
  1331. ) {
  1332. this.reduplicateGroup.push(this.reduplicateQuestions[i][k]);
  1333. }
  1334. return;
  1335. }
  1336. }
  1337. }
  1338. } else {
  1339. this.reduplicateGroup = [];
  1340. }
  1341. },
  1342. //编辑题目
  1343. editQues(paperDetailUnit, question) {
  1344. console.log("question:", question);
  1345. this.coursePropertyName = "";
  1346. this.firstPropertyId = "";
  1347. this.secondPropertyId = "";
  1348. this.editPaperDetailUnit = paperDetailUnit;
  1349. this.quesModel = JSON.parse(JSON.stringify(question)); //深拷贝
  1350. this.quesModel.score = paperDetailUnit.score;
  1351. //如果是套题下面的小题编辑 ( paperDetailUnit的类型是套题,question的类型不是套题)
  1352. if (
  1353. paperDetailUnit.questionType == "NESTED_ANSWER_QUESTION" &&
  1354. question.questionType != "NESTED_ANSWER_QUESTION"
  1355. ) {
  1356. for (var i = 0; i < paperDetailUnit.question.subQuestions.length; i++) {
  1357. if (
  1358. paperDetailUnit.question.subQuestions[i].id == this.quesModel.id
  1359. ) {
  1360. this.quesModel.score = paperDetailUnit.subScoreList[i];
  1361. break;
  1362. }
  1363. }
  1364. }
  1365. if (isEmptyStr(this.quesModel.answerType)) {
  1366. this.quesModel.answerType = "DIVERSIFIED_TEXT";
  1367. }
  1368. if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
  1369. this.quesModel.quesBody = this.quesModel.quesBody.replace(
  1370. /______/g,
  1371. "###"
  1372. );
  1373. }
  1374. this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
  1375. this.openQuesDialog();
  1376. },
  1377. //给singleRightAnswer和multipleRightAnswer赋值
  1378. assignAnswers() {
  1379. if (this.quesModel.quesOptions && this.quesModel.quesOptions.length > 0) {
  1380. this.singleRightAnswer = "";
  1381. this.multipleRightAnswer = [];
  1382. for (let i = 0; i < this.quesModel.quesOptions.length; i++) {
  1383. let option = this.quesModel.quesOptions[i];
  1384. if (
  1385. this.quesModel.questionType == "SINGLE_ANSWER_QUESTION" &&
  1386. option.isCorrect == 1
  1387. ) {
  1388. this.singleRightAnswer = String.fromCharCode(65 + i);
  1389. }
  1390. if (
  1391. this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION" &&
  1392. option.isCorrect == 1
  1393. ) {
  1394. this.multipleRightAnswer.push(String.fromCharCode(65 + i));
  1395. }
  1396. }
  1397. }
  1398. },
  1399. //打开修改试题编辑框
  1400. openQuesDialog() {
  1401. this.quesDialog = true;
  1402. },
  1403. //关闭试题编辑框
  1404. closeQuesDialog() {
  1405. this.quesDialog = false;
  1406. this.quesModel = {};
  1407. },
  1408. //删除属性
  1409. handleClose(tag) {
  1410. this.quesModel.quesProperties.splice(
  1411. this.quesModel.quesProperties.indexOf(tag),
  1412. 1
  1413. );
  1414. },
  1415. //查询一级属性
  1416. searchFirst() {
  1417. this.firstPropertyId = "";
  1418. this.secondPropertyId = "";
  1419. this.secondPropertyList = [];
  1420. if (this.coursePropertyName) {
  1421. for (let courseProperty of this.coursePropertyList) {
  1422. if (courseProperty.name == this.coursePropertyName) {
  1423. this.$http
  1424. .get(QUESTION_API + "/property/first/" + courseProperty.id)
  1425. .then((response) => {
  1426. this.firstPropertyList = response.data;
  1427. });
  1428. }
  1429. }
  1430. }
  1431. },
  1432. //查询二级属性
  1433. searchSecond() {
  1434. this.secondPropertyId = "";
  1435. if (this.firstPropertyId) {
  1436. this.$http
  1437. .get(QUESTION_API + "/property/second/" + this.firstPropertyId)
  1438. .then((response) => {
  1439. this.secondPropertyList = response.data;
  1440. });
  1441. }
  1442. },
  1443. //新增属性
  1444. insertProperty() {
  1445. if (!this.checkInsertPro()) {
  1446. return false;
  1447. }
  1448. var quesProperty = {
  1449. id: "",
  1450. coursePropertyName: "",
  1451. firstProperty: {},
  1452. secondProperty: {},
  1453. };
  1454. if (
  1455. this.quesModel.quesProperties == null ||
  1456. this.quesModel.quesProperties.length == 0
  1457. ) {
  1458. this.quesModel.quesProperties = [];
  1459. }
  1460. if (this.secondPropertyId) {
  1461. quesProperty.id =
  1462. this.coursePropertyName +
  1463. "-" +
  1464. this.firstPropertyId +
  1465. "-" +
  1466. this.secondPropertyId;
  1467. } else {
  1468. quesProperty.id = this.coursePropertyName + "-" + this.firstPropertyId;
  1469. }
  1470. for (let quesPro of this.quesModel.quesProperties) {
  1471. if (quesPro.id == quesProperty.id) {
  1472. this.$notify({
  1473. message: "该属性已存在,请重新选择",
  1474. type: "error",
  1475. });
  1476. return false;
  1477. }
  1478. }
  1479. quesProperty.coursePropertyName = this.coursePropertyName;
  1480. //取到一级属性对象
  1481. for (let property of this.firstPropertyList) {
  1482. if (property.id == this.firstPropertyId) {
  1483. quesProperty.firstProperty = property;
  1484. }
  1485. }
  1486. //判断是否有二级属性
  1487. if (
  1488. this.secondPropertyList != undefined &&
  1489. this.secondPropertyList.length > 0
  1490. ) {
  1491. if (!this.secondPropertyId) {
  1492. this.$notify({
  1493. message: "请选择二级属性",
  1494. type: "error",
  1495. });
  1496. return false;
  1497. }
  1498. }
  1499. //取到二级属性对象
  1500. for (let property of this.secondPropertyList) {
  1501. if (property.id == this.secondPropertyId) {
  1502. quesProperty.secondProperty = property;
  1503. }
  1504. }
  1505. this.quesModel.quesProperties.push(quesProperty);
  1506. this.quesModel = Object.assign({}, this.quesModel);
  1507. //清空下拉框
  1508. this.coursePropertyName = "";
  1509. this.firstPropertyId = "";
  1510. this.secondPropertyId = "";
  1511. this.firstPropertyList = [];
  1512. this.secondPropertyList = [];
  1513. },
  1514. //新增属性验证
  1515. checkInsertPro() {
  1516. if (!this.coursePropertyName) {
  1517. this.$notify({
  1518. message: "请选择属性",
  1519. type: "error",
  1520. });
  1521. return false;
  1522. }
  1523. if (!this.firstPropertyId) {
  1524. this.$notify({
  1525. message: "请选择一级属性",
  1526. type: "error",
  1527. });
  1528. return false;
  1529. }
  1530. return true;
  1531. },
  1532. //删除选项
  1533. removeQuesOption(option) {
  1534. this.singleRightAnswer = "";
  1535. this.multipleRightAnswer = [];
  1536. let index = this.quesModel.quesOptions.indexOf(option);
  1537. if (index !== -1) {
  1538. this.quesModel.quesOptions.splice(index, 1);
  1539. }
  1540. if (this.quesModel.quesOptions.length > 0) {
  1541. for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
  1542. var quesOption = this.quesModel.quesOptions[i];
  1543. quesOption["number"] = i + 1;
  1544. if (quesOption.isCorrect == 1) {
  1545. var answerOrderNum = String.fromCharCode(65 + i);
  1546. if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
  1547. this.singleRightAnswer = answerOrderNum;
  1548. }
  1549. if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
  1550. this.multipleRightAnswer.push(answerOrderNum);
  1551. }
  1552. }
  1553. }
  1554. }
  1555. },
  1556. //新增选项
  1557. addQuesOption() {
  1558. this.quesModel.quesOptions.push({
  1559. number: "",
  1560. optionBody: "",
  1561. isCorrect: "",
  1562. });
  1563. for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
  1564. this.quesModel.quesOptions[i]["number"] = i + 1;
  1565. }
  1566. },
  1567. savePaperDetailUnit() {
  1568. //跟新难度值
  1569. if (this.quesModel.difficultyDegree < 0.4) {
  1570. this.quesModel.difficulty = "难";
  1571. } else if (
  1572. this.quesModel.difficultyDegree > 0.3 &&
  1573. this.quesModel.difficultyDegree < 0.8
  1574. ) {
  1575. this.quesModel.difficulty = "中";
  1576. } else {
  1577. this.quesModel.difficulty = "易";
  1578. }
  1579. this.setRightAnswer();
  1580. if (/^\d+(?=\.{0,1}\d+$|$)/.test(this.quesModel.score)) {
  1581. console.log("正确");
  1582. } else {
  1583. this.$notify({
  1584. message: "分数只能为正数",
  1585. type: "error",
  1586. });
  1587. return;
  1588. }
  1589. if (this.paper.paperType == "GENERATE") {
  1590. this.$confirm(
  1591. "试题内容修改,会影响所有关联试卷,是否确定进行?",
  1592. "提示",
  1593. {
  1594. confirmButtonText: "确定",
  1595. cancelButtonText: "取消",
  1596. type: "warning",
  1597. }
  1598. ).then(() => {
  1599. this.submitPaperDetailUnit();
  1600. });
  1601. } else {
  1602. this.submitPaperDetailUnit();
  1603. }
  1604. },
  1605. submitPaperDetailUnit() {
  1606. let paperDetailUnitExp = {
  1607. id: this.editPaperDetailUnit.id,
  1608. question: this.quesModel,
  1609. score: this.quesModel.score,
  1610. };
  1611. if (
  1612. this.quesModel.quesOptions &&
  1613. this.quesModel.quesOptions.length == 0
  1614. ) {
  1615. this.$confirm("无选项将删除该试题, 是否继续?", "提示", {
  1616. confirmButtonText: "确定",
  1617. cancelButtonText: "取消",
  1618. type: "warning",
  1619. }).then(() => {
  1620. this.dialogLoading = true;
  1621. this.$httpWithMsg
  1622. .delete(
  1623. QUESTION_API +
  1624. "/paper/deleteQuestion/" +
  1625. this.editPaperDetailUnit.id +
  1626. "/" +
  1627. this.quesModel.id
  1628. )
  1629. .then((response) => {
  1630. if (response.data.length > 0) {
  1631. var deleteInfo =
  1632. "该试题被试卷:" +
  1633. response.data.join(" , ") +
  1634. "使用,不能删除";
  1635. this.$notify({
  1636. message: deleteInfo,
  1637. type: "error",
  1638. });
  1639. } else {
  1640. this.$notify({
  1641. message: "保存成功",
  1642. type: "success",
  1643. });
  1644. }
  1645. })
  1646. .finally(() => (this.loading = false));
  1647. });
  1648. } else {
  1649. this.dialogLoading = true;
  1650. //校验音频重复
  1651. let audiomap = new Map();
  1652. let regex = new RegExp(
  1653. '<a id="[^<>]+" name="([^<>]+\\.mp3)"></a>',
  1654. "ig"
  1655. );
  1656. let ret = "";
  1657. let quesBodyStr = paperDetailUnitExp.question.quesBody;
  1658. if (quesBodyStr) {
  1659. while ((ret = regex.exec(quesBodyStr))) {
  1660. if (audiomap.get(ret[1])) {
  1661. this.dialogLoading = false;
  1662. this.$notify({
  1663. type: "error",
  1664. message: "题干中存在相同的音频文件",
  1665. });
  1666. return;
  1667. } else {
  1668. audiomap.set(ret[1], ret[1]);
  1669. }
  1670. }
  1671. }
  1672. let quesAnswerStr = paperDetailUnitExp.question.quesAnswer;
  1673. if (quesAnswerStr) {
  1674. while ((ret = regex.exec(quesAnswerStr))) {
  1675. if (audiomap.get(ret[1])) {
  1676. this.dialogLoading = false;
  1677. this.$notify({
  1678. type: "error",
  1679. message: "答案中存在相同的音频文件",
  1680. });
  1681. return;
  1682. } else {
  1683. audiomap.set(ret[1], ret[1]);
  1684. }
  1685. }
  1686. }
  1687. let quesOptions = paperDetailUnitExp.question.quesOptions;
  1688. if (quesOptions) {
  1689. for (let i = 0; i < quesOptions.length; i++) {
  1690. let quesOptionStr = quesOptions[i].optionBody;
  1691. while ((ret = regex.exec(quesOptionStr))) {
  1692. if (audiomap.get(ret[1])) {
  1693. this.dialogLoading = false;
  1694. this.$notify({
  1695. type: "error",
  1696. message: "选项中存在相同的音频文件",
  1697. });
  1698. return;
  1699. } else {
  1700. audiomap.set(ret[1], ret[1]);
  1701. }
  1702. }
  1703. }
  1704. }
  1705. paperDetailUnitExp.question.quesAnswer = this.answer;
  1706. this.$httpWithMsg
  1707. .put(QUESTION_API + "/paperDetailUnit", paperDetailUnitExp)
  1708. .then(() => {
  1709. this.$notify({
  1710. message: "保存成功",
  1711. type: "success",
  1712. });
  1713. this.dialogLoading = false;
  1714. this.closeQuesDialog();
  1715. this.initPaper();
  1716. })
  1717. .finally(() => (this.dialogLoading = false));
  1718. }
  1719. },
  1720. //在正确的option上设置isCorrect=1
  1721. setRightAnswer() {
  1722. if (
  1723. !this.quesModel.quesOptions ||
  1724. this.quesModel.quesOptions.length == 0
  1725. ) {
  1726. return false;
  1727. }
  1728. for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
  1729. var option = this.quesModel.quesOptions[i];
  1730. var answerOrderNum = String.fromCharCode(65 + i);
  1731. if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
  1732. option["isCorrect"] =
  1733. answerOrderNum == this.singleRightAnswer ? 1 : 0;
  1734. }
  1735. if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
  1736. option["isCorrect"] =
  1737. this.multipleRightAnswer.indexOf(answerOrderNum) > -1 ? 1 : 0;
  1738. }
  1739. }
  1740. },
  1741. //删除试题
  1742. deleteQues(paperDetailUnit) {
  1743. let paperDetailUnitId = paperDetailUnit.id;
  1744. if (this.paper.paperType == "GENERATE") {
  1745. this.deleteQues01(paperDetailUnitId);
  1746. } else {
  1747. let questionId = paperDetailUnit.question.id;
  1748. this.deleteQues02(questionId, paperDetailUnitId);
  1749. }
  1750. },
  1751. deleteQues01(paperDetailUnitId) {
  1752. this.$alert("您确定删除吗?", "提示", {
  1753. confirmButtonText: "确定",
  1754. callback: (action) => {
  1755. if (action == "confirm") {
  1756. this.loading = true;
  1757. this.$httpWithMsg
  1758. .delete(QUESTION_API + "/paperDetailUnit/" + paperDetailUnitId)
  1759. .then(() => {
  1760. this.initPaper();
  1761. this.getreduplicateQuestions();
  1762. this.reduplicateGroup = [];
  1763. this.loading = true;
  1764. this.$notify({
  1765. message: "删除成功",
  1766. type: "success",
  1767. });
  1768. })
  1769. .finally(() => (this.loading = false));
  1770. }
  1771. },
  1772. });
  1773. },
  1774. deleteQues02(questionId, paperDetailUnitId) {
  1775. this.$alert("您确定删除吗?", "提示", {
  1776. confirmButtonText: "确定",
  1777. callback: (action) => {
  1778. if (action == "confirm") {
  1779. this.loading = true;
  1780. this.$http
  1781. .delete(
  1782. QUESTION_API +
  1783. "/paper/deleteQuestion/" +
  1784. paperDetailUnitId +
  1785. "/" +
  1786. questionId
  1787. )
  1788. .then((response) => {
  1789. if (response.data.length > 0) {
  1790. var deleteInfo =
  1791. "该试题被试卷:" +
  1792. response.data.join(" , ") +
  1793. "使用,不能删除";
  1794. this.$notify({
  1795. message: deleteInfo,
  1796. type: "error",
  1797. });
  1798. } else {
  1799. this.initPaper();
  1800. this.getreduplicateQuestions();
  1801. this.reduplicateGroup = [];
  1802. this.loading = true;
  1803. this.$notify({
  1804. message: "保存成功",
  1805. type: "success",
  1806. });
  1807. }
  1808. this.loading = false;
  1809. });
  1810. }
  1811. },
  1812. });
  1813. },
  1814. //获取重复试题
  1815. getreduplicateQuestions() {
  1816. this.duplicateLoading = true;
  1817. this.$http
  1818. .get(QUESTION_API + "/paper/" + this.paperId + "/reduplicate-questions")
  1819. .then((response) => {
  1820. this.reduplicateQuestions = response.data;
  1821. this.duplicateLoading = false;
  1822. this.initReduplicateQuesColor();
  1823. // var ques = document.getElementsByClassName("ques")[0];
  1824. // ques.style.display = "inline";
  1825. });
  1826. },
  1827. exportPaperAnswer() {
  1828. var key = this.user.key;
  1829. var token = this.user.token;
  1830. window.open(
  1831. QUESTION_API +
  1832. "/paper/answer/export/" +
  1833. this.paperId +
  1834. "?$key=" +
  1835. key +
  1836. "&$token=" +
  1837. token
  1838. );
  1839. },
  1840. initReduplicateQuesColor() {
  1841. var colorCount = this.reduplicateQuestions.length;
  1842. if (colorCount > 20) {
  1843. this.reduplicateQuesColor = randomColor({
  1844. luminosity: "bright",
  1845. count: colorCount,
  1846. });
  1847. } else {
  1848. this.reduplicateQuesColor = this.defaultColor;
  1849. }
  1850. },
  1851. getSubQuesEditId(paperDetailUnit, subQuestion) {
  1852. return paperDetailUnit.question.id + "_" + subQuestion.quesParams.number;
  1853. },
  1854. //打开考试说明编辑框
  1855. openEditExamPaperRemark() {
  1856. if (this.paper.examRemark) {
  1857. this.examRemark = this.paper.examRemark;
  1858. } else {
  1859. this.examRemark = "";
  1860. }
  1861. this.paperRemarkDialog = true;
  1862. },
  1863. //保存考试说明
  1864. savePaperRemark() {
  1865. this.paper.examRemark = this.examRemark;
  1866. this.savePaper();
  1867. this.paperRemarkDialog = false;
  1868. },
  1869. //关闭考试说明编辑框
  1870. closPaperRemark() {
  1871. this.examRemark = "";
  1872. this.paperRemarkDialog = false;
  1873. },
  1874. //保存试卷
  1875. savePaper() {
  1876. this.loading = true;
  1877. this.$http
  1878. .put(QUESTION_API + "/paper", this.paper)
  1879. .then(() => {
  1880. this.$notify({
  1881. message: "保存成功",
  1882. type: "success",
  1883. });
  1884. this.loading = false;
  1885. this.initPaper();
  1886. })
  1887. .catch((error) => {
  1888. this.loading = false;
  1889. this.$notify({
  1890. type: "error",
  1891. message: error.response.data.desc,
  1892. });
  1893. });
  1894. },
  1895. //删除试卷
  1896. deletePaper(id) {
  1897. this.$confirm("确认删除试卷吗?", "提示", {
  1898. type: "warning",
  1899. }).then(() => {
  1900. this.loading = true;
  1901. this.$http.delete(QUESTION_API + "/paper/" + id).then(
  1902. () => {
  1903. this.$notify({
  1904. message: "删除成功",
  1905. type: "success",
  1906. });
  1907. this.back();
  1908. },
  1909. (error) => {
  1910. this.$notify({
  1911. message: error.response.data.desc,
  1912. type: "error",
  1913. title: "错误",
  1914. });
  1915. this.loading = false;
  1916. }
  1917. );
  1918. });
  1919. },
  1920. //打开上传音频弹框
  1921. openDialog() {
  1922. this.checkResult = false;
  1923. this.isUpload = true;
  1924. if (document.getElementById("radioFile")) {
  1925. document.getElementById("radioFile").value = "";
  1926. }
  1927. this.dialogRadioFile = true;
  1928. this.fileList = [];
  1929. },
  1930. //关闭音频弹框
  1931. closeAudioDialog() {
  1932. this.dialogRadioFile = this.uploadAudioLoading;
  1933. },
  1934. //返回
  1935. back() {
  1936. if (sessionStorage.getItem("question_back") == "true") {
  1937. this.$router.push({
  1938. path: "/questions/" + this.parentView + "/0",
  1939. });
  1940. } else {
  1941. this.$router.push({
  1942. path: "/questions/" + this.parentView + "/1",
  1943. });
  1944. }
  1945. },
  1946. paperDetailShow(paperDetail) {
  1947. if (this.reduplicateGroup.length == 0) {
  1948. return true;
  1949. }
  1950. let paperDetailUnits = paperDetail.paperDetailUnits;
  1951. for (let i = 0, imax = paperDetailUnits.length; i < imax; i++) {
  1952. for (var j = 0, jmax = this.reduplicateGroup.length; j < jmax; j++) {
  1953. if (paperDetailUnits[i].id == this.reduplicateGroup[j]) {
  1954. return true;
  1955. }
  1956. }
  1957. }
  1958. return false;
  1959. },
  1960. //上传文件检查
  1961. checkFile() {
  1962. this.fileNameList = [];
  1963. //读取选取的文件夹里面的文件
  1964. this.checkResult = true;
  1965. var files = document.getElementById("radioFile").files;
  1966. if (files.length == 0) {
  1967. this.message = "请选择音频文件夹!";
  1968. return;
  1969. }
  1970. var size = 0;
  1971. var isGo = false;
  1972. //取到所有文件的文件名
  1973. for (var i = 0; i < files.length; i++) {
  1974. this.fileNameList.push(files[i].name);
  1975. if (files[i].size > 5 * 1024 * 1024) {
  1976. isGo = true;
  1977. break;
  1978. }
  1979. size = files[i].size + size;
  1980. }
  1981. if (isGo) {
  1982. this.message = "上传单个文件不能超过5M";
  1983. this.isUpload = true;
  1984. }
  1985. if (size > 50 * 1024 * 1024) {
  1986. this.message = "上传文件总和不能超过50M";
  1987. this.isUpload = true;
  1988. return;
  1989. }
  1990. this.$http
  1991. .post(
  1992. QUESTION_API + "/checkRadioFile/" + this.paperId,
  1993. this.fileNameList
  1994. )
  1995. .then((response) => {
  1996. console.log("response:", response);
  1997. this.message = response.data.errorMsg;
  1998. if (this.message == "OK") {
  1999. this.message = "OK!";
  2000. this.isUpload = false;
  2001. } else {
  2002. this.isUpload = true;
  2003. }
  2004. })
  2005. .catch((error) => {
  2006. console.log(error);
  2007. });
  2008. },
  2009. //读取文件
  2010. uploadAudioFile() {
  2011. let param = new FormData();
  2012. var fileList = document.getElementById("radioFile").files;
  2013. //循环添加到formData中
  2014. for (var i = 0; i < fileList.length; i++) {
  2015. var file = fileList[i];
  2016. param.append("files", file, file.name);
  2017. }
  2018. let config = {
  2019. headers: { "Content-Type": "multipart/form-data" },
  2020. };
  2021. this.$http
  2022. .post(QUESTION_API + "/uploadRadio/" + this.paperId, param, config)
  2023. .then(() => {
  2024. this.dialogRadioFile = false;
  2025. this.uploadAudioLoading = false;
  2026. this.checkResult = false;
  2027. this.isUpload = true;
  2028. document.getElementById("radioFile").value = "";
  2029. this.initPaper();
  2030. })
  2031. .catch((error) => {
  2032. this.message = error.response.data.desc;
  2033. this.uploadAudioLoading = false;
  2034. });
  2035. },
  2036. },
  2037. };
  2038. </script>
  2039. <style scoped src="../styles/EditPaper.css">
  2040. .property_with {
  2041. width: 100px;
  2042. }
  2043. .ck-toolbar {
  2044. z-index: 9999;
  2045. }
  2046. #app {
  2047. background-color: white !important;
  2048. }
  2049. </style>
  2050. <style scoped src="../styles/Common.css"></style>