adultInput2.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <!-- -->
  2. <template>
  3. <div class="Big-Book-container">
  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. />
  13. </div>
  14. <div class="Book-content" v-if="currentTreeID">
  15. <div class="Big-Book-save">
  16. <el-button type="primary" @click="onSave">保 存</el-button>
  17. <el-button type="danger" @click="onPreview" plain>预 览</el-button>
  18. </div>
  19. <el-tabs
  20. v-model="editableTabsValue"
  21. type="card"
  22. editable
  23. @edit="handleTabsEdit"
  24. @tab-click="tabClick"
  25. >
  26. <el-tab-pane
  27. v-for="(item, index) in question_list"
  28. :key="item.name"
  29. :label="item.title"
  30. :name="item.name"
  31. >
  32. <div class="createTable">
  33. <el-input
  34. maxlength="1"
  35. style="width: 50px"
  36. v-model="row"
  37. type="text"
  38. @input="rowLine('row')"
  39. />*<el-input
  40. style="width: 50px"
  41. v-model="line"
  42. type="text"
  43. maxlength="1"
  44. @input="rowLine('line')"
  45. />
  46. <el-button
  47. @click="createTable"
  48. style="margin-left: 10px"
  49. type="primary"
  50. >增加题</el-button
  51. >
  52. </div>
  53. <div
  54. v-for="(topic, toindex) in item.cur_fn_data"
  55. :key="'topic' + toindex + index"
  56. >
  57. <p>第{{ toindex + 1 }}题</p>
  58. <div class="Big-Book-top">
  59. <span>正标题</span>
  60. <el-input
  61. style="width: 80%"
  62. type="textarea"
  63. autosize
  64. placeholder="请输入正标题"
  65. v-model="topic.z_title"
  66. @blur="onBlur(topic, 'z_title')"
  67. ></el-input>
  68. </div>
  69. <div class="Big-Book-top">
  70. <span>副标题</span>
  71. <el-input
  72. style="width: 80%"
  73. type="textarea"
  74. autosize
  75. placeholder="请输入副标题"
  76. v-model="topic.f_title"
  77. @blur="onBlur(topic, 'f_title')"
  78. ></el-input>
  79. </div>
  80. <div class="Big-Book-top">
  81. <span>是否有背景色</span>
  82. <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
  83. <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
  84. </div>
  85. <div class="Big-Book-top">
  86. <span>是否有背景图</span>
  87. <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
  88. <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
  89. </div>
  90. <div
  91. v-for="(rowItem, rowIndex) in topic.table_list"
  92. :key="'row' + rowIndex + index"
  93. >
  94. <div
  95. v-for="(topicIitem, lineIndex) in rowItem"
  96. :key="lineIndex"
  97. >
  98. <p>{{ topicIitem.text }}</p>
  99. <div>
  100. <template
  101. v-if="
  102. topicIitem.type == 'article_chs' ||
  103. (topicIitem.data &&
  104. topicIitem.data.type == 'article_chs')
  105. "
  106. >
  107. <template v-if="topicIitem.is_edit">
  108. <ArticleTemChs
  109. :curQue="topicIitem.data"
  110. :changeCurQue="changeCurQue"
  111. />
  112. </template>
  113. <template v-else>
  114. <ArticleView :curQue="topicIitem.data" />
  115. </template>
  116. </template>
  117. <template
  118. v-if="
  119. topicIitem.type == 'dialog_article_chs' ||
  120. (topicIitem.data &&
  121. topicIitem.data.type == 'dialog_article_chs')
  122. "
  123. >
  124. <template v-if="topicIitem.is_edit">
  125. <DialogueArticleChs
  126. :curQue="topicIitem.data"
  127. :changeCurQue="changeCurQue"
  128. />
  129. </template>
  130. <template v-else>
  131. <!-- <ArticleView :curQue="topicIitem.que" /> -->
  132. </template>
  133. </template>
  134. <template v-if="topicIitem.type == 'NewWord_chs'">
  135. <template v-if="topicIitem.is_edit">
  136. <Neword
  137. :curQue="topicIitem.data"
  138. :changeCurQue="changeCurQue"
  139. />
  140. </template>
  141. <template v-else>
  142. <NewordPhraseview :curQue="topicIitem.data" />
  143. </template>
  144. </template>
  145. <template v-if="topicIitem.type == 'notes_chs'">
  146. <template v-if="topicIitem.is_edit">
  147. <Notes
  148. :curQue="topicIitem.data"
  149. :changeCurQue="changeCurQue"
  150. />
  151. </template>
  152. <template v-else>
  153. <NewordPhraseview :curQue="topicIitem.data" />
  154. </template>
  155. </template>
  156. </div>
  157. <div
  158. class="addoption"
  159. v-if="topicIitem.data && topicIitem.is_edit"
  160. @click="
  161. remoeModule(toindex, rowIndex, lineIndex, topicIitem)
  162. "
  163. >
  164. 删除模板
  165. </div>
  166. <div
  167. v-else-if="
  168. TopicIndex == toindex &&
  169. RowIndex == rowIndex &&
  170. lineIndex == LineIndex
  171. "
  172. class="addoption"
  173. >
  174. 选择模板
  175. </div>
  176. <div
  177. v-if="!topicIitem.data && topicIitem.is_add_module"
  178. class="addoption"
  179. @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
  180. >
  181. 添加模板
  182. </div>
  183. <template v-if="topicIitem.data">
  184. <div class="Big-Book-save" v-if="topicIitem.is_edit">
  185. <el-button
  186. type="success"
  187. size="small"
  188. @click="onSure(topicIitem)"
  189. >确定</el-button
  190. >
  191. </div>
  192. <div class="Big-Book-save" v-else>
  193. <el-button
  194. type="primary"
  195. size="small"
  196. @click.stop="editCurQue(topicIitem)"
  197. >编辑</el-button
  198. >
  199. </div>
  200. </template>
  201. </div>
  202. </div>
  203. </div>
  204. </el-tab-pane>
  205. </el-tabs>
  206. </div>
  207. <div class="Book-function" v-if="currentTreeID">
  208. <ul class="function-list">
  209. <li
  210. v-for="(item, index) in fn_data"
  211. :key="'fn' + index"
  212. @click="selectedFnType(item, index)"
  213. >
  214. <el-dropdown v-if="item.list">
  215. <span class="fn-name">
  216. {{ item.name }}<i class="el-icon-arrow-down el-icon--right"></i>
  217. </span>
  218. <el-dropdown-menu slot="dropdown" trigger="click">
  219. <el-dropdown-item
  220. @click.native="selectSmallModule(item, child, index, i)"
  221. v-for="(child, i) in item.list"
  222. :key="i"
  223. >{{ child.name }}</el-dropdown-item
  224. >
  225. </el-dropdown-menu>
  226. </el-dropdown>
  227. <span v-else class="fn-name">{{ item.name }}</span>
  228. </li>
  229. </ul>
  230. </div>
  231. </div>
  232. <el-dialog
  233. :visible.sync="previewVisible"
  234. title="预览"
  235. top="0"
  236. width="100%"
  237. @close="handleClosePre"
  238. >
  239. <div class="chooseCon">
  240. <Preview
  241. :context="context"
  242. :que-index="queIndex"
  243. :fatherName="fatherName"
  244. />
  245. </div>
  246. <span slot="footer" class="dialog-footer">
  247. <el-button @click="handleClosePre">关 闭</el-button>
  248. </span>
  249. </el-dialog>
  250. </div>
  251. </template>
  252. <script>
  253. import Header from "@/components/Header.vue";
  254. import Catelog from "@/components/Adult/inputModules/Catelog";
  255. import ArticleTemChs from "@/components/Adult/inputModules/ArticleTemChs/index.vue";
  256. import DialogueArticleChs from "@/components/Adult/inputModules/DialogueArticleChs/index.vue";
  257. import Single from "@/components/Adult/inputModules/Single.vue";
  258. import Judge from "@/components/Adult/inputModules/Judge.vue";
  259. import Dialogue from "@/components/Adult/inputModules/Dialogue.vue";
  260. import MatrixSingle from "@/components/Adult/inputModules/MatrixSingle.vue";
  261. import MultiRowInput from "@/components/Adult/inputModules/MultiRowInput.vue";
  262. import Ligature from "@/components/Adult/inputModules/Ligature.vue";
  263. import Neword from "@/components/Adult/inputModules/Neword.vue";
  264. import Notes from "@/components/Adult/inputModules/Notes.vue";
  265. import InputRecord from "@/components/Adult/inputModules/InputRecord.vue";
  266. import AudioControl from "@/components/Adult/inputModules/AudioControl.vue";
  267. import SuitchControl from "@/components/Adult/inputModules/SuitchControl.vue";
  268. import BgControl from "@/components/Adult/inputModules/BgControl.vue";
  269. import UploadControl from "@/components/Adult/inputModules/UploadControl.vue";
  270. import TextItem from "@/components/Adult/inputModules/TextItem.vue";
  271. import Sentence from "@/components/Adult/inputModules/Sentence.vue";
  272. import Textdes from "@/components/Adult/inputModules/Textdes.vue";
  273. import Record from "@/components/Adult/inputModules/Record.vue";
  274. import Hanzi from "@/components/Adult/inputModules/Hanzi.vue";
  275. import Picture from "@/components/Adult/inputModules/Picture.vue";
  276. import Singleview from "@/components/Adult/preview/Single.vue";
  277. import Judgeview from "@/components/Adult/preview/Judge.vue";
  278. import Textdesview from "@/components/Adult/preview/Textdes.vue";
  279. import Hanziview from "@/components/Adult/preview/Hanzi.vue";
  280. import Pictureview from "@/components/Adult/preview/Picture.vue";
  281. import Dialogueview from "@/components/Adult/preview/Dialogue.vue";
  282. import MatrixSingleview from "@/components/Adult/preview/MatrixSingle.vue";
  283. import MultiRowInputview from "@/components/Adult/preview/MultiRowInput.vue";
  284. import Ligatureview from "@/components/Adult/preview/Ligature.vue";
  285. import InputRecordview from "@/components/Adult/preview/InputRecord.vue";
  286. import BgControlview from "@/components/Adult/preview/BgControl.vue";
  287. import NewordPhraseview from "@/components/Adult/preview/WordPhrase.vue";
  288. import Preview from "@/components/Adult/Preview.vue";
  289. import fn from "@/components/Adult/common/data2.js";
  290. import { getContent } from "@/api/ajax";
  291. export default {
  292. components: {
  293. Header,
  294. Catelog,
  295. Single,
  296. Textdes,
  297. Record,
  298. Singleview,
  299. Textdesview,
  300. Hanziview,
  301. Pictureview,
  302. Preview,
  303. Hanzi,
  304. Picture,
  305. Judge,
  306. Judgeview,
  307. Dialogue,
  308. Dialogueview,
  309. MatrixSingle,
  310. MatrixSingleview,
  311. MultiRowInput,
  312. MultiRowInputview,
  313. Ligature,
  314. Ligatureview,
  315. Neword,
  316. Notes,
  317. InputRecord,
  318. ArticleTemChs,
  319. DialogueArticleChs,
  320. AudioControl,
  321. SuitchControl,
  322. BgControl,
  323. InputRecordview,
  324. BgControlview,
  325. NewordPhraseview,
  326. UploadControl,
  327. TextItem,
  328. Sentence,
  329. },
  330. data() {
  331. return {
  332. bookId: 1,
  333. bookLevel: "",
  334. bookIndex: "",
  335. fn_data: [],
  336. fn_type: "",
  337. cur_fn_data: null, //当前模块的数据结构
  338. cur_page_queIsEdit: [], //当前页数的某个题
  339. question_list: [
  340. {
  341. name: "tab1",
  342. title: "第1页",
  343. cur_fn_data: [],
  344. },
  345. ], //总的数据列表
  346. cur_page_que_index: 0,
  347. editableTabsValue: "tab1",
  348. tabIndex: 0,
  349. previewVisible: false,
  350. context: [],
  351. queIndex: 0,
  352. currentTreeID: null,
  353. row: null, //行
  354. line: null, //列
  355. TopicIndex: null, //第几题的索引
  356. RowIndex: null, //第几行
  357. LineIndex: null, //第几列
  358. bgControlX: null, // 背景图插入模板的 x
  359. bgControlY: null, // 背景图插入模板的 y
  360. bgControlIndex: null, //插入第几个
  361. DeletebgControlIndex: null, //删除第几个
  362. fatherName: "",
  363. module_type: "",
  364. tmInde: "",
  365. };
  366. },
  367. computed: {
  368. getCurrentQuestionView() {
  369. const function_type = this.fn_type;
  370. switch (function_type) {
  371. case "single":
  372. return Single;
  373. case "text":
  374. return Textdes;
  375. case "record":
  376. return Record;
  377. }
  378. },
  379. },
  380. watch: {},
  381. //方法集合
  382. methods: {
  383. // 随意插入模板获取位置
  384. changeSite(x, y) {
  385. this.bgControlX = x;
  386. this.bgControlY = y;
  387. },
  388. // 插入索引
  389. changebgControlIndex(index) {
  390. this.bgControlIndex = index;
  391. },
  392. // 删除索引
  393. changeDeletebgControlIndex(index) {
  394. this.DeletebgControlIndex = index;
  395. },
  396. rowLine(value) {
  397. this[value] = this[value].match(/^\d*(\.?\d{0,2})/g)[0] || "";
  398. },
  399. createTable() {
  400. if (this.row && this.line) {
  401. let arr = {
  402. z_title: "",
  403. f_title: "",
  404. is_bg: false, //是否有背景色
  405. is_layout: false, // 是不是按背景图布局
  406. table_list: [],
  407. };
  408. for (let i = 0; i < this.row; i++) {
  409. let rowArr = [];
  410. for (let j = 0; j < this.line; j++) {
  411. let obj = {
  412. text: `第${i + 1}行,第${j + 1}列`,
  413. is_add_module: true,
  414. is_edit: true,
  415. };
  416. rowArr.push(obj);
  417. }
  418. arr.table_list.push(rowArr);
  419. }
  420. this.question_list[this.tabIndex].cur_fn_data.push(arr);
  421. this.row = null;
  422. this.line = null;
  423. } else {
  424. this.$message.warning("请输入行和列");
  425. }
  426. },
  427. // 添加模板
  428. addModule(topicIndex, rowindex, lineIndex, item) {
  429. this.TopicIndex = topicIndex;
  430. this.RowIndex = rowindex;
  431. this.LineIndex = lineIndex;
  432. item.is_add_module = false;
  433. },
  434. // 删除模板
  435. remoeModule(topicIndex, rowindex, lineIndex, item) {
  436. // this.question_list[this.tabIndex].cur_fn_data[topicIndex].tableList[
  437. // rowindex
  438. // ][lineIndex].que = null;
  439. // this.$set(
  440. // this.question_list[this.tabIndex].cur_fn_data[topicIndex].tableList[
  441. // rowindex
  442. // ][lineIndex],
  443. // "que",
  444. // null
  445. // );
  446. item.data = null;
  447. this.TopicIndex = null;
  448. this.RowIndex = null;
  449. this.LineIndex = null;
  450. item.is_add_module = true;
  451. },
  452. handleClosePre() {
  453. if (window.stopAudioVoice) window.stopAudioVoice();
  454. if (window.stopAudioAudio) window.stopAudioAudio();
  455. if (window.stopAudioSound) window.stopAudioSound();
  456. this.previewVisible = false;
  457. },
  458. onBlur(item, field) {
  459. item[field] = item[field] ? item[field].trim() : "";
  460. },
  461. // 当前目录id name 父级name/当前 name
  462. changeId(id, name, fatherName) {
  463. this.fatherName = fatherName;
  464. this.currentTreeID = id;
  465. // 根据当前目录切换题
  466. let MethodName = "book-courseware_manager-GetCoursewareContent";
  467. let data = {
  468. id,
  469. };
  470. getContent(MethodName, data)
  471. .then((res) => {
  472. this.question_list = JSON.parse(res.content);
  473. this.cur_page_que_index =
  474. this.question_list[this.tabIndex].cur_fn_data.length - 1;
  475. })
  476. .catch((error) => {});
  477. },
  478. handleTabsEdit(targetName, action) {
  479. if (action === "add") {
  480. let leg = this.question_list.length;
  481. let obj = {
  482. name: `tab${leg + 1}`,
  483. title: `第${leg + 1}页`,
  484. cur_fn_data: [],
  485. };
  486. this.question_list.push(obj);
  487. }
  488. if (action === "remove") {
  489. let tabs = JSON.parse(JSON.stringify(this.question_list));
  490. let activeName = this.editableTabsValue;
  491. if (activeName === targetName) {
  492. tabs.forEach((tab, index) => {
  493. if (tab.name === targetName) {
  494. let nextTab = tabs[index + 1] || tabs[index - 1];
  495. if (nextTab) {
  496. activeName = nextTab.name;
  497. }
  498. }
  499. });
  500. }
  501. this.editableTabsValue = activeName;
  502. let question_list = tabs.filter((tab) => tab.name !== targetName);
  503. question_list.map((item, index) => {
  504. item.name = `tab${index + 1}`;
  505. item.title = `第${index + 1}页`;
  506. return item;
  507. });
  508. this.question_list = question_list;
  509. }
  510. },
  511. tabClick(tab) {
  512. this.tabIndex = tab.index;
  513. },
  514. // 大模板
  515. selectedFnType(item, index) {
  516. if (item.list) {
  517. return;
  518. }
  519. if (
  520. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  521. -1 &&
  522. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  523. ) {
  524. this.$message.warning("请先选择添加模板的位置");
  525. return;
  526. }
  527. if (
  528. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  529. .table_list[this.RowIndex][this.LineIndex].data
  530. ) {
  531. this.$message.warning("每列只能添加一个模板");
  532. } else {
  533. console.log("不存在");
  534. this.module_type = item.type;
  535. this.$set(
  536. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  537. .table_list[this.RowIndex][this.LineIndex],
  538. "type",
  539. item.type
  540. );
  541. this.$set(
  542. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  543. .table_list[this.RowIndex][this.LineIndex],
  544. "data",
  545. null
  546. );
  547. console.log(this.question_list);
  548. }
  549. },
  550. changeCurQue(data_stru) {
  551. console.log(this.RowIndex, this.LineIndex);
  552. this.$set(
  553. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  554. .table_list[this.RowIndex][this.LineIndex],
  555. "data",
  556. JSON.parse(JSON.stringify(data_stru))
  557. );
  558. console.log(this.question_list);
  559. },
  560. // 小模板
  561. selectSmallModule(item, child, itemIndex, childIndex) {
  562. console.log("选择了小模版");
  563. if (
  564. Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
  565. -1 &&
  566. Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
  567. ) {
  568. this.$message.warning("请先选择添加模板的位置");
  569. return;
  570. }
  571. let cur_fn_data = JSON.parse(
  572. JSON.stringify(this.fn_data[itemIndex].data_structure)
  573. );
  574. if (
  575. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  576. .table_list[this.RowIndex][this.LineIndex].data
  577. ) {
  578. this.$message.warning("每列只能添加一个模板");
  579. } else {
  580. cur_fn_data.ChildType = child.type;
  581. if (cur_fn_data.fn_list) {
  582. cur_fn_data.fn_list.forEach((gn) => {
  583. if (gn.type == child.type && gn.type != "image_record") {
  584. gn.isFn = true;
  585. }
  586. if (
  587. child.type == "image_input_three" ||
  588. child.type == "image_dobleinput" ||
  589. child.type == "image_wordInput" ||
  590. child.type == "image_gdcy"
  591. ) {
  592. if (gn.type == "image_input") {
  593. gn.isFn = true;
  594. }
  595. }
  596. });
  597. }
  598. this.$set(
  599. this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
  600. .table_list[this.RowIndex][this.LineIndex],
  601. "data",
  602. null
  603. );
  604. }
  605. },
  606. //删除某页中一个部分
  607. deleteCurQue(item, queIndex) {
  608. item.queList.splice(queIndex, 1);
  609. },
  610. onSave() {
  611. let question_list_str = JSON.stringify(this.question_list);
  612. localStorage.setItem("question_list", question_list_str);
  613. this.$message.success("保存成功");
  614. const MethodName = "book-courseware_manager-SaveCoursewareContent";
  615. let data = {
  616. id: this.currentTreeID,
  617. content: JSON.stringify(this.question_list),
  618. };
  619. getContent(MethodName, data)
  620. .then((res) => {})
  621. .catch((error) => {});
  622. },
  623. onPreview() {
  624. this.previewVisible = true;
  625. this.context = this.question_list;
  626. },
  627. onSure(curItem) {
  628. this.TopicIndex = null;
  629. this.RowIndex = null;
  630. this.LineIndex = null;
  631. curItem.is_edit = false;
  632. },
  633. onDel(item, curIndex) {
  634. item.cur_fn_data.splice(curIndex, 1);
  635. if (this.question_list[this.tabIndex].cur_fn_data.length > 0) {
  636. this.cur_page_que_index =
  637. this.question_list[this.tabIndex].cur_fn_data.length - 1;
  638. } else {
  639. this.cur_page_que_index = 0;
  640. }
  641. // let question_list_str = JSON.stringify(this.question_list);
  642. // localStorage.setItem("question_list", question_list_str);
  643. },
  644. //编辑当前题型
  645. editCurQue(curItem) {
  646. curItem.is_edit = true;
  647. console.log(curItem);
  648. // if (!curItem.isEdit) {
  649. // let count = 0;
  650. // let tabIndex = this.tabIndex;
  651. // let leg = this.question_list[tabIndex].cur_fn_data.length;
  652. // this.question_list[tabIndex].cur_fn_data.forEach((item) => {
  653. // if (item.isEdit) {
  654. // count++;
  655. // }
  656. // });
  657. // if (count == 0) {
  658. // if (!curItem.isEdit) {
  659. // curItem.isEdit = true;
  660. // }
  661. // } else {
  662. // this.$message.warning("有题目未保存");
  663. // }
  664. // }
  665. },
  666. },
  667. //生命周期 - 创建完成(可以访问当前this实例)
  668. created() {
  669. this.fn_data = fn.fnData;
  670. },
  671. //生命周期 - 挂载完成(可以访问DOM元素)
  672. mounted() {
  673. console.log(this.question_list);
  674. // let question_list_str = localStorage.getItem("question_list");
  675. // if (question_list_str) {
  676. // this.question_list = JSON.parse(question_list_str);
  677. // this.cur_page_que_index =
  678. // this.question_list[this.tabIndex].cur_fn_data.length - 1;
  679. // }
  680. },
  681. beforeCreate() {}, //生命周期 - 创建之前
  682. beforeMount() {}, //生命周期 - 挂载之前
  683. beforeUpdate() {}, //生命周期 - 更新之前
  684. updated() {}, //生命周期 - 更新之后
  685. beforeDestroy() {}, //生命周期 - 销毁之前
  686. destroyed() {}, //生命周期 - 销毁完成
  687. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  688. };
  689. </script>
  690. <style lang='scss' scoped>
  691. //@import url(); 引入公共css类
  692. .Big-Book-container {
  693. width: 100%;
  694. min-height: 100vh;
  695. .Big-Book-content {
  696. padding: 26px 0;
  697. display: flex;
  698. justify-content: flex-start;
  699. align-items: flex-start;
  700. }
  701. .content-tree {
  702. width: 280px;
  703. }
  704. .Book-content {
  705. flex: 1;
  706. box-sizing: border-box;
  707. padding: 30px;
  708. height: 859px;
  709. overflow-y: auto;
  710. &-inner {
  711. // width: 860px;
  712. }
  713. .addoption {
  714. width: 148px;
  715. height: 40px;
  716. background: #f3f3f3;
  717. border: 1px dashed rgba(0, 0, 0, 0.15);
  718. box-sizing: border-box;
  719. border-radius: 4px;
  720. text-align: center;
  721. line-height: 40px;
  722. cursor: pointer;
  723. font-size: 14px;
  724. color: #000000;
  725. margin-top: 20px;
  726. }
  727. .createTable {
  728. }
  729. }
  730. .Big-Book-save {
  731. width: 860px;
  732. display: flex;
  733. justify-content: flex-end;
  734. padding: 0 0 20px 0;
  735. }
  736. .Big-Book {
  737. &-add {
  738. position: absolute;
  739. top: -40px;
  740. right: 0;
  741. z-index: 1;
  742. width: 73px;
  743. height: 40px;
  744. background: #f7f7f7;
  745. border: 1px solid #d9d9d9;
  746. line-height: 40px;
  747. text-align: center;
  748. font-weight: bold;
  749. font-size: 18px;
  750. text-align: center;
  751. color: #000000;
  752. }
  753. &-name {
  754. display: flex;
  755. justify-content: flex-start;
  756. align-items: center;
  757. margin-bottom: 10px;
  758. > p {
  759. font-size: 14px;
  760. }
  761. }
  762. &-delete {
  763. width: 16px;
  764. height: 16px;
  765. margin-left: 15px;
  766. cursor: pointer;
  767. }
  768. &-curPage {
  769. margin-bottom: 20px;
  770. &.Big-Book-curPage-edit {
  771. border-top: 1px solid #e0e0e0;
  772. border-bottom: 1px solid #e0e0e0;
  773. background-color: #fafafa;
  774. }
  775. &.Big-Book-curPage-preview {
  776. border-top: 1px solid #fff;
  777. border-bottom: 1px solid #fff;
  778. display: flex;
  779. justify-content: flex-start;
  780. align-items: flex-start;
  781. &:hover {
  782. background-color: #fafafa;
  783. border-top: 1px solid #e0e0e0;
  784. border-bottom: 1px solid #e0e0e0;
  785. }
  786. }
  787. }
  788. &-queBox {
  789. padding: 10px 0;
  790. }
  791. }
  792. .Book-function {
  793. width: 204px;
  794. background: #f7f7f7;
  795. box-sizing: border-box;
  796. padding: 30px 16px;
  797. height: 859px;
  798. overflow-y: auto;
  799. .function-list {
  800. width: 100%;
  801. > li {
  802. width: 100%;
  803. width: 172px;
  804. height: 40px;
  805. background: #ffffff;
  806. border: 1px solid rgba(0, 0, 0, 0.15);
  807. box-sizing: border-box;
  808. border-radius: 4px;
  809. cursor: pointer;
  810. margin-bottom: 5px;
  811. display: flex;
  812. justify-content: center;
  813. align-items: center;
  814. > span {
  815. font-weight: normal;
  816. font-size: 16px;
  817. line-height: 150%;
  818. color: #000000;
  819. }
  820. }
  821. }
  822. }
  823. .Big-Book-top {
  824. margin-top: 20px;
  825. display: flex;
  826. align-items: center;
  827. span {
  828. margin-right: 10px;
  829. }
  830. }
  831. }
  832. </style>