SentenceMulModule.vue 44 KB

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