Browse Source

adultInput

guanchunjie 3 years ago
parent
commit
399dd0e950
2 changed files with 100 additions and 116 deletions
  1. 50 58
      src/views/adultInput.vue
  2. 50 58
      src/views/adultInput2.vue

+ 50 - 58
src/views/adultInput.vue

@@ -62,8 +62,8 @@
                   type="textarea"
                   autosize
                   placeholder="请输入正标题"
-                  v-model="topic.Ztitle"
-                  @blur="onBlur(topic, 'Ztitle')"
+                  v-model="topic.z_title"
+                  @blur="onBlur(topic, 'z_title')"
                 ></el-input>
               </div>
               <div class="Big-Book-top">
@@ -73,22 +73,22 @@
                   type="textarea"
                   autosize
                   placeholder="请输入副标题"
-                  v-model="topic.Ftitle"
-                  @blur="onBlur(topic, 'Ftitle')"
+                  v-model="topic.f_title"
+                  @blur="onBlur(topic, 'f_title')"
                 ></el-input>
               </div>
               <div class="Big-Book-top">
                 <span>是否有背景色</span>
-                <el-radio v-model="topic.Isbg" :label="true">有</el-radio>
-                <el-radio v-model="topic.Isbg" :label="false">无</el-radio>
+                <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
+                <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
               </div>
               <div class="Big-Book-top">
                 <span>是否有背景图</span>
-                <el-radio v-model="topic.IsLayout" :label="true">有</el-radio>
-                <el-radio v-model="topic.IsLayout" :label="false">无</el-radio>
+                <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
+                <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
               </div>
               <div
-                v-for="(rowItem, rowIndex) in topic.tableList"
+                v-for="(rowItem, rowIndex) in topic.table_list"
                 :key="'row' + rowIndex + index"
               >
                 <div
@@ -100,29 +100,30 @@
                     <template
                       v-if="
                         topicIitem.type == 'article_chs' ||
-                        (topicIitem.que && topicIitem.que.type == 'article_chs')
+                        (topicIitem.data &&
+                          topicIitem.data.type == 'article_chs')
                       "
                     >
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <ArticleTemChs
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
                       <template v-else>
-                        <ArticleView :curQue="topicIitem.que" />
+                        <ArticleView :curQue="topicIitem.data" />
                       </template>
                     </template>
                     <template
                       v-if="
                         topicIitem.type == 'dialog_article_chs' ||
-                        (topicIitem.que &&
-                          topicIitem.que.type == 'dialog_article_chs')
+                        (topicIitem.data &&
+                          topicIitem.data.type == 'dialog_article_chs')
                       "
                     >
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <DialogueArticleChs
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
@@ -131,31 +132,31 @@
                       </template>
                     </template>
                     <template v-if="topicIitem.type == 'NewWord_chs'">
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <Neword
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
                       <template v-else>
-                        <NewordPhraseview :curQue="topicIitem.que" />
+                        <NewordPhraseview :curQue="topicIitem.data" />
                       </template>
                     </template>
                     <template v-if="topicIitem.type == 'notes_chs'">
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <Notes
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
                       <template v-else>
-                        <NewordPhraseview :curQue="topicIitem.que" />
+                        <NewordPhraseview :curQue="topicIitem.data" />
                       </template>
                     </template>
                   </div>
                   <div
                     class="addoption"
-                    v-if="topicIitem.que && topicIitem.isEdit"
+                    v-if="topicIitem.data && topicIitem.is_edit"
                     @click="
                       remoeModule(toindex, rowIndex, lineIndex, topicIitem)
                     "
@@ -173,14 +174,14 @@
                     选择模板
                   </div>
                   <div
-                    v-if="!topicIitem.que && topicIitem.isAddModule"
+                    v-if="!topicIitem.data && topicIitem.is_addModule"
                     class="addoption"
                     @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
                   >
                     添加模板
                   </div>
-                  <template v-if="topicIitem.que">
-                    <div class="Big-Book-save" v-if="topicIitem.isEdit">
+                  <template v-if="topicIitem.data">
+                    <div class="Big-Book-save" v-if="topicIitem.is_edit">
                       <el-button
                         type="success"
                         size="small"
@@ -358,7 +359,6 @@ export default {
       TopicIndex: null, //第几题的索引
       RowIndex: null, //第几行
       LineIndex: null, //第几列
-      isAddModule: true,
       bgControlX: null, // 背景图插入模板的 x
       bgControlY: null, // 背景图插入模板的 y
       bgControlIndex: null, //插入第几个
@@ -403,23 +403,23 @@ export default {
     createTable() {
       if (this.row && this.line) {
         let arr = {
-          Ztitle: "",
-          Ftitle: "",
-          Isbg: false, //是否有背景色
-          IsLayout: false, // 是不是按背景图布局
-          tableList: [],
+          z_title: "",
+          f_title: "",
+          is_bg: false, //是否有背景色
+          is_layout: false, // 是不是按背景图布局
+          table_list: [],
         };
         for (let i = 0; i < this.row; i++) {
           let rowArr = [];
           for (let j = 0; j < this.line; j++) {
             let obj = {
               text: `第${i + 1}行,第${j + 1}列`,
-              isAddModule: true,
-              isEdit: true,
+              is_addModule: true,
+              is_edit: true,
             };
             rowArr.push(obj);
           }
-          arr.tableList.push(rowArr);
+          arr.table_list.push(rowArr);
         }
         this.question_list[this.tabIndex].cur_fn_data.push(arr);
         this.row = null;
@@ -433,7 +433,7 @@ export default {
       this.TopicIndex = topicIndex;
       this.RowIndex = rowindex;
       this.LineIndex = lineIndex;
-      item.isAddModule = false;
+      item.is_addModule = false;
     },
     // 删除模板
     remoeModule(topicIndex, rowindex, lineIndex, item) {
@@ -447,11 +447,11 @@ export default {
       //   "que",
       //   null
       // );
-      item.que = null;
+      item.data = null;
       this.TopicIndex = null;
       this.RowIndex = null;
       this.LineIndex = null;
-      item.isAddModule = true;
+      item.is_addModule = true;
     },
     handleClosePre() {
       if (window.stopAudioVoice) window.stopAudioVoice();
@@ -531,7 +531,7 @@ export default {
 
       if (
         this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-          .tableList[this.RowIndex][this.LineIndex].que
+          .table_list[this.RowIndex][this.LineIndex].data
       ) {
         this.$message.warning("每列只能添加一个模板");
       } else {
@@ -539,26 +539,25 @@ export default {
         this.module_type = item.type;
         this.$set(
           this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-            .tableList[this.RowIndex][this.LineIndex],
+            .table_list[this.RowIndex][this.LineIndex],
           "type",
           item.type
         );
         this.$set(
           this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-            .tableList[this.RowIndex][this.LineIndex],
-          "que",
+            .table_list[this.RowIndex][this.LineIndex],
+          "data",
           null
         );
         console.log(this.question_list);
       }
     },
     changeCurQue(data_stru) {
-      debugger;
       console.log(this.RowIndex, this.LineIndex);
       this.$set(
         this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-          .tableList[this.RowIndex][this.LineIndex],
-        "que",
+          .table_list[this.RowIndex][this.LineIndex],
+        "data",
         JSON.parse(JSON.stringify(data_stru))
       );
       console.log(this.question_list);
@@ -579,11 +578,10 @@ export default {
       );
       if (
         this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-          .tableList[this.RowIndex][this.LineIndex].que
+          .table_list[this.RowIndex][this.LineIndex].data
       ) {
         this.$message.warning("每列只能添加一个模板");
       } else {
-        // cur_fn_data.isEdit = true;
         cur_fn_data.ChildType = child.type;
         if (cur_fn_data.fn_list) {
           cur_fn_data.fn_list.forEach((gn) => {
@@ -605,8 +603,8 @@ export default {
 
         this.$set(
           this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-            .tableList[this.RowIndex][this.LineIndex],
-          "que",
+            .table_list[this.RowIndex][this.LineIndex],
+          "data",
           null
         );
       }
@@ -633,16 +631,10 @@ export default {
       this.context = this.question_list;
     },
     onSure(curItem) {
-      // this.$set(
-      //   this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-      //     .tableList[this.RowIndex][this.LineIndex].que,
-      //   "isEdit",
-      //   false
-      // );
       this.TopicIndex = null;
       this.RowIndex = null;
       this.LineIndex = null;
-      curItem.isEdit = false;
+      curItem.is_edit = false;
     },
     onDel(item, curIndex) {
       item.cur_fn_data.splice(curIndex, 1);
@@ -657,7 +649,7 @@ export default {
     },
     //编辑当前题型
     editCurQue(curItem) {
-      curItem.isEdit = true;
+      curItem.is_edit = true;
       console.log(curItem);
       // if (!curItem.isEdit) {
       //   let count = 0;

+ 50 - 58
src/views/adultInput2.vue

@@ -62,8 +62,8 @@
                   type="textarea"
                   autosize
                   placeholder="请输入正标题"
-                  v-model="topic.Ztitle"
-                  @blur="onBlur(topic, 'Ztitle')"
+                  v-model="topic.z_title"
+                  @blur="onBlur(topic, 'z_title')"
                 ></el-input>
               </div>
               <div class="Big-Book-top">
@@ -73,22 +73,22 @@
                   type="textarea"
                   autosize
                   placeholder="请输入副标题"
-                  v-model="topic.Ftitle"
-                  @blur="onBlur(topic, 'Ftitle')"
+                  v-model="topic.f_title"
+                  @blur="onBlur(topic, 'f_title')"
                 ></el-input>
               </div>
               <div class="Big-Book-top">
                 <span>是否有背景色</span>
-                <el-radio v-model="topic.Isbg" :label="true">有</el-radio>
-                <el-radio v-model="topic.Isbg" :label="false">无</el-radio>
+                <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
+                <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
               </div>
               <div class="Big-Book-top">
                 <span>是否有背景图</span>
-                <el-radio v-model="topic.IsLayout" :label="true">有</el-radio>
-                <el-radio v-model="topic.IsLayout" :label="false">无</el-radio>
+                <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
+                <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
               </div>
               <div
-                v-for="(rowItem, rowIndex) in topic.tableList"
+                v-for="(rowItem, rowIndex) in topic.table_list"
                 :key="'row' + rowIndex + index"
               >
                 <div
@@ -100,29 +100,30 @@
                     <template
                       v-if="
                         topicIitem.type == 'article_chs' ||
-                        (topicIitem.que && topicIitem.que.type == 'article_chs')
+                        (topicIitem.data &&
+                          topicIitem.data.type == 'article_chs')
                       "
                     >
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <ArticleTemChs
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
                       <template v-else>
-                        <ArticleView :curQue="topicIitem.que" />
+                        <ArticleView :curQue="topicIitem.data" />
                       </template>
                     </template>
                     <template
                       v-if="
                         topicIitem.type == 'dialog_article_chs' ||
-                        (topicIitem.que &&
-                          topicIitem.que.type == 'dialog_article_chs')
+                        (topicIitem.data &&
+                          topicIitem.data.type == 'dialog_article_chs')
                       "
                     >
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <DialogueArticleChs
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
@@ -131,31 +132,31 @@
                       </template>
                     </template>
                     <template v-if="topicIitem.type == 'NewWord_chs'">
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <Neword
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
                       <template v-else>
-                        <NewordPhraseview :curQue="topicIitem.que" />
+                        <NewordPhraseview :curQue="topicIitem.data" />
                       </template>
                     </template>
                     <template v-if="topicIitem.type == 'notes_chs'">
-                      <template v-if="topicIitem.isEdit">
+                      <template v-if="topicIitem.is_edit">
                         <Notes
-                          :curQue="topicIitem.que"
+                          :curQue="topicIitem.data"
                           :changeCurQue="changeCurQue"
                         />
                       </template>
                       <template v-else>
-                        <NewordPhraseview :curQue="topicIitem.que" />
+                        <NewordPhraseview :curQue="topicIitem.data" />
                       </template>
                     </template>
                   </div>
                   <div
                     class="addoption"
-                    v-if="topicIitem.que && topicIitem.isEdit"
+                    v-if="topicIitem.data && topicIitem.is_edit"
                     @click="
                       remoeModule(toindex, rowIndex, lineIndex, topicIitem)
                     "
@@ -173,14 +174,14 @@
                     选择模板
                   </div>
                   <div
-                    v-if="!topicIitem.que && topicIitem.isAddModule"
+                    v-if="!topicIitem.data && topicIitem.is_addModule"
                     class="addoption"
                     @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
                   >
                     添加模板
                   </div>
-                  <template v-if="topicIitem.que">
-                    <div class="Big-Book-save" v-if="topicIitem.isEdit">
+                  <template v-if="topicIitem.data">
+                    <div class="Big-Book-save" v-if="topicIitem.is_edit">
                       <el-button
                         type="success"
                         size="small"
@@ -358,7 +359,6 @@ export default {
       TopicIndex: null, //第几题的索引
       RowIndex: null, //第几行
       LineIndex: null, //第几列
-      isAddModule: true,
       bgControlX: null, // 背景图插入模板的 x
       bgControlY: null, // 背景图插入模板的 y
       bgControlIndex: null, //插入第几个
@@ -403,23 +403,23 @@ export default {
     createTable() {
       if (this.row && this.line) {
         let arr = {
-          Ztitle: "",
-          Ftitle: "",
-          Isbg: false, //是否有背景色
-          IsLayout: false, // 是不是按背景图布局
-          tableList: [],
+          z_title: "",
+          f_title: "",
+          is_bg: false, //是否有背景色
+          is_layout: false, // 是不是按背景图布局
+          table_list: [],
         };
         for (let i = 0; i < this.row; i++) {
           let rowArr = [];
           for (let j = 0; j < this.line; j++) {
             let obj = {
               text: `第${i + 1}行,第${j + 1}列`,
-              isAddModule: true,
-              isEdit: true,
+              is_addModule: true,
+              is_edit: true,
             };
             rowArr.push(obj);
           }
-          arr.tableList.push(rowArr);
+          arr.table_list.push(rowArr);
         }
         this.question_list[this.tabIndex].cur_fn_data.push(arr);
         this.row = null;
@@ -433,7 +433,7 @@ export default {
       this.TopicIndex = topicIndex;
       this.RowIndex = rowindex;
       this.LineIndex = lineIndex;
-      item.isAddModule = false;
+      item.is_addModule = false;
     },
     // 删除模板
     remoeModule(topicIndex, rowindex, lineIndex, item) {
@@ -447,11 +447,11 @@ export default {
       //   "que",
       //   null
       // );
-      item.que = null;
+      item.data = null;
       this.TopicIndex = null;
       this.RowIndex = null;
       this.LineIndex = null;
-      item.isAddModule = true;
+      item.is_addModule = true;
     },
     handleClosePre() {
       if (window.stopAudioVoice) window.stopAudioVoice();
@@ -531,7 +531,7 @@ export default {
 
       if (
         this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-          .tableList[this.RowIndex][this.LineIndex].que
+          .table_list[this.RowIndex][this.LineIndex].data
       ) {
         this.$message.warning("每列只能添加一个模板");
       } else {
@@ -539,26 +539,25 @@ export default {
         this.module_type = item.type;
         this.$set(
           this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-            .tableList[this.RowIndex][this.LineIndex],
+            .table_list[this.RowIndex][this.LineIndex],
           "type",
           item.type
         );
         this.$set(
           this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-            .tableList[this.RowIndex][this.LineIndex],
-          "que",
+            .table_list[this.RowIndex][this.LineIndex],
+          "data",
           null
         );
         console.log(this.question_list);
       }
     },
     changeCurQue(data_stru) {
-      debugger;
       console.log(this.RowIndex, this.LineIndex);
       this.$set(
         this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-          .tableList[this.RowIndex][this.LineIndex],
-        "que",
+          .table_list[this.RowIndex][this.LineIndex],
+        "data",
         JSON.parse(JSON.stringify(data_stru))
       );
       console.log(this.question_list);
@@ -579,11 +578,10 @@ export default {
       );
       if (
         this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-          .tableList[this.RowIndex][this.LineIndex].que
+          .table_list[this.RowIndex][this.LineIndex].data
       ) {
         this.$message.warning("每列只能添加一个模板");
       } else {
-        // cur_fn_data.isEdit = true;
         cur_fn_data.ChildType = child.type;
         if (cur_fn_data.fn_list) {
           cur_fn_data.fn_list.forEach((gn) => {
@@ -605,8 +603,8 @@ export default {
 
         this.$set(
           this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-            .tableList[this.RowIndex][this.LineIndex],
-          "que",
+            .table_list[this.RowIndex][this.LineIndex],
+          "data",
           null
         );
       }
@@ -633,16 +631,10 @@ export default {
       this.context = this.question_list;
     },
     onSure(curItem) {
-      // this.$set(
-      //   this.question_list[this.tabIndex].cur_fn_data[this.TopicIndex]
-      //     .tableList[this.RowIndex][this.LineIndex].que,
-      //   "isEdit",
-      //   false
-      // );
       this.TopicIndex = null;
       this.RowIndex = null;
       this.LineIndex = null;
-      curItem.isEdit = false;
+      curItem.is_edit = false;
     },
     onDel(item, curIndex) {
       item.cur_fn_data.splice(curIndex, 1);
@@ -657,7 +649,7 @@ export default {
     },
     //编辑当前题型
     editCurQue(curItem) {
-      curItem.isEdit = true;
+      curItem.is_edit = true;
       console.log(curItem);
       // if (!curItem.isEdit) {
       //   let count = 0;