Преглед на файлове

input页面上移下移删除 生词模版展开 文章标题

natasha преди 2 години
родител
ревизия
854b91585e

+ 1 - 2
src/components/Adult/common/SentenceSegTemp.vue

@@ -328,8 +328,7 @@ export default {
         this.detail.detail.splice(index + 1, 1);
       }
       if (type == "down" && index < this.detail.detail.length - 1) {
-        this.detail.detail.splice(index + 1, 0, obj);
-        this.detail.detail.splice(index, 1);
+        this.detail.detail[index] = this.detail.detail.splice(index + 1, 1, this.detail.detail[index])[0]
       }
     },
     //功能设置

+ 14 - 0
src/components/Adult/inputModules/Neword.vue

@@ -35,6 +35,16 @@
               
       </div>
       <div class="adult-book-input-item">
+        <span class="adult-book-lable">预览展开:</span>  
+        <div class="adult-book-main">
+          <el-radio-group v-model="curQue.isWordShow">
+            <el-radio :label="true">是</el-radio>
+            <el-radio :label="false">否</el-radio> </el-radio-group
+          >  
+        </div>
+              
+      </div>
+      <div class="adult-book-input-item">
         <span class="adult-book-lable">题目音频:</span>
         <Upload
           :changeFillId="changeMp3"
@@ -134,6 +144,7 @@ export default {
         name: "生词",
         title: "",
         isInfor: true,
+        isWordShow: true,
         titleBg: "themeColor", //标题背景颜色
         mp3_list: [],
         lrc_list: [],
@@ -345,6 +356,9 @@ export default {
       if (!this.curQue.hasOwnProperty("isInfor")) {
         this.$set(this.curQue, "isInfor", true);
       }
+      if (!this.curQue.hasOwnProperty("isWordShow")) {
+        this.$set(this.curQue, "isWordShow", true);
+      }
       if (!this.curQue.hasOwnProperty("titleBg")) {
         this.$set(this.curQue, "titleBg", "themeColor");
       }

+ 14 - 1
src/components/Adult/inputModules/Notes.vue

@@ -14,6 +14,16 @@
           show-word-limit
         ></el-input>
       </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">预览展开:</span>  
+        <div class="adult-book-main">
+          <el-radio-group v-model="curQue.isWordShow">
+            <el-radio :label="true">是</el-radio>
+            <el-radio :label="false">否</el-radio> </el-radio-group
+          >  
+        </div>
+              
+      </div>
       <div
         class="Big-Book-main"
         v-for="(curQueItem, index) in curQue.option"
@@ -107,6 +117,7 @@ export default {
         type: "notes_chs",
         name: "注释",
         title: "",
+        isWordShow: true,
         option: [
           {
             number: "", //序号
@@ -178,7 +189,9 @@ export default {
         fileCon.push(obj);
       });
       this.fileCon = JSON.parse(JSON.stringify(fileCon));
-      console.log(this.fileCon);
+      if (!this.curQue.hasOwnProperty("isWordShow")) {
+        this.$set(this.curQue, "isWordShow", true);
+      }
     }
   },
   beforeCreate() {}, //生命周期 - 创建之前

+ 23 - 19
src/components/Adult/preview/ArticleViewChs/PhraseModelChs.vue

@@ -455,20 +455,23 @@ export default {
       let dhaspinyin = false; // 每段是否有拼音
       curQue.detail.forEach((dItem, dIndex) => {
         dhaspinyin = false
-        let paraArr = [
-          {
-            pinyin: "",
-            chs: "",
-            width: 20,
-            height: 20,
-          },
-          {
-            width: 20,
-            height: 20,
-            pinyin: "",
-            chs: "",
-          },
-        ];
+        let paraArr = []
+        if(!dItem.isTitle){
+           paraArr = [
+            {
+                pinyin: "",
+                chs: "",
+                width: 20,
+                height: 20,
+            },
+            {
+                width: 20,
+                height: 20,
+                pinyin: "",
+                chs: "",
+            },
+          ]; 
+        }
         dItem.wordsList.forEach((sItem, sIndex) => {
           sItem.forEach((wItem, wIndex) => {
             //this.judgePad(sItem, wItem, wIndex);
@@ -491,7 +494,8 @@ export default {
 
         let paraObj = {
           wordsList: paraArr,
-          dhaspinyin:dhaspinyin
+          dhaspinyin:dhaspinyin,
+          isTitle: dItem.isTitle,
         };
         resArr.push(paraObj);
       });
@@ -507,10 +511,10 @@ export default {
     //词和标点合一起
     mergeWordSymbol(sItem, wItem, curIndex) {
       let leg = sItem.length;
-      if (curIndex < leg - 1) {
-        let nextIndex = curIndex + 1;
-        let chs = sItem[nextIndex].chs;
-        let pinyin = sItem[nextIndex].pinyin;
+      if (wItem&&wItem.chs) {
+        // let nextIndex = curIndex + 1;
+        // let chs = sItem[nextIndex].chs;
+        // let pinyin = sItem[nextIndex].pinyin;
         // if (this.chsFhList.indexOf(chs) > -1) {
         //   wItem.chs = "<a>" + wItem.chs + "</a><a>" + chs + "</a>";
         //   wItem.pinyin = "<a>" + wItem.pinyin + "</a><a>" + pinyin + "</a>";

+ 23 - 18
src/components/Adult/preview/ArticleViewChs/WordModelChs.vue

@@ -61,7 +61,7 @@
                   <template v-if="pItem.isShow">
                     <template
                       v-if="
-                        item.wordsList[pIndex + 1].chs &&
+                        item.wordsList[pIndex + 1]&&item.wordsList[pIndex + 1].chs &&
                         chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1
                       "
                     >
@@ -380,24 +380,28 @@ export default {
       let dhaspinyin = false; // 每段是否有拼音
       curQue.detail.forEach((dItem, dIndex) => {
         dhaspinyin = false
-        let paraArr = [
-          {
-            pinyin: "",
-            chs: "",
-            width: 20,
-            height: 20,
-          },
-          {
-            width: 20,
-            height: 20,
-            pinyin: "",
-            chs: "",
-          },
-        ];
+        let paraArr = []
+        if(!dItem.isTitle){
+           paraArr = [
+            {
+                pinyin: "",
+                chs: "",
+                width: 20,
+                height: 20,
+            },
+            {
+                width: 20,
+                height: 20,
+                pinyin: "",
+                chs: "",
+            },
+          ]; 
+        }
         dItem.wordsList.forEach((sItem, sIndex) => {
           sItem.forEach((wItem, wIndex) => {
             //this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbol(sItem, wItem, wIndex);
+
             let obj = {
               paraIndex: dIndex, //段落索引
               sentIndex: sIndex, //在段落中句子索引
@@ -422,7 +426,8 @@ export default {
         let paraObj = {
           wordsList: paraArr,
           timeList: timeList,
-          dhaspinyin:dhaspinyin
+          dhaspinyin:dhaspinyin,
+          isTitle: dItem.isTitle,
         };
         resArr.push(paraObj);
       });
@@ -437,13 +442,13 @@ export default {
     //词和标点合一起
     mergeWordSymbol(sItem, wItem, curIndex) {
       let leg = sItem.length;
-      if (curIndex < leg - 1) {
+      if (wItem&&wItem.chs) {
         if (this.chsFhList.indexOf(wItem.chs) > -1) {
           wItem.isShow = false;
         } else {
           wItem.isShow = true;
         }
-      }
+      }            
     },
     //判断是否有padding
     judgePad(sItem, wItem, curIndex) {

+ 1 - 1
src/components/Adult/preview/Notes.vue

@@ -55,7 +55,7 @@ export default {
   data() {
     //这里存放数据
     return {
-      wordShow: true,
+      wordShow: this.curQue.hasOwnProperty("isWordShow")?this.curQue.isWordShow:true,
     };
   },
   //计算属性 类似于data概念

+ 1 - 1
src/components/Adult/preview/WordPhrase.vue

@@ -243,7 +243,7 @@ export default {
   data() {
     //这里存放数据
     return {
-      wordShow: true,
+      wordShow: this.curQue.hasOwnProperty("isWordShow")?this.curQue.isWordShow:true,
       data: null,
       detailShow: false,
       detailIndex: 0,

+ 41 - 0
src/views/adultInput.vue

@@ -139,6 +139,24 @@
                 style="margin: 0 10px"
                 ><br /></el-checkbox
               ><span>{{ topic.group_name }}</span>
+              <el-button size="small" @click="deleteElement(toindex)"
+                >删除</el-button
+            >
+
+            <el-button
+                type="primary"
+                size="small"
+                icon="el-icon-top"
+                @click="moveElement(topic, toindex, 'up')"
+                >上移</el-button
+            >
+            <el-button
+                type="primary"
+                size="small"
+                icon="el-icon-bottom"
+                @click="moveElement(topic, toindex, 'down')"
+                >下移</el-button
+            >
             </div>
             <span @click="handleChangeTab(topic)">
               {{ topic.contentShow ? "收起" : "展开" }}
@@ -1935,6 +1953,29 @@ export default {
       });
       window.getSelection().removeAllRanges();
     },
+    deleteElement(index) {
+        this.$confirm(`确定要删除吗?`, "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+        }).then(() => {
+            if(this.question_list.cur_fn_data.length>1){
+                this.question_list.cur_fn_data.splice(index, 1);
+            }else{
+                this.question_list.cur_fn_data = [];
+            }
+        });
+    },
+    moveElement(dItem, index, type) {
+      let obj = JSON.parse(JSON.stringify(dItem));
+      if (type == "up" && index > 0) {
+        this.question_list.cur_fn_data.splice(index - 1, 0, obj);
+        this.question_list.cur_fn_data.splice(index + 1, 1);
+      }
+      if (type == "down" && index < this.question_list.cur_fn_data.length - 1) {
+        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]
+      }
+    },
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>