adultInput.vue 50 KB

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