adultInput.vue 78 KB

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