adultInput.vue 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380
  1. <!-- -->
  2. <template>
  3. <div v-loading="loading" class="Big-Book-container adult-book-input-sty">
  4. <Header />
  5. <div class="Big-Book-content">
  6. <div class="content-tree">
  7. <Catelog
  8. :book-id="bookId"
  9. :book-level="bookLevel"
  10. :book-node-index="bookIndex"
  11. :change-id="changeId"
  12. :change-tree-data="changeTreeData"
  13. :current-tree-i-d="currentTreeID"
  14. :emptyQustion="emptyQustion"
  15. />
  16. </div>
  17. <div v-if="currentTreeID" class="Book-content">
  18. <div class="Big-Book-save Big-Book-input-save">
  19. <el-button type="primary" @click="onSave">保 存</el-button>
  20. <el-button type="danger" plain @click="onPreview">预 览</el-button>
  21. </div>
  22. <!-- <el-tabs
  23. v-model="editableTabsValue"
  24. type="card"
  25. editable
  26. @edit="handleTabsEdit"
  27. @tab-click="tabClick"
  28. >
  29. <el-tab-pane
  30. v-for="(item, index) in question_list"
  31. :key="item.name"
  32. :label="item.title"
  33. :name="item.name"
  34. > -->
  35. <div
  36. v-for="(fc, fcIndex) in question_list.detailList"
  37. :key="'fc' + fcIndex"
  38. style="
  39. position: relative;
  40. margin-bottom: 20px;
  41. padding-bottom: 10px;
  42. border-bottom: 1px dotted #ccc;
  43. "
  44. >
  45. <SentenceSegwordChs :cur-que="fc.detail" type="adultinput" />
  46. <img
  47. style="position: absolute; right: 20px; top: 2px"
  48. class="close"
  49. src="../assets/adult/del-close.png"
  50. alt=""
  51. @click="deleteDetail(fcIndex)"
  52. />
  53. <div class="Big-Book-top" style="margin: 10px 0">
  54. <span>英文</span>
  55. <el-input
  56. v-model="fc.en"
  57. style="width: 80%"
  58. type="textarea"
  59. autosize
  60. placeholder="请输入英文"
  61. maxlength="200"
  62. show-word-limit
  63. @blur="onBlur(fc, 'en')"
  64. />
  65. </div>
  66. </div>
  67. <div class="addoption" @click="addDetail">添加分句</div>
  68. <div
  69. v-for="(kt, ktIndex) in question_list.classTopic"
  70. :key="'kt' + ktIndex"
  71. style="
  72. position: relative;
  73. margin-bottom: 20px;
  74. padding-bottom: 10px;
  75. border-bottom: 1px dotted #ccc;
  76. "
  77. >
  78. <div class="Big-Book-top" style="margin: 10px 0">
  79. <span>课题</span>
  80. <el-input
  81. v-model="kt.con"
  82. style="width: 80%"
  83. type="textarea"
  84. autosize
  85. placeholder="请输入课题"
  86. maxlength="200"
  87. show-word-limit
  88. @blur="onBlur(kt, 'con')"
  89. />
  90. <img
  91. style="position: absolute; right: 20px; top: 2px"
  92. class="close"
  93. src="../assets/adult/del-close.png"
  94. alt=""
  95. @click="deleteClassTopic(ktIndex)"
  96. />
  97. </div>
  98. <div class="Big-Book-top" style="margin: 10px 0">
  99. <span>字体</span>
  100. <el-radio-group v-model="kt.font">
  101. <el-radio label="cn">中文字体</el-radio>
  102. <el-radio label="en">英文字体</el-radio>
  103. <el-radio label="pinyin">拼音字体</el-radio>
  104. </el-radio-group>
  105. </div>
  106. </div>
  107. <div class="addoption" @click="addClassTopic">添加课题</div>
  108. <div class="createTable">
  109. <el-input
  110. v-model="row"
  111. maxlength="2"
  112. style="width: 50px"
  113. type="text"
  114. @input="rowLine('row')"
  115. />*<el-input
  116. v-model="line"
  117. style="width: 50px"
  118. type="text"
  119. maxlength="2"
  120. @input="rowLine('line')"
  121. />
  122. <el-button
  123. style="margin-left: 10px"
  124. type="primary"
  125. @click="createTable"
  126. >增加题</el-button
  127. >
  128. </div>
  129. <div
  130. v-for="(topic, toindex) in question_list.cur_fn_data"
  131. :key="'topic' + toindex"
  132. >
  133. <div class="topTitle">
  134. <div style="display: flex; align-items: center">
  135. <p>第{{ toindex + 1 }}题</p>
  136. <el-checkbox
  137. v-model="groupIndexList"
  138. :label="toindex"
  139. style="margin: 0 10px"
  140. ><br /></el-checkbox
  141. ><span>{{ topic.group_name }}</span>
  142. <el-button size="small" @click="deleteElement(toindex)"
  143. >删除</el-button
  144. >
  145. <el-button
  146. type="primary"
  147. size="small"
  148. icon="el-icon-top"
  149. @click="moveElement(topic, toindex, 'up')"
  150. >上移</el-button
  151. >
  152. <el-button
  153. type="primary"
  154. size="small"
  155. icon="el-icon-bottom"
  156. @click="moveElement(topic, toindex, 'down')"
  157. >下移</el-button
  158. >
  159. </div>
  160. <span @click="handleChangeTab(topic)">
  161. {{ topic.contentShow ? "收起" : "展开" }}
  162. <img
  163. v-if="topic.contentShow"
  164. src="../assets/NPC/down-black.png"
  165. alt=""
  166. />
  167. <img v-else src="../assets/NPC/up-black.png" alt="" />
  168. </span>
  169. </div>
  170. <el-collapse-transition>
  171. <div v-show="topic.contentShow" class="collapse-box">
  172. <div class="adult-book-input-item">
  173. <span class="adult-book-lable">序号:</span>
  174. <el-input
  175. v-model="topic.number"
  176. type="textarea"
  177. :autosize="{ minRows: 2 }"
  178. placeholder="请输入序号"
  179. maxlength="200"
  180. show-word-limit
  181. @blur="onBlur(topic, 'number')"
  182. />
  183. </div>
  184. <!-- <div class="adult-book-input-item">
  185. <span class="adult-book-lable">正标题:</span>
  186. <el-input
  187. v-model="topic.z_title"
  188. type="textarea"
  189. :autosize="{ minRows: 2 }"
  190. placeholder="请输入正标题"
  191. maxlength="500"
  192. show-word-limit
  193. @blur="onBlur(topic, 'z_title')"
  194. />
  195. </div> -->
  196. <sentence-segword-chs-detail
  197. :name="'正标题'"
  198. :curQue="topic.z_title_detail"
  199. type="adultinput"
  200. />
  201. <!-- <div class="adult-book-input-item">
  202. <span class="adult-book-lable">副标题:</span>
  203. <el-input
  204. v-model="topic.f_title"
  205. :autosize="{ minRows: 2 }"
  206. type="textarea"
  207. placeholder="请输入副标题"
  208. maxlength="500"
  209. show-word-limit
  210. @blur="onBlur(topic, 'f_title')"
  211. />
  212. </div> -->
  213. <sentence-segword-chs-detail
  214. :name="'副标题'"
  215. :curQue="topic.f_title_detail"
  216. type="adultinput"
  217. />
  218. <div class="adult-book-input-item">
  219. <span class="adult-book-lable">标题号:</span>
  220. <div style="width: 100%">
  221. <div
  222. style="
  223. display: flex;
  224. align-items: flex-start;
  225. margin-bottom: 10px;
  226. "
  227. >
  228. <el-input
  229. v-model="topic.little_title_number"
  230. style="width: 20%"
  231. type="textarea"
  232. placeholder="请输入标题题号"
  233. maxlength="200"
  234. show-word-limit
  235. @input="forupdata"
  236. @blur="onBlur(topic, 'little_title_number')"
  237. />
  238. <!-- <el-input
  239. v-model="topic.little_title"
  240. style="width: 70%; margin-left: 10px"
  241. type="textarea"
  242. placeholder="请输入标题内容"
  243. maxlength="500"
  244. show-word-limit
  245. @input="forupdata"
  246. @blur="onBlur(topic, 'little_title')"
  247. /> -->
  248. </div>
  249. </div>
  250. </div>
  251. <sentence-segword-chs-detail
  252. :name="'标题内容'"
  253. :curQue="topic.l_title_detail"
  254. type="adultinput"
  255. />
  256. <div class="Big-Book-top">
  257. <span>正副标题缩进</span>
  258. <el-radio v-model="topic.is_textIndex" :label="true"
  259. >是</el-radio
  260. >
  261. <el-radio v-model="topic.is_textIndex" :label="false"
  262. >否</el-radio
  263. >
  264. </div>
  265. <div class="Big-Book-top">
  266. <span>是否有背景色</span>
  267. <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
  268. <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
  269. </div>
  270. <div class="Big-Book-top">
  271. <span>是否有背景图</span>
  272. <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
  273. <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
  274. </div>
  275. <div
  276. v-for="(rowItem, rowIndex) in topic.table_list"
  277. :key="'row' + rowIndex"
  278. >
  279. <div
  280. v-for="(topicIitem, lineIndex) in rowItem"
  281. :key="lineIndex"
  282. :style="{ 'border-bottom': '2px #999 dotted' }"
  283. >
  284. <div>
  285. <span>{{
  286. "第" + (rowIndex + 1) + "行,第" + (lineIndex + 1) + "列"
  287. }}</span>
  288. <div
  289. class="addoption"
  290. style="margin-left: 10px"
  291. @click="handleRemoveCol(rowIndex, lineIndex, toindex)"
  292. >
  293. 删除当前列
  294. </div>
  295. <div
  296. class="addoption"
  297. style="margin-left: 10px"
  298. @click="
  299. handleAddCol('front', rowIndex, lineIndex, toindex)
  300. "
  301. >
  302. 在当前列前增加列
  303. </div>
  304. <div
  305. class="addoption"
  306. style="margin-left: 10px"
  307. @click="
  308. handleAddCol('behind', rowIndex, lineIndex, toindex)
  309. "
  310. >
  311. 在当前列后增加列
  312. </div>
  313. </div>
  314. <div>
  315. <template
  316. v-if="
  317. topicIitem.type == 'article_chs' ||
  318. (topicIitem.data &&
  319. topicIitem.data.type == 'article_chs')
  320. "
  321. >
  322. <template v-if="topicIitem.is_edit">
  323. <ArticleTemChs
  324. :cur-que="topicIitem.data"
  325. :change-cur-que="changeCurQue"
  326. v-if="refresh"
  327. />
  328. </template>
  329. <template v-else>
  330. <!-- <ArticleView :cur-que="topicIitem.data" /> -->
  331. </template>
  332. </template>
  333. <template v-if="topicIitem.type == 'sentence_segword_chs'">
  334. <template v-if="topicIitem.is_edit">
  335. <SentenceSegwordChs
  336. :cur-que="topicIitem.data"
  337. :change-cur-que="changeCurQue"
  338. v-if="refresh"
  339. />
  340. </template>
  341. <template v-else>
  342. <!-- <ArticleView :cur-que="topicIitem.data" /> -->
  343. </template>
  344. </template>
  345. <template v-if="topicIitem.type == 'dialogue_article_chs'">
  346. <template v-if="topicIitem.is_edit">
  347. <DialogueArticleChs
  348. :cur-que="topicIitem.data"
  349. :change-cur-que="changeCurQue"
  350. v-if="refresh"
  351. />
  352. </template>
  353. <template v-else>
  354. <!-- <ArticleView :curQue="topicIitem.que" /> -->
  355. </template>
  356. </template>
  357. <template v-if="topicIitem.type == 'dialogue_answer_chs'">
  358. <template v-if="topicIitem.is_edit">
  359. <DialogueAnswerChs
  360. :cur-que="topicIitem.data"
  361. :change-cur-que="changeCurQue"
  362. v-if="refresh"
  363. />
  364. </template>
  365. <template v-else>
  366. <!-- <ArticleView :curQue="topicIitem.que" /> -->
  367. </template>
  368. </template>
  369. <template v-if="topicIitem.type == 'NewWord_chs'">
  370. <template v-if="topicIitem.is_edit">
  371. <Neword
  372. :cur-que="topicIitem.data"
  373. :change-cur-que="changeCurQue"
  374. v-if="refresh"
  375. />
  376. </template>
  377. <template v-else>
  378. <NewordPhraseview :cur-que="topicIitem.data" />
  379. </template>
  380. </template>
  381. <template v-if="topicIitem.type == 'notes_chs'">
  382. <template v-if="topicIitem.is_edit">
  383. <Notes
  384. :cur-que="topicIitem.data"
  385. :change-cur-que="changeCurQue"
  386. v-if="refresh"
  387. />
  388. </template>
  389. <template v-else>
  390. <NewordPhraseview :cur-que="topicIitem.data" />
  391. </template>
  392. </template>
  393. <template v-if="topicIitem.type == 'input_record_chs'">
  394. <template v-if="topicIitem.is_edit">
  395. <InputRecord
  396. :cur-que="topicIitem.data"
  397. :fn_data="fn_data"
  398. :change-cur-que="changeCurQue"
  399. v-if="refresh"
  400. />
  401. </template>
  402. <template v-else />
  403. </template>
  404. <template
  405. v-if="
  406. topicIitem.type == 'recordHZ_inputPY_chs' ||
  407. topicIitem.type == 'inputItem_chs' ||
  408. topicIitem.type == 'sentence_input_chs' ||
  409. topicIitem.type == 'sentence_judge_chs' ||
  410. topicIitem.type == 'sentence_record_chs' ||
  411. topicIitem.type == 'sentence_input_record_chs' ||
  412. topicIitem.type == 'sentence_listen_read_chs'
  413. "
  414. >
  415. <template v-if="topicIitem.is_edit">
  416. <Sentence
  417. :cur-que="topicIitem.data"
  418. :type="topicIitem.type"
  419. :fn_data="fn_data"
  420. :change-cur-que="changeCurQue"
  421. v-if="refresh"
  422. />
  423. </template>
  424. <template v-else />
  425. </template>
  426. <template v-if="topicIitem.type == 'sudoku_chs'">
  427. <template v-if="topicIitem.is_edit">
  428. <Sudoku
  429. :cur-que="topicIitem.data"
  430. :type="topicIitem.type"
  431. :fn_data="fn_data"
  432. :change-cur-que="changeCurQue"
  433. v-if="refresh"
  434. />
  435. </template>
  436. <template v-else />
  437. </template>
  438. <template v-if="topicIitem.type == 'NumberCombination_chs'">
  439. <template v-if="topicIitem.is_edit">
  440. <NumberCombination
  441. :cur-que="topicIitem.data"
  442. :type="topicIitem.type"
  443. :fn_data="fn_data"
  444. :change-cur-que="changeCurQue"
  445. v-if="refresh"
  446. />
  447. </template>
  448. <template v-else />
  449. </template>
  450. <template v-if="topicIitem.type == 'toneSelect_chs'">
  451. <template v-if="topicIitem.is_edit">
  452. <ToneSelect
  453. :cur-que="topicIitem.data"
  454. :type="topicIitem.type"
  455. :fn_data="fn_data"
  456. :change-cur-que="changeCurQue"
  457. v-if="refresh"
  458. />
  459. </template>
  460. <template v-else />
  461. </template>
  462. <template v-if="topicIitem.type === 'voice_matrix'">
  463. <template v-if="topicIitem.is_edit">
  464. <voice-matrix
  465. :cur-que="topicIitem.data"
  466. :change-cur-que="changeCurQue"
  467. v-if="refresh"
  468. />
  469. </template>
  470. </template>
  471. <template v-if="topicIitem.type === 'select_drag'">
  472. <select-drag
  473. :cur-que="topicIitem.data"
  474. :change-cur-que="changeCurQue"
  475. v-if="refresh"
  476. />
  477. </template>
  478. <template v-if="topicIitem.type === 'config_table'">
  479. <configurable-table
  480. :cur-que="topicIitem.data"
  481. :change-cur-que="changeCurQue"
  482. />
  483. </template>
  484. <template v-if="topicIitem.type === 'header_separate'">
  485. <header-separate
  486. :cur-que="topicIitem.data"
  487. :change-cur-que="changeCurQue"
  488. v-if="refresh"
  489. />
  490. </template>
  491. <template v-if="topicIitem.type === 'fill_drag'">
  492. <fill-drag
  493. :cur-que="topicIitem.data"
  494. :change-cur-que="changeCurQue"
  495. v-if="refresh"
  496. />
  497. </template>
  498. <template v-if="topicIitem.type == 'ligature_chs'">
  499. <template v-if="topicIitem.is_edit">
  500. <Ligature
  501. :cur-que="topicIitem.data"
  502. :fn_data="fn_data"
  503. :change-cur-que="changeCurQue"
  504. :type="topicIitem.type"
  505. v-if="refresh"
  506. />
  507. </template>
  508. <template v-else> </template>
  509. </template>
  510. <template
  511. v-if="topicIitem.type == 'image_question_input_record'"
  512. >
  513. <template v-if="topicIitem.is_edit">
  514. <ImageQuestion
  515. :cur-que="topicIitem.data"
  516. :type="topicIitem.type"
  517. :fn_data="fn_data"
  518. :change-cur-que="changeCurQue"
  519. v-if="refresh"
  520. />
  521. </template>
  522. <template v-else />
  523. </template>
  524. <template
  525. v-if="
  526. topicIitem.type == 'single_chs' ||
  527. topicIitem.type == 'checkbox_chs' ||
  528. topicIitem.type == 'listen_record_single_chs'
  529. "
  530. >
  531. <template v-if="topicIitem.is_edit">
  532. <Single
  533. :cur-que="topicIitem.data"
  534. :type="topicIitem.type"
  535. :fn_data="fn_data"
  536. :change-cur-que="changeCurQue"
  537. v-if="refresh"
  538. />
  539. </template>
  540. <template v-else />
  541. </template>
  542. <template
  543. v-if="
  544. topicIitem.type == 'text_problem_chs' ||
  545. topicIitem.type == 'newWord_preview_chs' ||
  546. topicIitem.type == 'listen_record_single_syllable_chs'
  547. "
  548. >
  549. <template v-if="topicIitem.is_edit">
  550. <PurePreview
  551. :cur-que="topicIitem.data"
  552. :type="topicIitem.type"
  553. :fn_data="fn_data"
  554. :change-cur-que="changeCurQue"
  555. v-if="refresh"
  556. />
  557. </template>
  558. <template v-else />
  559. </template>
  560. <template
  561. v-if="topicIitem.type == 'zi_transverse_line_chs'"
  562. >
  563. <template v-if="topicIitem.is_edit">
  564. <ZiLine
  565. :cur-que="topicIitem.data"
  566. :type="topicIitem.type"
  567. :fn_data="fn_data"
  568. :change-cur-que="changeCurQue"
  569. v-if="refresh"
  570. />
  571. </template>
  572. <template v-else />
  573. </template>
  574. <template v-if="topicIitem.type == 'select_input_chs'">
  575. <template v-if="topicIitem.is_edit">
  576. <SelectInpue
  577. :cur-que="topicIitem.data"
  578. :type="topicIitem.type"
  579. :fn_data="fn_data"
  580. :change-cur-que="changeCurQue"
  581. v-if="refresh"
  582. />
  583. </template>
  584. <template v-else />
  585. </template>
  586. <template v-if="topicIitem.type == 'play_input_record_chs'">
  587. <template v-if="topicIitem.is_edit">
  588. <PlayInputReacord
  589. :cur-que="topicIitem.data"
  590. :type="topicIitem.type"
  591. :fn_data="fn_data"
  592. :change-cur-que="changeCurQue"
  593. v-if="refresh"
  594. />
  595. </template>
  596. <template v-else />
  597. </template>
  598. <template
  599. v-if="
  600. topicIitem.type == 'imgage_image' ||
  601. topicIitem.type == 'image_checkBox' ||
  602. topicIitem.type == 'image_judge' ||
  603. topicIitem.type == 'image_single' ||
  604. topicIitem.type == 'image_dobleinput' ||
  605. topicIitem.type == 'image_gdcy' ||
  606. topicIitem.type == 'image_input'
  607. "
  608. >
  609. <template v-if="topicIitem.is_edit">
  610. <Picture
  611. :cur-que="topicIitem.data"
  612. :type="topicIitem.type"
  613. :fn_data="fn_data"
  614. :change-cur-que="changeCurQue"
  615. v-if="refresh"
  616. />
  617. </template>
  618. <template v-else />
  619. </template>
  620. <!-- <template v-if="topicIitem.type == 'drag_chs'">
  621. <template v-if="topicIitem.is_edit">
  622. <Drag
  623. :curQue="topicIitem.data"
  624. :type="topicIitem.type"
  625. :fn_data="fn_data"
  626. :changeCurQue="changeCurQue"
  627. />
  628. </template>
  629. <template v-else> </template>
  630. </template> -->
  631. <template
  632. v-if="topicIitem.type == 'checkbox_self_assessment_chs'"
  633. >
  634. <template v-if="topicIitem.is_edit">
  635. <SelfAssessment
  636. :cur-que="topicIitem.data"
  637. :type="topicIitem.type"
  638. :fn_data="fn_data"
  639. :change-cur-que="changeCurQue"
  640. v-if="refresh"
  641. />
  642. </template>
  643. <template v-else />
  644. </template>
  645. <template v-if="topicIitem.type == 'sort_chs'">
  646. <template v-if="topicIitem.is_edit">
  647. <Sort
  648. :cur-que="topicIitem.data"
  649. :type="topicIitem.type"
  650. :fn_data="fn_data"
  651. :change-cur-que="changeCurQue"
  652. v-if="refresh"
  653. />
  654. </template>
  655. <template v-else> </template>
  656. </template>
  657. <template v-if="topicIitem.type == 'CourseStart_chs'">
  658. <template v-if="topicIitem.is_edit">
  659. <CourseStart
  660. :cur-que="topicIitem.data"
  661. :type="topicIitem.type"
  662. :fn_data="fn_data"
  663. :change-cur-que="changeCurQue"
  664. v-if="refresh"
  665. />
  666. </template>
  667. <template v-else />
  668. </template>
  669. <template
  670. v-if="
  671. topicIitem.type == 'record_control_mini' ||
  672. topicIitem.type == 'record_control_normal' ||
  673. topicIitem.type == 'record_control_pro' ||
  674. topicIitem.type == 'record_control_promax'
  675. "
  676. >
  677. <template v-if="topicIitem.is_edit">
  678. <RecordControl
  679. :cur-que="topicIitem.data"
  680. :type="topicIitem.type"
  681. :fn_data="fn_data"
  682. :change-cur-que="changeCurQue"
  683. v-if="refresh"
  684. />
  685. </template>
  686. <template v-else />
  687. </template>
  688. <template
  689. v-if="
  690. topicIitem.type == 'upload_control_chs' ||
  691. topicIitem.type == 'upload_control_preview_chs'
  692. "
  693. >
  694. <template v-if="topicIitem.is_edit">
  695. <UploadControl
  696. :cur-que="topicIitem.data"
  697. :type="topicIitem.type"
  698. :fn_data="fn_data"
  699. :change-cur-que="changeCurQue"
  700. v-if="refresh"
  701. />
  702. </template>
  703. <template v-else> </template>
  704. </template>
  705. <template v-if="topicIitem.type == 'tinydemo_chs'">
  706. <template v-if="topicIitem.is_edit">
  707. <Tinydemo
  708. :cur-que="topicIitem.data"
  709. :type="topicIitem.type"
  710. :fn_data="fn_data"
  711. :change-cur-que="changeCurQue"
  712. :number="
  713. currentTreeID + toindex + rowIndex + lineIndex
  714. "
  715. v-if="refresh"
  716. />
  717. </template>
  718. <template v-else />
  719. </template>
  720. <template v-if="topicIitem.type == 'switch_control_chs'">
  721. <template v-if="topicIitem.is_edit">
  722. <SuitchControl
  723. :cur-que="topicIitem.data"
  724. :type="topicIitem.type"
  725. :fn_data="fn_data"
  726. :change-cur-que="changeCurQue"
  727. v-if="refresh"
  728. />
  729. </template>
  730. <template v-else />
  731. </template>
  732. <template v-if="topicIitem.type == 'video_chs'">
  733. <template v-if="topicIitem.is_edit">
  734. <VideoControl
  735. :cur-que="topicIitem.data"
  736. :type="topicIitem.type"
  737. :fn_data="fn_data"
  738. :change-cur-que="changeCurQue"
  739. v-if="refresh"
  740. />
  741. </template>
  742. <template v-else>
  743. <!-- <VideoControlView
  744. :curQue="topicIitem.data"
  745. :type="topicIitem.type"
  746. :fn_data="fn_data"
  747. /> -->
  748. </template>
  749. </template>
  750. <template v-if="topicIitem.type == 'table_chs'">
  751. <template v-if="topicIitem.is_edit">
  752. <Table
  753. :cur-que="topicIitem.data"
  754. :type="topicIitem.type"
  755. :fn_data="fn_data"
  756. :change-cur-que="changeCurQue"
  757. v-if="refresh"
  758. />
  759. </template>
  760. <template v-else> </template>
  761. </template>
  762. <template v-if="topicIitem.type == 'play_record_chs'">
  763. <template v-if="topicIitem.is_edit">
  764. <PlayRecord
  765. :cur-que="topicIitem.data"
  766. :type="topicIitem.type"
  767. :fn_data="fn_data"
  768. :change-cur-que="changeCurQue"
  769. v-if="refresh"
  770. />
  771. </template>
  772. <template v-else>
  773. <PlayRecordView
  774. :cur-que="topicIitem.data"
  775. :type="topicIitem.type"
  776. :fn_data="fn_data"
  777. />
  778. </template>
  779. </template>
  780. <template v-if="topicIitem.type == 'upload_pdf_chs'">
  781. <template v-if="topicIitem.is_edit">
  782. <UploadPdf
  783. :cur-que="topicIitem.data"
  784. :type="topicIitem.type"
  785. :fn_data="fn_data"
  786. :change-cur-que="changeCurQue"
  787. v-if="refresh"
  788. />
  789. </template>
  790. <template v-else />
  791. </template>
  792. <template v-if="topicIitem.type == 'sentence_segtemp_chs'">
  793. <template v-if="topicIitem.is_edit">
  794. <SentenceModule
  795. :curQue="topicIitem.data"
  796. :type="topicIitem.type"
  797. :changeCurQue="changeCurQue"
  798. v-if="refresh"
  799. />
  800. </template>
  801. <template v-else> </template>
  802. </template>
  803. <template v-if="topicIitem.type == 'options_list_chs'">
  804. <template v-if="topicIitem.is_edit">
  805. <OptionsList
  806. :curQue="topicIitem.data"
  807. :type="topicIitem.type"
  808. :changeCurQue="changeCurQue"
  809. v-if="refresh"
  810. />
  811. </template>
  812. <template v-else> </template>
  813. </template>
  814. <template v-if="topicIitem.type == 'sentence_single_chs'">
  815. <template v-if="topicIitem.is_edit">
  816. <SentenceMulModule
  817. :curQue="topicIitem.data"
  818. :type="topicIitem.type"
  819. :changeCurQue="changeCurQue"
  820. v-if="refresh"
  821. />
  822. </template>
  823. <template v-else> </template>
  824. </template>
  825. </div>
  826. <div
  827. v-if="topicIitem.data && topicIitem.is_edit"
  828. class="addoption"
  829. @click="
  830. remoeModule(toindex, rowIndex, lineIndex, topicIitem)
  831. "
  832. >
  833. 删除模板 <br />{{ topicIitem.data.name }}
  834. <!-- + {{topicIitem.type}} -->
  835. </div>
  836. <div
  837. v-else-if="
  838. TopicIndex == toindex &&
  839. RowIndex == rowIndex &&
  840. lineIndex == LineIndex
  841. "
  842. class="addoption"
  843. >
  844. 选择模板
  845. </div>
  846. <div
  847. v-if="!topicIitem.data && topicIitem.is_add_module"
  848. class="addoption"
  849. @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
  850. >
  851. 添加模板
  852. </div>
  853. <template v-if="topicIitem.data">
  854. <div v-if="topicIitem.is_edit" class="Big-Book-save">
  855. <el-button
  856. type="success"
  857. size="small"
  858. @click="onSure(topicIitem)"
  859. >确定</el-button
  860. >
  861. </div>
  862. <div v-else class="Big-Book-save">
  863. <el-button
  864. type="primary"
  865. size="small"
  866. @click.stop="editCurQue(topicIitem)"
  867. >编辑</el-button
  868. >
  869. </div>
  870. </template>
  871. </div>
  872. <div style="display: flex">
  873. <div class="addoption" @click="removeRow(rowIndex, toindex)">
  874. 删除当前行
  875. </div>
  876. <div
  877. style="margin-left: 10px"
  878. class="addoption"
  879. @click="addRow('front', rowIndex, toindex)"
  880. >
  881. 在当前行前增加行
  882. </div>
  883. <div
  884. style="margin-left: 10px"
  885. class="addoption"
  886. @click="addRow('behind', rowIndex, toindex)"
  887. >
  888. 在当前行后增加行
  889. </div>
  890. </div>
  891. </div>
  892. </div>
  893. </el-collapse-transition>
  894. </div>
  895. <!-- </el-tab-pane> -->
  896. <!-- </el-tabs> -->
  897. </div>
  898. <div v-if="currentTreeID" class="Book-function">
  899. <el-button type="success" @click="handleSetGroup" size="medium"
  900. >设置分组</el-button
  901. >
  902. <ul class="function-list">
  903. <li
  904. v-for="(item, index) in fn_data"
  905. :key="'fn' + index"
  906. @click="selectedFnType(item, index)"
  907. >
  908. <el-dropdown v-if="item.list">
  909. <span class="fn-name">
  910. {{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
  911. </span>
  912. <el-dropdown-menu slot="dropdown" trigger="click">
  913. <el-dropdown-item
  914. v-for="(child, i) in item.list"
  915. :key="i"
  916. style="color: #000000"
  917. @click.native="selectSmallModule(item, child, index, i)"
  918. >{{ child.name }}</el-dropdown-item
  919. >
  920. </el-dropdown-menu>
  921. </el-dropdown>
  922. <span v-else class="fn-name">{{ item.name }}</span>
  923. </li>
  924. </ul>
  925. <div class="yunmu">
  926. <span>点击可复制</span>
  927. <table border="1" class="yunmu-table">
  928. <tr v-for="(item, index) in tableData" :key="'tableData' + index">
  929. <td
  930. v-for="(tdItem, tdIndex) in item"
  931. :key="'td' + index + tdIndex"
  932. :id="'td' + index + tdIndex"
  933. @click="CopyToClipboard('td' + index + tdIndex)"
  934. >
  935. {{ tdItem }}
  936. </td>
  937. </tr>
  938. </table>
  939. </div>
  940. </div>
  941. </div>
  942. <el-dialog
  943. :visible.sync="previewVisible"
  944. title="预览"
  945. top="0"
  946. width="100%"
  947. @close="handleClosePre"
  948. >
  949. <div class="chooseCon">
  950. <Preview
  951. ref="preview"
  952. :context="context"
  953. :que-index="queIndex"
  954. :father-name="fatherName"
  955. :current-tree-i-d="currentTreeID"
  956. :father-tree-data="FatherTreeData"
  957. :change-id="changeId"
  958. :theme-color="themeColor"
  959. :is-show-title="true"
  960. :task-model="TaskModel"
  961. :isAnswerItemShow="true"
  962. />
  963. </div>
  964. <span slot="footer" class="dialog-footer">
  965. <!-- <el-button @click="saveAnswer">保 存</el-button> -->
  966. <el-button @click="handleClosePre">关 闭</el-button>
  967. </span>
  968. </el-dialog>
  969. </div>
  970. </template>
  971. <script>
  972. import SentenceSegwordChsDetail from "@/components/Adult/common/SentenceSegwordChs/index.vue";
  973. import Header from "@/components/Header.vue";
  974. import Catelog from "@/components/Adult/inputModules/Catelog";
  975. import ArticleTemChs from "@/components/Adult/inputModules/ArticleTemChs/index.vue";
  976. import SentenceSegwordChs from "@/components/Adult/inputModules/SentenceSegwordChs/index.vue";
  977. import DialogueArticleChs from "@/components/Adult/inputModules/DialogueArticleChs/index.vue";
  978. import Single from "@/components/Adult/inputModules/Single.vue";
  979. import Judge from "@/components/Adult/inputModules/Judge.vue";
  980. import Dialogue from "@/components/Adult/inputModules/Dialogue.vue";
  981. import MatrixSingle from "@/components/Adult/inputModules/MatrixSingle.vue";
  982. import MultiRowInput from "@/components/Adult/inputModules/MultiRowInput.vue";
  983. import Ligature from "@/components/Adult/inputModules/Ligature.vue";
  984. import Neword from "@/components/Adult/inputModules/Neword.vue";
  985. import Notes from "@/components/Adult/inputModules/Notes.vue";
  986. import InputRecord from "@/components/Adult/inputModules/InputRecord.vue";
  987. import AudioControl from "@/components/Adult/inputModules/AudioControl.vue";
  988. import SuitchControl from "@/components/Adult/inputModules/SuitchControl.vue";
  989. import BgControl from "@/components/Adult/inputModules/BgControl.vue";
  990. import UploadControl from "@/components/Adult/inputModules/UploadControl.vue";
  991. import TextItem from "@/components/Adult/inputModules/TextItem.vue";
  992. import Sentence from "@/components/Adult/inputModules/Sentence.vue";
  993. import Sudoku from "@/components/Adult/inputModules/Sudoku.vue";
  994. import ToneSelect from "@/components/Adult/inputModules/ToneSelect.vue";
  995. import NumberCombination from "@/components/Adult/inputModules/NumberCombination.vue";
  996. import DialogueAnswerChs from "@/components/Adult/inputModules/DialogueAnswerChs";
  997. import VoiceMatrix from "@/components/Adult/inputModules/VoiceMatrix.vue";
  998. import SelectDrag from "@/components/Adult/inputModules/SelectDrag.vue";
  999. import ConfigurableTable from "@/components/Adult/inputModules/ConfigurableTable/index.vue";
  1000. import HeaderSeparate from "@/components/Adult/inputModules/HeaderSeparate/index.vue";
  1001. import FillDrag from "@/components/Adult/inputModules/FillDrag.vue";
  1002. import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
  1003. import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
  1004. import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
  1005. import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
  1006. import PlayInputReacord from "@/components/Adult/inputModules/PlayInputReacord.vue";
  1007. import Drag from "@/components/Adult/inputModules/Drag.vue";
  1008. import SelfAssessment from "@/components/Adult/inputModules/SelfAssessment.vue";
  1009. import Sort from "@/components/Adult/inputModules/Sort.vue";
  1010. import CourseStart from "@/components/Adult/inputModules/CourseStart.vue";
  1011. import RecordControl from "@/components/Adult/inputModules/RecordControl.vue";
  1012. import Tinydemo from "@/components/Adult/inputModules/Tinydemo.vue";
  1013. import VideoControl from "@/components/Adult/inputModules/VideoControl.vue";
  1014. import Table from "@/components/Adult/inputModules/Table.vue";
  1015. import PlayRecord from "@/components/Adult/inputModules/PlayRecord.vue";
  1016. import UploadPdf from "@/components/Adult/inputModules/UploadPdf.vue";
  1017. import OptionsList from "@/components/Adult/inputModules/OptionsList.vue";
  1018. import Textdes from "@/components/Adult/inputModules/Textdes.vue";
  1019. import Record from "@/components/Adult/inputModules/Record.vue";
  1020. import Hanzi from "@/components/Adult/inputModules/Hanzi.vue";
  1021. import Picture from "@/components/Adult/inputModules/Picture.vue";
  1022. import SentenceModule from "@/components/Adult/inputModules/SentenceModule.vue";
  1023. import SentenceMulModule from "@/components/Adult/inputModules/SentenceMulModule.vue";
  1024. import Singleview from "@/components/Adult/preview/Single.vue";
  1025. import Judgeview from "@/components/Adult/preview/Judge.vue";
  1026. import Textdesview from "@/components/Adult/preview/Textdes.vue";
  1027. import Hanziview from "@/components/Adult/preview/Hanzi.vue";
  1028. import Pictureview from "@/components/Adult/preview/Picture.vue";
  1029. import Dialogueview from "@/components/Adult/preview/Dialogue.vue";
  1030. import MatrixSingleview from "@/components/Adult/preview/MatrixSingle.vue";
  1031. import MultiRowInputview from "@/components/Adult/preview/MultiRowInput.vue";
  1032. import Ligatureview from "@/components/Adult/preview/Ligature.vue";
  1033. import InputRecordview from "@/components/Adult/preview/InputRecord.vue";
  1034. import BgControlview from "@/components/Adult/preview/BgControl.vue";
  1035. import NewordPhraseview from "@/components/Adult/preview/WordPhrase.vue";
  1036. import UploadControlView from "@/components/Adult/preview/UploadControlView.vue";
  1037. import VideoControlView from "@/components/Adult/preview/VideoControl.vue";
  1038. import SentenceSortQP from "@/components/Adult/preview/SentenceSortQP.vue";
  1039. import TableView from "@/components/Adult/preview/TableView.vue";
  1040. import PlayRecordView from "@/components/Adult/preview/PlayRecordView.vue";
  1041. import Preview from "@/components/Adult/Preview.vue";
  1042. import fn from "@/components/Adult/common/data.js";
  1043. import { getContent, getStaticContent } from "@/api/ajax";
  1044. export default {
  1045. components: {
  1046. Header,
  1047. Catelog,
  1048. Single,
  1049. Textdes,
  1050. Record,
  1051. Singleview,
  1052. Textdesview,
  1053. Hanziview,
  1054. Pictureview,
  1055. Preview,
  1056. Hanzi,
  1057. Picture,
  1058. Judge,
  1059. Judgeview,
  1060. Dialogue,
  1061. Dialogueview,
  1062. MatrixSingle,
  1063. MatrixSingleview,
  1064. MultiRowInput,
  1065. MultiRowInputview,
  1066. Ligature,
  1067. Ligatureview,
  1068. Neword,
  1069. Notes,
  1070. InputRecord,
  1071. ArticleTemChs,
  1072. SentenceSegwordChs,
  1073. DialogueArticleChs,
  1074. AudioControl,
  1075. SuitchControl,
  1076. BgControl,
  1077. InputRecordview,
  1078. BgControlview,
  1079. NewordPhraseview,
  1080. UploadControl,
  1081. TextItem,
  1082. Sentence,
  1083. UploadControlView,
  1084. Sudoku,
  1085. NumberCombination,
  1086. ToneSelect,
  1087. DialogueAnswerChs,
  1088. VoiceMatrix,
  1089. FillDrag,
  1090. SelectDrag,
  1091. ConfigurableTable,
  1092. HeaderSeparate,
  1093. ImageQuestion,
  1094. PurePreview,
  1095. ZiLine,
  1096. SelectInpue,
  1097. PlayInputReacord,
  1098. Drag,
  1099. SelfAssessment,
  1100. Sort,
  1101. CourseStart,
  1102. RecordControl,
  1103. Tinydemo,
  1104. VideoControl,
  1105. VideoControlView,
  1106. SentenceSortQP,
  1107. Table,
  1108. TableView,
  1109. PlayRecord,
  1110. PlayRecordView,
  1111. UploadPdf,
  1112. SentenceModule,
  1113. OptionsList,
  1114. SentenceMulModule,
  1115. SentenceSegwordChsDetail
  1116. },
  1117. data() {
  1118. return {
  1119. bookId: 1,
  1120. bookLevel: "",
  1121. bookIndex: "",
  1122. fn_data: [],
  1123. fn_type: "",
  1124. cur_fn_data: null, // 当前模块的数据结构
  1125. cur_page_queIsEdit: [], // 当前页数的某个题
  1126. org_question_list: {
  1127. detailList: [
  1128. {
  1129. detail: {
  1130. type: "detail",
  1131. pyPosition: "top", // top 拼音在上面;bottom 拼音在下面
  1132. sentence: "", // 句子
  1133. segList: [], // 分词结果
  1134. seg_words: "",
  1135. wordsList: []
  1136. },
  1137. en: ""
  1138. }
  1139. ], // 目录分词
  1140. classTopic: [
  1141. {
  1142. con: "",
  1143. font: "cn"
  1144. }
  1145. ], // 课题
  1146. cur_fn_data: []
  1147. },
  1148. // 总的数据列表
  1149. question_list: {
  1150. detailList: [
  1151. {
  1152. detail: {
  1153. type: "detail",
  1154. pyPosition: "top", // top 拼音在上面;bottom 拼音在下面
  1155. sentence: "", // 句子
  1156. segList: [], // 分词结果
  1157. seg_words: "",
  1158. wordsList: []
  1159. },
  1160. en: ""
  1161. }
  1162. ], // 目录分词
  1163. classTopic: [
  1164. {
  1165. con: "",
  1166. font: "cn"
  1167. }
  1168. ], // 课题
  1169. cur_fn_data: []
  1170. }, // 总的数据列表
  1171. cur_page_que_index: 0,
  1172. editableTabsValue: "tab1",
  1173. tabIndex: 0,
  1174. previewVisible: false,
  1175. context: [],
  1176. queIndex: 0,
  1177. currentTreeID: null,
  1178. row: null, // 行
  1179. line: null, // 列
  1180. TopicIndex: null, // 第几题的索引
  1181. RowIndex: null, // 第几行
  1182. LineIndex: null, // 第几列
  1183. bgControlX: null, // 背景图插入模板的 x
  1184. bgControlY: null, // 背景图插入模板的 y
  1185. bgControlIndex: null, // 插入第几个
  1186. DeletebgControlIndex: null, // 删除第几个
  1187. fatherName: "",
  1188. module_type: "",
  1189. tmInde: "",
  1190. FatherTreeData: null,
  1191. themeColor: "", // 主题颜色
  1192. loading: false,
  1193. NumberList: [
  1194. "①",
  1195. "②",
  1196. "③",
  1197. "④",
  1198. "⑤",
  1199. "⑥",
  1200. "⑦",
  1201. "⑧",
  1202. "⑨",
  1203. "⑩",
  1204. "⑪",
  1205. "⑫",
  1206. "⑬",
  1207. "⑭",
  1208. "⑮",
  1209. "⑯",
  1210. "⑰",
  1211. "⑱",
  1212. "⑲",
  1213. "⑳"
  1214. ],
  1215. TaskModel: "",
  1216. groupIndexList: [],
  1217. tableData: [
  1218. ["ā", "á", "ǎ", "à"],
  1219. ["ō", "ó", "ǒ", "ò"],
  1220. ["ē", "é", "ě", "è"],
  1221. ["ī", "í", "ǐ", "ì"],
  1222. ["ū", "ú", "ǔ", "ù"],
  1223. ["ǖ", "ǘ", "ǚ", "ǜ"],
  1224. ["Ā", "Á", "Â", "À"],
  1225. ["Ō", "Ó", "Ô", "Ò"],
  1226. ["Ē", "É", "Ê", "È"],
  1227. ["Ī", "Í", "Î", "Ì"],
  1228. ["Ū", "Ú", "Û", "Ù"]
  1229. ],
  1230. refresh: true
  1231. };
  1232. },
  1233. computed: {
  1234. getCurrentQuestionView() {
  1235. const function_type = this.fn_type;
  1236. switch (function_type) {
  1237. case "single":
  1238. return Single;
  1239. case "text":
  1240. return Textdes;
  1241. case "record":
  1242. return Record;
  1243. }
  1244. }
  1245. },
  1246. watch: {},
  1247. // 生命周期 - 创建完成(可以访问当前this实例)
  1248. created() {
  1249. this.fn_data = fn.fnData;
  1250. },
  1251. // 生命周期 - 挂载完成(可以访问DOM元素)
  1252. mounted() {
  1253. if (localStorage.getItem("Bookanswer")) {
  1254. this.TaskModel = "ANSWER";
  1255. }
  1256. document.getElementsByClassName("content-tree")[0].style.height =
  1257. window.innerHeight - 120 + "px";
  1258. },
  1259. beforeCreate() {}, // 生命周期 - 创建之前
  1260. beforeMount() {}, // 生命周期 - 挂载之前
  1261. beforeUpdate() {}, // 生命周期 - 更新之前
  1262. updated() {}, // 生命周期 - 更新之后
  1263. beforeDestroy() {}, // 生命周期 - 销毁之前
  1264. destroyed() {}, // 生命周期 - 销毁完成
  1265. activated() {},
  1266. // 方法集合
  1267. methods: {
  1268. handleChangeTab(item) {
  1269. item.contentShow = !item.contentShow;
  1270. },
  1271. saveAnswer() {
  1272. let answer = this.$refs.preview.saveAnswer();
  1273. console.log("保存答案:");
  1274. console.log(answer);
  1275. let answerStr = JSON.stringify(answer);
  1276. localStorage.setItem("Bookanswer", answerStr);
  1277. },
  1278. forupdata() {
  1279. this.$forceUpdate();
  1280. },
  1281. // 增加列
  1282. addCol(tyoe, rowindex, colindex, toindex) {},
  1283. // 添加行
  1284. addRow(type, rowindex, toindex) {
  1285. let arr = [
  1286. {
  1287. text: ``,
  1288. is_add_module: true,
  1289. is_edit: true
  1290. }
  1291. ];
  1292. if (type == "front") {
  1293. // 加到当前行前面
  1294. if (rowindex == 0) {
  1295. this.question_list.cur_fn_data[toindex].table_list.splice(0, 0, arr);
  1296. } else {
  1297. this.question_list.cur_fn_data[toindex].table_list.splice(
  1298. rowindex - 1,
  1299. 0,
  1300. arr
  1301. );
  1302. }
  1303. } else {
  1304. // 加到当前行后面
  1305. this.question_list.cur_fn_data[toindex].table_list.splice(
  1306. rowindex + 1,
  1307. 0,
  1308. arr
  1309. );
  1310. }
  1311. this.question_list.cur_fn_data[toindex].table_list.forEach(
  1312. (item, rowIndex) => {
  1313. item.forEach((it, colIndex) => {
  1314. it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
  1315. });
  1316. }
  1317. );
  1318. this.TopicIndex = null;
  1319. this.RowIndex = null;
  1320. this.LineIndex = null;
  1321. this.$forceUpdate();
  1322. },
  1323. // 增加列
  1324. handleAddCol(type, index, rowindex, toindex) {
  1325. let arr = {
  1326. text: ``,
  1327. is_add_module: true,
  1328. is_edit: true
  1329. };
  1330. if (type == "front") {
  1331. // 加到当前列前面
  1332. if (rowindex == 0) {
  1333. this.question_list.cur_fn_data[toindex].table_list[index].splice(
  1334. 0,
  1335. 0,
  1336. arr
  1337. );
  1338. } else {
  1339. this.question_list.cur_fn_data[toindex].table_list[index].splice(
  1340. rowindex - 1,
  1341. 0,
  1342. arr
  1343. );
  1344. }
  1345. } else {
  1346. // 加到当前列后面
  1347. this.question_list.cur_fn_data[toindex].table_list[index].splice(
  1348. rowindex + 1,
  1349. 0,
  1350. arr
  1351. );
  1352. }
  1353. this.question_list.cur_fn_data[toindex].table_list.forEach(
  1354. (item, rowIndex) => {
  1355. item.forEach((it, colIndex) => {
  1356. it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
  1357. });
  1358. }
  1359. );
  1360. this.TopicIndex = null;
  1361. this.RowIndex = null;
  1362. this.LineIndex = null;
  1363. this.$forceUpdate();
  1364. },
  1365. // 删除行
  1366. removeRow(index, toindex) {
  1367. this.$confirm("确定要删除当前行吗?", "提示", {
  1368. confirmButtonText: "确定",
  1369. cancelButtonText: "取消",
  1370. type: "warning"
  1371. }).then(() => {
  1372. // 里面是不是剩下最后一行了
  1373. if (this.question_list.cur_fn_data[toindex].table_list.length == 1) {
  1374. this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
  1375. this.question_list.cur_fn_data.splice(toindex, 1);
  1376. } else {
  1377. this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
  1378. }
  1379. this.question_list.cur_fn_data[toindex].table_list.forEach(
  1380. (item, rowIndex) => {
  1381. item.forEach((it, colIndex) => {
  1382. it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
  1383. });
  1384. }
  1385. );
  1386. this.TopicIndex = null;
  1387. this.RowIndex = null;
  1388. this.LineIndex = null;
  1389. this.$forceUpdate();
  1390. });
  1391. },
  1392. // 删除列
  1393. handleRemoveCol(index, rowindex, toindex) {
  1394. this.$confirm("确定要删除当前列吗?", "提示", {
  1395. confirmButtonText: "确定",
  1396. cancelButtonText: "取消",
  1397. type: "warning"
  1398. }).then(() => {
  1399. // 里面是不是剩下最后一列了
  1400. if (
  1401. this.question_list.cur_fn_data[toindex].table_list[index].length == 1
  1402. ) {
  1403. this.question_list.cur_fn_data[toindex].table_list[index].splice(
  1404. rowindex,
  1405. 1
  1406. );
  1407. this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
  1408. } else {
  1409. this.question_list.cur_fn_data[toindex].table_list[index].splice(
  1410. rowindex,
  1411. 1
  1412. );
  1413. }
  1414. this.question_list.cur_fn_data[toindex].table_list.forEach(
  1415. (item, rowIndex) => {
  1416. item.forEach((it, colIndex) => {
  1417. it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
  1418. });
  1419. }
  1420. );
  1421. this.TopicIndex = null;
  1422. this.RowIndex = null;
  1423. this.LineIndex = null;
  1424. this.$forceUpdate();
  1425. });
  1426. },
  1427. changeCurrentTreeID(val) {
  1428. this.currentTreeID = val;
  1429. },
  1430. changeTreeData(val) {
  1431. this.FatherTreeData = JSON.parse(JSON.stringify(val));
  1432. },
  1433. // 增加当前页的分词
  1434. addDetail() {
  1435. let obj = {
  1436. detail: {
  1437. type: "detail",
  1438. pyPosition: "top", // top 拼音在上面;bottom 拼音在下面
  1439. sentence: "", // 句子
  1440. segList: [], // 分词结果
  1441. seg_words: "",
  1442. wordsList: []
  1443. },
  1444. en: ""
  1445. };
  1446. this.question_list.detailList.push(obj);
  1447. },
  1448. // 删除当前页的分词
  1449. deleteDetail(fcindex) {
  1450. this.$confirm("确定要删除此模块吗?", "提示", {
  1451. confirmButtonText: "确定",
  1452. cancelButtonText: "取消",
  1453. type: "warning"
  1454. }).then(() => {
  1455. if (this.question_list.detailList.length <= 1) {
  1456. this.$message.warning("至少要保留一一个");
  1457. return;
  1458. }
  1459. this.question_list.detailList.splice(fcindex, 1);
  1460. });
  1461. },
  1462. // 增加课题
  1463. addClassTopic() {
  1464. let obj = {
  1465. con: "",
  1466. font: "cn"
  1467. };
  1468. this.question_list.classTopic.push(obj);
  1469. },
  1470. // 删除课题
  1471. deleteClassTopic(ktindex) {
  1472. this.$confirm("确定要删除此课题内容吗?", "提示", {
  1473. confirmButtonText: "确定",
  1474. cancelButtonText: "取消",
  1475. type: "warning"
  1476. }).then(() => {
  1477. if (this.question_list.classTopic.length <= 1) {
  1478. this.$message.warning("至少要保留一一个");
  1479. return;
  1480. }
  1481. this.question_list.classTopic.splice(ktindex, 1);
  1482. });
  1483. },
  1484. // 随意插入模板获取位置
  1485. changeSite(x, y) {
  1486. this.bgControlX = x;
  1487. this.bgControlY = y;
  1488. },
  1489. // 插入索引
  1490. changebgControlIndex(index) {
  1491. this.bgControlIndex = index;
  1492. },
  1493. // 删除索引
  1494. changeDeletebgControlIndex(index) {
  1495. this.DeletebgControlIndex = index;
  1496. },
  1497. rowLine(value) {
  1498. this[value] = this[value].match(/^\d*(\.?\d{0,2})/g)[0] || "";
  1499. },
  1500. createTable() {
  1501. if (this.row && this.line) {
  1502. let groupid = (
  1503. new Date().toLocaleString().replace(/\s|:|\/*/g, "") +
  1504. new Date().getMilliseconds() +
  1505. Math.random()
  1506. .toString(36)
  1507. .substr(2) +
  1508. new Date().getMilliseconds() +
  1509. Math.random()
  1510. .toString(36)
  1511. .substr(2)
  1512. ).substring(0, 32);
  1513. let arr = {
  1514. z_title: "",
  1515. z_title_detail: {
  1516. type: "detail",
  1517. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1518. sentence: "", //句子
  1519. segList: [], //分词结果
  1520. seg_words: "",
  1521. wordsList: []
  1522. },
  1523. f_title: "",
  1524. f_title_detail: {
  1525. type: "detail",
  1526. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1527. sentence: "", //句子
  1528. segList: [], //分词结果
  1529. seg_words: "",
  1530. wordsList: []
  1531. },
  1532. little_title_number: "",
  1533. little_title: "",
  1534. l_title_detail: {
  1535. type: "detail",
  1536. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1537. sentence: "", //句子
  1538. segList: [], //分词结果
  1539. seg_words: "",
  1540. wordsList: []
  1541. },
  1542. is_bg: false, // 是否有背景色
  1543. is_layout: false, // 是不是按背景图布局
  1544. is_textIndex: false,
  1545. table_list: [],
  1546. group_name: "", // 设置分组name
  1547. group_id: [groupid], // 分组id
  1548. contentShow: true // 是否显示这一题
  1549. };
  1550. for (let i = 0; i < this.row; i++) {
  1551. let rowArr = [];
  1552. for (let j = 0; j < this.line; j++) {
  1553. let obj = {
  1554. // text: `第${i + 1}行,第${j + 1}列`,
  1555. is_add_module: true,
  1556. is_edit: true
  1557. };
  1558. rowArr.push(obj);
  1559. }
  1560. arr.table_list.push(rowArr);
  1561. }
  1562. this.question_list.cur_fn_data.push(arr);
  1563. this.row = null;
  1564. this.line = null;
  1565. } else {
  1566. this.$message.warning("请输入行和列");
  1567. }
  1568. },
  1569. // 添加模板
  1570. addModule(topicIndex, rowindex, lineIndex, item) {
  1571. this.TopicIndex = topicIndex;
  1572. this.RowIndex = rowindex;
  1573. this.LineIndex = lineIndex;
  1574. this.question_list.cur_fn_data.forEach(pic => {
  1575. pic.table_list.forEach(row => {
  1576. row.forEach(col => {
  1577. col.is_add_module = true;
  1578. });
  1579. });
  1580. });
  1581. item.is_add_module = false;
  1582. },
  1583. // 删除模板
  1584. remoeModule(topicIndex, rowindex, lineIndex, item) {
  1585. this.$confirm("确定要删除此模板吗?", "提示", {
  1586. confirmButtonText: "确定",
  1587. cancelButtonText: "取消",
  1588. type: "warning"
  1589. }).then(() => {
  1590. item.type = "";
  1591. item.data = null;
  1592. this.TopicIndex = null;
  1593. this.RowIndex = null;
  1594. this.LineIndex = null;
  1595. item.is_add_module = true;
  1596. });
  1597. },
  1598. handleClosePre() {
  1599. if (window.stopAudioVoice) window.stopAudioVoice();
  1600. if (window.stopAudioAudio) window.stopAudioAudio();
  1601. if (window.stopAudioSound) window.stopAudioSound();
  1602. this.previewVisible = false;
  1603. },
  1604. onBlur(item, field) {
  1605. item[field] = item[field] ? item[field].trim() : "";
  1606. },
  1607. // 当前目录id name 父级name/当前 name
  1608. changeId(id, name, fatherName) {
  1609. this.loading = true;
  1610. this.TopicIndex = null;
  1611. this.RowIndex = null;
  1612. this.LineIndex = null;
  1613. this.fatherName = fatherName;
  1614. this.currentTreeID = id;
  1615. this.refresh = false;
  1616. // 根据当前目录切换题
  1617. let MethodName = "book-courseware_manager-GetCoursewareContent";
  1618. let data = {
  1619. id
  1620. };
  1621. getContent(MethodName, data)
  1622. .then(res => {
  1623. this.themeColor = res.book_theme_color ? res.book_theme_color : "";
  1624. this.question_list = res.content
  1625. ? JSON.parse(res.content)
  1626. : JSON.parse(JSON.stringify(this.org_question_list));
  1627. let data = JSON.parse(JSON.stringify(this.question_list));
  1628. data.cur_fn_data.forEach(item => {
  1629. if (!item.group_id) {
  1630. let groupid = (
  1631. new Date().toLocaleString().replace(/\s|:|\/*/g, "") +
  1632. new Date().getMilliseconds() +
  1633. Math.random()
  1634. .toString(36)
  1635. .substr(2) +
  1636. new Date().getMilliseconds() +
  1637. Math.random()
  1638. .toString(36)
  1639. .substr(2)
  1640. ).substring(0, 32);
  1641. item.group_name = ""; // 设置分组name
  1642. item.group_id = [groupid]; // 分组id
  1643. }
  1644. if (!item.hasOwnProperty("contentShow")) {
  1645. item.contentShow = true;
  1646. }
  1647. if (!item.hasOwnProperty("z_title_detail")) {
  1648. let obj = {
  1649. type: "detail",
  1650. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1651. sentence: item.z_title, //句子
  1652. segList: [], //分词结果
  1653. seg_words: "",
  1654. wordsList: []
  1655. };
  1656. this.$set(item, "z_title_detail", obj);
  1657. }
  1658. if (!item.hasOwnProperty("f_title_detail")) {
  1659. let obj = {
  1660. type: "detail",
  1661. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1662. sentence: item.f_title, //句子
  1663. segList: [], //分词结果
  1664. seg_words: "",
  1665. wordsList: []
  1666. };
  1667. this.$set(item, "f_title_detail", obj);
  1668. }
  1669. if (!item.hasOwnProperty("l_title_detail")) {
  1670. let obj = {
  1671. type: "detail",
  1672. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  1673. sentence: item.little_title, //句子
  1674. segList: [], //分词结果
  1675. seg_words: "",
  1676. wordsList: []
  1677. };
  1678. this.$set(item, "l_title_detail", obj);
  1679. }
  1680. });
  1681. data.detailList.forEach(item => {
  1682. if (!item.detail) {
  1683. let obj = JSON.parse(JSON.stringify(item));
  1684. item.detail = obj;
  1685. }
  1686. if (!item.en) {
  1687. item.en = "";
  1688. }
  1689. });
  1690. this.question_list = JSON.parse(JSON.stringify(data));
  1691. if (this.previewVisible) {
  1692. this.onPreview();
  1693. }
  1694. this.loading = false;
  1695. document.getElementsByClassName(
  1696. "Big-Book-input-save"
  1697. )[0].style.width =
  1698. document.getElementsByClassName("Book-content")[0].clientWidth -
  1699. 20 +
  1700. "px";
  1701. document.getElementsByClassName("Book-function")[0].style.height =
  1702. window.innerHeight - 120 + "px";
  1703. // this.cur_page_que_index =
  1704. // this.question_list[this.tabIndex].cur_fn_data.length - 1;
  1705. this.$nextTick(() => {
  1706. // 重新渲染组件
  1707. this.refresh = true;
  1708. });
  1709. })
  1710. .catch(error => {
  1711. this.loading = false;
  1712. this.$nextTick(() => {
  1713. // 重新渲染组件
  1714. this.refresh = true;
  1715. });
  1716. });
  1717. },
  1718. handleTabsEdit(targetName, action) {
  1719. if (action === "add") {
  1720. let leg = this.question_list.cur_fn_data.length;
  1721. let obj = {
  1722. name: `tab${leg + 1}`,
  1723. title: `第${leg + 1}页`,
  1724. cur_fn_data: []
  1725. };
  1726. this.question_list.push(obj);
  1727. }
  1728. if (action === "remove") {
  1729. let tabs = JSON.parse(JSON.stringify(this.question_list));
  1730. let activeName = this.editableTabsValue;
  1731. if (activeName === targetName) {
  1732. tabs.forEach((tab, index) => {
  1733. if (tab.name === targetName) {
  1734. let nextTab = tabs[index + 1] || tabs[index - 1];
  1735. if (nextTab) {
  1736. activeName = nextTab.name;
  1737. }
  1738. }
  1739. });
  1740. }
  1741. this.editableTabsValue = activeName;
  1742. let question_list = tabs.filter(tab => tab.name !== targetName);
  1743. question_list.map((item, index) => {
  1744. item.name = `tab${index + 1}`;
  1745. item.title = `第${index + 1}页`;
  1746. return item;
  1747. });
  1748. this.question_list = question_list;
  1749. this.TopicIndex = null;
  1750. this.RowIndex = null;
  1751. this.LineIndex = null;
  1752. }
  1753. },
  1754. tabClick(tab) {
  1755. this.tabIndex = tab.index;
  1756. },
  1757. // 大模板
  1758. selectedFnType(item, index) {
  1759. if (item.list) {
  1760. return;
  1761. }
  1762. if (
  1763. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  1764. -1 &&
  1765. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  1766. ) {
  1767. this.$message.warning("请先选择添加模板的位置");
  1768. return;
  1769. }
  1770. if (
  1771. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1772. this.RowIndex
  1773. ][this.LineIndex].data
  1774. ) {
  1775. this.$message.warning("每列只能添加一个模板");
  1776. } else {
  1777. this.$set(
  1778. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1779. this.RowIndex
  1780. ][this.LineIndex],
  1781. "type",
  1782. item.type
  1783. );
  1784. this.$set(
  1785. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1786. this.RowIndex
  1787. ][this.LineIndex],
  1788. "data",
  1789. undefined
  1790. );
  1791. }
  1792. },
  1793. changeCurQue(data_stru) {
  1794. this.$set(
  1795. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1796. this.RowIndex
  1797. ][this.LineIndex],
  1798. "data",
  1799. JSON.parse(JSON.stringify(data_stru))
  1800. );
  1801. },
  1802. // 小模板
  1803. selectSmallModule(item, child, itemIndex, childIndex) {
  1804. if (
  1805. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  1806. -1 &&
  1807. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  1808. ) {
  1809. this.$message.warning("请先选择添加模板的位置");
  1810. return;
  1811. }
  1812. if (
  1813. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1814. this.RowIndex
  1815. ][this.LineIndex].data
  1816. ) {
  1817. this.$message.warning("每列只能添加一个模板");
  1818. } else {
  1819. this.$set(
  1820. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1821. this.RowIndex
  1822. ][this.LineIndex],
  1823. "type",
  1824. child.type
  1825. );
  1826. this.$set(
  1827. this.question_list.cur_fn_data[this.TopicIndex].table_list[
  1828. this.RowIndex
  1829. ][this.LineIndex],
  1830. "data",
  1831. null
  1832. );
  1833. }
  1834. },
  1835. // 删除某页中一个部分
  1836. deleteCurQue(item, queIndex) {
  1837. item.queList.splice(queIndex, 1);
  1838. },
  1839. saveNewwordAndSentences() {
  1840. let question_list = JSON.parse(JSON.stringify(this.question_list));
  1841. let sentence_list = [];
  1842. let sentence_list_mp = [];
  1843. let new_word_list = [];
  1844. question_list.cur_fn_data.forEach(curItem => {
  1845. curItem.table_list.forEach(tabItem => {
  1846. tabItem.forEach(topicIitem => {
  1847. if (
  1848. topicIitem.type == "article_chs" ||
  1849. topicIitem.type == "dialogue_article_chs"
  1850. ) {
  1851. topicIitem.data.detail.forEach(item => {
  1852. let obj = this.handleSentences(item.sentences, item.segList);
  1853. sentence_list = sentence_list.concat(obj.sentenceArr); // 句子数组
  1854. sentence_list_mp = sentence_list_mp.concat(obj.res); // 句子+分词数组
  1855. });
  1856. } else if (topicIitem.type == "NewWord_chs") {
  1857. let audio_file_id = "";
  1858. audio_file_id =
  1859. topicIitem.data.mp3_list && topicIitem.data.mp3_list.length > 0
  1860. ? topicIitem.data.mp3_list[0].id
  1861. .replace("[FID##", "")
  1862. .replace("##FID]", "")
  1863. : "";
  1864. topicIitem.data.option.forEach(item => {
  1865. item.map(sItem => {
  1866. sItem.audio_file_id = audio_file_id;
  1867. sItem.audio_begin_time =
  1868. topicIitem.data.wordTime &&
  1869. topicIitem.data.wordTime[sItem.sIndex]
  1870. ? Number(topicIitem.data.wordTime[sItem.sIndex].bg)
  1871. : 0;
  1872. sItem.audio_end_time =
  1873. topicIitem.data.wordTime &&
  1874. topicIitem.data.wordTime[sItem.sIndex]
  1875. ? Number(topicIitem.data.wordTime[sItem.sIndex].ed)
  1876. : 0;
  1877. return sItem;
  1878. });
  1879. new_word_list = new_word_list.concat(item);
  1880. });
  1881. }
  1882. });
  1883. });
  1884. });
  1885. return {
  1886. new_word_list,
  1887. sentence_list,
  1888. sentence_list_mp
  1889. };
  1890. },
  1891. handleSentences(list, segList) {
  1892. let res = [];
  1893. let sentenceArr = [];
  1894. list.forEach((Litem, index) => {
  1895. Litem = Litem.replace(/#/g, "");
  1896. this.NumberList.forEach(nitem => {
  1897. if (Litem.indexOf(nitem) > -1) {
  1898. let reg = new RegExp(nitem, "g");
  1899. Litem = Litem.replace(reg, "");
  1900. }
  1901. });
  1902. let segItem = this.handleSegItem(segList[index]);
  1903. let obj = {
  1904. sentence: Litem,
  1905. word_list: segItem
  1906. };
  1907. res.push(obj);
  1908. sentenceArr.push(Litem);
  1909. });
  1910. return { res, sentenceArr };
  1911. },
  1912. handleSegItem(list) {
  1913. let resArr = [];
  1914. list.forEach(item => {
  1915. if (item != "#" && this.NumberList.indexOf(item) < 0) {
  1916. let obj = {
  1917. word: item,
  1918. word_bt: ""
  1919. };
  1920. resArr.push(obj);
  1921. }
  1922. });
  1923. return resArr;
  1924. },
  1925. onSave() {
  1926. let isProof = true;
  1927. for (let j = 0; j < this.question_list.cur_fn_data.length; j++) {
  1928. for (
  1929. let l = 0;
  1930. l < this.question_list.cur_fn_data[j].table_list.length;
  1931. l++
  1932. ) {
  1933. for (
  1934. let m = 0;
  1935. m < this.question_list.cur_fn_data[j].table_list[l].length;
  1936. m++
  1937. ) {
  1938. if (
  1939. this.question_list.cur_fn_data[j].table_list[l][m].type ==
  1940. "tinydemo_chs" ||
  1941. this.question_list.cur_fn_data[j].table_list[l][m].type ==
  1942. "toneSelect_chs"
  1943. ) {
  1944. for (let i = 0; i < tinymce.editors.length; i++) {
  1945. let content = tinymce.editors[i].getContent();
  1946. let arr = content.split(/[\n]/);
  1947. let newstr = "";
  1948. arr.forEach(item => {
  1949. newstr += item;
  1950. });
  1951. if (newstr.length > 5000) {
  1952. this.$message.warning("富文本已超出字数限制");
  1953. this.loading = false;
  1954. return false;
  1955. }
  1956. }
  1957. }
  1958. }
  1959. }
  1960. }
  1961. let question_list_str = JSON.stringify(this.question_list);
  1962. localStorage.setItem("question_list", question_list_str);
  1963. let result = this.saveNewwordAndSentences();
  1964. const MethodName = "book-courseware_manager-SaveCoursewareContent";
  1965. let data = {
  1966. id: this.currentTreeID,
  1967. content: JSON.stringify(this.question_list),
  1968. is_use_manual_proofreading_word_sentence: isProof,
  1969. new_word_list: result.new_word_list,
  1970. sentence_list: result.sentence_list,
  1971. sentence_list_mp: result.sentence_list_mp,
  1972. ui_type: "NPC",
  1973. category: "NPC"
  1974. };
  1975. getContent(MethodName, data)
  1976. .then(res => {
  1977. this.$message.success("保存成功!");
  1978. })
  1979. .catch(error => {});
  1980. },
  1981. async onPreview() {
  1982. let _this = this;
  1983. let question_data = null;
  1984. if (_this.question_list) {
  1985. const question2 = JSON.parse(JSON.stringify(_this.question_list));
  1986. question_data = await _this.getFileUrl_preview(question2);
  1987. _this.previewVisible = true;
  1988. _this.context = question_data;
  1989. console.log("预览数据");
  1990. console.log(this.question_list);
  1991. } else {
  1992. _this.$message.warning("还没有录入数据");
  1993. }
  1994. },
  1995. getFileUrl_preview(question) {
  1996. let questionStr = JSON.stringify(question);
  1997. const reg = /\[FID##(.*?)##FID\]/g;
  1998. let regConArr = [];
  1999. if (reg.test(questionStr)) {
  2000. regConArr = questionStr.match(reg);
  2001. }
  2002. if (regConArr.length > 0) {
  2003. regConArr = regConArr.map(item => {
  2004. item = item.replace("[FID##", "").replace("##FID]", "");
  2005. return item;
  2006. });
  2007. }
  2008. return new Promise((resolve, reject) => {
  2009. const MethodName = "file_store_manager-GetFileURLMap";
  2010. const data = {
  2011. file_id_list: regConArr
  2012. };
  2013. getStaticContent(MethodName, data).then(res => {
  2014. const backData = res.url_map;
  2015. for (const key in backData) {
  2016. const url = backData[key];
  2017. if (questionStr.indexOf(key) > -1) {
  2018. const d = `\\[FID##${key}##FID\\]`;
  2019. const regD = new RegExp(d, "g");
  2020. questionStr = questionStr.replace(regD, url);
  2021. }
  2022. }
  2023. const question3 = JSON.parse(questionStr);
  2024. resolve(question3);
  2025. });
  2026. });
  2027. },
  2028. onSure(curItem) {
  2029. this.TopicIndex = null;
  2030. this.RowIndex = null;
  2031. this.LineIndex = null;
  2032. curItem.is_edit = false;
  2033. },
  2034. onDel(item, curIndex) {
  2035. item.cur_fn_data.splice(curIndex, 1);
  2036. if (this.question_list.cur_fn_data.length > 0) {
  2037. this.cur_page_que_index = this.question_list.cur_fn_data.length - 1;
  2038. } else {
  2039. this.cur_page_que_index = 0;
  2040. }
  2041. // let question_list_str = JSON.stringify(this.question_list);
  2042. // localStorage.setItem("question_list", question_list_str);
  2043. },
  2044. // 编辑当前题型
  2045. editCurQue(curItem) {
  2046. curItem.is_edit = true;
  2047. // if (!curItem.isEdit) {
  2048. // let count = 0;
  2049. // let tabIndex = this.tabIndex;
  2050. // let leg = this.question_list[tabIndex].cur_fn_data.length;
  2051. // this.question_list[tabIndex].cur_fn_data.forEach((item) => {
  2052. // if (item.isEdit) {
  2053. // count++;
  2054. // }
  2055. // });
  2056. // if (count == 0) {
  2057. // if (!curItem.isEdit) {
  2058. // curItem.isEdit = true;
  2059. // }
  2060. // } else {
  2061. // this.$message.warning("有题目未保存");
  2062. // }
  2063. // }
  2064. },
  2065. emptyQustion() {
  2066. this.currentTreeID = "";
  2067. },
  2068. // 设置分组
  2069. handleSetGroup() {
  2070. let groupname = "";
  2071. let groupid = (
  2072. new Date().toLocaleString().replace(/\s|:|\/*/g, "") +
  2073. new Date().getMilliseconds() +
  2074. Math.random()
  2075. .toString(36)
  2076. .substr(2) +
  2077. new Date().getMilliseconds() +
  2078. Math.random()
  2079. .toString(36)
  2080. .substr(2)
  2081. ).substring(0, 32);
  2082. this.groupIndexList.forEach(item => {
  2083. groupname += item + 1 + "-";
  2084. });
  2085. groupname = groupname.substring(0, groupname.length - 1);
  2086. this.question_list.cur_fn_data.forEach((curItem, indexItem) => {
  2087. if (this.groupIndexList.indexOf(indexItem) > -1) {
  2088. curItem.group_name = "打包组" + groupname;
  2089. curItem.group_id = [groupid];
  2090. }
  2091. });
  2092. this.groupIndexList = [];
  2093. this.$forceUpdate();
  2094. },
  2095. CopyToClipboard(element) {
  2096. var doc = document,
  2097. text = doc.getElementById(element),
  2098. range,
  2099. selection;
  2100. if (doc.body.createTextRange) {
  2101. range = doc.body.createTextRange();
  2102. range.moveToElementText(text);
  2103. range.select();
  2104. } else if (window.getSelection) {
  2105. selection = window.getSelection();
  2106. range = doc.createRange();
  2107. range.selectNodeContents(text);
  2108. selection.removeAllRanges();
  2109. selection.addRange(range);
  2110. }
  2111. document.execCommand("copy");
  2112. this.$message({
  2113. message: "复制成功",
  2114. type: "success"
  2115. });
  2116. window.getSelection().removeAllRanges();
  2117. },
  2118. deleteElement(index) {
  2119. this.$confirm(`确定要删除吗?`, "提示", {
  2120. confirmButtonText: "确定",
  2121. cancelButtonText: "取消",
  2122. type: "warning"
  2123. }).then(() => {
  2124. if (this.question_list.cur_fn_data.length > 1) {
  2125. this.question_list.cur_fn_data.splice(index, 1);
  2126. } else {
  2127. this.question_list.cur_fn_data = [];
  2128. }
  2129. });
  2130. },
  2131. moveElement(dItem, index, type) {
  2132. let obj = JSON.parse(JSON.stringify(dItem));
  2133. if (type == "up" && index > 0) {
  2134. this.question_list.cur_fn_data.splice(index - 1, 0, obj);
  2135. this.question_list.cur_fn_data.splice(index + 1, 1);
  2136. }
  2137. if (type == "down" && index < this.question_list.cur_fn_data.length - 1) {
  2138. this.question_list.cur_fn_data[
  2139. index
  2140. ] = this.question_list.cur_fn_data.splice(
  2141. index + 1,
  2142. 1,
  2143. this.question_list.cur_fn_data[index]
  2144. )[0];
  2145. }
  2146. }
  2147. } // 如果页面有keep-alive缓存功能,这个函数会触发
  2148. };
  2149. </script>
  2150. <style lang="scss" scoped>
  2151. //@import url(); 引入公共css类
  2152. .topTitle {
  2153. width: 100%;
  2154. height: 48px;
  2155. display: flex;
  2156. justify-content: space-between;
  2157. padding: 0 16px;
  2158. align-items: center;
  2159. background: #f5f5f5 !important;
  2160. border: 1px rgba(0, 0, 0, 0.1) solid;
  2161. border-radius: 4px 4px 0 0;
  2162. margin-top: 10px;
  2163. > :nth-child(1) {
  2164. font-weight: 500;
  2165. font-size: 16px;
  2166. line-height: 150%;
  2167. color: rgba(0, 0, 0, 0.85);
  2168. }
  2169. > :nth-child(2) {
  2170. display: flex;
  2171. align-items: center;
  2172. font-weight: normal;
  2173. font-size: 14px;
  2174. line-height: 22px;
  2175. color: rgba(0, 0, 0, 0.85);
  2176. cursor: pointer;
  2177. }
  2178. img {
  2179. width: 16px;
  2180. height: 16px;
  2181. margin-left: 4px;
  2182. }
  2183. .rotate {
  2184. animation-name: firstrotate;
  2185. animation-direction: 2s;
  2186. animation-fill-mode: both;
  2187. animation-timing-function: linear;
  2188. }
  2189. }
  2190. .collapse-box {
  2191. padding: 10px;
  2192. border: 1px rgba(0, 0, 0, 0.1) solid;
  2193. border-top: none;
  2194. }
  2195. .Big-Book-container {
  2196. width: 100%;
  2197. min-height: 100vh;
  2198. .Big-Book-content {
  2199. padding: 26px 0;
  2200. display: flex;
  2201. justify-content: flex-start;
  2202. align-items: flex-start;
  2203. }
  2204. .content-tree {
  2205. width: 280px;
  2206. overflow: auto;
  2207. }
  2208. .Book-content {
  2209. flex: 1;
  2210. box-sizing: border-box;
  2211. padding: 90px 30px 30px;
  2212. height: 859px;
  2213. overflow-y: auto;
  2214. position: relative;
  2215. box-sizing: border-box;
  2216. &-inner {
  2217. // width: 860px;
  2218. }
  2219. .addoption {
  2220. padding: 0 20px;
  2221. width: auto;
  2222. display: inline-block;
  2223. height: 40px;
  2224. background: #f3f3f3;
  2225. border: 1px dashed rgba(0, 0, 0, 0.15);
  2226. box-sizing: border-box;
  2227. border-radius: 4px;
  2228. text-align: center;
  2229. line-height: 40px;
  2230. cursor: pointer;
  2231. font-size: 14px;
  2232. color: #000000;
  2233. margin-top: 20px;
  2234. }
  2235. .createTable {
  2236. }
  2237. }
  2238. .Big-Book-save {
  2239. width: 100%;
  2240. display: flex;
  2241. justify-content: flex-end;
  2242. padding: 0 0 20px 0;
  2243. &.Big-Book-input-save {
  2244. position: fixed;
  2245. top: 74px;
  2246. left: 280px;
  2247. z-index: 1;
  2248. background: #fff;
  2249. }
  2250. }
  2251. .Big-Book {
  2252. &-add {
  2253. position: absolute;
  2254. top: -40px;
  2255. right: 0;
  2256. z-index: 1;
  2257. width: 73px;
  2258. height: 40px;
  2259. background: #f7f7f7;
  2260. border: 1px solid #d9d9d9;
  2261. line-height: 40px;
  2262. text-align: center;
  2263. font-weight: bold;
  2264. font-size: 18px;
  2265. text-align: center;
  2266. color: #000000;
  2267. }
  2268. &-name {
  2269. display: flex;
  2270. justify-content: flex-start;
  2271. align-items: center;
  2272. margin-bottom: 10px;
  2273. > p {
  2274. font-size: 14px;
  2275. }
  2276. }
  2277. &-delete {
  2278. width: 16px;
  2279. height: 16px;
  2280. margin-left: 15px;
  2281. cursor: pointer;
  2282. }
  2283. &-curPage {
  2284. margin-bottom: 20px;
  2285. &.Big-Book-curPage-edit {
  2286. border-top: 1px solid #e0e0e0;
  2287. border-bottom: 1px solid #e0e0e0;
  2288. background-color: #fafafa;
  2289. }
  2290. &.Big-Book-curPage-preview {
  2291. border-top: 1px solid #fff;
  2292. border-bottom: 1px solid #fff;
  2293. display: flex;
  2294. justify-content: flex-start;
  2295. align-items: flex-start;
  2296. &:hover {
  2297. background-color: #fafafa;
  2298. border-top: 1px solid #e0e0e0;
  2299. border-bottom: 1px solid #e0e0e0;
  2300. }
  2301. }
  2302. }
  2303. &-queBox {
  2304. padding: 10px 0;
  2305. }
  2306. }
  2307. .Book-function {
  2308. width: 204px;
  2309. background: #f7f7f7;
  2310. box-sizing: border-box;
  2311. padding: 30px 16px;
  2312. height: 859px;
  2313. overflow-y: auto;
  2314. text-align: center;
  2315. .function-list {
  2316. width: 100%;
  2317. margin-top: 5px;
  2318. > li {
  2319. width: 100%;
  2320. width: 172px;
  2321. height: 40px;
  2322. background: #ffffff;
  2323. border: 1px solid rgba(0, 0, 0, 0.15);
  2324. box-sizing: border-box;
  2325. border-radius: 4px;
  2326. cursor: pointer;
  2327. margin-bottom: 5px;
  2328. display: flex;
  2329. justify-content: center;
  2330. align-items: center;
  2331. > span {
  2332. font-weight: normal;
  2333. font-size: 16px;
  2334. line-height: 150%;
  2335. color: #000000;
  2336. }
  2337. .el-dropdown {
  2338. color: #000000;
  2339. }
  2340. }
  2341. }
  2342. }
  2343. .Big-Book-top {
  2344. margin-top: 20px;
  2345. display: flex;
  2346. align-items: center;
  2347. span {
  2348. margin-right: 10px;
  2349. }
  2350. }
  2351. }
  2352. .yunmu {
  2353. &-table {
  2354. width: 172px;
  2355. > tr {
  2356. td {
  2357. cursor: pointer;
  2358. text-align: center;
  2359. font-size: 16px;
  2360. height: 26px;
  2361. }
  2362. }
  2363. }
  2364. }
  2365. </style>