adultInput.vue 58 KB

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