adultInput.vue 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719
  1. <!-- -->
  2. <template>
  3. <div class="Big-Book-container adult-book-input-sty" v-loading="loading">
  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. :currentTreeID="currentTreeID"
  14. />
  15. </div>
  16. <div v-if="currentTreeID" class="Book-content">
  17. <div class="Big-Book-save">
  18. <el-button type="primary" @click="onSave">保 存</el-button>
  19. <el-button type="danger" plain @click="onPreview">预 览</el-button>
  20. </div>
  21. <!-- <el-tabs
  22. v-model="editableTabsValue"
  23. type="card"
  24. editable
  25. @edit="handleTabsEdit"
  26. @tab-click="tabClick"
  27. >
  28. <el-tab-pane
  29. v-for="(item, index) in question_list"
  30. :key="item.name"
  31. :label="item.title"
  32. :name="item.name"
  33. > -->
  34. <div
  35. style="position: relative"
  36. v-for="(fc, fcIndex) in question_list.detailList"
  37. :key="'fc' + fcIndex"
  38. >
  39. <SentenceSegwordChs :curQue="fc.detail" type="adultinput" />
  40. <img
  41. style="position: absolute; right: 683px; top: 2px"
  42. @click="deleteDetail(fcIndex)"
  43. class="close"
  44. src="../assets/adult/del-close.png"
  45. alt=""
  46. />
  47. <div class="Big-Book-top" style="margin: 10px 0">
  48. <span>英文</span>
  49. <el-input
  50. v-model="fc.en"
  51. style="width: 80%"
  52. type="textarea"
  53. autosize
  54. placeholder="请输入英文"
  55. @blur="onBlur(fc, 'en')"
  56. />
  57. </div>
  58. </div>
  59. <div class="addoption" @click="addDetail">添加分句</div>
  60. <div
  61. v-for="(kt, ktIndex) in question_list.classTopic"
  62. :key="'kt' + ktIndex"
  63. >
  64. <div class="Big-Book-top" style="margin: 10px 0">
  65. <span>课题</span>
  66. <el-input
  67. v-model="kt.con"
  68. style="width: 80%"
  69. type="textarea"
  70. autosize
  71. placeholder="请输入课题"
  72. @blur="onBlur(kt, 'con')"
  73. />
  74. <img
  75. @click="deleteClassTopic(ktIndex)"
  76. class="close"
  77. src="../assets/adult/del-close.png"
  78. alt=""
  79. />
  80. </div>
  81. <div class="Big-Book-top" style="margin: 10px 0">
  82. <span>字体</span>
  83. <el-radio-group v-model="kt.font">
  84. <el-radio label="cn">中文字体</el-radio>
  85. <el-radio label="en">英文字体</el-radio>
  86. <el-radio label="pinyin">拼音字体</el-radio>
  87. </el-radio-group>
  88. </div>
  89. </div>
  90. <div class="addoption" @click="addClassTopic">添加课题</div>
  91. <div class="createTable">
  92. <el-input
  93. v-model="row"
  94. maxlength="1"
  95. style="width: 50px"
  96. type="text"
  97. @input="rowLine('row')"
  98. />*<el-input
  99. v-model="line"
  100. style="width: 50px"
  101. type="text"
  102. maxlength="1"
  103. @input="rowLine('line')"
  104. />
  105. <el-button
  106. style="margin-left: 10px"
  107. type="primary"
  108. @click="createTable"
  109. >增加题</el-button
  110. >
  111. </div>
  112. <div
  113. v-for="(topic, toindex) in question_list.cur_fn_data"
  114. :key="'topic' + toindex"
  115. >
  116. <p>第{{ toindex + 1 }}题</p>
  117. <div class="adult-book-input-item">
  118. <span class="adult-book-lable">序号:</span>
  119. <el-input
  120. v-model="topic.number"
  121. type="textarea"
  122. :autosize="{ minRows: 2 }"
  123. placeholder="请输入序号"
  124. @blur="onBlur(topic, 'number')"
  125. />
  126. </div>
  127. <div class="adult-book-input-item">
  128. <span class="adult-book-lable">正标题:</span>
  129. <el-input
  130. v-model="topic.z_title"
  131. type="textarea"
  132. :autosize="{ minRows: 2 }"
  133. placeholder="请输入正标题"
  134. @blur="onBlur(topic, 'z_title')"
  135. />
  136. </div>
  137. <div class="adult-book-input-item">
  138. <span class="adult-book-lable">副标题:</span>
  139. <el-input
  140. v-model="topic.f_title"
  141. :autosize="{ minRows: 2 }"
  142. type="textarea"
  143. placeholder="请输入副标题"
  144. @blur="onBlur(topic, 'f_title')"
  145. />
  146. </div>
  147. <div class="adult-book-input-item">
  148. <span class="adult-book-lable">标题:</span>
  149. <div style="width: 100%">
  150. <div
  151. style="
  152. display: flex;
  153. align-items: flex-start;
  154. margin-bottom: 10px;
  155. "
  156. >
  157. <el-input
  158. style="width: 20%"
  159. v-model="topic.little_title_number"
  160. type="textarea"
  161. @input="forupdata"
  162. placeholder="请输入标题题号"
  163. @blur="onBlur(topic, 'little_title_number')"
  164. />
  165. <el-input
  166. style="width: 70%; margin-left: 10px"
  167. v-model="topic.little_title"
  168. type="textarea"
  169. @input="forupdata"
  170. placeholder="请输入标题内容"
  171. @blur="onBlur(topic, 'little_title')"
  172. />
  173. </div>
  174. </div>
  175. </div>
  176. <div class="Big-Book-top">
  177. <span>正副标题缩进</span>
  178. <el-radio v-model="topic.is_textIndex" :label="true">是</el-radio>
  179. <el-radio v-model="topic.is_textIndex" :label="false">否</el-radio>
  180. </div>
  181. <div class="Big-Book-top">
  182. <span>是否有背景色</span>
  183. <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
  184. <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
  185. </div>
  186. <div class="Big-Book-top">
  187. <span>是否有背景图</span>
  188. <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
  189. <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
  190. </div>
  191. <div
  192. v-for="(rowItem, rowIndex) in topic.table_list"
  193. :key="'row' + rowIndex"
  194. >
  195. <div v-for="(topicIitem, lineIndex) in rowItem" :key="lineIndex">
  196. <p>{{ topicIitem.text }}</p>
  197. <div>
  198. <template
  199. v-if="
  200. topicIitem.type == 'article_chs' ||
  201. (topicIitem.data && topicIitem.data.type == 'article_chs')
  202. "
  203. >
  204. <template v-if="topicIitem.is_edit">
  205. <ArticleTemChs
  206. :cur-que="topicIitem.data"
  207. :change-cur-que="changeCurQue"
  208. />
  209. </template>
  210. <template v-else>
  211. <!-- <ArticleView :cur-que="topicIitem.data" /> -->
  212. </template>
  213. </template>
  214. <template v-if="topicIitem.type == 'sentence_segword_chs'">
  215. <template v-if="topicIitem.is_edit">
  216. <SentenceSegwordChs
  217. :cur-que="topicIitem.data"
  218. :change-cur-que="changeCurQue"
  219. />
  220. </template>
  221. <template v-else>
  222. <!-- <ArticleView :cur-que="topicIitem.data" /> -->
  223. </template>
  224. </template>
  225. <template v-if="topicIitem.type == 'dialogue_article_chs'">
  226. <template v-if="topicIitem.is_edit">
  227. <DialogueArticleChs
  228. :cur-que="topicIitem.data"
  229. :change-cur-que="changeCurQue"
  230. />
  231. </template>
  232. <template v-else>
  233. <!-- <ArticleView :curQue="topicIitem.que" /> -->
  234. </template>
  235. </template>
  236. <template v-if="topicIitem.type == 'dialogue_answer_chs'">
  237. <template v-if="topicIitem.is_edit">
  238. <DialogueAnswerChs
  239. :cur-que="topicIitem.data"
  240. :change-cur-que="changeCurQue"
  241. />
  242. </template>
  243. <template v-else>
  244. <!-- <ArticleView :curQue="topicIitem.que" /> -->
  245. </template>
  246. </template>
  247. <template v-if="topicIitem.type == 'NewWord_chs'">
  248. <template v-if="topicIitem.is_edit">
  249. <Neword
  250. :cur-que="topicIitem.data"
  251. :change-cur-que="changeCurQue"
  252. />
  253. </template>
  254. <template v-else>
  255. <NewordPhraseview :cur-que="topicIitem.data" />
  256. </template>
  257. </template>
  258. <template v-if="topicIitem.type == 'notes_chs'">
  259. <template v-if="topicIitem.is_edit">
  260. <Notes
  261. :cur-que="topicIitem.data"
  262. :change-cur-que="changeCurQue"
  263. />
  264. </template>
  265. <template v-else>
  266. <NewordPhraseview :cur-que="topicIitem.data" />
  267. </template>
  268. </template>
  269. <template v-if="topicIitem.type == 'input_record_chs'">
  270. <template v-if="topicIitem.is_edit">
  271. <InputRecord
  272. :cur-que="topicIitem.data"
  273. :fn_data="fn_data"
  274. :change-cur-que="changeCurQue"
  275. />
  276. </template>
  277. <template v-else />
  278. </template>
  279. <template
  280. v-if="
  281. topicIitem.type == 'recordHZ_inputPY_chs' ||
  282. topicIitem.type == 'inputItem_chs' ||
  283. topicIitem.type == 'sentence_input_chs' ||
  284. topicIitem.type == 'sentence_judge_chs' ||
  285. topicIitem.type == 'sentence_record_chs' ||
  286. topicIitem.type == 'sentence_input_record_chs' ||
  287. topicIitem.type == 'sentence_listen_read_chs'
  288. "
  289. >
  290. <template v-if="topicIitem.is_edit">
  291. <Sentence
  292. :cur-que="topicIitem.data"
  293. :type="topicIitem.type"
  294. :fn_data="fn_data"
  295. :change-cur-que="changeCurQue"
  296. />
  297. </template>
  298. <template v-else />
  299. </template>
  300. <template v-if="topicIitem.type == 'sudoku_chs'">
  301. <template v-if="topicIitem.is_edit">
  302. <Sudoku
  303. :cur-que="topicIitem.data"
  304. :type="topicIitem.type"
  305. :fn_data="fn_data"
  306. :change-cur-que="changeCurQue"
  307. />
  308. </template>
  309. <template v-else />
  310. </template>
  311. <template v-if="topicIitem.type == 'NumberCombination_chs'">
  312. <template v-if="topicIitem.is_edit">
  313. <NumberCombination
  314. :cur-que="topicIitem.data"
  315. :type="topicIitem.type"
  316. :fn_data="fn_data"
  317. :change-cur-que="changeCurQue"
  318. />
  319. </template>
  320. <template v-else />
  321. </template>
  322. <template v-if="topicIitem.type == 'toneSelect_chs'">
  323. <template v-if="topicIitem.is_edit">
  324. <ToneSelect
  325. :cur-que="topicIitem.data"
  326. :type="topicIitem.type"
  327. :fn_data="fn_data"
  328. :change-cur-que="changeCurQue"
  329. />
  330. </template>
  331. <template v-else />
  332. </template>
  333. <template v-if="topicIitem.type === 'voice_matrix'">
  334. <template v-if="topicIitem.is_edit">
  335. <voice-matrix
  336. :cur-que="topicIitem.data"
  337. :change-cur-que="changeCurQue"
  338. />
  339. </template>
  340. </template>
  341. <template v-if="topicIitem.type == 'ligature_chs'">
  342. <template v-if="topicIitem.is_edit">
  343. <Ligature
  344. :curQue="topicIitem.data"
  345. :fn_data="fn_data"
  346. :changeCurQue="changeCurQue"
  347. />
  348. </template>
  349. <template v-else>
  350. <Ligatureview :curQue="topicIitem.data" />
  351. </template>
  352. </template>
  353. <template
  354. v-if="topicIitem.type == 'image_question_input_record'"
  355. >
  356. <template v-if="topicIitem.is_edit">
  357. <ImageQuestion
  358. :curQue="topicIitem.data"
  359. :type="topicIitem.type"
  360. :fn_data="fn_data"
  361. :changeCurQue="changeCurQue"
  362. />
  363. </template>
  364. <template v-else> </template>
  365. </template>
  366. <template
  367. v-if="
  368. topicIitem.type == 'single_chs' ||
  369. topicIitem.type == 'checkbox_chs' ||
  370. topicIitem.type == 'listen_record_single_chs'
  371. "
  372. >
  373. <template v-if="topicIitem.is_edit">
  374. <Single
  375. :curQue="topicIitem.data"
  376. :type="topicIitem.type"
  377. :fn_data="fn_data"
  378. :changeCurQue="changeCurQue"
  379. />
  380. </template>
  381. <template v-else> </template>
  382. </template>
  383. <template
  384. v-if="
  385. topicIitem.type == 'text_problem_chs' ||
  386. topicIitem.type == 'newWord_preview_chs' ||
  387. topicIitem.type == 'listen_record_single_syllable_chs'
  388. "
  389. >
  390. <template v-if="topicIitem.is_edit">
  391. <PurePreview
  392. :curQue="topicIitem.data"
  393. :type="topicIitem.type"
  394. :fn_data="fn_data"
  395. :changeCurQue="changeCurQue"
  396. />
  397. </template>
  398. <template v-else> </template>
  399. </template>
  400. <template v-if="topicIitem.type == 'zi_transverse_line_chs'">
  401. <template v-if="topicIitem.is_edit">
  402. <ZiLine
  403. :curQue="topicIitem.data"
  404. :type="topicIitem.type"
  405. :fn_data="fn_data"
  406. :changeCurQue="changeCurQue"
  407. />
  408. </template>
  409. <template v-else> </template>
  410. </template>
  411. <template v-if="topicIitem.type == 'select_input_chs'">
  412. <template v-if="topicIitem.is_edit">
  413. <SelectInpue
  414. :curQue="topicIitem.data"
  415. :type="topicIitem.type"
  416. :fn_data="fn_data"
  417. :changeCurQue="changeCurQue"
  418. />
  419. </template>
  420. <template v-else> </template>
  421. </template>
  422. <template v-if="topicIitem.type == 'play_input_record_chs'">
  423. <template v-if="topicIitem.is_edit">
  424. <PlayInputReacord
  425. :curQue="topicIitem.data"
  426. :type="topicIitem.type"
  427. :fn_data="fn_data"
  428. :changeCurQue="changeCurQue"
  429. />
  430. </template>
  431. <template v-else> </template>
  432. </template>
  433. <template
  434. v-if="
  435. topicIitem.type == 'imgage_image' ||
  436. topicIitem.type == 'image_checkBox' ||
  437. topicIitem.type == 'image_judge' ||
  438. topicIitem.type == 'image_single' ||
  439. topicIitem.type == 'image_dobleinput' ||
  440. topicIitem.type == 'image_gdcy' ||
  441. topicIitem.type == 'image_input'
  442. "
  443. >
  444. <template v-if="topicIitem.is_edit">
  445. <Picture
  446. :curQue="topicIitem.data"
  447. :type="topicIitem.type"
  448. :fn_data="fn_data"
  449. :changeCurQue="changeCurQue"
  450. />
  451. </template>
  452. <template v-else> </template>
  453. </template>
  454. <template v-if="topicIitem.type == 'drag_chs'">
  455. <template v-if="topicIitem.is_edit">
  456. <Drag
  457. :curQue="topicIitem.data"
  458. :type="topicIitem.type"
  459. :fn_data="fn_data"
  460. :changeCurQue="changeCurQue"
  461. />
  462. </template>
  463. <template v-else> </template>
  464. </template>
  465. <template
  466. v-if="topicIitem.type == 'checkbox_self_assessment_chs'"
  467. >
  468. <template v-if="topicIitem.is_edit">
  469. <SelfAssessment
  470. :curQue="topicIitem.data"
  471. :type="topicIitem.type"
  472. :fn_data="fn_data"
  473. :changeCurQue="changeCurQue"
  474. />
  475. </template>
  476. <template v-else> </template>
  477. </template>
  478. <template v-if="topicIitem.type == 'sort_chs'">
  479. <template v-if="topicIitem.is_edit">
  480. <Sort
  481. :curQue="topicIitem.data"
  482. :type="topicIitem.type"
  483. :fn_data="fn_data"
  484. :changeCurQue="changeCurQue"
  485. />
  486. </template>
  487. <template v-else>
  488. <SentenceSortQP
  489. :curQue="topicIitem.data"
  490. :type="topicIitem.type"
  491. :fn_data="fn_data"
  492. />
  493. </template>
  494. </template>
  495. <template v-if="topicIitem.type == 'CourseStart_chs'">
  496. <template v-if="topicIitem.is_edit">
  497. <CourseStart
  498. :curQue="topicIitem.data"
  499. :type="topicIitem.type"
  500. :fn_data="fn_data"
  501. :changeCurQue="changeCurQue"
  502. />
  503. </template>
  504. <template v-else> </template>
  505. </template>
  506. <template
  507. v-if="
  508. topicIitem.type == 'record_control_mini' ||
  509. topicIitem.type == 'record_control_normal' ||
  510. topicIitem.type == 'record_control_pro' ||
  511. topicIitem.type == 'record_control_promax'
  512. "
  513. >
  514. <template v-if="topicIitem.is_edit">
  515. <RecordControl
  516. :curQue="topicIitem.data"
  517. :type="topicIitem.type"
  518. :fn_data="fn_data"
  519. :changeCurQue="changeCurQue"
  520. />
  521. </template>
  522. <template v-else> </template>
  523. </template>
  524. <template
  525. v-if="
  526. topicIitem.type == 'upload_control_chs' ||
  527. topicIitem.type == 'upload_control_preview_chs'
  528. "
  529. >
  530. <template v-if="topicIitem.is_edit">
  531. <UploadControl
  532. :curQue="topicIitem.data"
  533. :type="topicIitem.type"
  534. :fn_data="fn_data"
  535. :changeCurQue="changeCurQue"
  536. />
  537. </template>
  538. <template v-else>
  539. <UploadControlView
  540. :type="topicIitem.type"
  541. :curQue="topicIitem.data"
  542. :fn_data="fn_data"
  543. />
  544. </template>
  545. </template>
  546. <template v-if="topicIitem.type == 'tinydemo_chs'">
  547. <template v-if="topicIitem.is_edit">
  548. <Tinydemo
  549. :curQue="topicIitem.data"
  550. :type="topicIitem.type"
  551. :fn_data="fn_data"
  552. :changeCurQue="changeCurQue"
  553. :number="currentTreeID + toindex + rowIndex + lineIndex"
  554. />
  555. </template>
  556. <template v-else> </template>
  557. </template>
  558. <template v-if="topicIitem.type == 'switch_control_chs'">
  559. <template v-if="topicIitem.is_edit">
  560. <SuitchControl
  561. :curQue="topicIitem.data"
  562. :type="topicIitem.type"
  563. :fn_data="fn_data"
  564. :changeCurQue="changeCurQue"
  565. />
  566. </template>
  567. <template v-else> </template>
  568. </template>
  569. <template v-if="topicIitem.type == 'video_chs'">
  570. <template v-if="topicIitem.is_edit">
  571. <VideoControl
  572. :curQue="topicIitem.data"
  573. :type="topicIitem.type"
  574. :fn_data="fn_data"
  575. :changeCurQue="changeCurQue"
  576. />
  577. </template>
  578. <template v-else>
  579. <!-- <VideoControlView
  580. :curQue="topicIitem.data"
  581. :type="topicIitem.type"
  582. :fn_data="fn_data"
  583. /> -->
  584. </template>
  585. </template>
  586. <template v-if="topicIitem.type == 'table_chs'">
  587. <template v-if="topicIitem.is_edit">
  588. <Table
  589. :curQue="topicIitem.data"
  590. :type="topicIitem.type"
  591. :fn_data="fn_data"
  592. :changeCurQue="changeCurQue"
  593. />
  594. </template>
  595. <template v-else>
  596. <TableView
  597. :curQue="topicIitem.data"
  598. :type="topicIitem.type"
  599. :fn_data="fn_data"
  600. />
  601. </template>
  602. </template>
  603. <template v-if="topicIitem.type == 'play_record_chs'">
  604. <template v-if="topicIitem.is_edit">
  605. <PlayRecord
  606. :curQue="topicIitem.data"
  607. :type="topicIitem.type"
  608. :fn_data="fn_data"
  609. :changeCurQue="changeCurQue"
  610. />
  611. </template>
  612. <template v-else>
  613. <PlayRecordView
  614. :curQue="topicIitem.data"
  615. :type="topicIitem.type"
  616. :fn_data="fn_data"
  617. />
  618. </template>
  619. </template>
  620. <template v-if="topicIitem.type == 'upload_pdf_chs'">
  621. <template v-if="topicIitem.is_edit">
  622. <UploadPdf
  623. :curQue="topicIitem.data"
  624. :type="topicIitem.type"
  625. :fn_data="fn_data"
  626. :changeCurQue="changeCurQue"
  627. />
  628. </template>
  629. <template v-else> </template>
  630. </template>
  631. </div>
  632. <div
  633. v-if="topicIitem.data && topicIitem.is_edit"
  634. class="addoption"
  635. @click="remoeModule(toindex, rowIndex, lineIndex, topicIitem)"
  636. >
  637. 删除模板 {{ topicIitem.type }}
  638. </div>
  639. <div
  640. v-else-if="
  641. TopicIndex == toindex &&
  642. RowIndex == rowIndex &&
  643. lineIndex == LineIndex
  644. "
  645. class="addoption"
  646. >
  647. 选择模板
  648. </div>
  649. <div
  650. v-if="!topicIitem.data && topicIitem.is_add_module"
  651. class="addoption"
  652. @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
  653. >
  654. 添加模板
  655. </div>
  656. <template v-if="topicIitem.data">
  657. <div v-if="topicIitem.is_edit" class="Big-Book-save">
  658. <el-button
  659. type="success"
  660. size="small"
  661. @click="onSure(topicIitem)"
  662. >确定</el-button
  663. >
  664. </div>
  665. <div v-else class="Big-Book-save">
  666. <el-button
  667. type="primary"
  668. size="small"
  669. @click.stop="editCurQue(topicIitem)"
  670. >编辑</el-button
  671. >
  672. </div>
  673. </template>
  674. </div>
  675. <div style="display: flex">
  676. <div class="addoption" @click="removeRow(rowIndex, toindex)">
  677. 删除当前行
  678. </div>
  679. <div
  680. style="margin-left: 10px"
  681. @click="addRow('front', rowIndex, toindex)"
  682. class="addoption"
  683. >
  684. 在当前行前增加行
  685. </div>
  686. <div
  687. style="margin-left: 10px"
  688. @click="addRow('behind', rowIndex, toindex)"
  689. class="addoption"
  690. >
  691. 在当前行后增加行
  692. </div>
  693. </div>
  694. </div>
  695. </div>
  696. <!-- </el-tab-pane> -->
  697. <!-- </el-tabs> -->
  698. </div>
  699. <div v-if="currentTreeID" class="Book-function">
  700. <ul class="function-list">
  701. <li
  702. v-for="(item, index) in fn_data"
  703. :key="'fn' + index"
  704. @click="selectedFnType(item, index)"
  705. >
  706. <el-dropdown v-if="item.list">
  707. <span class="fn-name">
  708. {{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
  709. </span>
  710. <el-dropdown-menu slot="dropdown" trigger="click">
  711. <el-dropdown-item
  712. v-for="(child, i) in item.list"
  713. :key="i"
  714. @click.native="selectSmallModule(item, child, index, i)"
  715. style="color: #000000"
  716. >{{ child.name }}</el-dropdown-item
  717. >
  718. </el-dropdown-menu>
  719. </el-dropdown>
  720. <span v-else class="fn-name">{{ item.name }}</span>
  721. </li>
  722. </ul>
  723. </div>
  724. </div>
  725. <el-dialog
  726. :visible.sync="previewVisible"
  727. title="预览"
  728. top="0"
  729. width="100%"
  730. @close="handleClosePre"
  731. >
  732. <div class="chooseCon">
  733. <Preview
  734. :context="context"
  735. :que-index="queIndex"
  736. :father-name="fatherName"
  737. :currentTreeID="currentTreeID"
  738. :FatherTreeData="FatherTreeData"
  739. :change-id="changeId"
  740. :themeColor="themeColor"
  741. :isShowTitle="true"
  742. />
  743. </div>
  744. <span slot="footer" class="dialog-footer">
  745. <el-button @click="handleClosePre">关 闭</el-button>
  746. </span>
  747. </el-dialog>
  748. </div>
  749. </template>
  750. <script>
  751. import Header from "@/components/Header.vue";
  752. import Catelog from "@/components/Adult/inputModules/Catelog";
  753. import ArticleTemChs from "@/components/Adult/inputModules/ArticleTemChs/index.vue";
  754. import SentenceSegwordChs from "@/components/Adult/inputModules/SentenceSegwordChs/index.vue";
  755. import DialogueArticleChs from "@/components/Adult/inputModules/DialogueArticleChs/index.vue";
  756. import Single from "@/components/Adult/inputModules/Single.vue";
  757. import Judge from "@/components/Adult/inputModules/Judge.vue";
  758. import Dialogue from "@/components/Adult/inputModules/Dialogue.vue";
  759. import MatrixSingle from "@/components/Adult/inputModules/MatrixSingle.vue";
  760. import MultiRowInput from "@/components/Adult/inputModules/MultiRowInput.vue";
  761. import Ligature from "@/components/Adult/inputModules/Ligature.vue";
  762. import Neword from "@/components/Adult/inputModules/Neword.vue";
  763. import Notes from "@/components/Adult/inputModules/Notes.vue";
  764. import InputRecord from "@/components/Adult/inputModules/InputRecord.vue";
  765. import AudioControl from "@/components/Adult/inputModules/AudioControl.vue";
  766. import SuitchControl from "@/components/Adult/inputModules/SuitchControl.vue";
  767. import BgControl from "@/components/Adult/inputModules/BgControl.vue";
  768. import UploadControl from "@/components/Adult/inputModules/UploadControl.vue";
  769. import TextItem from "@/components/Adult/inputModules/TextItem.vue";
  770. import Sentence from "@/components/Adult/inputModules/Sentence.vue";
  771. import Sudoku from "@/components/Adult/inputModules/Sudoku.vue";
  772. import ToneSelect from "@/components/Adult/inputModules/ToneSelect.vue";
  773. import NumberCombination from "@/components/Adult/inputModules/NumberCombination.vue";
  774. import DialogueAnswerChs from "@/components/Adult/inputModules/DialogueAnswerChs";
  775. import VoiceMatrix from "@/components/Adult/inputModules/VoiceMatrix.vue";
  776. import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
  777. import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
  778. import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
  779. import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
  780. import PlayInputReacord from "@/components/Adult/inputModules/PlayInputReacord.vue";
  781. import Drag from "@/components/Adult/inputModules/Drag.vue";
  782. import SelfAssessment from "@/components/Adult/inputModules/SelfAssessment.vue";
  783. import Sort from "@/components/Adult/inputModules/Sort.vue";
  784. import CourseStart from "@/components/Adult/inputModules/CourseStart.vue";
  785. import RecordControl from "@/components/Adult/inputModules/RecordControl.vue";
  786. import Tinydemo from "@/components/Adult/inputModules/Tinydemo.vue";
  787. import VideoControl from "@/components/Adult/inputModules/VideoControl.vue";
  788. import Table from "@/components/Adult/inputModules/Table.vue";
  789. import PlayRecord from "@/components/Adult/inputModules/PlayRecord.vue";
  790. import UploadPdf from "@/components/Adult/inputModules/UploadPdf.vue";
  791. import Textdes from "@/components/Adult/inputModules/Textdes.vue";
  792. import Record from "@/components/Adult/inputModules/Record.vue";
  793. import Hanzi from "@/components/Adult/inputModules/Hanzi.vue";
  794. import Picture from "@/components/Adult/inputModules/Picture.vue";
  795. import Singleview from "@/components/Adult/preview/Single.vue";
  796. import Judgeview from "@/components/Adult/preview/Judge.vue";
  797. import Textdesview from "@/components/Adult/preview/Textdes.vue";
  798. import Hanziview from "@/components/Adult/preview/Hanzi.vue";
  799. import Pictureview from "@/components/Adult/preview/Picture.vue";
  800. import Dialogueview from "@/components/Adult/preview/Dialogue.vue";
  801. import MatrixSingleview from "@/components/Adult/preview/MatrixSingle.vue";
  802. import MultiRowInputview from "@/components/Adult/preview/MultiRowInput.vue";
  803. import Ligatureview from "@/components/Adult/preview/Ligature.vue";
  804. import InputRecordview from "@/components/Adult/preview/InputRecord.vue";
  805. import BgControlview from "@/components/Adult/preview/BgControl.vue";
  806. import NewordPhraseview from "@/components/Adult/preview/WordPhrase.vue";
  807. import UploadControlView from "@/components/Adult/preview/UploadControlView.vue";
  808. import VideoControlView from "@/components/Adult/preview/VideoControl.vue";
  809. import SentenceSortQP from "@/components/Adult/preview/SentenceSortQP.vue";
  810. import TableView from "@/components/Adult/preview/TableView.vue";
  811. import PlayRecordView from "@/components/Adult/preview/PlayRecordView.vue";
  812. import DialogueAnswerViewChs from "@/components/Adult/preview/DialogueArticleViewChs/DialogueAnswerViewChs.vue";
  813. import Preview from "@/components/Adult/Preview.vue";
  814. import fn from "@/components/Adult/common/data.js";
  815. import { getContent, getStaticContent } from "@/api/ajax";
  816. export default {
  817. components: {
  818. Header,
  819. Catelog,
  820. Single,
  821. Textdes,
  822. Record,
  823. Singleview,
  824. Textdesview,
  825. Hanziview,
  826. Pictureview,
  827. Preview,
  828. Hanzi,
  829. Picture,
  830. Judge,
  831. Judgeview,
  832. Dialogue,
  833. Dialogueview,
  834. MatrixSingle,
  835. MatrixSingleview,
  836. MultiRowInput,
  837. MultiRowInputview,
  838. Ligature,
  839. Ligatureview,
  840. Neword,
  841. Notes,
  842. InputRecord,
  843. ArticleTemChs,
  844. SentenceSegwordChs,
  845. DialogueArticleChs,
  846. AudioControl,
  847. SuitchControl,
  848. BgControl,
  849. InputRecordview,
  850. BgControlview,
  851. NewordPhraseview,
  852. UploadControl,
  853. TextItem,
  854. Sentence,
  855. UploadControlView,
  856. Sudoku,
  857. NumberCombination,
  858. ToneSelect,
  859. DialogueAnswerChs,
  860. VoiceMatrix,
  861. ImageQuestion,
  862. PurePreview,
  863. ZiLine,
  864. SelectInpue,
  865. PlayInputReacord,
  866. Drag,
  867. SelfAssessment,
  868. Sort,
  869. CourseStart,
  870. RecordControl,
  871. Tinydemo,
  872. VideoControl,
  873. VideoControlView,
  874. SentenceSortQP,
  875. Table,
  876. TableView,
  877. PlayRecord,
  878. PlayRecordView,
  879. UploadPdf,
  880. },
  881. data() {
  882. return {
  883. bookId: 1,
  884. bookLevel: "",
  885. bookIndex: "",
  886. fn_data: [],
  887. fn_type: "",
  888. cur_fn_data: null, // 当前模块的数据结构
  889. cur_page_queIsEdit: [], // 当前页数的某个题
  890. org_question_list: {
  891. detailList: [
  892. {
  893. detail: {
  894. type: "detail",
  895. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  896. sentence: "", //句子
  897. segList: [], //分词结果
  898. seg_words: "",
  899. wordsList: [],
  900. },
  901. en: "",
  902. },
  903. ], //目录分词
  904. classTopic: [
  905. {
  906. con: "",
  907. font: "",
  908. },
  909. ], //课题
  910. cur_fn_data: [],
  911. },
  912. // 总的数据列表
  913. question_list: {
  914. detailList: [
  915. {
  916. detail: {
  917. type: "detail",
  918. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  919. sentence: "", //句子
  920. segList: [], //分词结果
  921. seg_words: "",
  922. wordsList: [],
  923. },
  924. en: "",
  925. },
  926. ], //目录分词
  927. classTopic: [
  928. {
  929. con: "",
  930. font: "",
  931. },
  932. ], //课题
  933. cur_fn_data: [],
  934. }, // 总的数据列表
  935. cur_page_que_index: 0,
  936. editableTabsValue: "tab1",
  937. tabIndex: 0,
  938. previewVisible: false,
  939. context: [],
  940. queIndex: 0,
  941. currentTreeID: null,
  942. row: null, // 行
  943. line: null, // 列
  944. TopicIndex: null, // 第几题的索引
  945. RowIndex: null, // 第几行
  946. LineIndex: null, // 第几列
  947. bgControlX: null, // 背景图插入模板的 x
  948. bgControlY: null, // 背景图插入模板的 y
  949. bgControlIndex: null, // 插入第几个
  950. DeletebgControlIndex: null, // 删除第几个
  951. fatherName: "",
  952. module_type: "",
  953. tmInde: "",
  954. FatherTreeData: null,
  955. themeColor: "", // 主题颜色
  956. loading: false,
  957. NumberList: [
  958. "①",
  959. "②",
  960. "③",
  961. "④",
  962. "⑤",
  963. "⑥",
  964. "⑦",
  965. "⑧",
  966. "⑨",
  967. "⑩",
  968. "⑪",
  969. "⑫",
  970. "⑬",
  971. "⑭",
  972. "⑮",
  973. "⑯",
  974. "⑰",
  975. "⑱",
  976. "⑲",
  977. "⑳",
  978. ],
  979. };
  980. },
  981. computed: {
  982. getCurrentQuestionView() {
  983. const function_type = this.fn_type;
  984. switch (function_type) {
  985. case "single":
  986. return Single;
  987. case "text":
  988. return Textdes;
  989. case "record":
  990. return Record;
  991. }
  992. },
  993. },
  994. watch: {},
  995. // 生命周期 - 创建完成(可以访问当前this实例)
  996. created() {
  997. this.fn_data = fn.fnData;
  998. },
  999. // 生命周期 - 挂载完成(可以访问DOM元素)
  1000. mounted() {
  1001. console.log(this.question_list);
  1002. // let question_list_str = localStorage.getItem("question_list");
  1003. // if (question_list_str) {
  1004. // this.question_list = JSON.parse(question_list_str);
  1005. // this.cur_page_que_index =
  1006. // this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1007. // }
  1008. },
  1009. beforeCreate() {}, // 生命周期 - 创建之前
  1010. beforeMount() {}, // 生命周期 - 挂载之前
  1011. beforeUpdate() {}, // 生命周期 - 更新之前
  1012. updated() {}, // 生命周期 - 更新之后
  1013. beforeDestroy() {}, // 生命周期 - 销毁之前
  1014. destroyed() {}, // 生命周期 - 销毁完成
  1015. activated() {},
  1016. // 方法集合
  1017. methods: {
  1018. forupdata() {
  1019. this.$forceUpdate();
  1020. },
  1021. // 增加列
  1022. addCol(tyoe, rowindex, colindex, toindex) {},
  1023. // 添加行
  1024. addRow(type, rowindex, toindex) {
  1025. let arr = [
  1026. {
  1027. text: ``,
  1028. is_add_module: true,
  1029. is_edit: true,
  1030. },
  1031. ];
  1032. if (type == "front") {
  1033. // 加到当前行前面
  1034. if (rowindex == 0) {
  1035. this.question_list.cur_fn_data[toindex].table_list.splice(0, 0, arr);
  1036. } else {
  1037. this.question_list.cur_fn_data[toindex].table_list.splice(
  1038. rowindex - 1,
  1039. 0,
  1040. arr
  1041. );
  1042. }
  1043. } else {
  1044. // 加到当前行后面
  1045. this.question_list.cur_fn_data[toindex].table_list.splice(
  1046. rowindex + 1,
  1047. 0,
  1048. arr
  1049. );
  1050. }
  1051. this.question_list.cur_fn_data[toindex].table_list.forEach(
  1052. (item, rowIndex) => {
  1053. item.forEach((it, colIndex) => {
  1054. it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
  1055. });
  1056. }
  1057. );
  1058. this.TopicIndex = null;
  1059. this.RowIndex = null;
  1060. this.LineIndex = null;
  1061. this.$forceUpdate();
  1062. },
  1063. // 删除行
  1064. removeRow(index, toindex) {
  1065. // 里面是不是剩下最后一行了
  1066. if (this.question_list.cur_fn_data[toindex].table_list.length == 1) {
  1067. this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
  1068. this.question_list.cur_fn_data.splice(toindex, 1);
  1069. } else {
  1070. this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
  1071. }
  1072. this.question_list.cur_fn_data[toindex].table_list.forEach(
  1073. (item, rowIndex) => {
  1074. item.forEach((it, colIndex) => {
  1075. it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
  1076. });
  1077. }
  1078. );
  1079. this.TopicIndex = null;
  1080. this.RowIndex = null;
  1081. this.LineIndex = null;
  1082. this.$forceUpdate();
  1083. },
  1084. changeCurrentTreeID(val) {
  1085. this.currentTreeID = val;
  1086. },
  1087. changeTreeData(val) {
  1088. this.FatherTreeData = JSON.parse(JSON.stringify(val));
  1089. },
  1090. // 增加当前页的分词
  1091. addDetail() {
  1092. let obj = {
  1093. detail: {
  1094. type: "detail",
  1095. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1096. sentence: "", //句子
  1097. segList: [], //分词结果
  1098. seg_words: "",
  1099. wordsList: [],
  1100. },
  1101. en: "",
  1102. };
  1103. this.question_list.detailList.push(obj);
  1104. },
  1105. // 删除当前页的分词
  1106. deleteDetail(fcindex) {
  1107. if (this.question_list.detailList.length <= 1) {
  1108. this.$message.warning("至少要保留一一个");
  1109. return;
  1110. }
  1111. this.question_list.detailList.splice(fcindex, 1);
  1112. },
  1113. // 增加课题
  1114. addClassTopic() {
  1115. let obj = {
  1116. con: "",
  1117. font: "",
  1118. };
  1119. this.question_list.classTopic.push(obj);
  1120. },
  1121. // 删除课题
  1122. deleteClassTopic(ktindex) {
  1123. if (this.question_list.classTopic.length <= 1) {
  1124. this.$message.warning("至少要保留一一个");
  1125. return;
  1126. }
  1127. this.question_list.classTopic.splice(ktindex, 1);
  1128. },
  1129. // 随意插入模板获取位置
  1130. changeSite(x, y) {
  1131. this.bgControlX = x;
  1132. this.bgControlY = y;
  1133. },
  1134. // 插入索引
  1135. changebgControlIndex(index) {
  1136. this.bgControlIndex = index;
  1137. },
  1138. // 删除索引
  1139. changeDeletebgControlIndex(index) {
  1140. this.DeletebgControlIndex = index;
  1141. },
  1142. rowLine(value) {
  1143. this[value] = this[value].match(/^\d*(\.?\d{0,2})/g)[0] || "";
  1144. },
  1145. createTable() {
  1146. if (this.row && this.line) {
  1147. let arr = {
  1148. z_title: "",
  1149. f_title: "",
  1150. little_title_number:"",
  1151. little_title:"",
  1152. is_bg: false, // 是否有背景色
  1153. is_layout: false, // 是不是按背景图布局
  1154. is_textIndex: false,
  1155. table_list: [],
  1156. };
  1157. for (let i = 0; i < this.row; i++) {
  1158. let rowArr = [];
  1159. for (let j = 0; j < this.line; j++) {
  1160. let obj = {
  1161. text: `第${i + 1}行,第${j + 1}列`,
  1162. is_add_module: true,
  1163. is_edit: true,
  1164. };
  1165. rowArr.push(obj);
  1166. }
  1167. arr.table_list.push(rowArr);
  1168. }
  1169. this.question_list.cur_fn_data.push(arr);
  1170. this.row = null;
  1171. this.line = null;
  1172. } else {
  1173. this.$message.warning("请输入行和列");
  1174. }
  1175. },
  1176. // 添加模板
  1177. addModule(topicIndex, rowindex, lineIndex, item) {
  1178. this.TopicIndex = topicIndex;
  1179. this.RowIndex = rowindex;
  1180. this.LineIndex = lineIndex;
  1181. this.question_list.cur_fn_data.forEach((pic) => {
  1182. pic.table_list.forEach((row) => {
  1183. row.forEach((col) => {
  1184. col.is_add_module = true;
  1185. });
  1186. });
  1187. });
  1188. item.is_add_module = false;
  1189. },
  1190. // 删除模板
  1191. remoeModule(topicIndex, rowindex, lineIndex, item) {
  1192. item.type = "";
  1193. item.data = null;
  1194. this.TopicIndex = null;
  1195. this.RowIndex = null;
  1196. this.LineIndex = null;
  1197. item.is_add_module = true;
  1198. },
  1199. handleClosePre() {
  1200. if (window.stopAudioVoice) window.stopAudioVoice();
  1201. if (window.stopAudioAudio) window.stopAudioAudio();
  1202. if (window.stopAudioSound) window.stopAudioSound();
  1203. this.previewVisible = false;
  1204. },
  1205. onBlur(item, field) {
  1206. item[field] = item[field] ? item[field].trim() : "";
  1207. },
  1208. // 当前目录id name 父级name/当前 name
  1209. changeId(id, name, fatherName) {
  1210. this.loading = true;
  1211. this.TopicIndex = null;
  1212. this.RowIndex = null;
  1213. this.LineIndex = null;
  1214. this.fatherName = fatherName;
  1215. this.currentTreeID = id;
  1216. // 根据当前目录切换题
  1217. let MethodName = "book-courseware_manager-GetCoursewareContent";
  1218. let data = {
  1219. id,
  1220. };
  1221. console.log(this.question_list);
  1222. getContent(MethodName, data)
  1223. .then((res) => {
  1224. this.themeColor = res.book_theme_color ? res.book_theme_color : "";
  1225. this.question_list = res.content
  1226. ? JSON.parse(res.content)
  1227. : JSON.parse(JSON.stringify(this.org_question_list));
  1228. let data = JSON.parse(JSON.stringify(this.question_list));
  1229. data.detailList.forEach((item) => {
  1230. if (!item.detail) {
  1231. let obj = JSON.parse(JSON.stringify(item));
  1232. item.detail = obj;
  1233. }
  1234. if (!item.en) {
  1235. item.en = "";
  1236. }
  1237. });
  1238. this.question_list = JSON.parse(JSON.stringify(data));
  1239. if (this.previewVisible) {
  1240. this.onPreview();
  1241. }
  1242. this.loading = false;
  1243. // this.cur_page_que_index =
  1244. // this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1245. })
  1246. .catch((error) => {
  1247. this.loading = false;
  1248. });
  1249. },
  1250. handleTabsEdit(targetName, action) {
  1251. if (action === "add") {
  1252. let leg = this.question_list.cur_fn_data.length;
  1253. let obj = {
  1254. name: `tab${leg + 1}`,
  1255. title: `第${leg + 1}页`,
  1256. cur_fn_data: [],
  1257. };
  1258. this.question_list.push(obj);
  1259. }
  1260. if (action === "remove") {
  1261. let tabs = JSON.parse(JSON.stringify(this.question_list));
  1262. let activeName = this.editableTabsValue;
  1263. if (activeName === targetName) {
  1264. tabs.forEach((tab, index) => {
  1265. if (tab.name === targetName) {
  1266. let nextTab = tabs[index + 1] || tabs[index - 1];
  1267. if (nextTab) {
  1268. activeName = nextTab.name;
  1269. }
  1270. }
  1271. });
  1272. }
  1273. this.editableTabsValue = activeName;
  1274. let question_list = tabs.filter((tab) => tab.name !== targetName);
  1275. question_list.map((item, index) => {
  1276. item.name = `tab${index + 1}`;
  1277. item.title = `第${index + 1}页`;
  1278. return item;
  1279. });
  1280. this.question_list = question_list;
  1281. this.TopicIndex = null;
  1282. this.RowIndex = null;
  1283. this.LineIndex = null;
  1284. }
  1285. },
  1286. tabClick(tab) {
  1287. this.tabIndex = tab.index;
  1288. },
  1289. // 大模板
  1290. selectedFnType(item, index) {
  1291. if (item.list) {
  1292. return;
  1293. }
  1294. if (
  1295. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  1296. -1 &&
  1297. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  1298. ) {
  1299. this.$message.warning("请先选择添加模板的位置");
  1300. return;
  1301. }
  1302. if (
  1303. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1304. this.RowIndex
  1305. ][this.LineIndex].data
  1306. ) {
  1307. this.$message.warning("每列只能添加一个模板");
  1308. } else {
  1309. console.log("不存在");
  1310. this.$set(
  1311. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1312. this.RowIndex
  1313. ][this.LineIndex],
  1314. "type",
  1315. item.type
  1316. );
  1317. this.$set(
  1318. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1319. this.RowIndex
  1320. ][this.LineIndex],
  1321. "data",
  1322. null
  1323. );
  1324. console.log(this.question_list);
  1325. }
  1326. },
  1327. changeCurQue(data_stru) {
  1328. console.log(this.RowIndex, this.LineIndex);
  1329. this.$set(
  1330. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1331. this.RowIndex
  1332. ][this.LineIndex],
  1333. "data",
  1334. JSON.parse(JSON.stringify(data_stru))
  1335. );
  1336. console.log(this.question_list);
  1337. },
  1338. // 小模板
  1339. selectSmallModule(item, child, itemIndex, childIndex) {
  1340. console.log("选择了小模版");
  1341. if (
  1342. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  1343. -1 &&
  1344. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  1345. ) {
  1346. this.$message.warning("请先选择添加模板的位置");
  1347. return;
  1348. }
  1349. if (
  1350. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1351. this.RowIndex
  1352. ][this.LineIndex].data
  1353. ) {
  1354. this.$message.warning("每列只能添加一个模板");
  1355. } else {
  1356. this.$set(
  1357. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1358. this.RowIndex
  1359. ][this.LineIndex],
  1360. "type",
  1361. child.type
  1362. );
  1363. this.$set(
  1364. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1365. this.RowIndex
  1366. ][this.LineIndex],
  1367. "data",
  1368. null
  1369. );
  1370. }
  1371. },
  1372. // 删除某页中一个部分
  1373. deleteCurQue(item, queIndex) {
  1374. item.queList.splice(queIndex, 1);
  1375. },
  1376. saveNewwordAndSentences() {
  1377. let question_list = JSON.parse(JSON.stringify(this.question_list));
  1378. let sentence_list = [];
  1379. let sentence_list_mp = [];
  1380. let new_word_list = [];
  1381. question_list.cur_fn_data.forEach((curItem) => {
  1382. curItem.table_list.forEach((tabItem) => {
  1383. tabItem.forEach((topicIitem) => {
  1384. if (
  1385. topicIitem.type == "article_chs" ||
  1386. topicIitem.type == "dialogue_article_chs"
  1387. ) {
  1388. topicIitem.data.detail.forEach((item) => {
  1389. let obj = this.handleSentences(item.sentences, item.segList);
  1390. sentence_list = sentence_list.concat(obj.sentenceArr); //句子数组
  1391. sentence_list_mp = sentence_list_mp.concat(obj.res); //句子+分词数组
  1392. });
  1393. } else if (topicIitem.type == "NewWord_chs") {
  1394. topicIitem.data.option.forEach((item) => {
  1395. item.map((sItem) => {
  1396. sItem.audio_file_id = "";
  1397. if (sItem.mp3_list && sItem.mp3_list.length > 0) {
  1398. sItem.audio_file_id = sItem.mp3_list[0].id
  1399. .replace("[FID##", "")
  1400. .replace("##FID]", "");
  1401. }
  1402. sItem.audio_begin_time = 0;
  1403. sItem.audio_end_time = 0;
  1404. return sItem;
  1405. });
  1406. new_word_list = new_word_list.concat(item);
  1407. });
  1408. }
  1409. });
  1410. });
  1411. });
  1412. return {
  1413. new_word_list,
  1414. sentence_list,
  1415. sentence_list_mp,
  1416. };
  1417. },
  1418. handleSentences(list, segList) {
  1419. let res = [],
  1420. sentenceArr = [];
  1421. list.forEach((Litem, index) => {
  1422. Litem = Litem.replace(/#/g, "");
  1423. this.NumberList.forEach((nitem) => {
  1424. if (Litem.indexOf(nitem) > -1) {
  1425. let reg = new RegExp(nitem, g);
  1426. Litem = Litem.replace(reg, "");
  1427. }
  1428. });
  1429. let segItem = this.handleSegItem(segList[index]);
  1430. let obj = {
  1431. sentence: Litem,
  1432. word_list: segItem,
  1433. };
  1434. res.push(obj);
  1435. sentenceArr.push(Litem);
  1436. });
  1437. return { res: res, sentenceArr: sentenceArr };
  1438. },
  1439. handleSegItem(list) {
  1440. let resArr = [];
  1441. list.forEach((item) => {
  1442. if (item != "#" && this.NumberList.indexOf(item) < 0) {
  1443. let obj = {
  1444. word: item,
  1445. word_bt: "",
  1446. };
  1447. resArr.push(obj);
  1448. }
  1449. });
  1450. return resArr;
  1451. },
  1452. onSave() {
  1453. let isProof = true;
  1454. let question_list_str = JSON.stringify(this.question_list);
  1455. console.log(this.question_list);
  1456. localStorage.setItem("question_list", question_list_str);
  1457. let result = this.saveNewwordAndSentences();
  1458. const MethodName = "book-courseware_manager-SaveCoursewareContent";
  1459. let data = {
  1460. id: this.currentTreeID,
  1461. content: JSON.stringify(this.question_list),
  1462. is_use_manual_proofreading_word_sentence: isProof,
  1463. new_word_list: result.new_word_list,
  1464. sentence_list: result.sentence_list,
  1465. sentence_list_mp: result.sentence_list_mp,
  1466. ui_type: "NPC",
  1467. category: "NPC",
  1468. };
  1469. getContent(MethodName, data)
  1470. .then((res) => {
  1471. this.$message.success("保存成功!");
  1472. })
  1473. .catch((error) => {});
  1474. },
  1475. async onPreview() {
  1476. let _this = this;
  1477. let question_data = null;
  1478. if (_this.question_list) {
  1479. const question2 = JSON.parse(JSON.stringify(_this.question_list));
  1480. question_data = await _this.getFileUrl_preview(question2);
  1481. _this.previewVisible = true;
  1482. _this.context = question_data;
  1483. console.log("预览数据");
  1484. console.log(this.question_list);
  1485. } else {
  1486. _this.$message.warning("还没有录入数据");
  1487. }
  1488. },
  1489. getFileUrl_preview(question) {
  1490. let questionStr = JSON.stringify(question);
  1491. const reg = /\[FID##(.*?)##FID\]/g;
  1492. let regConArr = [];
  1493. if (reg.test(questionStr)) {
  1494. regConArr = questionStr.match(reg);
  1495. }
  1496. if (regConArr.length > 0) {
  1497. regConArr = regConArr.map((item) => {
  1498. item = item.replace("[FID##", "").replace("##FID]", "");
  1499. return item;
  1500. });
  1501. }
  1502. return new Promise((resolve, reject) => {
  1503. const MethodName = "file_store_manager-GetFileURLMap";
  1504. const data = {
  1505. file_id_list: regConArr,
  1506. };
  1507. getStaticContent(MethodName, data).then((res) => {
  1508. const backData = res.url_map;
  1509. for (const key in backData) {
  1510. const url = backData[key];
  1511. if (questionStr.indexOf(key) > -1) {
  1512. const d = `\\[FID##${key}##FID\\]`;
  1513. const regD = new RegExp(d, "g");
  1514. questionStr = questionStr.replace(regD, url);
  1515. }
  1516. }
  1517. const question3 = JSON.parse(questionStr);
  1518. resolve(question3);
  1519. });
  1520. });
  1521. },
  1522. onSure(curItem) {
  1523. this.TopicIndex = null;
  1524. this.RowIndex = null;
  1525. this.LineIndex = null;
  1526. curItem.is_edit = false;
  1527. },
  1528. onDel(item, curIndex) {
  1529. item.cur_fn_data.splice(curIndex, 1);
  1530. if (this.question_list.cur_fn_data.length > 0) {
  1531. this.cur_page_que_index = this.question_list.cur_fn_data.length - 1;
  1532. } else {
  1533. this.cur_page_que_index = 0;
  1534. }
  1535. // let question_list_str = JSON.stringify(this.question_list);
  1536. // localStorage.setItem("question_list", question_list_str);
  1537. },
  1538. // 编辑当前题型
  1539. editCurQue(curItem) {
  1540. curItem.is_edit = true;
  1541. // if (!curItem.isEdit) {
  1542. // let count = 0;
  1543. // let tabIndex = this.tabIndex;
  1544. // let leg = this.question_list[tabIndex].cur_fn_data.length;
  1545. // this.question_list[tabIndex].cur_fn_data.forEach((item) => {
  1546. // if (item.isEdit) {
  1547. // count++;
  1548. // }
  1549. // });
  1550. // if (count == 0) {
  1551. // if (!curItem.isEdit) {
  1552. // curItem.isEdit = true;
  1553. // }
  1554. // } else {
  1555. // this.$message.warning("有题目未保存");
  1556. // }
  1557. // }
  1558. },
  1559. }, // 如果页面有keep-alive缓存功能,这个函数会触发
  1560. };
  1561. </script>
  1562. <style lang='scss' scoped>
  1563. //@import url(); 引入公共css类
  1564. .Big-Book-container {
  1565. width: 100%;
  1566. min-height: 100vh;
  1567. .Big-Book-content {
  1568. padding: 26px 0;
  1569. display: flex;
  1570. justify-content: flex-start;
  1571. align-items: flex-start;
  1572. }
  1573. .content-tree {
  1574. width: 280px;
  1575. }
  1576. .Book-content {
  1577. flex: 1;
  1578. box-sizing: border-box;
  1579. padding: 30px;
  1580. height: 859px;
  1581. overflow-y: auto;
  1582. &-inner {
  1583. // width: 860px;
  1584. }
  1585. .addoption {
  1586. width: 148px;
  1587. height: 40px;
  1588. background: #f3f3f3;
  1589. border: 1px dashed rgba(0, 0, 0, 0.15);
  1590. box-sizing: border-box;
  1591. border-radius: 4px;
  1592. text-align: center;
  1593. line-height: 40px;
  1594. cursor: pointer;
  1595. font-size: 14px;
  1596. color: #000000;
  1597. margin-top: 20px;
  1598. }
  1599. .createTable {
  1600. }
  1601. }
  1602. .Big-Book-save {
  1603. width: 860px;
  1604. display: flex;
  1605. justify-content: flex-end;
  1606. padding: 0 0 20px 0;
  1607. }
  1608. .Big-Book {
  1609. &-add {
  1610. position: absolute;
  1611. top: -40px;
  1612. right: 0;
  1613. z-index: 1;
  1614. width: 73px;
  1615. height: 40px;
  1616. background: #f7f7f7;
  1617. border: 1px solid #d9d9d9;
  1618. line-height: 40px;
  1619. text-align: center;
  1620. font-weight: bold;
  1621. font-size: 18px;
  1622. text-align: center;
  1623. color: #000000;
  1624. }
  1625. &-name {
  1626. display: flex;
  1627. justify-content: flex-start;
  1628. align-items: center;
  1629. margin-bottom: 10px;
  1630. > p {
  1631. font-size: 14px;
  1632. }
  1633. }
  1634. &-delete {
  1635. width: 16px;
  1636. height: 16px;
  1637. margin-left: 15px;
  1638. cursor: pointer;
  1639. }
  1640. &-curPage {
  1641. margin-bottom: 20px;
  1642. &.Big-Book-curPage-edit {
  1643. border-top: 1px solid #e0e0e0;
  1644. border-bottom: 1px solid #e0e0e0;
  1645. background-color: #fafafa;
  1646. }
  1647. &.Big-Book-curPage-preview {
  1648. border-top: 1px solid #fff;
  1649. border-bottom: 1px solid #fff;
  1650. display: flex;
  1651. justify-content: flex-start;
  1652. align-items: flex-start;
  1653. &:hover {
  1654. background-color: #fafafa;
  1655. border-top: 1px solid #e0e0e0;
  1656. border-bottom: 1px solid #e0e0e0;
  1657. }
  1658. }
  1659. }
  1660. &-queBox {
  1661. padding: 10px 0;
  1662. }
  1663. }
  1664. .Book-function {
  1665. width: 204px;
  1666. background: #f7f7f7;
  1667. box-sizing: border-box;
  1668. padding: 30px 16px;
  1669. height: 859px;
  1670. overflow-y: auto;
  1671. .function-list {
  1672. width: 100%;
  1673. > li {
  1674. width: 100%;
  1675. width: 172px;
  1676. height: 40px;
  1677. background: #ffffff;
  1678. border: 1px solid rgba(0, 0, 0, 0.15);
  1679. box-sizing: border-box;
  1680. border-radius: 4px;
  1681. cursor: pointer;
  1682. margin-bottom: 5px;
  1683. display: flex;
  1684. justify-content: center;
  1685. align-items: center;
  1686. > span {
  1687. font-weight: normal;
  1688. font-size: 16px;
  1689. line-height: 150%;
  1690. color: #000000;
  1691. }
  1692. .el-dropdown {
  1693. color: #000000;
  1694. }
  1695. }
  1696. }
  1697. }
  1698. .Big-Book-top {
  1699. margin-top: 20px;
  1700. display: flex;
  1701. align-items: center;
  1702. span {
  1703. margin-right: 10px;
  1704. }
  1705. }
  1706. }
  1707. </style>