SentenceModule.vue 41 KB

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