EditPaperPendingTrial.vue 82 KB

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