adultInput3.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. <!-- -->
  2. <template>
  3. <div class="Big-Book-container adult-book-input-sty">
  4. <Header />
  5. <div class="Big-Book-content">
  6. <div class="content-tree">
  7. <Catelog
  8. :book-id="bookId"
  9. :book-level="bookLevel"
  10. :book-node-index="bookIndex"
  11. :change-id="changeId"
  12. :changeTreeData="changeTreeData"
  13. />
  14. </div>
  15. <div class="Book-content" v-if="currentTreeID">
  16. <div class="Big-Book-save">
  17. <el-button type="primary" @click="onSave">保 存</el-button>
  18. <el-button type="danger" @click="onPreview" plain>预 览</el-button>
  19. </div>
  20. <el-tabs
  21. v-model="editableTabsValue"
  22. type="card"
  23. editable
  24. @edit="handleTabsEdit"
  25. @tab-click="tabClick"
  26. >
  27. <el-tab-pane
  28. v-for="(item, index) in question_list"
  29. :key="item.name"
  30. :label="item.title"
  31. :name="item.name"
  32. >
  33. <div class="createTable">
  34. <el-input
  35. maxlength="1"
  36. style="width: 50px"
  37. v-model="row"
  38. type="text"
  39. @input="rowLine('row')"
  40. />*<el-input
  41. style="width: 50px"
  42. v-model="line"
  43. type="text"
  44. maxlength="1"
  45. @input="rowLine('line')"
  46. />
  47. <el-button
  48. @click="createTable"
  49. style="margin-left: 10px"
  50. type="primary"
  51. >增加题</el-button
  52. >
  53. </div>
  54. <div
  55. v-for="(topic, toindex) in item.cur_fn_data"
  56. :key="'topic' + toindex + index"
  57. >
  58. <p>第{{ toindex + 1 }}题</p>
  59. <div class="adult-book-input-item">
  60. <span class="adult-book-lable">正标题</span>
  61. <el-input
  62. class="adult-book-input"
  63. :autosize="{ minRows: 2 }"
  64. type="textarea"
  65. placeholder="请输入正标题"
  66. v-model="topic.z_title"
  67. @blur="onBlur(topic, 'z_title')"
  68. ></el-input>
  69. </div>
  70. <div class="adult-book-input-item">
  71. <span class="adult-book-lable">副标题</span>
  72. <el-input
  73. class="adult-book-input"
  74. :autosize="{ minRows: 2 }"
  75. type="textarea"
  76. placeholder="请输入副标题"
  77. v-model="topic.f_title"
  78. @blur="onBlur(topic, 'f_title')"
  79. ></el-input>
  80. </div>
  81. <div class="adult-book-input-item">
  82. <span>是否有背景色:</span>
  83. <el-radio-group v-model="topic.is_bg">
  84. <el-radio :label="true">有</el-radio>
  85. <el-radio :label="false">无</el-radio>
  86. </el-radio-group>
  87. </div>
  88. <div class="adult-book-input-item">
  89. <span>是否有背景图:</span>
  90. <el-radio-group v-model="topic.is_layout">
  91. <el-radio :label="true">有</el-radio>
  92. <el-radio :label="false">无</el-radio>
  93. </el-radio-group>
  94. </div>
  95. <div
  96. v-for="(rowItem, rowIndex) in topic.table_list"
  97. :key="'row' + rowIndex + index"
  98. >
  99. <div
  100. v-for="(topicIitem, lineIndex) in rowItem"
  101. :key="lineIndex"
  102. >
  103. <p>{{ topicIitem.text }}</p>
  104. <div>
  105. <template
  106. v-if="
  107. topicIitem.type == 'article_chs' ||
  108. (topicIitem.data &&
  109. topicIitem.data.type == 'article_chs')
  110. "
  111. >
  112. <template v-if="topicIitem.is_edit">
  113. <ArticleTemChs
  114. :curQue="topicIitem.data"
  115. :changeCurQue="changeCurQue"
  116. />
  117. </template>
  118. <template v-else>
  119. <ArticleView :curQue="topicIitem.data" />
  120. </template>
  121. </template>
  122. <template v-if="topicIitem.type == 'sentence_segword_chs'">
  123. <template v-if="topicIitem.is_edit">
  124. <SentenceSegwordChs
  125. :curQue="topicIitem.data"
  126. :changeCurQue="changeCurQue"
  127. />
  128. </template>
  129. <template v-else>
  130. <ArticleView :curQue="topicIitem.data" />
  131. </template>
  132. </template>
  133. <template
  134. v-if="
  135. topicIitem.type == 'dialog_article_chs' ||
  136. (topicIitem.data &&
  137. topicIitem.data.type == 'dialog_article_chs')
  138. "
  139. >
  140. <template v-if="topicIitem.is_edit">
  141. <DialogueArticleChs
  142. :curQue="topicIitem.data"
  143. :changeCurQue="changeCurQue"
  144. />
  145. </template>
  146. <template v-else>
  147. <!-- <ArticleView :curQue="topicIitem.que" /> -->
  148. </template>
  149. </template>
  150. <template v-if="topicIitem.type == 'NewWord_chs'">
  151. <template v-if="topicIitem.is_edit">
  152. <Neword
  153. :curQue="topicIitem.data"
  154. :changeCurQue="changeCurQue"
  155. />
  156. </template>
  157. <template v-else>
  158. <NewordPhraseview :curQue="topicIitem.data" />
  159. </template>
  160. </template>
  161. <template v-if="topicIitem.type == 'notes_chs'">
  162. <template v-if="topicIitem.is_edit">
  163. <Notes
  164. :curQue="topicIitem.data"
  165. :changeCurQue="changeCurQue"
  166. />
  167. </template>
  168. <template v-else>
  169. <NewordPhraseview :curQue="topicIitem.data" />
  170. </template>
  171. </template>
  172. <template v-if="topicIitem.type == 'input_record_chs'">
  173. <template v-if="topicIitem.is_edit">
  174. <InputRecord
  175. :curQue="topicIitem.data"
  176. :fn_data="fn_data"
  177. :changeCurQue="changeCurQue"
  178. />
  179. </template>
  180. <template v-else> </template>
  181. </template>
  182. <template
  183. v-if="
  184. topicIitem.type == 'recordHZ_inputPY_chs' ||
  185. topicIitem.type == 'inputItem_chs' ||
  186. topicIitem.type == 'sentence_input_chs' ||
  187. topicIitem.type == 'sentence_judge_chs' ||
  188. topicIitem.type == 'sentence_record_chs' ||
  189. topicIitem.type == 'sentence_input_record_chs' ||
  190. topicIitem.type == 'sentence_listen_read_chs'
  191. "
  192. >
  193. <template v-if="topicIitem.is_edit">
  194. <Sentence
  195. :curQue="topicIitem.data"
  196. :type="topicIitem.type"
  197. :fn_data="fn_data"
  198. :changeCurQue="changeCurQue"
  199. />
  200. </template>
  201. <template v-else> </template>
  202. </template>
  203. <template
  204. v-if="
  205. topicIitem.type == 'upload_control_chs' ||
  206. topicIitem.type == 'upload_control_preview_chs'
  207. "
  208. >
  209. <template v-if="topicIitem.is_edit">
  210. <UploadControl
  211. :curQue="topicIitem.data"
  212. :type="topicIitem.type"
  213. :fn_data="fn_data"
  214. :changeCurQue="changeCurQue"
  215. />
  216. </template>
  217. <template v-else>
  218. <UploadControlView
  219. :type="topicIitem.type"
  220. :curQue="topicIitem.data"
  221. :fn_data="fn_data"
  222. />
  223. </template>
  224. </template>
  225. <template v-if="topicIitem.type == 'sudoku_chs'">
  226. <template v-if="topicIitem.is_edit">
  227. <Sudoku
  228. :curQue="topicIitem.data"
  229. :type="topicIitem.type"
  230. :fn_data="fn_data"
  231. :changeCurQue="changeCurQue"
  232. />
  233. </template>
  234. <template v-else> </template>
  235. </template>
  236. <template v-if="topicIitem.type == 'NumberCombination_chs'">
  237. <template v-if="topicIitem.is_edit">
  238. <NumberCombination
  239. :curQue="topicIitem.data"
  240. :type="topicIitem.type"
  241. :fn_data="fn_data"
  242. :changeCurQue="changeCurQue"
  243. />
  244. </template>
  245. <template v-else> </template>
  246. </template>
  247. <template v-if="topicIitem.type == 'toneSelect_chs'">
  248. <template v-if="topicIitem.is_edit">
  249. <ToneSelect
  250. :curQue="topicIitem.data"
  251. :type="topicIitem.type"
  252. :fn_data="fn_data"
  253. :changeCurQue="changeCurQue"
  254. />
  255. </template>
  256. <template v-else> </template>
  257. </template>
  258. <template v-if="topicIitem.type == 'ligature_chs'">
  259. <template v-if="topicIitem.is_edit">
  260. <Ligature
  261. :curQue="topicIitem.data"
  262. :fn_data="fn_data"
  263. :changeCurQue="changeCurQue"
  264. />
  265. </template>
  266. <template v-else>
  267. <Ligatureview :curQue="topicIitem.data" />
  268. </template>
  269. </template>
  270. <template
  271. v-if="topicIitem.type == 'image_question_input_record'"
  272. >
  273. <template v-if="topicIitem.is_edit">
  274. <ImageQuestion
  275. :curQue="topicIitem.data"
  276. :type="topicIitem.type"
  277. :fn_data="fn_data"
  278. :changeCurQue="changeCurQue"
  279. />
  280. </template>
  281. <template v-else> </template>
  282. </template>
  283. <template
  284. v-if="
  285. topicIitem.type == 'single_chs' ||
  286. topicIitem.type == 'checkbox_chs' ||
  287. topicIitem.type == 'listen_record_single_chs'
  288. "
  289. >
  290. <template v-if="topicIitem.is_edit">
  291. <Single
  292. :curQue="topicIitem.data"
  293. :type="topicIitem.type"
  294. :fn_data="fn_data"
  295. :changeCurQue="changeCurQue"
  296. />
  297. </template>
  298. <template v-else> </template>
  299. </template>
  300. <template
  301. v-if="
  302. topicIitem.type == 'text_problem_chs' ||
  303. topicIitem.type == 'newWord_preview_chs' ||
  304. topicIitem.type == 'listen_record_single_syllable_chs'
  305. "
  306. >
  307. <template v-if="topicIitem.is_edit">
  308. <PurePreview
  309. :curQue="topicIitem.data"
  310. :type="topicIitem.type"
  311. :fn_data="fn_data"
  312. :changeCurQue="changeCurQue"
  313. />
  314. </template>
  315. <template v-else> </template>
  316. </template>
  317. <template
  318. v-if="topicIitem.type == 'zi_transverse_line_chs'"
  319. >
  320. <template v-if="topicIitem.is_edit">
  321. <ZiLine
  322. :curQue="topicIitem.data"
  323. :type="topicIitem.type"
  324. :fn_data="fn_data"
  325. :changeCurQue="changeCurQue"
  326. />
  327. </template>
  328. <template v-else> </template>
  329. </template>
  330. <template v-if="topicIitem.type == 'select_input_chs'">
  331. <template v-if="topicIitem.is_edit">
  332. <SelectInpue
  333. :curQue="topicIitem.data"
  334. :type="topicIitem.type"
  335. :fn_data="fn_data"
  336. :changeCurQue="changeCurQue"
  337. />
  338. </template>
  339. <template v-else> </template>
  340. </template>
  341. <template v-if="topicIitem.type == 'play_input_record_chs'">
  342. <template v-if="topicIitem.is_edit">
  343. <PlayInputReacord
  344. :curQue="topicIitem.data"
  345. :type="topicIitem.type"
  346. :fn_data="fn_data"
  347. :changeCurQue="changeCurQue"
  348. />
  349. </template>
  350. <template v-else> </template>
  351. </template>
  352. <template
  353. v-if="
  354. topicIitem.type == 'imgage_image' ||
  355. topicIitem.type == 'image_checkBox' ||
  356. topicIitem.type == 'image_judge' ||
  357. topicIitem.type == 'image_single' ||
  358. topicIitem.type == 'image_dobleinput' ||
  359. topicIitem.type == 'image_gdcy' ||
  360. topicIitem.type == 'image_input'
  361. "
  362. >
  363. <template v-if="topicIitem.is_edit">
  364. <Picture
  365. :curQue="topicIitem.data"
  366. :type="topicIitem.type"
  367. :fn_data="fn_data"
  368. :changeCurQue="changeCurQue"
  369. />
  370. </template>
  371. <template v-else> </template>
  372. </template>
  373. <template v-if="topicIitem.type == 'drag_chs'">
  374. <template v-if="topicIitem.is_edit">
  375. <Drag
  376. :curQue="topicIitem.data"
  377. :type="topicIitem.type"
  378. :fn_data="fn_data"
  379. :changeCurQue="changeCurQue"
  380. />
  381. </template>
  382. <template v-else> </template>
  383. </template>
  384. <template
  385. v-if="topicIitem.type == 'checkbox_self_assessment_chs'"
  386. >
  387. <template v-if="topicIitem.is_edit">
  388. <SelfAssessment
  389. :curQue="topicIitem.data"
  390. :type="topicIitem.type"
  391. :fn_data="fn_data"
  392. :changeCurQue="changeCurQue"
  393. />
  394. </template>
  395. <template v-else> </template>
  396. </template>
  397. <template v-if="topicIitem.type == 'sort_chs'">
  398. <template v-if="topicIitem.is_edit">
  399. <Sort
  400. :curQue="topicIitem.data"
  401. :type="topicIitem.type"
  402. :fn_data="fn_data"
  403. :changeCurQue="changeCurQue"
  404. />
  405. </template>
  406. <template v-else> </template>
  407. </template>
  408. </div>
  409. <div
  410. class="addoption"
  411. v-if="topicIitem.data && topicIitem.is_edit"
  412. @click="
  413. remoeModule(toindex, rowIndex, lineIndex, topicIitem)
  414. "
  415. >
  416. 删除模板
  417. </div>
  418. <div
  419. v-else-if="
  420. TopicIndex == toindex &&
  421. RowIndex == rowIndex &&
  422. lineIndex == LineIndex
  423. "
  424. class="addoption"
  425. >
  426. 选择模板
  427. </div>
  428. <div
  429. v-if="!topicIitem.data && topicIitem.is_add_module"
  430. class="addoption"
  431. @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
  432. >
  433. 添加模板
  434. </div>
  435. <template v-if="topicIitem.data">
  436. <div class="Big-Book-save" v-if="topicIitem.is_edit">
  437. <el-button
  438. type="success"
  439. size="small"
  440. @click="onSure(topicIitem)"
  441. >确定</el-button
  442. >
  443. </div>
  444. <div class="Big-Book-save" v-else>
  445. <el-button
  446. type="primary"
  447. size="small"
  448. @click.stop="editCurQue(topicIitem)"
  449. >编辑</el-button
  450. >
  451. </div>
  452. </template>
  453. </div>
  454. </div>
  455. </div>
  456. </el-tab-pane>
  457. </el-tabs>
  458. </div>
  459. <div class="Book-function" v-if="currentTreeID">
  460. <ul class="function-list">
  461. <li
  462. v-for="(item, index) in fn_data"
  463. :key="'fn' + index"
  464. @click="selectedFnType(item, index)"
  465. >
  466. <el-dropdown v-if="item.list">
  467. <span class="fn-name">
  468. {{ item.name }}<i class="el-icon-arrow-down el-icon--right"></i>
  469. </span>
  470. <el-dropdown-menu slot="dropdown" trigger="click">
  471. <el-dropdown-item
  472. @click.native="selectSmallModule(item, child, index, i)"
  473. v-for="(child, i) in item.list"
  474. :key="i"
  475. >{{ child.name }}</el-dropdown-item
  476. >
  477. </el-dropdown-menu>
  478. </el-dropdown>
  479. <span v-else class="fn-name">{{ item.name }}</span>
  480. </li>
  481. </ul>
  482. </div>
  483. </div>
  484. <el-dialog
  485. :visible.sync="previewVisible"
  486. title="预览"
  487. top="0"
  488. width="100%"
  489. @close="handleClosePre"
  490. >
  491. <div class="chooseCon">
  492. <Preview
  493. :context="context"
  494. :que-index="queIndex"
  495. :fatherName="fatherName"
  496. :currentTreeID="currentTreeID"
  497. :FatherTreeData="FatherTreeData"
  498. :change-id="changeId"
  499. :changeCurrentTreeID="changeCurrentTreeID"
  500. />
  501. </div>
  502. <span slot="footer" class="dialog-footer">
  503. <el-button @click="handleClosePre">关 闭</el-button>
  504. </span>
  505. </el-dialog>
  506. </div>
  507. </template>
  508. <script>
  509. import Header from "@/components/Header.vue";
  510. import Catelog from "@/components/Adult/inputModules/Catelog";
  511. import ArticleTemChs from "@/components/Adult/inputModules/ArticleTemChs/index.vue";
  512. import SentenceSegwordChs from "@/components/Adult/inputModules/SentenceSegwordChs/index.vue";
  513. import DialogueArticleChs from "@/components/Adult/inputModules/DialogueArticleChs/index.vue";
  514. import Single from "@/components/Adult/inputModules/Single.vue";
  515. import Judge from "@/components/Adult/inputModules/Judge.vue";
  516. import Dialogue from "@/components/Adult/inputModules/Dialogue.vue";
  517. import MatrixSingle from "@/components/Adult/inputModules/MatrixSingle.vue";
  518. import MultiRowInput from "@/components/Adult/inputModules/MultiRowInput.vue";
  519. import Ligature from "@/components/Adult/inputModules/Ligature.vue";
  520. import Neword from "@/components/Adult/inputModules/Neword.vue";
  521. import Notes from "@/components/Adult/inputModules/Notes.vue";
  522. import InputRecord from "@/components/Adult/inputModules/InputRecord.vue";
  523. import AudioControl from "@/components/Adult/inputModules/AudioControl.vue";
  524. import SuitchControl from "@/components/Adult/inputModules/SuitchControl.vue";
  525. import BgControl from "@/components/Adult/inputModules/BgControl.vue";
  526. import UploadControl from "@/components/Adult/inputModules/UploadControl.vue";
  527. import TextItem from "@/components/Adult/inputModules/TextItem.vue";
  528. import Sentence from "@/components/Adult/inputModules/Sentence.vue";
  529. import Sudoku from "@/components/Adult/inputModules/Sudoku.vue";
  530. import ToneSelect from "@/components/Adult/inputModules/ToneSelect.vue";
  531. import NumberCombination from "@/components/Adult/inputModules/NumberCombination.vue";
  532. import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
  533. import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
  534. import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
  535. import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
  536. import PlayInputReacord from "@/components/Adult/inputModules/PlayInputReacord.vue";
  537. import Drag from "@/components/Adult/inputModules/Drag.vue";
  538. import SelfAssessment from "@/components/Adult/inputModules/SelfAssessment.vue";
  539. import Sort from "@/components/Adult/inputModules/Sort.vue";
  540. import Textdes from "@/components/Adult/inputModules/Textdes.vue";
  541. import Record from "@/components/Adult/inputModules/Record.vue";
  542. import Hanzi from "@/components/Adult/inputModules/Hanzi.vue";
  543. import Picture from "@/components/Adult/inputModules/Picture.vue";
  544. import Singleview from "@/components/Adult/preview/Single.vue";
  545. import Judgeview from "@/components/Adult/preview/Judge.vue";
  546. import Textdesview from "@/components/Adult/preview/Textdes.vue";
  547. import Hanziview from "@/components/Adult/preview/Hanzi.vue";
  548. import Pictureview from "@/components/Adult/preview/Picture.vue";
  549. import Dialogueview from "@/components/Adult/preview/Dialogue.vue";
  550. import MatrixSingleview from "@/components/Adult/preview/MatrixSingle.vue";
  551. import MultiRowInputview from "@/components/Adult/preview/MultiRowInput.vue";
  552. import Ligatureview from "@/components/Adult/preview/Ligature.vue";
  553. import InputRecordview from "@/components/Adult/preview/InputRecord.vue";
  554. import BgControlview from "@/components/Adult/preview/BgControl.vue";
  555. import NewordPhraseview from "@/components/Adult/preview/WordPhrase.vue";
  556. import UploadControlView from "@/components/Adult/preview/UploadControlView.vue";
  557. import Preview from "@/components/Adult/Preview.vue";
  558. import fn from "@/components/Adult/common/data3.js";
  559. import { getContent, getStaticContent } from "@/api/ajax";
  560. export default {
  561. components: {
  562. Header,
  563. Catelog,
  564. Single,
  565. Textdes,
  566. Record,
  567. Singleview,
  568. Textdesview,
  569. Hanziview,
  570. Pictureview,
  571. Preview,
  572. Hanzi,
  573. Picture,
  574. Judge,
  575. Judgeview,
  576. Dialogue,
  577. Dialogueview,
  578. MatrixSingle,
  579. MatrixSingleview,
  580. MultiRowInput,
  581. MultiRowInputview,
  582. Ligature,
  583. Ligatureview,
  584. Neword,
  585. Notes,
  586. InputRecord,
  587. ArticleTemChs,
  588. SentenceSegwordChs,
  589. DialogueArticleChs,
  590. AudioControl,
  591. SuitchControl,
  592. BgControl,
  593. InputRecordview,
  594. BgControlview,
  595. NewordPhraseview,
  596. UploadControl,
  597. TextItem,
  598. Sentence,
  599. UploadControlView,
  600. Sudoku,
  601. NumberCombination,
  602. ToneSelect,
  603. ImageQuestion,
  604. PurePreview,
  605. ZiLine,
  606. SelectInpue,
  607. PlayInputReacord,
  608. Drag,
  609. SelfAssessment,
  610. Sort,
  611. },
  612. data() {
  613. return {
  614. bookId: 1,
  615. bookLevel: "",
  616. bookIndex: "",
  617. fn_data: [],
  618. fn_type: "",
  619. cur_fn_data: null, //当前模块的数据结构
  620. cur_page_queIsEdit: [], //当前页数的某个题
  621. question_list: [
  622. {
  623. name: "tab1",
  624. title: "第1页",
  625. cur_fn_data: [],
  626. },
  627. ], //总的数据列表
  628. cur_page_que_index: 0,
  629. editableTabsValue: "tab1",
  630. tabIndex: 0,
  631. previewVisible: false,
  632. context: [],
  633. queIndex: 0,
  634. currentTreeID: null,
  635. row: null, //行
  636. line: null, //列
  637. TopicIndex: null, //第几题的索引
  638. RowIndex: null, //第几行
  639. LineIndex: null, //第几列
  640. bgControlX: null, // 背景图插入模板的 x
  641. bgControlY: null, // 背景图插入模板的 y
  642. bgControlIndex: null, //插入第几个
  643. DeletebgControlIndex: null, //删除第几个
  644. fatherName: "",
  645. module_type: "",
  646. tmInde: "",
  647. FatherTreeData: null,
  648. };
  649. },
  650. computed: {
  651. getCurrentQuestionView() {
  652. const function_type = this.fn_type;
  653. switch (function_type) {
  654. case "single":
  655. return Single;
  656. case "text":
  657. return Textdes;
  658. case "record":
  659. return Record;
  660. }
  661. },
  662. },
  663. watch: {
  664. FatherTreeData(val, oldval) {
  665. console.log(val);
  666. },
  667. },
  668. //方法集合
  669. methods: {
  670. changeCurrentTreeID(val) {
  671. this.currentTreeID = val;
  672. },
  673. changeTreeData(val) {
  674. this.FatherTreeData = JSON.parse(JSON.stringify(val));
  675. },
  676. // 随意插入模板获取位置
  677. changeSite(x, y) {
  678. this.bgControlX = x;
  679. this.bgControlY = y;
  680. },
  681. // 插入索引
  682. changebgControlIndex(index) {
  683. this.bgControlIndex = index;
  684. },
  685. // 删除索引
  686. changeDeletebgControlIndex(index) {
  687. this.DeletebgControlIndex = index;
  688. },
  689. rowLine(value) {
  690. this[value] = this[value].match(/^\d*(\.?\d{0,2})/g)[0] || "";
  691. },
  692. createTable() {
  693. if (this.row && this.line) {
  694. let arr = {
  695. z_title: "",
  696. f_title: "",
  697. is_bg: false, //是否有背景色
  698. is_layout: false, // 是不是按背景图布局
  699. table_list: [],
  700. };
  701. for (let i = 0; i < this.row; i++) {
  702. let rowArr = [];
  703. for (let j = 0; j < this.line; j++) {
  704. let obj = {
  705. text: `第${i + 1}行,第${j + 1}列`,
  706. is_add_module: true,
  707. is_edit: true,
  708. };
  709. rowArr.push(obj);
  710. }
  711. arr.table_list.push(rowArr);
  712. }
  713. this.question_list[this.tabIndex].cur_fn_data.push(arr);
  714. this.row = null;
  715. this.line = null;
  716. } else {
  717. this.$message.warning("请输入行和列");
  718. }
  719. },
  720. // 添加模板
  721. addModule(topicIndex, rowindex, lineIndex, item) {
  722. this.TopicIndex = topicIndex;
  723. this.RowIndex = rowindex;
  724. this.LineIndex = lineIndex;
  725. this.question_list.forEach((page) => {
  726. page.cur_fn_data.forEach((pic) => {
  727. pic.table_list.forEach((row) => {
  728. row.forEach((col) => {
  729. col.is_add_module = true;
  730. });
  731. });
  732. });
  733. });
  734. item.is_add_module = false;
  735. },
  736. // 删除模板
  737. remoeModule(topicIndex, rowindex, lineIndex, item) {
  738. item.type = "";
  739. item.data = null;
  740. this.TopicIndex = null;
  741. this.RowIndex = null;
  742. this.LineIndex = null;
  743. item.is_add_module = true;
  744. },
  745. handleClosePre() {
  746. if (window.stopAudioVoice) window.stopAudioVoice();
  747. if (window.stopAudioAudio) window.stopAudioAudio();
  748. if (window.stopAudioSound) window.stopAudioSound();
  749. this.previewVisible = false;
  750. },
  751. onBlur(item, field) {
  752. item[field] = item[field] ? item[field].trim() : "";
  753. },
  754. // 当前目录id name 父级name/当前 name
  755. changeId(id, name, fatherName, type) {
  756. this.TopicIndex = null;
  757. this.RowIndex = null;
  758. this.LineIndex = null;
  759. this.fatherName = fatherName;
  760. this.currentTreeID = id;
  761. // 根据当前目录切换题
  762. let MethodName = "book-courseware_manager-GetCoursewareContent";
  763. let data = {
  764. id,
  765. };
  766. getContent(MethodName, data)
  767. .then((res) => {
  768. if (res.content) {
  769. this.question_list = JSON.parse(res.content);
  770. this.cur_page_que_index =
  771. this.question_list[this.tabIndex].cur_fn_data.length - 1;
  772. if (type == "Preview") {
  773. this.onPreview();
  774. }
  775. } else {
  776. this.question_list = [
  777. {
  778. name: "tab1",
  779. title: "第1页",
  780. cur_fn_data: [],
  781. },
  782. ];
  783. }
  784. })
  785. .catch((error) => {});
  786. },
  787. handleTabsEdit(targetName, action) {
  788. if (action === "add") {
  789. let leg = this.question_list.length;
  790. let obj = {
  791. name: `tab${leg + 1}`,
  792. title: `第${leg + 1}页`,
  793. cur_fn_data: [],
  794. };
  795. this.question_list.push(obj);
  796. }
  797. if (action === "remove") {
  798. let tabs = JSON.parse(JSON.stringify(this.question_list));
  799. let activeName = this.editableTabsValue;
  800. if (activeName === targetName) {
  801. tabs.forEach((tab, index) => {
  802. if (tab.name === targetName) {
  803. let nextTab = tabs[index + 1] || tabs[index - 1];
  804. if (nextTab) {
  805. activeName = nextTab.name;
  806. }
  807. }
  808. });
  809. }
  810. this.editableTabsValue = activeName;
  811. let question_list = tabs.filter((tab) => tab.name !== targetName);
  812. question_list.map((item, index) => {
  813. item.name = `tab${index + 1}`;
  814. item.title = `第${index + 1}页`;
  815. return item;
  816. });
  817. this.question_list = question_list;
  818. this.TopicIndex = null;
  819. this.RowIndex = null;
  820. this.LineIndex = null;
  821. }
  822. },
  823. tabClick(tab) {
  824. this.tabIndex = tab.index;
  825. },
  826. // 大模板
  827. selectedFnType(item, index) {
  828. if (item.list) {
  829. return;
  830. }
  831. if (
  832. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  833. -1 &&
  834. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  835. ) {
  836. this.$message.warning("请先选择添加模板的位置");
  837. return;
  838. }
  839. if (
  840. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  841. .table_list[this.RowIndex][this.LineIndex].data
  842. ) {
  843. this.$message.warning("每列只能添加一个模板");
  844. } else {
  845. console.log("不存在");
  846. this.$set(
  847. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  848. .table_list[this.RowIndex][this.LineIndex],
  849. "type",
  850. item.type
  851. );
  852. this.$set(
  853. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  854. .table_list[this.RowIndex][this.LineIndex],
  855. "data",
  856. null
  857. );
  858. console.log(this.question_list);
  859. }
  860. },
  861. changeCurQue(data_stru) {
  862. console.log(data_stru);
  863. console.log(this.RowIndex, this.LineIndex);
  864. this.$set(
  865. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  866. .table_list[this.RowIndex][this.LineIndex],
  867. "data",
  868. JSON.parse(JSON.stringify(data_stru))
  869. );
  870. console.log(this.question_list);
  871. },
  872. // 小模板
  873. selectSmallModule(item, child, itemIndex, childIndex) {
  874. console.log("选择了小模版");
  875. if (
  876. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  877. -1 &&
  878. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  879. ) {
  880. this.$message.warning("请先选择添加模板的位置");
  881. return;
  882. }
  883. if (
  884. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  885. .table_list[this.RowIndex][this.LineIndex].data
  886. ) {
  887. this.$message.warning("每列只能添加一个模板");
  888. } else {
  889. this.$set(
  890. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  891. .table_list[this.RowIndex][this.LineIndex],
  892. "type",
  893. child.type
  894. );
  895. this.$set(
  896. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  897. .table_list[this.RowIndex][this.LineIndex],
  898. "data",
  899. null
  900. );
  901. }
  902. },
  903. //删除某页中一个部分
  904. deleteCurQue(item, queIndex) {
  905. item.queList.splice(queIndex, 1);
  906. },
  907. saveNewwordAndSentences() {
  908. let question_list = this.question_list;
  909. let sentence_list = [],
  910. new_word_list = [];
  911. question_list.forEach((item) => {
  912. item.cur_fn_data.forEach((curItem) => {
  913. curItem.table_list.forEach((tabItem) => {
  914. tabItem.forEach((topicIitem) => {
  915. if (topicIitem.type == "article_chs") {
  916. topicIitem.data.detail.forEach((item) => {
  917. sentence_list = sentence_list.concat(item.sentences);
  918. });
  919. } else if (topicIitem.type == "NewWord_chs") {
  920. new_word_list = topicIitem.data.option;
  921. }
  922. });
  923. });
  924. });
  925. });
  926. return {
  927. new_word_list: new_word_list,
  928. sentence_list: sentence_list,
  929. };
  930. },
  931. onSave() {
  932. let question_list_str = JSON.stringify(this.question_list);
  933. console.log(this.question_list);
  934. localStorage.setItem("question_list", question_list_str);
  935. let result = this.saveNewwordAndSentences();
  936. this.$message.success("保存成功");
  937. const MethodName = "book-courseware_manager-SaveCoursewareContent";
  938. let data = {
  939. id: this.currentTreeID,
  940. content: JSON.stringify(this.question_list),
  941. new_word_list: result.new_word_list,
  942. sentence_list: result.sentence_list,
  943. };
  944. getContent(MethodName, data)
  945. .then((res) => {
  946. this.$message.success("保存成功!");
  947. })
  948. .catch((error) => {});
  949. },
  950. async onPreview() {
  951. let _this = this;
  952. let question_data = null;
  953. if (_this.question_list) {
  954. const question2 = JSON.parse(JSON.stringify(_this.question_list));
  955. question_data = await _this.getFileUrl_preview(question2);
  956. _this.previewVisible = true;
  957. _this.context = question_data;
  958. console.log("预览数据");
  959. console.log(this.question_list);
  960. } else {
  961. _this.$message.warning("还没有录入数据");
  962. }
  963. },
  964. getFileUrl_preview(question) {
  965. let questionStr = JSON.stringify(question);
  966. const reg = /\[FID##(.*?)##FID\]/g;
  967. let regConArr = [];
  968. if (reg.test(questionStr)) {
  969. regConArr = questionStr.match(reg);
  970. }
  971. if (regConArr.length > 0) {
  972. regConArr = regConArr.map((item) => {
  973. item = item.replace("[FID##", "").replace("##FID]", "");
  974. return item;
  975. });
  976. }
  977. return new Promise((resolve, reject) => {
  978. const MethodName = "file_store_manager-GetFileURLMap";
  979. const data = {
  980. file_id_list: regConArr,
  981. };
  982. getStaticContent(MethodName, data).then((res) => {
  983. const backData = res.url_map;
  984. for (const key in backData) {
  985. const url = backData[key];
  986. if (questionStr.indexOf(key) > -1) {
  987. const d = `\\[FID##${key}##FID\\]`;
  988. const regD = new RegExp(d, "g");
  989. questionStr = questionStr.replace(regD, url);
  990. }
  991. }
  992. const question3 = JSON.parse(questionStr);
  993. resolve(question3);
  994. });
  995. });
  996. },
  997. onSure(curItem) {
  998. this.TopicIndex = null;
  999. this.RowIndex = null;
  1000. this.LineIndex = null;
  1001. curItem.is_edit = false;
  1002. },
  1003. onDel(item, curIndex) {
  1004. item.cur_fn_data.splice(curIndex, 1);
  1005. if (this.question_list[this.tabIndex].cur_fn_data.length > 0) {
  1006. this.cur_page_que_index =
  1007. this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1008. } else {
  1009. this.cur_page_que_index = 0;
  1010. }
  1011. // let question_list_str = JSON.stringify(this.question_list);
  1012. // localStorage.setItem("question_list", question_list_str);
  1013. },
  1014. //编辑当前题型
  1015. editCurQue(curItem) {
  1016. curItem.is_edit = true;
  1017. // if (!curItem.isEdit) {
  1018. // let count = 0;
  1019. // let tabIndex = this.tabIndex;
  1020. // let leg = this.question_list[tabIndex].cur_fn_data.length;
  1021. // this.question_list[tabIndex].cur_fn_data.forEach((item) => {
  1022. // if (item.isEdit) {
  1023. // count++;
  1024. // }
  1025. // });
  1026. // if (count == 0) {
  1027. // if (!curItem.isEdit) {
  1028. // curItem.isEdit = true;
  1029. // }
  1030. // } else {
  1031. // this.$message.warning("有题目未保存");
  1032. // }
  1033. // }
  1034. },
  1035. },
  1036. //生命周期 - 创建完成(可以访问当前this实例)
  1037. created() {
  1038. this.fn_data = fn.fnData;
  1039. },
  1040. //生命周期 - 挂载完成(可以访问DOM元素)
  1041. mounted() {
  1042. console.log(this.question_list);
  1043. // let question_list_str = localStorage.getItem("question_list");
  1044. // if (question_list_str) {
  1045. // this.question_list = JSON.parse(question_list_str);
  1046. // this.cur_page_que_index =
  1047. // this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1048. // }
  1049. },
  1050. beforeCreate() {}, //生命周期 - 创建之前
  1051. beforeMount() {}, //生命周期 - 挂载之前
  1052. beforeUpdate() {}, //生命周期 - 更新之前
  1053. updated() {}, //生命周期 - 更新之后
  1054. beforeDestroy() {}, //生命周期 - 销毁之前
  1055. destroyed() {}, //生命周期 - 销毁完成
  1056. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  1057. };
  1058. </script>
  1059. <style lang='scss' scoped>
  1060. //@import url(); 引入公共css类
  1061. .Big-Book-container {
  1062. width: 100%;
  1063. min-height: 100vh;
  1064. .Big-Book-content {
  1065. padding: 26px 0;
  1066. display: flex;
  1067. justify-content: flex-start;
  1068. align-items: flex-start;
  1069. }
  1070. .content-tree {
  1071. width: 280px;
  1072. }
  1073. .Book-content {
  1074. flex: 1;
  1075. box-sizing: border-box;
  1076. padding: 30px;
  1077. height: 859px;
  1078. overflow-y: auto;
  1079. &-inner {
  1080. // width: 860px;
  1081. }
  1082. .addoption {
  1083. width: 148px;
  1084. height: 40px;
  1085. background: #f3f3f3;
  1086. border: 1px dashed rgba(0, 0, 0, 0.15);
  1087. box-sizing: border-box;
  1088. border-radius: 4px;
  1089. text-align: center;
  1090. line-height: 40px;
  1091. cursor: pointer;
  1092. font-size: 14px;
  1093. color: #000000;
  1094. margin-top: 20px;
  1095. }
  1096. .createTable {
  1097. }
  1098. }
  1099. .Big-Book-save {
  1100. width: 860px;
  1101. display: flex;
  1102. justify-content: flex-end;
  1103. padding: 0 0 20px 0;
  1104. }
  1105. .Big-Book {
  1106. &-add {
  1107. position: absolute;
  1108. top: -40px;
  1109. right: 0;
  1110. z-index: 1;
  1111. width: 73px;
  1112. height: 40px;
  1113. background: #f7f7f7;
  1114. border: 1px solid #d9d9d9;
  1115. line-height: 40px;
  1116. text-align: center;
  1117. font-weight: bold;
  1118. font-size: 18px;
  1119. text-align: center;
  1120. color: #000000;
  1121. }
  1122. &-name {
  1123. display: flex;
  1124. justify-content: flex-start;
  1125. align-items: center;
  1126. margin-bottom: 10px;
  1127. > p {
  1128. font-size: 14px;
  1129. }
  1130. }
  1131. &-delete {
  1132. width: 16px;
  1133. height: 16px;
  1134. margin-left: 15px;
  1135. cursor: pointer;
  1136. }
  1137. &-curPage {
  1138. margin-bottom: 20px;
  1139. &.Big-Book-curPage-edit {
  1140. border-top: 1px solid #e0e0e0;
  1141. border-bottom: 1px solid #e0e0e0;
  1142. background-color: #fafafa;
  1143. }
  1144. &.Big-Book-curPage-preview {
  1145. border-top: 1px solid #fff;
  1146. border-bottom: 1px solid #fff;
  1147. display: flex;
  1148. justify-content: flex-start;
  1149. align-items: flex-start;
  1150. &:hover {
  1151. background-color: #fafafa;
  1152. border-top: 1px solid #e0e0e0;
  1153. border-bottom: 1px solid #e0e0e0;
  1154. }
  1155. }
  1156. }
  1157. &-queBox {
  1158. padding: 10px 0;
  1159. }
  1160. }
  1161. .Book-function {
  1162. width: 204px;
  1163. background: #f7f7f7;
  1164. box-sizing: border-box;
  1165. padding: 30px 16px;
  1166. height: 859px;
  1167. overflow-y: auto;
  1168. .function-list {
  1169. width: 100%;
  1170. > li {
  1171. width: 100%;
  1172. width: 172px;
  1173. height: 40px;
  1174. background: #ffffff;
  1175. border: 1px solid rgba(0, 0, 0, 0.15);
  1176. box-sizing: border-box;
  1177. border-radius: 4px;
  1178. cursor: pointer;
  1179. margin-bottom: 5px;
  1180. display: flex;
  1181. justify-content: center;
  1182. align-items: center;
  1183. > span {
  1184. font-weight: normal;
  1185. font-size: 16px;
  1186. line-height: 150%;
  1187. color: #000000;
  1188. }
  1189. }
  1190. }
  1191. }
  1192. .Big-Book-top {
  1193. margin-top: 20px;
  1194. display: flex;
  1195. align-items: center;
  1196. span {
  1197. margin-right: 10px;
  1198. }
  1199. }
  1200. }
  1201. </style>