adultInput.vue 55 KB

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