Procházet zdrojové kódy

修改上传文件的id保存及录入拷贝的bug修改及上传控件的录入和预览效果

秦鹏 před 3 roky
rodič
revize
0248251035

+ 1 - 1
package.json

@@ -35,7 +35,7 @@
         "vue-element-utils": "^0.2.1",
         "vue-esign": "^1.0.5",
         "vue-i18n": "^8.24.4",
-        "vue-pdf": "^4.3.0",
+        "vue-pdf": "^4.2.0",
         "vue-router": "3.0.6",
         "vue-slider-component": "^3.2.14",
         "vue-video-player": "^5.0.2",

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

@@ -102,7 +102,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }

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

@@ -199,7 +199,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }

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

@@ -210,7 +210,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }

+ 1 - 1
src/components/Adult/common/InputRecordModule.vue

@@ -103,7 +103,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
             media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);

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

@@ -126,7 +126,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }

+ 3 - 2
src/components/Adult/common/JudgeModule.vue

@@ -163,7 +163,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }
@@ -180,7 +181,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }

+ 3 - 2
src/components/Adult/common/LigatureModule.vue

@@ -188,7 +188,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }
@@ -205,7 +206,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }

+ 2 - 2
src/components/Adult/common/NewordPhraseModule.vue

@@ -145,7 +145,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
             media_duration: item.response.file_info_list[0].media_duration,
             file_relative_path:
               item.response.file_info_list[0].file_relative_path,
@@ -165,7 +165,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
             file_relative_path: file_relative_path,
           };
           articleImgRes.push(obj);

+ 2 - 2
src/components/Adult/common/RecordModule.vue

@@ -190,7 +190,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
             media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
@@ -207,7 +207,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }

+ 11 - 3
src/components/Adult/common/SentenceModule.vue

@@ -50,6 +50,15 @@
     >
       <img src="../../../assets/adult/pro-plus.png" alt="" />
     </div>
+    <div class="Big-Book-top" v-if="type == 'inputItem_chs'">
+      <span>音频</span>
+      <Upload
+        :changeFillId="changeMp3"
+        :datafileList="fileCon.mp3_list"
+        :filleNumber="mp3Number"
+        :uploadType="'mp3'"
+      />
+    </div>
     <!-- <div class="Big-Book-mp3">
       <span>音频</span>
       <Upload
@@ -151,7 +160,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
             media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
@@ -168,7 +177,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }
@@ -253,7 +262,6 @@ export default {
     // display: flex;
     // justify-content: flex-start;
     // align-items: center;
-
     > div {
       display: flex;
       justify-content: flex-start;

+ 3 - 2
src/components/Adult/common/SingleModule.vue

@@ -159,7 +159,8 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }
@@ -176,7 +177,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }

+ 3 - 2
src/components/Adult/inputModules/ArticleTemChs/index.vue

@@ -3092,7 +3092,8 @@ export default {
             name: item.name,
             duration: item.response.file_info_list[0].media_duration,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }
@@ -3106,7 +3107,7 @@ export default {
         const obj = {
           name: file.name,
           url: file.response.file_info_list[0].file_url,
-          id: file.response.file_info_list[0].file_id,
+          id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           imgNumber: 0,
         };
         this.curQue.img_list.push(obj);

+ 1 - 1
src/components/Adult/inputModules/BgControl.vue

@@ -45,7 +45,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }

+ 1 - 1
src/components/Adult/inputModules/DialogueArticleChs/components/RoleChs.vue

@@ -136,7 +136,7 @@ export default {
           const obj = {
             name: item.name,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           };
           articleImgRes.push(obj);
         }

+ 3 - 2
src/components/Adult/inputModules/DialogueArticleChs/index.vue

@@ -213,7 +213,8 @@ export default {
             name: item.name,
             duration: item.response.file_info_list[0].media_duration,
             url: item.response.file_info_list[0].file_url,
-            id: item.response.file_info_list[0].file_id,
+            id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
+            media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
           articleImgRes.push(obj);
         }
@@ -226,7 +227,7 @@ export default {
         const obj = {
           name: file.name,
           url: file.response.file_info_list[0].file_url,
-          id: file.response.file_info_list[0].file_id,
+          id: "[FID##" + item.response.file_info_list[0].file_id + "#FID]",
           imgNumber: 0,
         };
         this.curQue.img_list.push(obj);

+ 2 - 1
src/components/Adult/inputModules/Sentence.vue

@@ -1,6 +1,6 @@
 <!--  -->
 <template>
-  <div class="Big-Book-sentence">
+  <div class="Big-Book-sentence" v-if="curQue">
     <div
       class="Big-Book-Single-content"
       style="margin-left: 50px; margin-top: 20px"
@@ -70,6 +70,7 @@ export default {
             con: "",
             answer: "",
             IsRecord: false,
+            mp3_url: [],
           },
         ],
       },

+ 24 - 47
src/components/Adult/inputModules/UploadControl.vue

@@ -5,9 +5,9 @@
       :changeFillId="changeFillId"
       :accept="accept"
       :filleNumber="1"
-      :fileList="fileList"
+      :fileList="curQue.fileList"
     />
-    <div class="dv">
+    <div class="dv" v-loading="loading">
       <div class="main">
         <div class="content">
           <template v-if="curQue.data">
@@ -23,24 +23,12 @@
               <pdf
                 ref="pdf"
                 :src="curQue.data.fileRelativePath"
-                v-for="i in numPages"
+                v-for="i in curQue.data.numPages"
                 :key="i"
                 :page="i"
               >
               </pdf>
             </template>
-            <template v-else>
-              <iframe
-                :src="
-                  'https://view.officeapps.live.com/op/view.aspx?src=' +
-                  `${curQue.data.file_url}`
-                "
-                width="100%"
-                height="1000px"
-                id="if"
-              >
-              </iframe>
-            </template>
           </template>
         </div>
       </div>
@@ -68,17 +56,12 @@ export default {
       numPages: null,
       accept: ".png,.jpg,.pdf",
       data_structure: {
-        type: "recordHZ_inputPY_chs",
-        name: "读汉字写拼音",
+        type: "upload_control_chs",
+        name: "上传控件",
         title: "",
-        option: [
-          {
-            number: "",
-            con: "",
-            answer: "",
-          },
-        ],
+        fileList: [],
       },
+      loading: false,
     };
   },
   computed: {},
@@ -87,16 +70,17 @@ export default {
   methods: {
     remove() {
       this.data = null;
-      tis.curQue.data = null;
-      this.fileList = [];
+      this.curQue.data = null;
+      this.curQue.fileList = [];
+      this.$message.success("删除成功");
     },
     changeFillId(fileList, item, index) {
-      this.fileList = fileList;
-      this.curQue.data = this.fileList[0].response.file_info_list[0];
+      this.curQue.fileList = fileList;
+      this.curQue.data = fileList[0].response.file_info_list[0];
       if (this.curQue.data.file_name.indexOf("pdf" != -1)) {
+        this.curQue.data = fileList[0].response.file_info_list[0];
         this.curQue.data.fileRelativePath =
           process.env.VUE_APP_BASE_API + this.curQue.data.file_relative_path;
-        this.curQue.data = this.fileList[0].response.file_info_list[0];
         this.getNumPages();
       }
     },
@@ -107,13 +91,19 @@ export default {
         _this.curQue.data.fileRelativePath
       );
       loadingTask.promise
-        .then((pdf) => {
-          _this.numPages = pdf.numPages;
+        .then((pdff) => {
+          _this.numPages = pdff.numPages;
+          _this.curQue.data.numPages = pdff.numPages;
+          this.$forceUpdate();
         })
         .catch((err) => {
-          console.error("pdf 加载失败", err);
+          this.$message.success("pdf 加载失败", err);
+          this.data = null;
+          this.curQue.data = null;
+          this.curQue.fileList = [];
         });
     },
+
     initcurQue() {
       let data = JSON.parse(JSON.stringify(this.data_structure));
       this.changeCurQue(data);
@@ -123,24 +113,11 @@ export default {
   created() {
     if (!this.curQue) {
       this.initcurQue();
+    } else {
     }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-    if (this.curQue.data && this.curQue.data.file_name.indexOf("pdf") != -1) {
-      let _this = this;
-      let loadingTask = pdf.createLoadingTask(
-        _this.curQue.data.fileRelativePath
-      );
-      loadingTask.promise
-        .then((pdf) => {
-          _this.numPages = pdf.numPages;
-        })
-        .catch((err) => {
-          console.error("pdf 加载失败", err);
-        });
-    }
-  },
+  mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
   beforeUpdate() {}, //生命周期 - 更新之前

+ 44 - 37
src/components/Adult/preview/UploadControlView.vue

@@ -6,9 +6,9 @@
         :changeFillId="changeFillId"
         :accept="accept"
         :filleNumber="1"
-        :fileList="fileList"
+        :fileList="curQue.fileList"
       />
-      <div class="uploadBtn">
+      <div class="uploadBtn" @click="downLoad">
         <img
           style="width: 24px; height: 24px"
           src="../../../assets/adult/download.png"
@@ -18,7 +18,7 @@
       </div>
     </div>
 
-    <div class="dv">
+    <div class="dv" v-loading="loading">
       <div class="main">
         <div class="content">
           <template v-if="curQue.data">
@@ -34,24 +34,12 @@
               <pdf
                 ref="pdf"
                 :src="curQue.data.fileRelativePath"
-                v-for="i in numPages"
+                v-for="i in curQue.data.numPages"
                 :key="i"
                 :page="i"
               >
               </pdf>
             </template>
-            <template v-else>
-              <iframe
-                :src="
-                  'https://view.officeapps.live.com/op/view.aspx?src=' +
-                  `${curQue.data.file_url}`
-                "
-                width="100%"
-                height="1000px"
-                id="if"
-              >
-              </iframe>
-            </template>
           </template>
         </div>
       </div>
@@ -65,12 +53,14 @@
 <script>
 import UploadView from "../common/UploadView.vue";
 import pdf from "vue-pdf";
+import { getToken } from "@/utils/auth";
+
 export default {
   components: {
     UploadView,
     pdf,
   },
-  props: ["curQue", "changeCurQue"],
+  props: ["curQue", "fn_data"],
   data() {
     return {
       uploadType: "",
@@ -90,24 +80,49 @@ export default {
           },
         ],
       },
+      loading: false,
     };
   },
   computed: {},
   watch: {},
   //方法集合
   methods: {
+    //   下载表格
+    downLoad() {
+      let userInfor = JSON.parse(getToken());
+      let UserCode = "",
+        UserType = "",
+        SessionID = "";
+      if (userInfor) {
+        UserCode = userInfor.user_code;
+        UserType = userInfor.user_type;
+        SessionID = userInfor.session_id;
+      }
+      let FileID = this.curQue.data.file_id;
+      let data = {
+        SessionID,
+        UserCode,
+        UserType,
+        FileID,
+      };
+      location.href =
+        process.env.VUE_APP_BASE_API +
+        `/GCLSFileServer/WebFileDownload?UserCode=${data.UserCode}&UserType=${data.UserType}&SessionID=${data.SessionID}&FileID=${data.FileID}`;
+    },
     remove() {
       this.data = null;
-      tis.curQue.data = null;
-      this.fileList = [];
+      this.curQue.data = null;
+      this.curQue.fileList = [];
+      this.$message.success("删除成功")
+
     },
     changeFillId(fileList, item, index) {
-      this.fileList = fileList;
-      this.curQue.data = this.fileList[0].response.file_info_list[0];
+      this.curQue.fileList = fileList;
+      this.curQue.data = fileList[0].response.file_info_list[0];
       if (this.curQue.data.file_name.indexOf("pdf" != -1)) {
+        this.curQue.data = fileList[0].response.file_info_list[0];
         this.curQue.data.fileRelativePath =
           process.env.VUE_APP_BASE_API + this.curQue.data.file_relative_path;
-        this.curQue.data = this.fileList[0].response.file_info_list[0];
         this.getNumPages();
       }
     },
@@ -118,8 +133,11 @@ export default {
         _this.curQue.data.fileRelativePath
       );
       loadingTask.promise
-        .then((pdf) => {
-          _this.numPages = pdf.numPages;
+        .then((pdff) => {
+          _this.numPages = pdff.numPages;
+          _this.curQue.data.numPages = pdff.numPages;
+          this.$forceUpdate();
+
         })
         .catch((err) => {
           console.error("pdf 加载失败", err);
@@ -132,19 +150,7 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    if (!this.curQue) {
-      this.initcurQue();
-    } else {
-      if (this.curQue.data && this.curQue.data.file_name.indexOf("pdf") != -1) {
-        let _this = this;
-        let loadingTask = pdf.createLoadingTask(
-          _this.curQue.data.fileRelativePath
-        );
-        loadingTask.promise.then((pdf) => {
-          _this.numPages = pdf.numPages;
-        });
-      }
-    }
+
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
@@ -199,6 +205,7 @@ export default {
     line-height: 150%;
     color: #000000;
     margin-left: 16px;
+    cursor: pointer;
     img {
       margin-right: 13px;
     }

+ 78 - 78
src/utils/request.js

@@ -10,94 +10,94 @@ axios.defaults.dataType = 'json'
 axios.defaults.headers['cache-control'] = 'no-cache'
 axios.defaults.headers['Content-Type'] = 'application/json'
 axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'
-// create an axios instance
+    // create an axios instance
 const service = axios.create({
-  baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
-  // withCredentials: true, // send cookies when cross-domain requests
-  timeout: 60000 // request timeout
+    baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
+    // withCredentials: true, // send cookies when cross-domain requests
+    timeout: 60000 // request timeout
 })
 
 // request interceptor
 service.interceptors.request.use(
-  config => {
-    // do something before request is sent
-    // let each request carry token
-    // ['X-Token'] is a custom headers key
-    // please modify it according to the actual situation
-    config.headers['Content-Type'] = 'application/json'
-    return config
-  },
-  error => {
-    // do something with request error
-    console.log(error) // for debug
-    return Promise.reject(error)
-  }
+    config => {
+        // do something before request is sent
+        // let each request carry token
+        // ['X-Token'] is a custom headers key
+        // please modify it according to the actual situation
+        config.headers['Content-Type'] = 'application/json'
+        return config
+    },
+    error => {
+        // do something with request error
+        console.log(error) // for debug
+        return Promise.reject(error)
+    }
 )
 
 // response interceptor
 service.interceptors.response.use(
-  /**
-   * If you want to get http information such as headers or status
-   * Please return  response => response
-   */
+    /**
+     * If you want to get http information such as headers or status
+     * Please return  response => response
+     */
 
-  /**
-   * Determine the request status by custom code
-   * Here is just an example
-   * You can also judge the status by HTTP Status Code
-   */
-  response => {
-    const res = response.data
-    console.log(res)
-    let msg = null
-    // if the custom code is not 20000, it is judged as an error.
-    if (res.status == 0 || res.status == -2) {
-      // 执行错误  JSON 数据格式错误
-      msg = Message({
-        message: res.msg || res.error || 'Error',
-        type: 'error',
-        showClose: true,
-        duration: 0
-      })
-      return Promise.reject(new Error(res.message || res.error || 'Error'))
-    } else if (res.status === -1) {
-      // 登录失效
-      Cookies.remove('session_id')
-      Cookies.remove('user_code')
-      Cookies.remove('user_real_name')
-      Cookies.remove('user_type')
-      removeToken();
-      msg = Message({
-        message: '登录会话失效,请重新登录',
-        type: 'error',
-        showClose: true,
-        duration: 0
-      })
-      if (process.env.NODE_ENV === 'development') {
-        router.push(`/login`)
-      } else {
-        window.location.href = '/';
-      }
-      return false
-    } else {
-      Message.closeAll()
-      return res
-    }
-  },
-  error => {
-    // || (error+1).indexOf('500') > -1
-    if ((error + 1).indexOf('401') > -1) {
-      // console.log(router)
-      // store.dispatch('user/postError')
-      // router.push(`/login`)
+    /**
+     * Determine the request status by custom code
+     * Here is just an example
+     * You can also judge the status by HTTP Status Code
+     */
+    response => {
+        const res = response.data
+        console.log(res)
+        let msg = null
+            // if the custom code is not 20000, it is judged as an error.
+        if (res.status == 0 || res.status == -2) {
+            // 执行错误  JSON 数据格式错误
+            msg = Message({
+                message: res.msg || res.error || 'Error',
+                type: 'error',
+                showClose: true,
+                duration: 0
+            })
+            return Promise.reject(new Error(res.message || res.error || 'Error'))
+        } else if (res.status === -1) {
+            // 登录失效
+            Cookies.remove('session_id')
+            Cookies.remove('user_code')
+            Cookies.remove('user_real_name')
+            Cookies.remove('user_type')
+            removeToken();
+            msg = Message({
+                message: '登录会话失效,请重新登录',
+                type: 'error',
+                showClose: true,
+                duration: 0
+            })
+            if (process.env.NODE_ENV === 'development') {
+                router.push(`/login`)
+            } else {
+                window.location.href = '/';
+            }
+            return false
+        } else {
+            Message.closeAll()
+            return res
+        }
+    },
+    error => {
+        // || (error+1).indexOf('500') > -1
+        if ((error + 1).indexOf('401') > -1) {
+            // console.log(router)
+            // store.dispatch('user/postError')
+            // router.push(`/login`)
+        }
+        Message({
+            message: '网络错误,请稍后重试',
+            type: 'error',
+            duration: 2 * 1000
+        })
+        return Promise.reject(error)
     }
-    Message({
-      message: '网络错误,请稍后重试',
-      type: 'error',
-      duration: 2 * 1000
-    })
-    return Promise.reject(error)
-  }
 )
 
-export default service
+export default service

+ 4 - 4
src/views/adultInput2.vue

@@ -174,7 +174,7 @@
                     选择模板
                   </div>
                   <div
-                    v-if="!topicIitem.data && topicIitem.is_addModule"
+                    v-if="!topicIitem.data && topicIitem.is_add_module"
                     class="addoption"
                     @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
                   >
@@ -414,7 +414,7 @@ export default {
           for (let j = 0; j < this.line; j++) {
             let obj = {
               text: `第${i + 1}行,第${j + 1}列`,
-              is_addModule: true,
+              is_add_module: true,
               is_edit: true,
             };
             rowArr.push(obj);
@@ -433,7 +433,7 @@ export default {
       this.TopicIndex = topicIndex;
       this.RowIndex = rowindex;
       this.LineIndex = lineIndex;
-      item.is_addModule = false;
+      item.is_add_module = false;
     },
     // 删除模板
     remoeModule(topicIndex, rowindex, lineIndex, item) {
@@ -451,7 +451,7 @@ export default {
       this.TopicIndex = null;
       this.RowIndex = null;
       this.LineIndex = null;
-      item.is_addModule = true;
+      item.is_add_module = true;
     },
     handleClosePre() {
       if (window.stopAudioVoice) window.stopAudioVoice();

+ 96 - 95
vue.config.js

@@ -3,7 +3,7 @@ const path = require('path')
 const defaultSettings = require('./src/settings.js')
 
 function resolve(dir) {
-  return path.join(__dirname, dir)
+    return path.join(__dirname, dir)
 }
 
 const name = defaultSettings.title || '发展汉语' // page title
@@ -19,102 +19,103 @@ const webpack = require('webpack')
 
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
-  /**
-   * You will need to set publicPath if you plan to deploy your site under a sub path,
-   * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
-   * then publicPath should be set to "/bar/".
-   * In most cases please use '/' !!!
-   * Detail: https://cli.vuejs.org/config/#publicpath
-   */
-  publicPath: process.env.NODE_ENV === 'development' ? '/' : '/GCLS-Book',
-  outputDir: 'dist',
-  assetsDir: 'static',
-  lintOnSave: false,
-  productionSourceMap: false,
-  devServer: {
-    port: port,
-    open: true,
-    overlay: {
-      warnings: false,
-      errors: true
-    },
-    proxy: {
-      // change xxx-api/login => mock/login
-      // detail: https://cli.vuejs.org/config/#devserver-proxy
-      [process.env.VUE_APP_BASE_API]: {
-        target: `http://gcls.helxsoft.cn/`,
-        changeOrigin: true,
-        pathRewrite: {
-          ['^' + process.env.VUE_APP_BASE_API]: ''
-        }
-      }
+    /**
+     * You will need to set publicPath if you plan to deploy your site under a sub path,
+     * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
+     * then publicPath should be set to "/bar/".
+     * In most cases please use '/' !!!
+     * Detail: https://cli.vuejs.org/config/#publicpath
+     */
+    publicPath: process.env.NODE_ENV === 'development' ? '/' : '/GCLS-Book',
+    outputDir: 'dist',
+    assetsDir: 'static',
+    lintOnSave: false,
+    productionSourceMap: false,
+    devServer: {
+        port: port,
+        open: true,
+        overlay: {
+            warnings: false,
+            errors: true
+        },
+        proxy: {
+            // change xxx-api/login => mock/login
+            // detail: https://cli.vuejs.org/config/#devserver-proxy
+            [process.env.VUE_APP_BASE_API]: {
+                target: `http://gcls.helxsoft.cn/`,
+                changeOrigin: true,
+                pathRewrite: {
+                    ['^' + process.env.VUE_APP_BASE_API]: ''
+                }
+            },
+        },
+
+        after: require('./mock/mock-server.js')
     },
-    after: require('./mock/mock-server.js')
-  },
-  chainWebpack(config) {
-    // it can improve the speed of the first screen, it is recommended to turn on preload
-    config.plugin('preload').tap(() => [{
-      rel: 'preload',
-      // to ignore runtime.js
-      // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
-      fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
-      include: 'initial'
-    }])
+    chainWebpack(config) {
+        // it can improve the speed of the first screen, it is recommended to turn on preload
+        config.plugin('preload').tap(() => [{
+            rel: 'preload',
+            // to ignore runtime.js
+            // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
+            fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
+            include: 'initial'
+        }])
 
-    // when there are many pages, it will cause too many meaningless requests
-    config.plugins.delete('prefetch')
+        // when there are many pages, it will cause too many meaningless requests
+        config.plugins.delete('prefetch')
 
-    // set svg-sprite-loader
-    config.module
-      .rule('svg')
-      .exclude.add(resolve('src/icons'))
-      .end()
-    config.module
-      .rule('icons')
-      .test(/\.svg$/)
-      .include.add(resolve('src/icons'))
-      .end()
-      .use('svg-sprite-loader')
-      .loader('svg-sprite-loader')
-      .options({
-        symbolId: 'icon-[name]'
-      })
-      .end()
+        // set svg-sprite-loader
+        config.module
+            .rule('svg')
+            .exclude.add(resolve('src/icons'))
+            .end()
+        config.module
+            .rule('icons')
+            .test(/\.svg$/)
+            .include.add(resolve('src/icons'))
+            .end()
+            .use('svg-sprite-loader')
+            .loader('svg-sprite-loader')
+            .options({
+                symbolId: 'icon-[name]'
+            })
+            .end()
 
-    config.when(process.env.NODE_ENV !== 'development', config => {
-      config
-        .plugin('ScriptExtHtmlWebpackPlugin')
-        .after('html')
-        .use('script-ext-html-webpack-plugin', [{
-          // `runtime` must same as runtimeChunk name. default is `runtime`
-          inline: /runtime\..*\.js$/
-        }])
-        .end()
-      config.optimization.splitChunks({
-        chunks: 'all',
-        cacheGroups: {
-          libs: {
-            name: 'chunk-libs',
-            test: /[\\/]node_modules[\\/]/,
-            priority: 10,
-            chunks: 'initial' // only package third parties that are initially dependent
-          },
-          elementUI: {
-            name: 'chunk-elementUI', // split elementUI into a single package
-            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
-            test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
-          },
-          commons: {
-            name: 'chunk-commons',
-            test: resolve('src/components'), // can customize your rules
-            minChunks: 3, //  minimum common number
-            priority: 5,
-            reuseExistingChunk: true
-          }
-        }
-      })
-      // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
-      config.optimization.runtimeChunk('single')
-    })
-  }
+        config.when(process.env.NODE_ENV !== 'development', config => {
+            config
+                .plugin('ScriptExtHtmlWebpackPlugin')
+                .after('html')
+                .use('script-ext-html-webpack-plugin', [{
+                    // `runtime` must same as runtimeChunk name. default is `runtime`
+                    inline: /runtime\..*\.js$/
+                }])
+                .end()
+            config.optimization.splitChunks({
+                    chunks: 'all',
+                    cacheGroups: {
+                        libs: {
+                            name: 'chunk-libs',
+                            test: /[\\/]node_modules[\\/]/,
+                            priority: 10,
+                            chunks: 'initial' // only package third parties that are initially dependent
+                        },
+                        elementUI: {
+                            name: 'chunk-elementUI', // split elementUI into a single package
+                            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+                            test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
+                        },
+                        commons: {
+                            name: 'chunk-commons',
+                            test: resolve('src/components'), // can customize your rules
+                            minChunks: 3, //  minimum common number
+                            priority: 5,
+                            reuseExistingChunk: true
+                        }
+                    }
+                })
+                // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
+            config.optimization.runtimeChunk('single')
+        })
+    }
 }