adultInput.vue 62 KB

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