adultInput.vue 78 KB

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