adultInput3.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205
  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. />
  500. </div>
  501. <span slot="footer" class="dialog-footer">
  502. <el-button @click="handleClosePre">关 闭</el-button>
  503. </span>
  504. </el-dialog>
  505. </div>
  506. </template>
  507. <script>
  508. import Header from "@/components/Header.vue";
  509. import Catelog from "@/components/Adult/inputModules/Catelog";
  510. import ArticleTemChs from "@/components/Adult/inputModules/ArticleTemChs/index.vue";
  511. import SentenceSegwordChs from "@/components/Adult/inputModules/SentenceSegwordChs/index.vue";
  512. import DialogueArticleChs from "@/components/Adult/inputModules/DialogueArticleChs/index.vue";
  513. import Single from "@/components/Adult/inputModules/Single.vue";
  514. import Judge from "@/components/Adult/inputModules/Judge.vue";
  515. import Dialogue from "@/components/Adult/inputModules/Dialogue.vue";
  516. import MatrixSingle from "@/components/Adult/inputModules/MatrixSingle.vue";
  517. import MultiRowInput from "@/components/Adult/inputModules/MultiRowInput.vue";
  518. import Ligature from "@/components/Adult/inputModules/Ligature.vue";
  519. import Neword from "@/components/Adult/inputModules/Neword.vue";
  520. import Notes from "@/components/Adult/inputModules/Notes.vue";
  521. import InputRecord from "@/components/Adult/inputModules/InputRecord.vue";
  522. import AudioControl from "@/components/Adult/inputModules/AudioControl.vue";
  523. import SuitchControl from "@/components/Adult/inputModules/SuitchControl.vue";
  524. import BgControl from "@/components/Adult/inputModules/BgControl.vue";
  525. import UploadControl from "@/components/Adult/inputModules/UploadControl.vue";
  526. import TextItem from "@/components/Adult/inputModules/TextItem.vue";
  527. import Sentence from "@/components/Adult/inputModules/Sentence.vue";
  528. import Sudoku from "@/components/Adult/inputModules/Sudoku.vue";
  529. import ToneSelect from "@/components/Adult/inputModules/ToneSelect.vue";
  530. import NumberCombination from "@/components/Adult/inputModules/NumberCombination.vue";
  531. import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
  532. import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
  533. import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
  534. import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
  535. import PlayInputReacord from "@/components/Adult/inputModules/PlayInputReacord.vue";
  536. import Drag from "@/components/Adult/inputModules/Drag.vue";
  537. import SelfAssessment from "@/components/Adult/inputModules/SelfAssessment.vue";
  538. import Sort from "@/components/Adult/inputModules/Sort.vue";
  539. import Textdes from "@/components/Adult/inputModules/Textdes.vue";
  540. import Record from "@/components/Adult/inputModules/Record.vue";
  541. import Hanzi from "@/components/Adult/inputModules/Hanzi.vue";
  542. import Picture from "@/components/Adult/inputModules/Picture.vue";
  543. import Singleview from "@/components/Adult/preview/Single.vue";
  544. import Judgeview from "@/components/Adult/preview/Judge.vue";
  545. import Textdesview from "@/components/Adult/preview/Textdes.vue";
  546. import Hanziview from "@/components/Adult/preview/Hanzi.vue";
  547. import Pictureview from "@/components/Adult/preview/Picture.vue";
  548. import Dialogueview from "@/components/Adult/preview/Dialogue.vue";
  549. import MatrixSingleview from "@/components/Adult/preview/MatrixSingle.vue";
  550. import MultiRowInputview from "@/components/Adult/preview/MultiRowInput.vue";
  551. import Ligatureview from "@/components/Adult/preview/Ligature.vue";
  552. import InputRecordview from "@/components/Adult/preview/InputRecord.vue";
  553. import BgControlview from "@/components/Adult/preview/BgControl.vue";
  554. import NewordPhraseview from "@/components/Adult/preview/WordPhrase.vue";
  555. import UploadControlView from "@/components/Adult/preview/UploadControlView.vue";
  556. import Preview from "@/components/Adult/Preview.vue";
  557. import fn from "@/components/Adult/common/data3.js";
  558. import { getContent, getStaticContent } from "@/api/ajax";
  559. export default {
  560. components: {
  561. Header,
  562. Catelog,
  563. Single,
  564. Textdes,
  565. Record,
  566. Singleview,
  567. Textdesview,
  568. Hanziview,
  569. Pictureview,
  570. Preview,
  571. Hanzi,
  572. Picture,
  573. Judge,
  574. Judgeview,
  575. Dialogue,
  576. Dialogueview,
  577. MatrixSingle,
  578. MatrixSingleview,
  579. MultiRowInput,
  580. MultiRowInputview,
  581. Ligature,
  582. Ligatureview,
  583. Neword,
  584. Notes,
  585. InputRecord,
  586. ArticleTemChs,
  587. SentenceSegwordChs,
  588. DialogueArticleChs,
  589. AudioControl,
  590. SuitchControl,
  591. BgControl,
  592. InputRecordview,
  593. BgControlview,
  594. NewordPhraseview,
  595. UploadControl,
  596. TextItem,
  597. Sentence,
  598. UploadControlView,
  599. Sudoku,
  600. NumberCombination,
  601. ToneSelect,
  602. ImageQuestion,
  603. PurePreview,
  604. ZiLine,
  605. SelectInpue,
  606. PlayInputReacord,
  607. Drag,
  608. SelfAssessment,
  609. Sort,
  610. },
  611. data() {
  612. return {
  613. bookId: 1,
  614. bookLevel: "",
  615. bookIndex: "",
  616. fn_data: [],
  617. fn_type: "",
  618. cur_fn_data: null, //当前模块的数据结构
  619. cur_page_queIsEdit: [], //当前页数的某个题
  620. question_list: [
  621. {
  622. name: "tab1",
  623. title: "第1页",
  624. cur_fn_data: [],
  625. },
  626. ], //总的数据列表
  627. cur_page_que_index: 0,
  628. editableTabsValue: "tab1",
  629. tabIndex: 0,
  630. previewVisible: false,
  631. context: [],
  632. queIndex: 0,
  633. currentTreeID: null,
  634. row: null, //行
  635. line: null, //列
  636. TopicIndex: null, //第几题的索引
  637. RowIndex: null, //第几行
  638. LineIndex: null, //第几列
  639. bgControlX: null, // 背景图插入模板的 x
  640. bgControlY: null, // 背景图插入模板的 y
  641. bgControlIndex: null, //插入第几个
  642. DeletebgControlIndex: null, //删除第几个
  643. fatherName: "",
  644. module_type: "",
  645. tmInde: "",
  646. FatherTreeData: null,
  647. };
  648. },
  649. computed: {
  650. getCurrentQuestionView() {
  651. const function_type = this.fn_type;
  652. switch (function_type) {
  653. case "single":
  654. return Single;
  655. case "text":
  656. return Textdes;
  657. case "record":
  658. return Record;
  659. }
  660. },
  661. },
  662. watch: {
  663. FatherTreeData(val, oldval) {
  664. console.log(val);
  665. },
  666. },
  667. //方法集合
  668. methods: {
  669. changeTreeData(val){
  670. this.FatherTreeData = JSON.parse(JSON.stringify(val))
  671. },
  672. // 随意插入模板获取位置
  673. changeSite(x, y) {
  674. this.bgControlX = x;
  675. this.bgControlY = y;
  676. },
  677. // 插入索引
  678. changebgControlIndex(index) {
  679. this.bgControlIndex = index;
  680. },
  681. // 删除索引
  682. changeDeletebgControlIndex(index) {
  683. this.DeletebgControlIndex = index;
  684. },
  685. rowLine(value) {
  686. this[value] = this[value].match(/^\d*(\.?\d{0,2})/g)[0] || "";
  687. },
  688. createTable() {
  689. if (this.row && this.line) {
  690. let arr = {
  691. z_title: "",
  692. f_title: "",
  693. is_bg: false, //是否有背景色
  694. is_layout: false, // 是不是按背景图布局
  695. table_list: [],
  696. };
  697. for (let i = 0; i < this.row; i++) {
  698. let rowArr = [];
  699. for (let j = 0; j < this.line; j++) {
  700. let obj = {
  701. text: `第${i + 1}行,第${j + 1}列`,
  702. is_add_module: true,
  703. is_edit: true,
  704. };
  705. rowArr.push(obj);
  706. }
  707. arr.table_list.push(rowArr);
  708. }
  709. this.question_list[this.tabIndex].cur_fn_data.push(arr);
  710. this.row = null;
  711. this.line = null;
  712. } else {
  713. this.$message.warning("请输入行和列");
  714. }
  715. },
  716. // 添加模板
  717. addModule(topicIndex, rowindex, lineIndex, item) {
  718. this.TopicIndex = topicIndex;
  719. this.RowIndex = rowindex;
  720. this.LineIndex = lineIndex;
  721. this.question_list.forEach((page) => {
  722. page.cur_fn_data.forEach((pic) => {
  723. pic.table_list.forEach((row) => {
  724. row.forEach((col) => {
  725. col.is_add_module = true;
  726. });
  727. });
  728. });
  729. });
  730. item.is_add_module = false;
  731. },
  732. // 删除模板
  733. remoeModule(topicIndex, rowindex, lineIndex, item) {
  734. item.type = "";
  735. item.data = null;
  736. this.TopicIndex = null;
  737. this.RowIndex = null;
  738. this.LineIndex = null;
  739. item.is_add_module = true;
  740. },
  741. handleClosePre() {
  742. if (window.stopAudioVoice) window.stopAudioVoice();
  743. if (window.stopAudioAudio) window.stopAudioAudio();
  744. if (window.stopAudioSound) window.stopAudioSound();
  745. this.previewVisible = false;
  746. },
  747. onBlur(item, field) {
  748. item[field] = item[field] ? item[field].trim() : "";
  749. },
  750. // 当前目录id name 父级name/当前 name
  751. changeId(id, name, fatherName) {
  752. this.TopicIndex = null;
  753. this.RowIndex = null;
  754. this.LineIndex = null;
  755. this.fatherName = fatherName;
  756. this.currentTreeID = id;
  757. // 根据当前目录切换题
  758. let MethodName = "book-courseware_manager-GetCoursewareContent";
  759. let data = {
  760. id,
  761. };
  762. getContent(MethodName, data)
  763. .then((res) => {
  764. if (res.content) {
  765. this.question_list = JSON.parse(res.content);
  766. this.cur_page_que_index =
  767. this.question_list[this.tabIndex].cur_fn_data.length - 1;
  768. } else {
  769. this.question_list = [
  770. {
  771. name: "tab1",
  772. title: "第1页",
  773. cur_fn_data: [],
  774. },
  775. ];
  776. }
  777. })
  778. .catch((error) => {});
  779. },
  780. handleTabsEdit(targetName, action) {
  781. if (action === "add") {
  782. let leg = this.question_list.length;
  783. let obj = {
  784. name: `tab${leg + 1}`,
  785. title: `第${leg + 1}页`,
  786. cur_fn_data: [],
  787. };
  788. this.question_list.push(obj);
  789. }
  790. if (action === "remove") {
  791. let tabs = JSON.parse(JSON.stringify(this.question_list));
  792. let activeName = this.editableTabsValue;
  793. if (activeName === targetName) {
  794. tabs.forEach((tab, index) => {
  795. if (tab.name === targetName) {
  796. let nextTab = tabs[index + 1] || tabs[index - 1];
  797. if (nextTab) {
  798. activeName = nextTab.name;
  799. }
  800. }
  801. });
  802. }
  803. this.editableTabsValue = activeName;
  804. let question_list = tabs.filter((tab) => tab.name !== targetName);
  805. question_list.map((item, index) => {
  806. item.name = `tab${index + 1}`;
  807. item.title = `第${index + 1}页`;
  808. return item;
  809. });
  810. this.question_list = question_list;
  811. this.TopicIndex = null;
  812. this.RowIndex = null;
  813. this.LineIndex = null;
  814. }
  815. },
  816. tabClick(tab) {
  817. this.tabIndex = tab.index;
  818. },
  819. // 大模板
  820. selectedFnType(item, index) {
  821. if (item.list) {
  822. return;
  823. }
  824. if (
  825. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  826. -1 &&
  827. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  828. ) {
  829. this.$message.warning("请先选择添加模板的位置");
  830. return;
  831. }
  832. if (
  833. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  834. .table_list[this.RowIndex][this.LineIndex].data
  835. ) {
  836. this.$message.warning("每列只能添加一个模板");
  837. } else {
  838. console.log("不存在");
  839. this.$set(
  840. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  841. .table_list[this.RowIndex][this.LineIndex],
  842. "type",
  843. item.type
  844. );
  845. this.$set(
  846. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  847. .table_list[this.RowIndex][this.LineIndex],
  848. "data",
  849. null
  850. );
  851. console.log(this.question_list);
  852. }
  853. },
  854. changeCurQue(data_stru) {
  855. console.log(data_stru);
  856. console.log(this.RowIndex, this.LineIndex);
  857. this.$set(
  858. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  859. .table_list[this.RowIndex][this.LineIndex],
  860. "data",
  861. JSON.parse(JSON.stringify(data_stru))
  862. );
  863. console.log(this.question_list);
  864. },
  865. // 小模板
  866. selectSmallModule(item, child, itemIndex, childIndex) {
  867. console.log("选择了小模版");
  868. if (
  869. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  870. -1 &&
  871. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  872. ) {
  873. this.$message.warning("请先选择添加模板的位置");
  874. return;
  875. }
  876. if (
  877. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  878. .table_list[this.RowIndex][this.LineIndex].data
  879. ) {
  880. this.$message.warning("每列只能添加一个模板");
  881. } else {
  882. this.$set(
  883. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  884. .table_list[this.RowIndex][this.LineIndex],
  885. "type",
  886. child.type
  887. );
  888. this.$set(
  889. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  890. .table_list[this.RowIndex][this.LineIndex],
  891. "data",
  892. null
  893. );
  894. }
  895. },
  896. //删除某页中一个部分
  897. deleteCurQue(item, queIndex) {
  898. item.queList.splice(queIndex, 1);
  899. },
  900. saveNewwordAndSentences() {
  901. let question_list = this.question_list;
  902. let sentence_list = [],
  903. new_word_list = [];
  904. question_list.forEach((item) => {
  905. item.cur_fn_data.forEach((curItem) => {
  906. curItem.table_list.forEach((tabItem) => {
  907. tabItem.forEach((topicIitem) => {
  908. if (topicIitem.type == "article_chs") {
  909. topicIitem.data.detail.forEach((item) => {
  910. sentence_list = sentence_list.concat(item.sentences);
  911. });
  912. } else if (topicIitem.type == "NewWord_chs") {
  913. new_word_list = topicIitem.data.option;
  914. }
  915. });
  916. });
  917. });
  918. });
  919. return {
  920. new_word_list: new_word_list,
  921. sentence_list: sentence_list,
  922. };
  923. },
  924. onSave() {
  925. let question_list_str = JSON.stringify(this.question_list);
  926. console.log(this.question_list);
  927. localStorage.setItem("question_list", question_list_str);
  928. let result = this.saveNewwordAndSentences();
  929. this.$message.success("保存成功");
  930. const MethodName = "book-courseware_manager-SaveCoursewareContent";
  931. let data = {
  932. id: this.currentTreeID,
  933. content: JSON.stringify(this.question_list),
  934. new_word_list: result.new_word_list,
  935. sentence_list: result.sentence_list,
  936. };
  937. getContent(MethodName, data)
  938. .then((res) => {
  939. this.$message.success("保存成功!");
  940. })
  941. .catch((error) => {});
  942. },
  943. async onPreview() {
  944. let _this = this;
  945. let question_data = null;
  946. if (_this.question_list) {
  947. debugger;
  948. const question2 = JSON.parse(JSON.stringify(_this.question_list));
  949. question_data = await _this.getFileUrl_preview(question2);
  950. _this.previewVisible = true;
  951. _this.context = question_data;
  952. console.log("预览数据");
  953. console.log(this.question_list);
  954. } else {
  955. _this.$message.warning("还没有录入数据");
  956. }
  957. },
  958. getFileUrl_preview(question) {
  959. let questionStr = JSON.stringify(question);
  960. const reg = /\[FID##(.*?)##FID\]/g;
  961. let regConArr = [];
  962. if (reg.test(questionStr)) {
  963. regConArr = questionStr.match(reg);
  964. }
  965. if (regConArr.length > 0) {
  966. regConArr = regConArr.map((item) => {
  967. item = item.replace("[FID##", "").replace("##FID]", "");
  968. return item;
  969. });
  970. }
  971. return new Promise((resolve, reject) => {
  972. const MethodName = "file_store_manager-GetFileURLMap";
  973. const data = {
  974. file_id_list: regConArr,
  975. };
  976. getStaticContent(MethodName, data).then((res) => {
  977. const backData = res.url_map;
  978. for (const key in backData) {
  979. const url = backData[key];
  980. if (questionStr.indexOf(key) > -1) {
  981. const d = `\\[FID##${key}##FID\\]`;
  982. const regD = new RegExp(d, "g");
  983. questionStr = questionStr.replace(regD, url);
  984. }
  985. }
  986. const question3 = JSON.parse(questionStr);
  987. resolve(question3);
  988. });
  989. });
  990. },
  991. onSure(curItem) {
  992. this.TopicIndex = null;
  993. this.RowIndex = null;
  994. this.LineIndex = null;
  995. curItem.is_edit = false;
  996. },
  997. onDel(item, curIndex) {
  998. item.cur_fn_data.splice(curIndex, 1);
  999. if (this.question_list[this.tabIndex].cur_fn_data.length > 0) {
  1000. this.cur_page_que_index =
  1001. this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1002. } else {
  1003. this.cur_page_que_index = 0;
  1004. }
  1005. // let question_list_str = JSON.stringify(this.question_list);
  1006. // localStorage.setItem("question_list", question_list_str);
  1007. },
  1008. //编辑当前题型
  1009. editCurQue(curItem) {
  1010. curItem.is_edit = true;
  1011. // if (!curItem.isEdit) {
  1012. // let count = 0;
  1013. // let tabIndex = this.tabIndex;
  1014. // let leg = this.question_list[tabIndex].cur_fn_data.length;
  1015. // this.question_list[tabIndex].cur_fn_data.forEach((item) => {
  1016. // if (item.isEdit) {
  1017. // count++;
  1018. // }
  1019. // });
  1020. // if (count == 0) {
  1021. // if (!curItem.isEdit) {
  1022. // curItem.isEdit = true;
  1023. // }
  1024. // } else {
  1025. // this.$message.warning("有题目未保存");
  1026. // }
  1027. // }
  1028. },
  1029. },
  1030. //生命周期 - 创建完成(可以访问当前this实例)
  1031. created() {
  1032. this.fn_data = fn.fnData;
  1033. },
  1034. //生命周期 - 挂载完成(可以访问DOM元素)
  1035. mounted() {
  1036. console.log(this.question_list);
  1037. // let question_list_str = localStorage.getItem("question_list");
  1038. // if (question_list_str) {
  1039. // this.question_list = JSON.parse(question_list_str);
  1040. // this.cur_page_que_index =
  1041. // this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1042. // }
  1043. },
  1044. beforeCreate() {}, //生命周期 - 创建之前
  1045. beforeMount() {}, //生命周期 - 挂载之前
  1046. beforeUpdate() {}, //生命周期 - 更新之前
  1047. updated() {}, //生命周期 - 更新之后
  1048. beforeDestroy() {}, //生命周期 - 销毁之前
  1049. destroyed() {}, //生命周期 - 销毁完成
  1050. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  1051. };
  1052. </script>
  1053. <style lang='scss' scoped>
  1054. //@import url(); 引入公共css类
  1055. .Big-Book-container {
  1056. width: 100%;
  1057. min-height: 100vh;
  1058. .Big-Book-content {
  1059. padding: 26px 0;
  1060. display: flex;
  1061. justify-content: flex-start;
  1062. align-items: flex-start;
  1063. }
  1064. .content-tree {
  1065. width: 280px;
  1066. }
  1067. .Book-content {
  1068. flex: 1;
  1069. box-sizing: border-box;
  1070. padding: 30px;
  1071. height: 859px;
  1072. overflow-y: auto;
  1073. &-inner {
  1074. // width: 860px;
  1075. }
  1076. .addoption {
  1077. width: 148px;
  1078. height: 40px;
  1079. background: #f3f3f3;
  1080. border: 1px dashed rgba(0, 0, 0, 0.15);
  1081. box-sizing: border-box;
  1082. border-radius: 4px;
  1083. text-align: center;
  1084. line-height: 40px;
  1085. cursor: pointer;
  1086. font-size: 14px;
  1087. color: #000000;
  1088. margin-top: 20px;
  1089. }
  1090. .createTable {
  1091. }
  1092. }
  1093. .Big-Book-save {
  1094. width: 860px;
  1095. display: flex;
  1096. justify-content: flex-end;
  1097. padding: 0 0 20px 0;
  1098. }
  1099. .Big-Book {
  1100. &-add {
  1101. position: absolute;
  1102. top: -40px;
  1103. right: 0;
  1104. z-index: 1;
  1105. width: 73px;
  1106. height: 40px;
  1107. background: #f7f7f7;
  1108. border: 1px solid #d9d9d9;
  1109. line-height: 40px;
  1110. text-align: center;
  1111. font-weight: bold;
  1112. font-size: 18px;
  1113. text-align: center;
  1114. color: #000000;
  1115. }
  1116. &-name {
  1117. display: flex;
  1118. justify-content: flex-start;
  1119. align-items: center;
  1120. margin-bottom: 10px;
  1121. > p {
  1122. font-size: 14px;
  1123. }
  1124. }
  1125. &-delete {
  1126. width: 16px;
  1127. height: 16px;
  1128. margin-left: 15px;
  1129. cursor: pointer;
  1130. }
  1131. &-curPage {
  1132. margin-bottom: 20px;
  1133. &.Big-Book-curPage-edit {
  1134. border-top: 1px solid #e0e0e0;
  1135. border-bottom: 1px solid #e0e0e0;
  1136. background-color: #fafafa;
  1137. }
  1138. &.Big-Book-curPage-preview {
  1139. border-top: 1px solid #fff;
  1140. border-bottom: 1px solid #fff;
  1141. display: flex;
  1142. justify-content: flex-start;
  1143. align-items: flex-start;
  1144. &:hover {
  1145. background-color: #fafafa;
  1146. border-top: 1px solid #e0e0e0;
  1147. border-bottom: 1px solid #e0e0e0;
  1148. }
  1149. }
  1150. }
  1151. &-queBox {
  1152. padding: 10px 0;
  1153. }
  1154. }
  1155. .Book-function {
  1156. width: 204px;
  1157. background: #f7f7f7;
  1158. box-sizing: border-box;
  1159. padding: 30px 16px;
  1160. height: 859px;
  1161. overflow-y: auto;
  1162. .function-list {
  1163. width: 100%;
  1164. > li {
  1165. width: 100%;
  1166. width: 172px;
  1167. height: 40px;
  1168. background: #ffffff;
  1169. border: 1px solid rgba(0, 0, 0, 0.15);
  1170. box-sizing: border-box;
  1171. border-radius: 4px;
  1172. cursor: pointer;
  1173. margin-bottom: 5px;
  1174. display: flex;
  1175. justify-content: center;
  1176. align-items: center;
  1177. > span {
  1178. font-weight: normal;
  1179. font-size: 16px;
  1180. line-height: 150%;
  1181. color: #000000;
  1182. }
  1183. }
  1184. }
  1185. }
  1186. .Big-Book-top {
  1187. margin-top: 20px;
  1188. display: flex;
  1189. align-items: center;
  1190. span {
  1191. margin-right: 10px;
  1192. }
  1193. }
  1194. }
  1195. </style>