SentenceModule.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. <!-- -->
  2. <template>
  3. <div class="sentenceControl" v-if="curQue">
  4. <div class="adult-book-input-item">
  5. <span class="adult-book-lable">序号类型:</span>
  6. <el-radio-group v-model="curQue.numberStyle">
  7. <el-radio label="number">数字</el-radio>
  8. <el-radio label="en">小写英文字母</el-radio>
  9. <el-radio label="En">大写英文字母</el-radio>
  10. </el-radio-group>
  11. </div>
  12. <div class="adult-book-input-item">
  13. <span class="adult-book-lable">拼音位置:</span>
  14. <el-radio-group v-model="curQue.pyPosition">
  15. <el-radio :label="'top'">字的上面</el-radio>
  16. <el-radio :label="'bottom'">字的下面</el-radio>
  17. </el-radio-group>
  18. </div>
  19. <div class="adult-book-input-item">
  20. <span class="adult-book-lable">拼音颜色:</span>
  21. <el-radio-group v-model="curQue.pyColor">
  22. <el-radio label="black">黑色</el-radio>
  23. <el-radio label="grey">灰色</el-radio>
  24. <el-radio label="sub">书的辅助色</el-radio>
  25. </el-radio-group>
  26. </div>
  27. <div class="adult-book-input-item">
  28. <span class="adult-book-lable">分词模式:</span>
  29. <el-radio-group v-model="curQue.segModel">
  30. <el-radio :label="'word'">按字分割</el-radio>
  31. <el-radio :label="'words'">按词分割</el-radio>
  32. </el-radio-group>
  33. </div>
  34. <div class="adult-book-input-item">
  35. <span class="adult-book-lable">排序方式:</span>
  36. <el-radio-group v-model="curQue.sortType">
  37. <el-radio label="col">横向</el-radio>
  38. <el-radio label="row">纵向</el-radio>
  39. </el-radio-group>
  40. </div>
  41. <div class="adult-book-input-item">
  42. <span class="adult-book-lable">背景颜色:</span>
  43. <el-radio-group v-model="curQue.bgColor">
  44. <el-radio label="grey">灰色</el-radio>
  45. <el-radio label="white">白色</el-radio>
  46. <el-radio label="theme">主题色</el-radio>
  47. </el-radio-group>
  48. </div>
  49. <div class="adult-book-input-item">
  50. <span class="adult-book-lable">图片:</span>
  51. <Upload
  52. :changeFillId="timuchangeImage"
  53. :datafileList="curQue.img_list"
  54. :filleNumber="imgNumber"
  55. :uploadType="'image'"
  56. />
  57. </div>
  58. <div class="adult-book-input-item">
  59. <span class="adult-book-lable">图片位置:</span>
  60. <el-radio-group v-model="curQue.img_site">
  61. <el-radio label="top">上边</el-radio>
  62. <el-radio label="rightCenter">右边</el-radio>
  63. <el-radio label="bottom">下边</el-radio>
  64. </el-radio-group>
  65. </div>
  66. <div class="adult-book-input-item">
  67. <span class="adult-book-lable">图片大小:</span>
  68. <el-radio-group v-model="curQue.img_size">
  69. <el-radio :label="732">732px</el-radio>
  70. <el-radio :label="320">320px</el-radio>
  71. <el-radio :label="240">240px</el-radio>
  72. <el-radio :label="200">200px</el-radio>
  73. </el-radio-group>
  74. </div>
  75. <Lrc :curQue="curQue" @setCurQue="setCurQue" />
  76. <div class="option">
  77. <div
  78. class="option-item"
  79. v-for="(item, col) in curQue.option"
  80. :key="'control' + col"
  81. >
  82. <div class="adult-book-input-item">
  83. <span class="adult-book-lable"
  84. >第{{ col + 1 }}{{ curQue.sortType == "col" ? "行" : "列" }}:</span
  85. >
  86. <img
  87. @click="deleteColRow(col)"
  88. class="close"
  89. src="../../../assets/adult/del-close.png"
  90. alt=""
  91. />
  92. </div>
  93. <div
  94. v-for="(items, row) in item"
  95. :key="'op' + row"
  96. class="Big-Book-main"
  97. >
  98. <div class="adult-book-input-item">
  99. <span class="adult-book-lable">功能:</span>
  100. <el-button
  101. type="primary"
  102. size="small"
  103. @click="setConfig(items, col, row)"
  104. style="margin"
  105. >功能设置</el-button
  106. >
  107. <ul class="check-fn-list">
  108. <li v-if="items && items.fn_check_list.sent_check">
  109. {{ items.fn_check_list.sent_check | getFnName(fn_list) }}
  110. </li>
  111. <li v-if="items && items.fn_check_list.short_check">
  112. {{ items.fn_check_list.short_check | getFnName(fn_list) }}
  113. </li>
  114. <li v-if="items && items.fn_check_list.long_check">
  115. {{ items.fn_check_list.long_check | getFnName(fn_list) }}
  116. </li>
  117. <li v-if="items && items.fn_check_list.judge_check">
  118. {{ items.fn_check_list.judge_check | getFnName(fn_list) }}
  119. </li>
  120. <li v-if="items && items.fn_check_list.checkbox_check">
  121. {{ items.fn_check_list.checkbox_check | getFnName(fn_list) }}
  122. </li>
  123. <li v-if="items && items.fn_check_list.radio_check">
  124. {{ items.fn_check_list.radio_check | getFnName(fn_list) }}
  125. </li>
  126. </ul>
  127. </div>
  128. <div class="adult-book-input-item">
  129. <span class="adult-book-lable">音频:</span>
  130. <Upload
  131. :changeFillId="changeMp3"
  132. :datafileList="items.mp3_list"
  133. :filleNumber="mp3Number"
  134. :uploadType="'mp3'"
  135. :index="col"
  136. :index2="row"
  137. />
  138. <img
  139. @click="deleteWOptionOne(col, row)"
  140. class="close"
  141. src="../../../assets/adult/del-close.png"
  142. alt=""
  143. />
  144. </div>
  145. <div
  146. class="adult-book-input-item"
  147. v-if="
  148. curQue.wordTime &&
  149. curQue.wordTime.length > 0 &&
  150. curQue.wordTime[items.index]
  151. "
  152. >
  153. <span class="adult-book-lable">字幕时间:</span>
  154. <div style="display: flex; align-items: center">
  155. <el-input
  156. class="adult-book-input"
  157. style="width: 200px"
  158. v-model.trim="curQue.wordTime[items.index].bg"
  159. ></el-input>
  160. ~
  161. <el-input
  162. class="adult-book-input"
  163. style="width: 200px"
  164. v-model.trim="curQue.wordTime[items.index].ed"
  165. ></el-input>
  166. </div>
  167. </div>
  168. <div class="adult-book-input-item">
  169. <span class="adult-book-lable">图片:</span>
  170. <Upload
  171. :changeFillId="changeImg"
  172. :datafileList="items.img_list"
  173. :filleNumber="mp3Number"
  174. :uploadType="'image'"
  175. :index="col"
  176. :index2="row"
  177. />
  178. </div>
  179. <div class="adult-book-input-item">
  180. <span class="adult-book-lable">题干部分:</span>
  181. <el-button type="primary" @click="setOptionDetail(col, row)"
  182. >添加句子</el-button
  183. >
  184. </div>
  185. <div
  186. v-if="items.detail.length > 0"
  187. style="padding: 10px 0px 10px 86px"
  188. >
  189. <ul
  190. class="option-detail-detail"
  191. v-for="(dItem, dIndex) in items.detail"
  192. :key="'ddItem' + col + row + dIndex"
  193. >
  194. <li
  195. v-for="(ddItem, ddIndex) in dItem.detail"
  196. :key="'ddItem' + col + row + dIndex + ddIndex"
  197. >
  198. <span
  199. :class="[
  200. ddItem.config.wordPadding.indexOf('left') > -1
  201. ? 'dleft'
  202. : '',
  203. ddItem.config.wordPadding.indexOf('right') > -1
  204. ? 'dright'
  205. : '',
  206. !ddItem.sentence ? 'placeholder' : '',
  207. ]"
  208. >{{ ddItem.sentence }}</span
  209. >
  210. </li>
  211. <i
  212. class="el-icon-edit"
  213. @click.prevent="
  214. setOptionDetail(col, row, 'edit', dItem, dIndex)
  215. "
  216. style="margin-left: 14px"
  217. ></i>
  218. <i
  219. class="el-icon-delete"
  220. @click.prevent="deleteOptionDetail(items.detail, dIndex)"
  221. style="margin-left: 14px"
  222. ></i>
  223. </ul>
  224. </div>
  225. <div class="adult-book-input-item">
  226. <span class="adult-book-lable">例子:</span>
  227. <el-radio-group v-model="items.Isexample">
  228. <el-radio :label="true">是</el-radio>
  229. <el-radio :label="false">否</el-radio>
  230. </el-radio-group>
  231. </div>
  232. <div class="correct-box">
  233. <div
  234. style="width: 600px"
  235. v-if="
  236. items.fn_check_list.sent_check &&
  237. (items.fn_check_list.sent_check ==
  238. 'sentence_complete_input_chs' ||
  239. items.fn_check_list.sent_check == 'sentence_long_input_chs')
  240. "
  241. >
  242. <div style="padding-top: 10px">
  243. <span style="display: block; margin-bottom: 10px"
  244. >句子填空答案:<b style="font-size: 12px"
  245. >请输入本题答案,答案用换行符隔开;如果有的输入框没有答案,答案请输入??</b
  246. ></span
  247. >
  248. <el-input
  249. class="adult-book-input"
  250. type="textarea"
  251. :autosize="{ minRows: 2 }"
  252. v-model="items.correct.completeInput"
  253. placeholder="请输入句子填空答案"
  254. @blur="onBlur"
  255. maxlength="200"
  256. ></el-input>
  257. </div>
  258. </div>
  259. <div
  260. class="adult-book-input-item"
  261. v-if="
  262. items.fn_check_list.short_check &&
  263. items.fn_check_list.short_check != 'sentence_double_input_chs'
  264. "
  265. >
  266. <span class="adult-book-lable">短输入答案:</span>
  267. <el-input
  268. v-model="items.correct.shortInput"
  269. @blur="onBlur(items.correct, 'shortInput')"
  270. placeholder="请输入短输入答案"
  271. ></el-input>
  272. </div>
  273. <div
  274. class="adult-book-input-item"
  275. v-if="items.fn_check_list.long_check"
  276. >
  277. <span class="adult-book-lable">长输入答案:</span>
  278. <el-input
  279. type="textarea"
  280. @blur="onBlur(items.correct, 'longInput')"
  281. :autosize="{ minRows: 2 }"
  282. v-model="items.correct.longInput"
  283. placeholder="请输入答案"
  284. ></el-input>
  285. </div>
  286. <div
  287. class="adult-book-input-item"
  288. v-if="
  289. items.fn_check_list.short_check &&
  290. items.fn_check_list.short_check == 'sentence_double_input_chs'
  291. "
  292. >
  293. <span class="adult-book-lable">多输入答案:</span>
  294. <div>
  295. <div
  296. class="adult-book-input-item"
  297. v-for="(cdItem, cdIndex) in items.correct.doubleInput"
  298. :key="'cd+' + col + row + cdIndex"
  299. >
  300. <el-input
  301. v-model="cdItem.notice"
  302. @blur="onBlur(cdItem, 'notice')"
  303. placeholder="提示语"
  304. style="margin-right: 10px; width: 120px"
  305. ></el-input>
  306. <el-input
  307. v-model="cdItem.correct"
  308. @blur="onBlur(cdItem, 'correct')"
  309. placeholder="请输入答案"
  310. ></el-input>
  311. <i
  312. class="el-icon-delete"
  313. @click="deleteCD(items.correct.doubleInput, cdIndex)"
  314. style="margin: 14px 0 0 10px; cursor: pointer"
  315. ></i>
  316. </div>
  317. <i
  318. class="el-icon-circle-plus"
  319. @click="plusCD(items.correct.doubleInput)"
  320. style="cursor: pointer"
  321. ></i>
  322. </div>
  323. </div>
  324. <div
  325. class="adult-book-input-item"
  326. v-if="items.fn_check_list.judge_check"
  327. >
  328. <span class="adult-book-lable">判断答案:</span>
  329. <el-radio-group v-model="items.correct.judge">
  330. <el-radio label="true">正确</el-radio>
  331. <el-radio label="false">错误</el-radio>
  332. <el-radio label="unso" v-if="items.judge_isNo">无解</el-radio>
  333. </el-radio-group>
  334. <el-checkbox-group
  335. v-model="items.judge_isNo"
  336. style="margin-left: 20px; margin-top: 5px"
  337. >
  338. <el-checkbox :label="true">预览显示无解按钮</el-checkbox>
  339. </el-checkbox-group>
  340. </div>
  341. <div
  342. class="adult-book-input-item"
  343. v-if="items.fn_check_list.checkbox_check"
  344. >
  345. <span class="adult-book-lable">多选选项:</span>
  346. <div class="select-option-list">
  347. <div class="adult-book-input-item">
  348. <el-button
  349. type="primary"
  350. size="mini"
  351. plain
  352. @click="setSelectOption('checkbox', col, row, 'add')"
  353. style="margin-right: 10px"
  354. >添加选项</el-button
  355. >
  356. <el-select
  357. v-model="items.checkboxNumber"
  358. size="mini"
  359. placeholder="请选择每行选项最大数量"
  360. >
  361. <el-option
  362. v-for="(item, i) in numberList.arr"
  363. :key="i"
  364. :label="item.value"
  365. :value="item.id"
  366. >
  367. </el-option>
  368. </el-select>
  369. </div>
  370. <template v-if="items.checkbox_option.length > 0">
  371. <el-checkbox-group v-model="items.correct.checkbox">
  372. <el-checkbox
  373. v-for="(bItem, bIndex) in items.checkbox_option"
  374. :key="'box' + col + row + bIndex"
  375. :label="bIndex"
  376. >
  377. {{ bItem.number }} {{ bItem.detail.sentence }}
  378. <i
  379. class="el-icon-edit"
  380. @click.prevent="
  381. setSelectOption(
  382. 'checkbox',
  383. col,
  384. row,
  385. 'edit',
  386. bItem,
  387. bIndex
  388. )
  389. "
  390. style="margin-left: 14px"
  391. ></i>
  392. <i
  393. class="el-icon-delete"
  394. @click.prevent="
  395. deleteSelectOption(items.checkbox_option, bIndex)
  396. "
  397. style="margin-left: 14px"
  398. ></i
  399. ></el-checkbox>
  400. </el-checkbox-group>
  401. </template>
  402. </div>
  403. </div>
  404. <div
  405. class="adult-book-input-item"
  406. v-if="items.fn_check_list.radio_check"
  407. >
  408. <span class="adult-book-lable">单选选项:</span>
  409. <div class="select-option-list">
  410. <div class="adult-book-input-item">
  411. <el-button
  412. type="primary"
  413. size="mini"
  414. plain
  415. @click="setSelectOption('radio', col, row, 'add')"
  416. style="margin-right: 10px"
  417. >添加选项</el-button
  418. >
  419. <el-select
  420. v-model="items.radioNumber"
  421. size="mini"
  422. placeholder="请选择每行选项最大数量"
  423. >
  424. <el-option
  425. v-for="(item, i) in numberList.arr"
  426. :key="i"
  427. :label="item.value"
  428. :value="item.id"
  429. >
  430. </el-option>
  431. </el-select>
  432. </div>
  433. <template v-if="items.radio_option.length > 0">
  434. <el-radio-group v-model="items.correct.radio">
  435. <el-radio
  436. v-for="(bItem, bIndex) in items.radio_option"
  437. :key="'box' + col + row + bIndex"
  438. :label="bIndex"
  439. >
  440. {{ bItem.number }} {{ bItem.detail.sentence }}
  441. <i
  442. class="el-icon-edit"
  443. @click.prevent="
  444. setSelectOption(
  445. 'radio',
  446. col,
  447. row,
  448. 'edit',
  449. bItem,
  450. bIndex
  451. )
  452. "
  453. style="margin-left: 14px"
  454. ></i>
  455. <i
  456. class="el-icon-delete"
  457. @click.prevent="
  458. deleteSelectOption(items.radio_option, bIndex)
  459. "
  460. style="margin-left: 14px"
  461. ></i
  462. ></el-radio>
  463. </el-radio-group>
  464. </template>
  465. </div>
  466. </div>
  467. </div>
  468. <el-button @click="addWordcard(items.wordcard)"
  469. >添加词汇卡片</el-button
  470. >
  471. </div>
  472. <div class="addoption" @click="addWOption(col)">添加一题</div>
  473. </div>
  474. <div class="addoption" @click="addColRow">
  475. 添加{{ curQue.sortType == "col" ? "行" : "列" }}
  476. </div>
  477. </div>
  478. <el-dialog title="功能设置" :visible.sync="configVisible" width="60%">
  479. <FnConfig :items="items" :config="queConfig" />
  480. <span slot="footer" class="dialog-footer">
  481. <el-button @click="configVisible = false">取 消</el-button>
  482. <el-button type="primary" @click="saveConfig">确 定</el-button>
  483. </span>
  484. </el-dialog>
  485. <el-dialog
  486. title="设置选项"
  487. :close-on-click-modal="false"
  488. :modal-append-to-body="false"
  489. append-to-body
  490. :visible.sync="checkboxVisible"
  491. width="40%"
  492. >
  493. <selectOption
  494. :item="selectItem"
  495. :segModel="curQue.segModel"
  496. v-if="checkboxVisible"
  497. />
  498. <span slot="footer" class="dialog-footer">
  499. <el-button @click="checkboxVisible = false">取 消</el-button>
  500. <el-button type="primary" @click="saveSelectOption">确 定</el-button>
  501. </span>
  502. </el-dialog>
  503. <el-dialog
  504. title="添加句子"
  505. :close-on-click-modal="false"
  506. :modal-append-to-body="false"
  507. append-to-body
  508. :visible.sync="addStemVisible"
  509. width="50%"
  510. >
  511. <SentenceSegTemp :detail="optionItemDetail" :segModel="curQue.segModel" />
  512. <span slot="footer" class="dialog-footer">
  513. <el-button @click="addStemVisible = false">取 消</el-button>
  514. <el-button type="primary" @click="saveOptionDetail">确 定</el-button>
  515. </span>
  516. </el-dialog>
  517. <el-dialog
  518. title="添加词汇卡片"
  519. :close-on-click-modal="false"
  520. :modal-append-to-body="false"
  521. append-to-body
  522. :visible.sync="wordCardVisible"
  523. width="40%"
  524. top="10px"
  525. >
  526. <template v-if="curWordcard">
  527. <Wordcard :curQue="curWordcard" />
  528. </template>
  529. <span slot="footer" class="dialog-footer">
  530. <el-button @click="wordCardVisible = false">取 消</el-button>
  531. <el-button type="primary" @click="wordCardVisible = false"
  532. >确 定</el-button
  533. >
  534. </span>
  535. </el-dialog>
  536. </div>
  537. </template>
  538. <script>
  539. import Upload from "../common/Upload";
  540. import Lrc from "../common/Lrc";
  541. import FnConfig from "../common/FnConfig";
  542. import selectOption from "../common/selectOption";
  543. import SentenceSegwordChs from "../common/SentenceSegwordChs";
  544. import SentenceSegTemp from "../common/SentenceSegTemp";
  545. import Wordcard from "../inputModules/DialogueAnswerChs/Wordcard.vue";
  546. export default {
  547. components: {
  548. Upload,
  549. Lrc,
  550. FnConfig,
  551. selectOption,
  552. SentenceSegwordChs,
  553. SentenceSegTemp,
  554. Wordcard,
  555. },
  556. props: ["curQue", "changeCurQue", "tmIndex"],
  557. filters: {
  558. getFnName(type, fn_list) {
  559. let name = "";
  560. let arr = fn_list.filter((item) => item.type == type);
  561. if (arr.length > 0) {
  562. name = arr[0].name;
  563. }
  564. return name;
  565. },
  566. },
  567. data() {
  568. return {
  569. numberList: {
  570. type: "number",
  571. name: "每行几个",
  572. arr: [
  573. {
  574. id: 1,
  575. value: 1,
  576. },
  577. {
  578. id: 2,
  579. value: 2,
  580. },
  581. {
  582. id: 3,
  583. value: 3,
  584. },
  585. {
  586. id: 4,
  587. value: 4,
  588. },
  589. ],
  590. },
  591. wordCardVisible: false,
  592. curWordcard: null,
  593. optionItemDetail: null,
  594. addStemVisible: false,
  595. datailIndex: 0,
  596. detailSelectType: "",
  597. checkList: [],
  598. mp3Number: 1,
  599. imgNumber: 1,
  600. configVisible: false,
  601. items: null,
  602. row: 0,
  603. col: 0,
  604. checkboxVisible: false,
  605. selectItem: null,
  606. optionEditIndex: 0,
  607. optionType: "",
  608. fn_list: [
  609. {
  610. type: "sentence_view_chs",
  611. name: "句子预览(______不会转成输入框)",
  612. isFn: false,
  613. },
  614. {
  615. type: "sentence_complete_input_chs",
  616. name: "补全句子",
  617. isFn: false,
  618. },
  619. {
  620. type: "sentence_long_input_chs",
  621. name: "句子填空(长输入)",
  622. isFn: true,
  623. },
  624. {
  625. type: "sentence_double_input_chs",
  626. name: "短输入或多输入",
  627. isFn: false,
  628. },
  629. {
  630. type: "sentence_judge_col_chs",
  631. name: "判断(题干和选项横排)",
  632. isFn: false,
  633. },
  634. {
  635. type: "sentence_judge_row_chs",
  636. name: "判断(题干和选项竖排)",
  637. isFn: false,
  638. },
  639. {
  640. type: "sentence_checkbox_col_chs",
  641. name: "多选(题干和选项横排)",
  642. isFn: false,
  643. },
  644. {
  645. type: "sentence_checkbox_row_chs",
  646. name: "多选(题干和选项竖排)",
  647. isFn: false,
  648. },
  649. {
  650. type: "sentence_radio_col_chs",
  651. name: "单选(题干和选项横排)",
  652. isFn: false,
  653. },
  654. {
  655. type: "sentence_radio_row_chs",
  656. name: "单选(题干和选项竖排)",
  657. isFn: false,
  658. },
  659. {
  660. type: "sentence_record_normal_chs",
  661. name: "录音控件-normal",
  662. isFn: false,
  663. },
  664. {
  665. type: "sentence_record_pro_chs",
  666. name: "录音控件-pro",
  667. isFn: false,
  668. },
  669. ],
  670. data_structure: {
  671. type: "sentence_set_chs",
  672. name: "句子总配置",
  673. title: "",
  674. mp3_list: [],
  675. lrc_list: [],
  676. img_list: [],
  677. img_site: "rightCenter",
  678. img_size: 240, // 图片大小
  679. taskId: "",
  680. wordTime: [],
  681. detail: [],
  682. sentenceType: "chinese",
  683. numberStyle: "number",
  684. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  685. pyColor: "black",
  686. segModel: "words", //word 按字分割;words 按词分割
  687. sortType: "col", //col横;row:纵
  688. bgColor: "grey", //背景颜色
  689. option: [
  690. [
  691. {
  692. index: 0,
  693. mp3_list: [],
  694. img_list: [],
  695. Isexample: false,
  696. font: "",
  697. detail: [],
  698. radioNumber: 1,
  699. checkboxNumber: 1,
  700. checkbox_option: [],
  701. radio_option: [],
  702. judge_isNo: false,
  703. correct: {
  704. completeInput: "",
  705. shortInput: "",
  706. longInput: "",
  707. doubleInput: [
  708. {
  709. notice: "",
  710. correct: "",
  711. },
  712. ],
  713. judge: "",
  714. checkbox: [],
  715. radio: "",
  716. },
  717. fn_check_list: {
  718. sent_check: "sentence_complete_input_chs",
  719. style_check: "",
  720. short_check: "",
  721. long_check: "",
  722. judge_check: "",
  723. checkbox_check: "",
  724. radio_check: "",
  725. record_check: "",
  726. },
  727. wordcard: {
  728. //词汇卡片配置
  729. pyPosition: "top",
  730. wordcardList: [
  731. [
  732. {
  733. chs: "",
  734. pinyin: "",
  735. },
  736. ],
  737. ],
  738. },
  739. },
  740. ],
  741. ],
  742. },
  743. queConfig: {
  744. fn_sent_list: [
  745. {
  746. type: "sentence_view_chs",
  747. name: "句子预览(______不会转成输入框)",
  748. isFn: true,
  749. },
  750. {
  751. type: "sentence_complete_input_chs",
  752. name: "句子填空 (补全句子)",
  753. isFn: true,
  754. },
  755. {
  756. type: "sentence_long_input_chs",
  757. name: "句子填空(长输入)",
  758. isFn: true,
  759. },
  760. ],
  761. fn_style_list: [
  762. {
  763. type: "sentence_input_chs",
  764. name: "单行文本",
  765. isFn: false,
  766. },
  767. {
  768. type: "sentence_textarea_chs",
  769. name: "多行文本",
  770. isFn: false,
  771. },
  772. ],
  773. fn_short_list: [
  774. {
  775. type: "sentence_double_input_chs",
  776. name: "短输入或多输入(题干和选项横排)",
  777. isFn: false,
  778. },
  779. ],
  780. fn_judge_list: [
  781. {
  782. type: "sentence_judge_col_chs",
  783. name: "判断(题干和选项横排)",
  784. isFn: false,
  785. },
  786. {
  787. type: "sentence_judge_row_chs",
  788. name: "判断(题干和选项竖排)",
  789. isFn: false,
  790. },
  791. ],
  792. fn_checkbox_list: [
  793. {
  794. type: "sentence_checkbox_col_chs",
  795. name: "多选(题干和选项横排)",
  796. isFn: false,
  797. },
  798. {
  799. type: "sentence_checkbox_row_chs",
  800. name: "多选(题干和选项竖排)",
  801. isFn: false,
  802. },
  803. ],
  804. fn_radio_list: [
  805. {
  806. type: "sentence_radio_col_chs",
  807. name: "单选(题干和选项横排)",
  808. isFn: false,
  809. },
  810. {
  811. type: "sentence_radio_row_chs",
  812. name: "单选(题干和选项竖排)",
  813. isFn: false,
  814. },
  815. ],
  816. },
  817. };
  818. },
  819. computed: {},
  820. watch: {},
  821. //方法集合
  822. methods: {
  823. onBlur(item, field) {
  824. item[field] = item[field] ? item[field].trim() : "";
  825. },
  826. //功能设置
  827. setConfig(items, col, row) {
  828. this.configVisible = true;
  829. this.row = row;
  830. this.col = col;
  831. this.items = JSON.parse(JSON.stringify(items));
  832. },
  833. saveConfig() {
  834. this.configVisible = false;
  835. this.curQue.option[this.col][this.row].fn_check_list =
  836. this.items.fn_check_list;
  837. },
  838. // 添加行或者列
  839. addColRow() {
  840. let obj = JSON.parse(JSON.stringify(this.data_structure.option[0]));
  841. this.curQue.option.push(obj);
  842. this.curQue.option = this.changeoptionIndex(this.curQue.option);
  843. },
  844. // 删除行或者列
  845. deleteColRow(index) {
  846. if (this.curQue.option.length <= 1) {
  847. this.$message.warning(
  848. `至少保留1${this.curQue.sortType == "col" ? "行" : "列"}`
  849. );
  850. return;
  851. }
  852. this.curQue.option.splice(index, 1);
  853. this.curQue.option = this.changeoptionIndex(this.curQue.option);
  854. },
  855. // 新增题
  856. addWOption(col) {
  857. let obj = JSON.parse(JSON.stringify(this.data_structure.option[0][0]));
  858. let opleg = this.curQue.option[col].length - 1;
  859. let list = this.curQue.option[col][opleg].fn_check_list;
  860. obj.fn_check_list = list;
  861. this.curQue.option[col].push(obj);
  862. this.curQue.option = this.changeoptionIndex(this.curQue.option);
  863. },
  864. // 删除题
  865. deleteWOptionOne(col, row) {
  866. if (this.curQue.option[col].length <= 1) {
  867. this.$message.warning("至少要保留1题");
  868. return;
  869. }
  870. this.curQue.option[col].splice(row, 1);
  871. this.curQue.option = this.changeoptionIndex(this.curQue.option);
  872. },
  873. // 给二维的数组每个添加索引
  874. changeoptionIndex(data) {
  875. let index = 0;
  876. data.forEach((item) => {
  877. item.forEach((items) => {
  878. items.index = index;
  879. index++;
  880. });
  881. });
  882. return data;
  883. },
  884. changeMp3(fileList, file, index, index2) {
  885. const articleImgList = JSON.parse(JSON.stringify(fileList));
  886. const articleImgRes = [];
  887. articleImgList.forEach((item) => {
  888. if (item.response) {
  889. const obj = {
  890. name: item.name,
  891. url: item.response.file_info_list[0].file_url,
  892. id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
  893. media_duration: item.response.file_info_list[0].media_duration, //音频时长
  894. };
  895. articleImgRes.push(obj);
  896. }
  897. });
  898. this.curQue.option[index][index2].mp3_list = JSON.parse(
  899. JSON.stringify(articleImgRes)
  900. );
  901. },
  902. changeImg(fileList, file, index, index2) {
  903. const articleImgList = JSON.parse(JSON.stringify(fileList));
  904. const articleImgRes = [];
  905. articleImgList.forEach((item) => {
  906. if (item.response) {
  907. const obj = {
  908. name: item.name,
  909. url: item.response.file_info_list[0].file_url,
  910. id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
  911. media_duration: item.response.file_info_list[0].media_duration, //音频时长
  912. };
  913. articleImgRes.push(obj);
  914. }
  915. });
  916. this.curQue.option[index][index2].img_list = JSON.parse(
  917. JSON.stringify(articleImgRes)
  918. );
  919. },
  920. cancleSelected(key) {
  921. if (key) {
  922. key = "";
  923. }
  924. },
  925. // 更多配置选择
  926. handleCheckedFnChange(value) {
  927. let fn_list = JSON.parse(JSON.stringify(this.curQue.fn_list));
  928. this.curQue.fn_list = fn_list.map((item) => {
  929. if (value.indexOf(item.name) > -1) {
  930. item.isFn = true;
  931. } else {
  932. item.isFn = false;
  933. let option = JSON.parse(JSON.stringify(this.data_structure.option));
  934. let optionItem = option[0];
  935. this.curQue.option.forEach((it) => {
  936. it.correct = optionItem.correct;
  937. });
  938. }
  939. return item;
  940. });
  941. },
  942. judgeFnList(type) {
  943. let bool = false;
  944. this.curQue.fn_list.forEach((item) => {
  945. if (type == item.type && item.isFn) {
  946. bool = true;
  947. }
  948. });
  949. return bool;
  950. },
  951. judgeIsAnswer() {
  952. let arr = [];
  953. arr = this.curQue.fn_list.filter((item) => item.isFn);
  954. return arr.length > 0;
  955. },
  956. setCurQue(key, data) {
  957. this.curQue[key] = JSON.parse(JSON.stringify(data));
  958. this.$forceUpdate();
  959. },
  960. setSelectOption(isSelectType, col, row, type, bItem, optionEditIndex) {
  961. this.checkboxVisible = true;
  962. if (type == "edit") {
  963. this.selectItem = JSON.parse(JSON.stringify(bItem));
  964. this.optionEditIndex = optionEditIndex;
  965. } else {
  966. let obj = {
  967. number: "",
  968. detail: {
  969. sentence: "", //句子
  970. sentenceArr: [],
  971. segList: [], //分词结果
  972. seg_words: "",
  973. wordsList: [],
  974. hengList: [],
  975. },
  976. };
  977. this.selectItem = JSON.parse(JSON.stringify(obj));
  978. }
  979. this.row = row;
  980. this.col = col;
  981. this.optionType = type;
  982. this.isSelectType = isSelectType;
  983. },
  984. saveSelectOption() {
  985. if (this.isSelectType == "checkbox") {
  986. this.saveCheckboxOption();
  987. } else if (this.isSelectType == "radio") {
  988. this.saveRadioOption();
  989. }
  990. },
  991. saveCheckboxOption() {
  992. let _this = this;
  993. _this.checkboxVisible = false;
  994. let selectItem = JSON.parse(JSON.stringify(_this.selectItem));
  995. if (this.optionType == "add") {
  996. _this.curQue.option[_this.col][_this.row].checkbox_option.push(
  997. selectItem
  998. );
  999. } else {
  1000. _this.curQue.option[_this.col][_this.row].checkbox_option[
  1001. this.optionEditIndex
  1002. ] = selectItem;
  1003. }
  1004. },
  1005. saveRadioOption() {
  1006. let _this = this;
  1007. _this.checkboxVisible = false;
  1008. let selectItem = JSON.parse(JSON.stringify(_this.selectItem));
  1009. if (this.optionType == "add") {
  1010. _this.curQue.option[_this.col][_this.row].radio_option.push(selectItem);
  1011. } else {
  1012. _this.curQue.option[_this.col][_this.row].radio_option[
  1013. this.optionEditIndex
  1014. ] = selectItem;
  1015. }
  1016. },
  1017. deleteSelectOption(arr, index) {
  1018. arr.splice(index, 1);
  1019. },
  1020. //多输入的添加
  1021. plusCD(arr) {
  1022. let obj = {
  1023. notice: "",
  1024. correct: "",
  1025. };
  1026. arr.push(JSON.parse(JSON.stringify(obj)));
  1027. },
  1028. //多输入的删除
  1029. deleteCD(arr, index) {
  1030. arr.splice(index, 1);
  1031. },
  1032. //添加句子
  1033. setOptionDetail(col, row, type, dItem, dIndex) {
  1034. let _this = this;
  1035. _this.addStemVisible = true;
  1036. if (type == "edit") {
  1037. this.optionItemDetail = JSON.parse(JSON.stringify(dItem));
  1038. } else {
  1039. let obj = {
  1040. hengLeg: -1,
  1041. detail: [
  1042. {
  1043. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1044. sentence: "", //句子
  1045. segList: [], //分词结果
  1046. seg_words: "",
  1047. wordsList: [],
  1048. hengList: [],
  1049. config: {
  1050. fontSize: "24px",
  1051. fontColor: "#000",
  1052. fontFamily: "FZJCGFKTK",
  1053. wordPadding: [],
  1054. },
  1055. },
  1056. ],
  1057. fn_check_list: {
  1058. record_check: "",
  1059. },
  1060. };
  1061. this.optionItemDetail = JSON.parse(JSON.stringify(obj));
  1062. }
  1063. this.row = row;
  1064. this.col = col;
  1065. this.datailIndex = dIndex;
  1066. this.detailSelectType = type;
  1067. },
  1068. //删除句子
  1069. deleteOptionDetail(detail, dIndex) {
  1070. detail.splice(dIndex, 1);
  1071. },
  1072. //保存句子
  1073. saveOptionDetail() {
  1074. let _this = this;
  1075. _this.addStemVisible = false;
  1076. if (_this.detailSelectType == "edit") {
  1077. let optionItem = JSON.parse(JSON.stringify(_this.optionItemDetail));
  1078. _this.curQue.option[_this.col][_this.row].detail[_this.datailIndex] =
  1079. optionItem;
  1080. } else {
  1081. let optionItem = JSON.parse(JSON.stringify(_this.optionItemDetail));
  1082. _this.curQue.option[_this.col][_this.row].detail.push(optionItem);
  1083. }
  1084. },
  1085. timuchangeImage(fileList, item) {
  1086. const articleImgList = JSON.parse(JSON.stringify(fileList));
  1087. const articleImgRes = [];
  1088. articleImgList.forEach((item) => {
  1089. if (item.response) {
  1090. const obj = {
  1091. name: item.name,
  1092. url: item.response.file_info_list[0].file_url,
  1093. id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
  1094. };
  1095. articleImgRes.push(obj);
  1096. }
  1097. });
  1098. this.curQue.img_list = JSON.parse(JSON.stringify(articleImgRes));
  1099. },
  1100. addWordcard(wordcard) {
  1101. this.wordCardVisible = true;
  1102. this.curWordcard = wordcard;
  1103. },
  1104. initCurQueData() {
  1105. let res_data = JSON.parse(JSON.stringify(this.data_structure));
  1106. this.changeCurQue(res_data);
  1107. },
  1108. },
  1109. //生命周期 - 创建完成(可以访问当前this实例)
  1110. created() {},
  1111. //生命周期 - 挂载完成(可以访问DOM元素)
  1112. mounted() {
  1113. let _this = this;
  1114. if (!_this.curQue) {
  1115. _this.initCurQueData();
  1116. } else {
  1117. // 如果保存过需要将选中的功能设置选中
  1118. // _this.curQue.fn_list.forEach((item) => {
  1119. // if (item.isFn) {
  1120. // _this.checkList.push(item.name);
  1121. // }
  1122. // });
  1123. }
  1124. },
  1125. beforeCreate() {}, //生命周期 - 创建之前
  1126. beforeMount() {}, //生命周期 - 挂载之前
  1127. beforeUpdate() {}, //生命周期 - 更新之前
  1128. updated() {}, //生命周期 - 更新之后
  1129. beforeDestroy() {}, //生命周期 - 销毁之前
  1130. destroyed() {}, //生命周期 - 销毁完成
  1131. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  1132. };
  1133. </script>
  1134. <style lang='scss' scoped>
  1135. //@import url(); 引入公共css类
  1136. .option-item {
  1137. width: 100%;
  1138. box-sizing: border-box;
  1139. border: 1px rgb(173, 173, 173) dotted;
  1140. background: rgb(241, 241, 241);
  1141. padding: 16px;
  1142. margin-bottom: 10px;
  1143. }
  1144. .correct-box {
  1145. width: 500px;
  1146. > div {
  1147. margin-bottom: 10px;
  1148. }
  1149. .adult-book-input-item {
  1150. .adult-book-lable {
  1151. width: 105px;
  1152. }
  1153. }
  1154. }
  1155. .Big-Book-main {
  1156. border-bottom: 1px rgb(173, 173, 173) dotted;
  1157. }
  1158. .check-fn-list {
  1159. display: flex;
  1160. > li {
  1161. margin-left: 10px;
  1162. line-height: 32px;
  1163. color: #999;
  1164. }
  1165. }
  1166. .select-option-list {
  1167. .el-checkbox,
  1168. .el-radio {
  1169. display: block;
  1170. margin-bottom: 10px;
  1171. }
  1172. }
  1173. .adult-book-input-sty .el-radio-group {
  1174. padding: 8px 0;
  1175. display: block;
  1176. }
  1177. .option-detail-detail {
  1178. clear: both;
  1179. overflow: hidden;
  1180. margin-bottom: 10px;
  1181. > li {
  1182. float: left;
  1183. > span {
  1184. float: left;
  1185. &.dleft {
  1186. padding-left: 4px;
  1187. padding-right: 4px;
  1188. }
  1189. }
  1190. }
  1191. > i {
  1192. float: left;
  1193. }
  1194. }
  1195. .placeholder {
  1196. width: 8px;
  1197. height: 18px;
  1198. }
  1199. </style>