EditPaper.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509
  1. <template>
  2. <div class="edit-paper" ref="editPaper">
  3. <div class="edit-header">
  4. <div class="edit-header-top box-justify">
  5. <div class="header-info">
  6. <el-button
  7. class="is-back"
  8. icon="el-icon-arrow-left"
  9. @click="toBack"
  10. size="mini"
  11. style="margin-right: 0"
  12. ></el-button>
  13. <!-- <div class="header-info-item">
  14. <span>课程代码:</span>
  15. <span>{{ paper.course.code }}</span>
  16. </div> -->
  17. <div class="header-info-item">
  18. <!-- <span>课程名称:</span> -->
  19. <span style="color: #262626; font-size: 16px; font-weight: bold">{{
  20. paper.course.name
  21. }}</span>
  22. </div>
  23. <div class="header-info-item">
  24. <span>试卷名称:</span>
  25. <span>
  26. <el-tooltip class="item" effect="dark" placement="top-start">
  27. <div slot="content">{{ paper.name }}</div>
  28. <el-input
  29. v-model="paper.name"
  30. size="mini"
  31. class="header-info-input"
  32. placeholder="试卷名称"
  33. ></el-input>
  34. </el-tooltip>
  35. </span>
  36. </div>
  37. <div class="header-info-item">
  38. <span>试卷标题:</span>
  39. <span>
  40. <el-tooltip class="item" effect="dark" placement="top-start">
  41. <div slot="content">{{ paper.title }}</div>
  42. <el-input
  43. v-model="paper.title"
  44. size="mini"
  45. class="header-info-input"
  46. placeholder="试卷标题"
  47. ></el-input>
  48. </el-tooltip>
  49. </span>
  50. </div>
  51. <div class="header-info-item">
  52. <span>试卷总分:</span>
  53. <span>{{ paper.totalScore }}</span>
  54. </div>
  55. </div>
  56. <div class="header-btns">
  57. <el-dropdown trigger="click" @command="importCommand">
  58. <div class="avatar-wrapper">
  59. <el-button>
  60. 导入
  61. <i class="el-icon-arrow-down" />
  62. </el-button>
  63. </div>
  64. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  65. <el-dropdown-item command="answer">
  66. <span>导入答案</span>
  67. </el-dropdown-item>
  68. <el-dropdown-item command="property">
  69. <span>导入知识点</span>
  70. </el-dropdown-item>
  71. </el-dropdown-menu>
  72. </el-dropdown>
  73. <el-button
  74. v-if="checkDuplicateBtnShow"
  75. type="primary"
  76. size="small"
  77. plain
  78. @click="toCheckDuplicate"
  79. >
  80. 进入查重
  81. </el-button>
  82. <el-button
  83. type="danger"
  84. size="small"
  85. plain
  86. class="maintain"
  87. @click="toDeletePaper(paper.id)"
  88. >
  89. 删除
  90. </el-button>
  91. <el-button type="primary" size="small" @click="toSavePaper">
  92. 保存
  93. </el-button>
  94. <!-- <el-button
  95. size="small"
  96. type="primary"
  97. plain
  98. @click="toImportPaperAnswer"
  99. >导入答案</el-button
  100. >
  101. <el-button
  102. size="small"
  103. type="primary"
  104. plain
  105. @click="toImportPaperProperty"
  106. >导入属性</el-button
  107. > -->
  108. <!-- <el-button
  109. size="small"
  110. type="danger"
  111. plain
  112. icon="icon icon-back"
  113. @click="toBack"
  114. >返回</el-button
  115. > -->
  116. </div>
  117. </div>
  118. <div class="edit-header-bottom box-justify">
  119. <div>
  120. <el-button
  121. plain
  122. size="small"
  123. icon="el-icon-circle-plus"
  124. @click="addBigQuestion"
  125. >
  126. 新增大题
  127. </el-button>
  128. <el-button plain size="small" @click="toViewStructInfo">
  129. 试卷结构分析
  130. </el-button>
  131. <!-- <el-button plain size="small" @click="toViewBaseInfo">
  132. 基础构成
  133. </el-button>
  134. <el-button plain size="small" @click="toViewQuestypeInfo">
  135. 题型分布
  136. </el-button>
  137. <el-button plain size="small" @click="toViewBlueInfo">
  138. 蓝图分布
  139. </el-button> -->
  140. <!-- <el-button plain size="small" @click="toViewAuditInfo">
  141. 审核记录
  142. </el-button> -->
  143. <el-button
  144. v-if="
  145. enableCardEdit &&
  146. authButtons.includes('exam_paper_manager-edit_card')
  147. "
  148. plain
  149. size="small"
  150. @click="toEditCard"
  151. >
  152. 编辑题卡
  153. </el-button>
  154. <el-button
  155. v-if="
  156. enableCardEdit &&
  157. authButtons.includes('exam_paper_manager-edit_card')
  158. "
  159. type="danger"
  160. size="small"
  161. plain
  162. class="maintain"
  163. @click="toDeletCard"
  164. >
  165. 清除题卡
  166. </el-button>
  167. </div>
  168. <div>
  169. <el-button size="small" @click="toViewLog">试卷修改记录</el-button>
  170. <tool-tip-btn
  171. name="shenhejilu"
  172. content="审核记录"
  173. @click="toViewAuditInfo"
  174. ></tool-tip-btn>
  175. <tool-tip-btn
  176. name="yulan"
  177. content="生成试卷"
  178. @click="previewPDF2"
  179. ></tool-tip-btn>
  180. <tool-tip-btn
  181. name="shuxingyincangxianshi"
  182. :content="(quesTagShow ? '隐藏' : '显示') + '属性'"
  183. @click="toSwitchQuesTagShowHide"
  184. ></tool-tip-btn>
  185. <tool-tip-btn
  186. name="daochu"
  187. content="导出试卷蓝图"
  188. :disabled="downloading"
  189. @click="toExportPaperBlue"
  190. ></tool-tip-btn>
  191. <tool-tip-btn
  192. name="daanyincangxianshi"
  193. :content="(quesAnswerShow ? '隐藏' : '显示') + '答案'"
  194. @click="toSwitchQuesAnswerShowHide"
  195. ></tool-tip-btn>
  196. <!-- <el-button size="small" type="primary" plain @click="previewPDF2"
  197. >预览</el-button
  198. > -->
  199. <!-- <el-button
  200. type="primary"
  201. size="small"
  202. plain
  203. @click="toSwitchQuesTagShowHide"
  204. >
  205. {{ quesTagShow ? "隐藏" : "显示" }}属性
  206. </el-button> -->
  207. <!-- <el-button
  208. size="small"
  209. type="primary"
  210. plain
  211. :loading="downloading"
  212. @click="toExportPaperBlue"
  213. >导出试卷蓝图</el-button
  214. > -->
  215. <!-- <el-button
  216. type="primary"
  217. size="small"
  218. plain
  219. @click="toSwitchQuesAnswerShowHide"
  220. >
  221. {{ quesAnswerShow ? "隐藏" : "显示" }}答案
  222. </el-button> -->
  223. </div>
  224. </div>
  225. </div>
  226. <div
  227. class="edit-body"
  228. style="
  229. margin: 0 16px;
  230. padding-top: 0;
  231. display: flex;
  232. flex-direction: column;
  233. height: 100%;
  234. "
  235. >
  236. <div
  237. class="edit-warning-wrap"
  238. :class="{ hid: this.checkPaperQuestionAllHasScore() }"
  239. >
  240. <div class="edit-warning">
  241. <img src="../../../assets/images/paper_edit_warning.png" />
  242. <span>有小题未设置分值</span>
  243. </div>
  244. </div>
  245. <div style="flex: 1; overflow: auto" ref="editPaperBody">
  246. <!-- 考试说明 -->
  247. <div class="edit-part-list">
  248. <div class="edit-part">
  249. <div class="edit-cont">
  250. <div
  251. class="edit-cont-title"
  252. style="display: flex; align-items: center"
  253. >
  254. <h3>考试说明</h3>
  255. <svg-btn
  256. name="bianji"
  257. color="#6D5FF6"
  258. hoverBgColor="#F0EFFE"
  259. class="hover-show"
  260. @click="toEditExamRemark"
  261. style="margin-left: 10px"
  262. >编辑</svg-btn
  263. >
  264. </div>
  265. <!-- <div class="edit-cont-action">
  266. <el-button
  267. type="primary"
  268. plain
  269. size="small"
  270. @click="toEditExamRemark"
  271. >编辑</el-button
  272. >
  273. </div> -->
  274. <div class="edit-cont-body">
  275. <rich-text :text-json="paper.examRemark"></rich-text>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. <!-- 循环大题 -->
  281. <div
  282. v-for="(paperDetail, detailIndex) in paper.paperDetails"
  283. :key="paperDetail.id"
  284. class="edit-part-list"
  285. >
  286. <div class="edit-part level1">
  287. <div class="edit-cont">
  288. <div class="edit-cont-title">
  289. <h3>
  290. <span>{{ paperDetail.cnNum }}</span> <span>.</span>
  291. <span>{{ paperDetail.name }}</span>
  292. </h3>
  293. </div>
  294. <rich-text
  295. class="edit-cont-body"
  296. :text-json="paperDetail.description"
  297. ></rich-text>
  298. </div>
  299. <div class="level1-hover-show">
  300. <div style="color: #595959; margin-bottom: 5px">
  301. 共{{ paperDetail.unitCount }}小题,满分{{ paperDetail.score }}分
  302. </div>
  303. <div class="gray-btn-group">
  304. <span @click="toSelectPaperDetailQues(paperDetail)">选题</span>
  305. <span @click="toEditPaperDetail(paperDetail)">编辑</span>
  306. <span
  307. v-if="detailIndex"
  308. @click="toMovePaperDetail(paperDetail, 'up')"
  309. >上移</span
  310. >
  311. <span
  312. v-if="detailIndex < paper.paperDetails.length - 1"
  313. @click="toMovePaperDetail(paperDetail, 'down')"
  314. >下移</span
  315. >
  316. <span @click="toDeletePaperDetail(paperDetail)">删除</span>
  317. <span
  318. @click.stop="
  319. paperDetail.showQuestions = !paperDetail.showQuestions
  320. "
  321. >{{ paperDetail.showQuestions ? "收起" : "展开" }}</span
  322. >
  323. </div>
  324. <!--
  325. <div>
  326. <el-button
  327. size="small"
  328. type="primary"
  329. plain
  330. @click="toSelectPaperDetailQues(paperDetail)"
  331. >选题
  332. </el-button>
  333. <el-button
  334. size="small"
  335. type="primary"
  336. plain
  337. @click="toEditPaperDetail(paperDetail)"
  338. >编辑
  339. </el-button>
  340. <el-button
  341. v-if="detailIndex"
  342. size="small"
  343. type="primary"
  344. plain
  345. @click="toMovePaperDetail(paperDetail, 'up')"
  346. >上移
  347. </el-button>
  348. <el-button
  349. v-if="detailIndex < paper.paperDetails.length - 1"
  350. size="small"
  351. type="primary"
  352. plain
  353. @click="toMovePaperDetail(paperDetail, 'down')"
  354. >下移
  355. </el-button>
  356. <el-button
  357. size="small"
  358. type="danger"
  359. @click="toDeletePaperDetail(paperDetail)"
  360. >删除
  361. </el-button>
  362. <el-button
  363. size="small"
  364. type="primary"
  365. plain
  366. :icon="
  367. paperDetail.showQuestions
  368. ? 'el-icon-arrow-up'
  369. : 'el-icon-arrow-down'
  370. "
  371. @click.stop="
  372. paperDetail.showQuestions = !paperDetail.showQuestions
  373. "
  374. ></el-button>
  375. </div> -->
  376. </div>
  377. <div v-show="quesTagShow" class="edit-property">
  378. <div class="edit-property-box">
  379. <div
  380. v-for="(paperDetailTag, tagIndex) in paperDetail.tags"
  381. :key="tagIndex"
  382. class="edit-property-item"
  383. >
  384. <div class="edit-property-body level1">
  385. <div class="edit-property-title">
  386. {{ paperDetailTag.tag }}
  387. </div>
  388. <div class="edit-property-content">
  389. {{ paperDetailTag.content }}
  390. </div>
  391. </div>
  392. </div>
  393. <template v-if="paperDetail.selective">
  394. <div class="edit-property-item">
  395. <div class="edit-property-body level1">
  396. <div class="edit-property-title">选做题数</div>
  397. <div class="edit-property-content">
  398. {{ paperDetail.selectiveCount }}
  399. </div>
  400. </div>
  401. </div>
  402. <div class="edit-property-item">
  403. <div class="edit-property-body level1">
  404. <div class="edit-property-title">取分规则</div>
  405. <div class="edit-property-content">
  406. {{
  407. paperDetail.selectiveRule | selectiveRuleTypeFilter
  408. }}
  409. </div>
  410. </div>
  411. </div>
  412. </template>
  413. </div>
  414. </div>
  415. </div>
  416. <!-- 循环小题 -->
  417. <div v-show="paperDetail.showQuestions" class="edit-paper-questions">
  418. <template
  419. v-for="(
  420. paperDetailUnit, unitIndex
  421. ) in paperDetail.paperDetailUnits"
  422. >
  423. <div
  424. :key="`question-${unitIndex}`"
  425. :class="[
  426. 'edit-part',
  427. 'level2',
  428. `small-${detailIndex}-${unitIndex}`,
  429. {
  430. 'question-duplicate':
  431. paperDetailUnit.question.checkDuplicateStatus ==
  432. 'TO_BE_DISPOSE',
  433. 'is-danger': !paperDetailUnit.score,
  434. },
  435. ]"
  436. >
  437. <div class="level2-hover-show">
  438. <div class="box-justify">
  439. <div class="gray-btn-group">
  440. <span
  441. v-if="
  442. paperDetailUnit.question.checkDuplicateStatus ===
  443. 'TO_BE_DISPOSE'
  444. "
  445. @click="
  446. toCheckDuplicateQuestion(paperDetailUnit.question.id)
  447. "
  448. >进入查重</span
  449. >
  450. <span @click="toChangeQues(paperDetailUnit)">换题</span>
  451. <span @click="toEditQues(paperDetailUnit)">编辑</span>
  452. <span
  453. v-if="unitIndex"
  454. @click="
  455. toMoveQues(paperDetail.id, paperDetailUnit.id, 'up')
  456. "
  457. >上移</span
  458. >
  459. <span
  460. v-if="
  461. unitIndex < paperDetail.paperDetailUnits.length - 1
  462. "
  463. @click="
  464. toMoveQues(paperDetail.id, paperDetailUnit.id, 'down')
  465. "
  466. >下移</span
  467. >
  468. <span @click="toDeleteQues(paperDetailUnit)">删除</span>
  469. <span
  470. v-if="isNested(paperDetailUnit.questionType)"
  471. @click="
  472. paperDetailUnit.showSubQuestions =
  473. !paperDetailUnit.showSubQuestions
  474. "
  475. >{{
  476. paperDetailUnit.showSubQuestions ? "收起" : "展开"
  477. }}</span
  478. >
  479. </div>
  480. <span class="tips-info">
  481. {{ paperDetailUnit.question.bodyLengthText }}
  482. </span>
  483. </div>
  484. <!-- <el-button
  485. v-if="
  486. paperDetailUnit.question.checkDuplicateStatus ===
  487. 'TO_BE_DISPOSE'
  488. "
  489. size="small"
  490. type="primary"
  491. plain
  492. @click="
  493. toCheckDuplicateQuestion(paperDetailUnit.question.id)
  494. "
  495. >进入查重
  496. </el-button>
  497. <el-button
  498. size="small"
  499. type="primary"
  500. plain
  501. @click="toChangeQues(paperDetailUnit)"
  502. >换题
  503. </el-button>
  504. <el-button
  505. size="small"
  506. type="primary"
  507. plain
  508. @click="toEditQues(paperDetailUnit)"
  509. >编辑
  510. </el-button>
  511. <el-button
  512. v-if="unitIndex"
  513. size="small"
  514. type="primary"
  515. plain
  516. @click="
  517. toMoveQues(paperDetail.id, paperDetailUnit.id, 'up')
  518. "
  519. >上移
  520. </el-button>
  521. <el-button
  522. v-if="unitIndex < paperDetail.paperDetailUnits.length - 1"
  523. size="small"
  524. type="primary"
  525. plain
  526. @click="
  527. toMoveQues(paperDetail.id, paperDetailUnit.id, 'down')
  528. "
  529. >下移
  530. </el-button>
  531. <el-button
  532. type="danger"
  533. size="small"
  534. @click="toDeleteQues(paperDetailUnit)"
  535. >删除
  536. </el-button>
  537. <el-button
  538. v-if="isNested(paperDetailUnit.questionType)"
  539. size="small"
  540. :icon="
  541. paperDetailUnit.showSubQuestions
  542. ? 'el-icon-arrow-up'
  543. : 'el-icon-arrow-down'
  544. "
  545. @click.stop="
  546. paperDetailUnit.showSubQuestions =
  547. !paperDetailUnit.showSubQuestions
  548. "
  549. ></el-button> -->
  550. </div>
  551. <div class="edit-cont">
  552. <div class="edit-cont-title">
  553. <span>{{ paperDetailUnit.number }}.</span>
  554. <rich-text
  555. :text-json="paperDetailUnit.question.quesBody"
  556. ></rich-text>
  557. <span :class="{ 'color-danger': !paperDetailUnit.score }">
  558. ({{ paperDetailUnit.score }}分)
  559. </span>
  560. </div>
  561. <div class="edit-cont-body">
  562. <div
  563. v-for="(quesOption, optionIndex) in paperDetailUnit
  564. .question.quesOptions"
  565. :key="optionIndex"
  566. class="paper-option"
  567. >
  568. <span>{{ optionIndex | optionOrderWordFilter }}. </span>
  569. <rich-text :text-json="quesOption.optionBody"></rich-text>
  570. </div>
  571. <div v-if="!isNested(paperDetailUnit.questionType)">
  572. <div v-show="quesAnswerShow" class="paper-answer">
  573. <span>答案:</span>
  574. <question-answer
  575. :data="paperDetailUnit.question"
  576. ></question-answer>
  577. </div>
  578. </div>
  579. </div>
  580. <div
  581. v-if="paperDetailUnit.question.quesProperties"
  582. class="edit-cont-props"
  583. style="margin-top: 10px"
  584. >
  585. <el-tag
  586. v-for="(content, propIndex) in paperDetailUnit.question
  587. .quesProperties"
  588. :key="propIndex"
  589. type="primary"
  590. effect="dark"
  591. style="margin-right: 5px; margin-bottom: 5px"
  592. >
  593. <!-- {{ content.courseProperty && content.courseProperty.name }}
  594. <span style="margin: 0 3px">/</span> -->
  595. {{ content.firstProperty && content.firstProperty.name }}
  596. <span v-if="content.secondProperty" style="margin: 0 3px"
  597. >/</span
  598. >
  599. {{
  600. content.secondProperty && content.secondProperty.name
  601. }}
  602. </el-tag>
  603. </div>
  604. </div>
  605. <div v-show="quesTagShow" class="edit-property">
  606. <div class="edit-property-box">
  607. <div
  608. v-for="(questionTag, tagIndex) in paperDetailUnit.question
  609. .tags"
  610. :key="tagIndex"
  611. class="edit-property-item"
  612. >
  613. <div class="edit-property-body level2">
  614. <div class="edit-property-title">
  615. {{ questionTag.tag }}
  616. </div>
  617. <div class="edit-property-content">
  618. {{ questionTag.content }}
  619. </div>
  620. </div>
  621. </div>
  622. </div>
  623. </div>
  624. </div>
  625. <div
  626. v-if="isNested(paperDetailUnit.questionType)"
  627. v-show="paperDetailUnit.showSubQuestions"
  628. :key="`question-sub-${unitIndex}`"
  629. class="edit-paper-question-subs"
  630. >
  631. <div
  632. v-for="(subQuestion, subIndex) in paperDetailUnit.question
  633. .subQuestions"
  634. :key="subIndex"
  635. :class="[
  636. 'edit-part',
  637. {
  638. 'is-danger': !paperDetailUnit.subScoreList[subIndex],
  639. },
  640. ]"
  641. >
  642. <div class="edit-cont">
  643. <div class="edit-cont-title">
  644. <span>{{ subIndex + 1 }}. </span>
  645. <rich-text :text-json="subQuestion.quesBody"></rich-text>
  646. <span
  647. :class="{
  648. 'color-danger':
  649. !paperDetailUnit.subScoreList[subIndex],
  650. }"
  651. >
  652. ({{ paperDetailUnit.subScoreList[subIndex] }}分)
  653. </span>
  654. </div>
  655. <div
  656. v-if="!isMatchingQuestion(paperDetailUnit.questionType)"
  657. class="edit-cont-body"
  658. >
  659. <div
  660. v-for="(
  661. subQuesOption, subOptIndex
  662. ) in subQuestion.quesOptions"
  663. :key="subOptIndex"
  664. class="paper-option"
  665. >
  666. <span>{{ subOptIndex | optionOrderWordFilter }}. </span>
  667. <rich-text
  668. :text-json="subQuesOption.optionBody"
  669. ></rich-text>
  670. </div>
  671. </div>
  672. <div v-show="quesAnswerShow" class="paper-answer">
  673. <span>答案:</span>
  674. <question-answer :data="subQuestion"></question-answer>
  675. <!-- <rich-text :text-json="subQuestion.quesAnswer"></rich-text> -->
  676. </div>
  677. <div
  678. v-if="subQuestion.quesProperties"
  679. class="edit-cont-props"
  680. style="margin-top: 10px"
  681. >
  682. <el-tag
  683. v-for="(
  684. content, propIndex
  685. ) in subQuestion.quesProperties"
  686. :key="propIndex"
  687. type="primary"
  688. effect="dark"
  689. style="margin-right: 5px; margin-bottom: 5px"
  690. >
  691. <!-- {{
  692. content.courseProperty && content.courseProperty.name
  693. }}
  694. <span style="margin: 0 3px">/</span> -->
  695. {{
  696. content.firstProperty && content.firstProperty.name
  697. }}
  698. <span
  699. v-if="content.secondProperty"
  700. style="margin: 0 3px"
  701. >/</span
  702. >
  703. {{
  704. content.secondProperty && content.secondProperty.name
  705. }}
  706. </el-tag>
  707. </div>
  708. </div>
  709. <!-- <div
  710. v-if="subQuestion.quesProperties"
  711. class="edit-cont-props"
  712. style="margin-top: 10px"
  713. >
  714. <el-tag
  715. v-for="(content, propIndex) in subQuestion.quesProperties"
  716. :key="propIndex"
  717. type="primary"
  718. effect="dark"
  719. style="margin-right: 5px; margin-bottom: 5px"
  720. >
  721. {{ content.courseProperty && content.courseProperty.name }}
  722. <span style="margin: 0 3px">/</span>
  723. {{ content.firstProperty && content.firstProperty.name }}
  724. <span v-if="content.secondProperty" style="margin: 0 3px"
  725. >/</span
  726. >
  727. {{ content.secondProperty && content.secondProperty.name }}
  728. </el-tag>
  729. </div> -->
  730. <div v-show="quesTagShow" class="edit-property">
  731. <div class="edit-property-box">
  732. <div
  733. v-for="(subQuestionTag, tagIndex) in subQuestion.tags"
  734. :key="tagIndex"
  735. class="edit-property-item"
  736. >
  737. <div class="edit-property-body level2">
  738. <div class="edit-property-title">
  739. {{ subQuestionTag.tag }}
  740. </div>
  741. <div class="edit-property-content">
  742. {{ subQuestionTag.content }}
  743. </div>
  744. </div>
  745. </div>
  746. </div>
  747. </div>
  748. </div>
  749. </div>
  750. </template>
  751. </div>
  752. </div>
  753. </div>
  754. </div>
  755. <!-- 编辑考试说明 -->
  756. <modify-rich-text
  757. ref="ModifyRichText"
  758. :content="paper.examRemark"
  759. title="考试说明"
  760. @modified="examRemarkModified"
  761. ></modify-rich-text>
  762. <!-- 编辑大题弹框 -->
  763. <modify-detail-struct
  764. ref="ModifyDetailStruct"
  765. :detail="curDetail"
  766. only-name
  767. show-selective
  768. @modified="detailModified"
  769. ></modify-detail-struct>
  770. <paper-struct-info
  771. ref="PaperStructInfo"
  772. :paper-id="paperId"
  773. :course-id="paper.course.id"
  774. ></paper-struct-info>
  775. <!-- 基础构成 -->
  776. <paper-base-info ref="PaperBaseInfo" :paper-id="paperId"></paper-base-info>
  777. <!-- 上传答案文件 -->
  778. <import-file-dialog
  779. ref="ImportAnswerDialog"
  780. dialog-title="上传答案文件"
  781. :template-url="answerTemplateUrl"
  782. :upload-url="uploadAnswerUrl"
  783. add-file-param="dataFile"
  784. @uploaded="initPaper"
  785. ></import-file-dialog>
  786. <!-- 上传属性文件 -->
  787. <import-file-dialog
  788. ref="ImportPorpertyDialog"
  789. dialog-title="上传知识点文件"
  790. :template-url="propertyTemplateUrl"
  791. :upload-url="uploadPropertyUrl"
  792. add-file-param="dataFile"
  793. @uploaded="initPaper"
  794. ></import-file-dialog>
  795. <!-- 题型分布 -->
  796. <paper-questype-info
  797. ref="PaperQuestypeInfo"
  798. :paper-id="paperId"
  799. ></paper-questype-info>
  800. <!-- 蓝图分布 -->
  801. <paper-blue-info
  802. ref="PaperBlueInfo"
  803. :paper-id="paperId"
  804. :course-id="paper.course.id"
  805. ></paper-blue-info>
  806. <!-- 审核记录 -->
  807. <paper-audit-info
  808. ref="PaperAuditInfo"
  809. :paper-id="paperId"
  810. ></paper-audit-info>
  811. <!-- 试题编辑 -->
  812. <question-edit-dialog
  813. ref="QuestionEditDialog"
  814. :question="curQuestion"
  815. edit-mode="paper"
  816. @modified="questionEdited"
  817. ></question-edit-dialog>
  818. <!-- SelectQuestionDialog -->
  819. <select-question-dialog
  820. ref="SelectQuestionDialog"
  821. :course-id="paper.course.id"
  822. :disabled-question-ids="paperQuestionIds"
  823. select-mode="paper"
  824. @confirm="questionSelected"
  825. ></select-question-dialog>
  826. <!-- PaperEditLogDialog -->
  827. <paper-edit-log-dialog
  828. ref="PaperEditLogDialog"
  829. :paper-id="paperId"
  830. ></paper-edit-log-dialog>
  831. </div>
  832. </template>
  833. <script>
  834. import {
  835. paperDetailApi,
  836. paperSaveApi,
  837. paperDeleteApi,
  838. paperDetailUpdateApi,
  839. paperDetailMoveApi,
  840. paperDetailDeleteApi,
  841. paperQuestionMoveApi,
  842. paperQuestionDeleteApi,
  843. paperQuestionSaveApi,
  844. paperDetailAddQuestionApi,
  845. paperQuestionChangeApi,
  846. paperCardDeleteApi,
  847. paperPropertyExportApi,
  848. paperDetailAddApi,
  849. } from "../api";
  850. import { QUESTION_API } from "@/constants/constants";
  851. import ImportFileDialog from "@/components/ImportFileDialog.vue";
  852. import PaperStructInfo from "../components/PaperStructInfo.vue";
  853. import PaperBaseInfo from "../components/PaperBaseInfo.vue";
  854. import PaperQuestypeInfo from "../components/PaperQuestypeInfo.vue";
  855. import PaperBlueInfo from "../components/PaperBlueInfo.vue";
  856. import PaperAuditInfo from "../components/PaperAuditInfo.vue";
  857. import ModifyDetailStruct from "../components/ModifyDetailStruct.vue";
  858. import PaperEditLogDialog from "../components/PaperEditLogDialog.vue";
  859. import ModifyRichText from "@/components/ModifyRichText.vue";
  860. import QuestionEditDialog from "../../question/components/QuestionEditDialog.vue";
  861. import SelectQuestionDialog from "../components/SelectQuestionDialog.vue";
  862. import QuestionAnswer from "../../question/components/QuestionAnswer.vue";
  863. import { calcSum } from "@/plugins/utils";
  864. import { downloadByApi } from "@/plugins/download";
  865. import { mapGetters } from "vuex";
  866. export default {
  867. name: "EditPaper",
  868. components: {
  869. PaperStructInfo,
  870. PaperBaseInfo,
  871. PaperQuestypeInfo,
  872. PaperAuditInfo,
  873. PaperBlueInfo,
  874. ModifyDetailStruct,
  875. ModifyRichText,
  876. QuestionEditDialog,
  877. ImportFileDialog,
  878. SelectQuestionDialog,
  879. QuestionAnswer,
  880. PaperEditLogDialog,
  881. },
  882. data() {
  883. return {
  884. paperId: "",
  885. parentView: "",
  886. paper: {
  887. name: "",
  888. title: "",
  889. totalScore: 0,
  890. course: {
  891. id: "",
  892. code: "",
  893. name: "",
  894. },
  895. examRemark: "",
  896. paperDetails: [],
  897. },
  898. checkDuplicateBtnShow: false,
  899. quesTagShow: true,
  900. quesAnswerShow: false,
  901. curDetail: {},
  902. curQuestion: {},
  903. paperQuestionIds: [],
  904. changeSelectQuestionMap: {},
  905. downloading: false,
  906. // upload answer
  907. uploadAnswerUrl: "",
  908. answerTemplateUrl: "",
  909. // upload property
  910. propertyTemplateUrl: "",
  911. uploadPropertyUrl: "",
  912. bigOpenStatusIds: [],
  913. smallOpenStatusIds: [],
  914. };
  915. },
  916. computed: {
  917. user() {
  918. return this.$store.state.user;
  919. },
  920. enableCardEdit() {
  921. return this.paper.auditStatus === "PASS";
  922. },
  923. ...mapGetters(["authButtons"]),
  924. },
  925. created() {
  926. let qt = sessionStorage.getItem("quesTagShow");
  927. if (qt) {
  928. this.quesTagShow = qt === "true";
  929. }
  930. let qa = sessionStorage.getItem("quesAnswerShow");
  931. if (qa) {
  932. this.quesAnswerShow = qa === "true";
  933. }
  934. this.paperId = Number(this.$route.params.id);
  935. this.parentView = this.$route.params.parentView;
  936. this.initPaper();
  937. },
  938. methods: {
  939. saveOpenStatus() {
  940. let bigOpenStatusIds = [];
  941. let smallOpenStatusIds = [];
  942. for (let i = 0; i < this.paper.paperDetails.length; i++) {
  943. let detail = this.paper.paperDetails[i];
  944. bigOpenStatusIds.push({
  945. id: detail.id,
  946. showQuestions: detail.showQuestions,
  947. });
  948. for (let j = 0; j < detail.paperDetailUnits.length; j++) {
  949. let question = detail.paperDetailUnits[j];
  950. smallOpenStatusIds.push({
  951. id: question.id,
  952. showSubQuestions: question.showSubQuestions,
  953. });
  954. }
  955. }
  956. this.bigOpenStatusIds = bigOpenStatusIds;
  957. this.smallOpenStatusIds = smallOpenStatusIds;
  958. },
  959. async initPaper(type) {
  960. this.saveOpenStatus();
  961. const res = await paperDetailApi(this.paperId);
  962. res.data.paperDetails.forEach((detail) => {
  963. detail.showQuestions =
  964. this.bigOpenStatusIds.find((item) => item.id == detail.id)
  965. ?.showQuestions ?? true;
  966. if (type == "addSmall" && detail.id == this.curDetail.id) {
  967. detail.showQuestions = true;
  968. }
  969. detail.paperDetailUnits.forEach((question) => {
  970. question.showSubQuestions =
  971. this.smallOpenStatusIds.find((item) => item.id == question.id)
  972. ?.showSubQuestions ?? true;
  973. });
  974. });
  975. this.paper = res.data;
  976. this.paper.title = this.paper.title || this.paper.name;
  977. this.showCheckDuplicate();
  978. if (type == "addBig") {
  979. setTimeout(() => {
  980. this.$refs.editPaperBody.scrollTo({
  981. left: 0,
  982. top: 100000,
  983. behavior: "smooth",
  984. });
  985. }, 20);
  986. } else if (type == "addSmall") {
  987. let bigIndex = this.paper.paperDetails.findIndex(
  988. (item) => item.id == this.curDetail.id
  989. );
  990. if (bigIndex > -1) {
  991. let cls = `small-${bigIndex}-${
  992. this.paper.paperDetails[bigIndex].paperDetailUnits.length - 1
  993. }`;
  994. setTimeout(() => {
  995. const el = document.querySelector("." + cls);
  996. // this.$refs.editPaperBody.scrollTo({
  997. // left: 0,
  998. // top: el.getBoundingClientRect().top - 210,
  999. // behavior: "smooth",
  1000. // });
  1001. el.scrollIntoView({ behavior: "smooth", block: "start" });
  1002. }, 100);
  1003. }
  1004. }
  1005. if (!this.checkPaperQuestionAllHasScore()) {
  1006. this.$notify.error("有小题未设置分值!");
  1007. }
  1008. },
  1009. previewPDF2() {
  1010. window.open(
  1011. this.getRouterPath({
  1012. name: "PaperTemplateBuild",
  1013. params: {
  1014. paperId: this.paper.id,
  1015. },
  1016. })
  1017. );
  1018. },
  1019. // header-actions
  1020. showCheckDuplicate() {
  1021. if (this.paper.checkDuplicateStatus === "DISPOSED") {
  1022. this.checkDuplicateBtnShow = false;
  1023. return;
  1024. }
  1025. this.checkDuplicateBtnShow = this.paper.paperDetails.some((detail) =>
  1026. detail.paperDetailUnits.some(
  1027. (question) =>
  1028. question.question.checkDuplicateStatus === "TO_BE_DISPOSE"
  1029. )
  1030. );
  1031. },
  1032. toCheckDuplicate() {
  1033. this.$router.push({
  1034. name: "check_duplicate_info",
  1035. query: {
  1036. basePaperId: this.paper.id,
  1037. from: "paper",
  1038. },
  1039. });
  1040. },
  1041. checkPaperQuestionAllHasScore() {
  1042. return !this.paper.paperDetails.some((detail) => {
  1043. return detail.paperDetailUnits.some((qUnit) => !qUnit.score);
  1044. });
  1045. },
  1046. // 保存试卷
  1047. async toSavePaper() {
  1048. const confirm = await this.$confirm(`确定保存吗?`, "系统通知", {
  1049. type: "warning",
  1050. }).catch(() => {});
  1051. if (confirm !== "confirm") return;
  1052. const res = await paperSaveApi(this.paper).catch(() => {});
  1053. if (!res) return;
  1054. this.$message.success("保存成功!");
  1055. },
  1056. // 删除试卷
  1057. async toDeletePaper() {
  1058. const confirm = await this.$confirm(`确定要删除该试卷吗?`, "系统通知", {
  1059. type: "warning",
  1060. }).catch(() => {});
  1061. if (confirm !== "confirm") return;
  1062. const res = await paperDeleteApi(this.paper.id).catch(() => {});
  1063. if (!res) return;
  1064. this.$message.success("删除成功!");
  1065. this.toBack();
  1066. },
  1067. importCommand(command) {
  1068. if (command == "answer") {
  1069. this.toImportPaperAnswer();
  1070. } else {
  1071. this.toImportPaperProperty();
  1072. }
  1073. },
  1074. // 导入答案
  1075. toImportPaperAnswer() {
  1076. this.answerTemplateUrl = `${QUESTION_API}/paper/answer/export/${this.paperId}`;
  1077. this.uploadAnswerUrl = `${QUESTION_API}/paper/answer/import/${this.paperId}`;
  1078. this.$refs.ImportAnswerDialog.open();
  1079. },
  1080. // 导出试卷蓝图
  1081. async toExportPaperBlue() {
  1082. if (this.downloading) return;
  1083. this.downloading = true;
  1084. const res = await downloadByApi(() => {
  1085. return paperPropertyExportApi(this.paperId);
  1086. }).catch((e) => {
  1087. this.$message.error(e || "下载失败,请重新尝试!");
  1088. });
  1089. this.downloading = false;
  1090. if (!res) return;
  1091. this.$message.success("下载成功!");
  1092. },
  1093. // 导入属性
  1094. toImportPaperProperty() {
  1095. this.propertyTemplateUrl = `${QUESTION_API}/paper/property/template?paperId=${this.paperId}`;
  1096. this.uploadPropertyUrl = `${QUESTION_API}/paper/property/import?paperId=${this.paperId}`;
  1097. this.$refs.ImportPorpertyDialog.open();
  1098. },
  1099. toBack() {
  1100. window.history.go(-1);
  1101. },
  1102. // 显示/隐藏答案
  1103. toSwitchQuesAnswerShowHide() {
  1104. this.quesAnswerShow = !this.quesAnswerShow;
  1105. sessionStorage.setItem("quesAnswerShow", this.quesAnswerShow);
  1106. },
  1107. // 显示/隐藏属性
  1108. toSwitchQuesTagShowHide() {
  1109. this.quesTagShow = !this.quesTagShow;
  1110. sessionStorage.setItem("quesTagShow", this.quesTagShow);
  1111. },
  1112. toViewStructInfo() {
  1113. this.$refs.PaperStructInfo.open();
  1114. },
  1115. // 查看基础构成
  1116. toViewBaseInfo() {
  1117. this.$refs.PaperBaseInfo.open();
  1118. },
  1119. // 查看题型分布
  1120. toViewQuestypeInfo() {
  1121. this.$refs.PaperQuestypeInfo.open();
  1122. },
  1123. // 查看蓝图分布
  1124. toViewBlueInfo() {
  1125. this.$refs.PaperBlueInfo.open();
  1126. },
  1127. // 查看审核信息
  1128. toViewAuditInfo() {
  1129. this.$refs.PaperAuditInfo.open();
  1130. },
  1131. // 编辑题卡
  1132. toEditCard() {
  1133. this.$router.push({
  1134. name: "CardEdit",
  1135. params: {
  1136. idType: "paper",
  1137. paperOrCardId: this.paperId,
  1138. },
  1139. });
  1140. },
  1141. async toDeletCard() {
  1142. const confirm = await this.$confirm(
  1143. `确定要清除当前试卷的题卡吗?`,
  1144. "提示",
  1145. {
  1146. type: "warning",
  1147. }
  1148. ).catch(() => {});
  1149. if (confirm !== "confirm") return;
  1150. await paperCardDeleteApi(this.paperId);
  1151. this.$message.success("操作成功!");
  1152. },
  1153. toViewLog() {
  1154. this.$refs.PaperEditLogDialog.open();
  1155. },
  1156. // header-action ----end
  1157. // 考试说明
  1158. toEditExamRemark() {
  1159. this.$refs.ModifyRichText.open();
  1160. },
  1161. examRemarkModified(content) {
  1162. this.paper.examRemark = content;
  1163. this.toSavePaper();
  1164. },
  1165. getPaperQuestionIds() {
  1166. let ids = [];
  1167. this.paper.paperDetails.forEach((detail) => {
  1168. let qids = detail.paperDetailUnits.map((q) => q.question.id);
  1169. ids.push(...qids);
  1170. });
  1171. return ids;
  1172. },
  1173. // detail-action
  1174. // 大题选题
  1175. toSelectPaperDetailQues(detail) {
  1176. this.curDetail = detail;
  1177. this.paperQuestionIds = this.getPaperQuestionIds();
  1178. this.$refs.SelectQuestionDialog.open();
  1179. },
  1180. async questionSelected(questions) {
  1181. if (!questions.length) {
  1182. this.$message.error("请选择试题!");
  1183. return;
  1184. }
  1185. const res = await paperDetailAddQuestionApi(
  1186. this.paperId,
  1187. this.curDetail.id,
  1188. questions
  1189. ).catch(() => {});
  1190. if (!res) return;
  1191. this.$message.success("添加成功!");
  1192. this.initPaper("addSmall");
  1193. },
  1194. addBigQuestion() {
  1195. this.curDetail = {};
  1196. this.$refs.ModifyDetailStruct.open();
  1197. },
  1198. // 大题编辑
  1199. toEditPaperDetail(detail) {
  1200. this.curDetail = { ...detail, detailName: detail.name };
  1201. this.$refs.ModifyDetailStruct.open();
  1202. },
  1203. async detailModified(detail, isAdd) {
  1204. if (isAdd) {
  1205. const res = paperDetailAddApi({
  1206. paperId: this.paperId,
  1207. name: detail.detailName,
  1208. description: detail.description,
  1209. }).catch(() => {});
  1210. if (!res) return;
  1211. this.$message.success("新增成功!");
  1212. setTimeout(() => {
  1213. this.initPaper("addBig");
  1214. }, 50);
  1215. } else {
  1216. detail.name = detail.detailName;
  1217. const res = await paperDetailUpdateApi(this.paperId, detail).catch(
  1218. () => {}
  1219. );
  1220. if (!res) return;
  1221. this.$message.success("修改成功!");
  1222. this.initPaper();
  1223. }
  1224. // const paperDetail = this.paper.paperDetails.find(
  1225. // (item) => item.id === detail.id
  1226. // );
  1227. // if (!paperDetail) return;
  1228. // paperDetail.name = detail.detailName;
  1229. // paperDetail.description = detail.description;
  1230. },
  1231. // 移动大题
  1232. async toMovePaperDetail(detail, vector) {
  1233. const vectorStr = vector == "up" ? "上移" : "下移";
  1234. const confirm = await this.$confirm(
  1235. `确定要${vectorStr}该大题吗?`,
  1236. "提示",
  1237. {
  1238. type: "warning",
  1239. }
  1240. ).catch(() => {});
  1241. if (confirm !== "confirm") return;
  1242. const res = await paperDetailMoveApi({
  1243. paperId: this.paperId,
  1244. detailId: detail.id,
  1245. vector,
  1246. }).catch(() => {});
  1247. if (!res) return;
  1248. this.$message.success("操作成功!");
  1249. this.initPaper();
  1250. },
  1251. // 删除大题
  1252. async toDeletePaperDetail(detail) {
  1253. if (detail.paperDetailUnits.length) {
  1254. this.$message.error("大题下还有小题,不可删除!");
  1255. return;
  1256. }
  1257. const confirm = await this.$confirm(`确定要删除该大题吗?`, "提示", {
  1258. type: "warning",
  1259. }).catch(() => {});
  1260. if (confirm !== "confirm") return;
  1261. const res = await paperDetailDeleteApi({
  1262. paperId: this.paperId,
  1263. detailId: detail.id,
  1264. }).catch(() => {});
  1265. if (!res) return;
  1266. this.$message.success("操作成功!");
  1267. this.initPaper();
  1268. },
  1269. // detail-action ----end
  1270. // question-action
  1271. toCheckDuplicateQuestion(questionId) {
  1272. this.$router.push({
  1273. name: "check_duplicate_info",
  1274. query: {
  1275. quesId: questionId,
  1276. basePaperId: this.paperId,
  1277. from: "paper",
  1278. },
  1279. });
  1280. },
  1281. // 更换试题
  1282. async toChangeQues(row) {
  1283. let question = row.question;
  1284. if (!this.changeSelectQuestionMap[question.sourceDetailId])
  1285. this.changeSelectQuestionMap[question.sourceDetailId] = [];
  1286. const res = await paperQuestionChangeApi(
  1287. row.id,
  1288. this.changeSelectQuestionMap[question.sourceDetailId].join()
  1289. ).catch(() => {});
  1290. if (!res) return;
  1291. if (!this.changeSelectQuestionMap[question.sourceDetailId].length) {
  1292. this.changeSelectQuestionMap[question.sourceDetailId].push(question.id);
  1293. }
  1294. this.changeSelectQuestionMap[question.sourceDetailId].push(res.data);
  1295. this.initPaper();
  1296. },
  1297. // 编辑小题
  1298. toEditQues(row) {
  1299. this.curQuestion = row;
  1300. this.$refs.QuestionEditDialog.open();
  1301. },
  1302. async questionEdited(question) {
  1303. let subScoreList = [];
  1304. if (question.subQuestions && question.subQuestions.length) {
  1305. subScoreList = question.subQuestions.map((item) => item.score || 0);
  1306. question.score = calcSum(subScoreList);
  1307. }
  1308. let questionUnit = {
  1309. id: this.curQuestion.id,
  1310. question,
  1311. score: question.score,
  1312. };
  1313. if (subScoreList.length) questionUnit.subScoreList = subScoreList;
  1314. const res = await paperQuestionSaveApi(questionUnit).catch(() => {});
  1315. if (!res) return;
  1316. this.$message.success("保存成功!");
  1317. this.initPaper();
  1318. },
  1319. // 移动小题
  1320. async toMoveQues(detailId, unitid, vector) {
  1321. const vectorStr = vector == "up" ? "上移" : "下移";
  1322. const confirm = await this.$confirm(
  1323. `确定要${vectorStr}该小题吗?`,
  1324. "提示",
  1325. {
  1326. type: "warning",
  1327. }
  1328. ).catch(() => {});
  1329. if (confirm !== "confirm") return;
  1330. const res = await paperQuestionMoveApi({
  1331. detailId,
  1332. unitid,
  1333. vector,
  1334. }).catch(() => {});
  1335. if (!res) return;
  1336. this.$message.success("操作成功!");
  1337. this.initPaper();
  1338. },
  1339. // 删除小题
  1340. async toDeleteQues(paperDetailUnit) {
  1341. const confirm = await this.$confirm(`确定要删除该题吗?`, "提示", {
  1342. type: "warning",
  1343. }).catch(() => {});
  1344. if (confirm !== "confirm") return;
  1345. const res = await paperQuestionDeleteApi(paperDetailUnit.id).catch(
  1346. () => {}
  1347. );
  1348. if (!res) return;
  1349. this.$message.success("操作成功!");
  1350. this.initPaper();
  1351. },
  1352. // other
  1353. isNested(questionType) {
  1354. const nestedQuestion = [
  1355. "PARAGRAPH_MATCHING",
  1356. "BANKED_CLOZE",
  1357. "CLOZE",
  1358. "READING_COMPREHENSION",
  1359. "LISTENING_QUESTION",
  1360. ];
  1361. return nestedQuestion.includes(questionType);
  1362. },
  1363. isMatchingQuestion(questionType) {
  1364. const typeQuestion = ["PARAGRAPH_MATCHING", "BANKED_CLOZE"];
  1365. return typeQuestion.includes(questionType);
  1366. },
  1367. },
  1368. };
  1369. </script>
  1370. <style lang="scss" scoped>
  1371. .edit-paper {
  1372. height: calc(100vh - 140px);
  1373. margin-top: 140px;
  1374. .edit-warning-wrap {
  1375. height: 69px;
  1376. &.hid {
  1377. height: 0;
  1378. overflow: hidden;
  1379. .edit-warning {
  1380. height: 0;
  1381. overflow: hidden;
  1382. }
  1383. }
  1384. transition: all 0.3s;
  1385. }
  1386. .edit-warning {
  1387. height: 54px;
  1388. background: #fdcdc5;
  1389. border-radius: 8px;
  1390. padding: 0 15px;
  1391. display: flex;
  1392. align-items: center;
  1393. transition: all 0.3s;
  1394. img {
  1395. width: 20px;
  1396. margin-right: 8px;
  1397. }
  1398. span {
  1399. color: #262626;
  1400. font-size: 14px;
  1401. }
  1402. }
  1403. .edit-part {
  1404. &.level2 {
  1405. padding-bottom: 60px;
  1406. & > .edit-cont {
  1407. .edit-cont-title > .rich-text {
  1408. vertical-align: top;
  1409. }
  1410. }
  1411. .level2-hover-show {
  1412. display: none;
  1413. position: absolute;
  1414. bottom: 15px;
  1415. left: 20px;
  1416. z-index: 1;
  1417. width: calc(100% - 450px);
  1418. }
  1419. &:hover {
  1420. .level2-hover-show {
  1421. display: block;
  1422. }
  1423. }
  1424. }
  1425. &.level1 {
  1426. padding-bottom: 80px;
  1427. .level1-hover-show {
  1428. display: none;
  1429. position: absolute;
  1430. bottom: 15px;
  1431. left: 20px;
  1432. z-index: 1;
  1433. }
  1434. &:hover {
  1435. .level1-hover-show {
  1436. display: block;
  1437. }
  1438. }
  1439. }
  1440. .hover-show {
  1441. visibility: hidden;
  1442. }
  1443. &:hover {
  1444. .hover-show {
  1445. visibility: visible;
  1446. }
  1447. }
  1448. .gray-btn-group {
  1449. height: 32px;
  1450. border-radius: 6px;
  1451. background: #f2f3f5;
  1452. display: flex;
  1453. align-items: center;
  1454. & > span {
  1455. color: #8c8c8c;
  1456. font-size: 14px;
  1457. padding: 0 12px;
  1458. cursor: pointer;
  1459. transition: all 0.3s;
  1460. &:not(:first-child) {
  1461. border-left: 1px solid #e5e5e5;
  1462. }
  1463. &:hover {
  1464. color: #262626;
  1465. }
  1466. }
  1467. }
  1468. }
  1469. }
  1470. </style>