Browse Source

1、eslint lint 2、移动下载离线包位置

dsy 1 month ago
parent
commit
493307d51e
37 changed files with 4147 additions and 6430 deletions
  1. 3619 5815
      package-lock.json
  2. 12 9
      src/api/book.js
  3. 0 5
      src/components/MindMap.vue
  4. 0 0
      src/components/RichText.vue
  5. 1 1
      src/utils/auth.js
  6. 1 1
      src/views/book/courseware/create/components/base/common/UploadFile.vue
  7. 2 2
      src/views/book/courseware/create/components/question/notes/Notes.vue
  8. 2 2
      src/views/book/courseware/create/components/question/other_word/OtherWord.vue
  9. 0 1
      src/views/book/courseware/create/components/question/video_interaction/VideoInteraction.vue
  10. 3 3
      src/views/book/courseware/data/bookType.js
  11. 18 17
      src/views/book/courseware/data/dialogueArticle.js
  12. 0 2
      src/views/book/courseware/preview/CoursewarePreview.vue
  13. 10 13
      src/views/book/courseware/preview/components/article/NormalModelChs.vue
  14. 30 34
      src/views/book/courseware/preview/components/article/PhraseModelChs.vue
  15. 13 15
      src/views/book/courseware/preview/components/article/Practicechs.vue
  16. 173 198
      src/views/book/courseware/preview/components/article/Voicefullscreen.vue
  17. 12 14
      src/views/book/courseware/preview/components/article/WordModelChs.vue
  18. 2 14
      src/views/book/courseware/preview/components/article/components/AudioCompare.vue
  19. 7 8
      src/views/book/courseware/preview/components/article/components/Freewrite.vue
  20. 7 16
      src/views/book/courseware/preview/components/article/components/FreewriteLettle.vue
  21. 10 12
      src/views/book/courseware/preview/components/article/components/Soundrecorddiff.vue
  22. 3 3
      src/views/book/courseware/preview/components/article/components/Strockplayredline.vue
  23. 1 1
      src/views/book/courseware/preview/components/article/components/WordPhraseDetail.vue
  24. 4 4
      src/views/book/courseware/preview/components/article/index.vue
  25. 3 3
      src/views/book/courseware/preview/components/dialogue_article/Practicechs.vue
  26. 4 5
      src/views/book/courseware/preview/components/drawing/DrawingPreview.vue
  27. 2 2
      src/views/book/courseware/preview/components/image_text/ImageTextPreview.vue
  28. 1 1
      src/views/book/courseware/preview/components/new_word/NewWordPreview.vue
  29. 4 4
      src/views/book/courseware/preview/components/new_word/components/Strockplay.vue
  30. 1 1
      src/views/book/courseware/preview/components/new_word/components/writeTableZoom.vue
  31. 0 24
      src/views/login/userAgreement.vue
  32. 1 1
      src/views/personal_workbench/edit_task/edit/index.vue
  33. 0 181
      src/views/personal_workbench/edit_task/preview/index.vue
  34. 9 12
      src/views/personal_workbench/project/ProductionResourceManage.vue
  35. 187 1
      src/views/project_manage/org/book/index.vue
  36. 4 4
      src/views/project_manage/project/ProjectVisNetwork.vue
  37. 1 1
      vue.config.js

File diff suppressed because it is too large
+ 3619 - 5815
package-lock.json


+ 12 - 9
src/api/book.js

@@ -285,49 +285,49 @@ export function GetBookUnifiedAttrib(data) {
 
 /**
  *@description 添加我的笔记
- * @param {object} data  
+ * @param {object} data
  */
 export function AddMyNote(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-AddMyNote`, data);
 }
 /**
  *@description 更新我的笔记
- * @param {object} data  
+ * @param {object} data
  */
 export function UpdateMyNote(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-UpdateMyNote`, data);
 }
 /**
  * @description 得到我的笔记列表
- * @param {object} data 
+ * @param {object} data
  */
 export function GetMyNoteList(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-GetMyNoteList`, data);
 }
 /**
  * @description 删除我的笔记
- * @param {object} data 
+ * @param {object} data
  */
 export function DeleteMyNote(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-DeleteMyNote`, data);
 }
 /**
  *@description 添加我的收藏
- * @param {object} data  
+ * @param {object} data
  */
 export function AddMyCollect(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-AddMyCollect`, data);
 }
 /**
  * @description 得到我的收藏列表
- * @param {object} data 
+ * @param {object} data
  */
 export function GetMyCollectList(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-GetMyCollectList`, data);
 }
 /**
  * @description 删除我的收藏
- * @param {object} data 
+ * @param {object} data
  */
 export function DeleteMyCollect(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_preview_manager-DeleteMyCollect`, data);
@@ -338,7 +338,10 @@ export function DeleteMyCollect(data) {
  * @param {object} data
  */
 export function MangerGenerateKnowledgeGraphByBookContent(data) {
-  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_content_manager-GenerateKnowledgeGraphByBookContent`,data);
+  return http.post(
+    `${process.env.VUE_APP_EepServer}?MethodName=book_content_manager-GenerateKnowledgeGraphByBookContent`,
+    data,
+  );
 }
 
 /**
@@ -355,4 +358,4 @@ export function GetBookKnowledgeGraph(data) {
  */
 export function SaveBookKnowledgeGraph(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_content_manager-SaveBookKnowledgeGraph`, data);
-}
+}

File diff suppressed because it is too large
+ 0 - 5
src/components/MindMap.vue


File diff suppressed because it is too large
+ 0 - 0
src/components/RichText.vue


+ 1 - 1
src/utils/auth.js

@@ -48,7 +48,7 @@ const TokenKey = 'GCLS_Token';
 
 export function getSessionID() {
   const token = getItemWithExpiry(TokenKey);
-  return token ? token.session_id ?? '' : '';
+  return token ? (token.session_id ?? '') : '';
 }
 
 export function getToken() {

+ 1 - 1
src/views/book/courseware/create/components/base/common/UploadFile.vue

@@ -38,7 +38,7 @@
             <span v-else>{{
               canEditName && file.file_id
                 ? content.file_info[file.file_id].xuhao + content.file_info[file.file_id].file_name
-                : file.file_name ?? file.name
+                : (file.file_name ?? file.name)
             }}</span>
             <!-- <span>({{ file.size }})</span> -->
           </span>

+ 2 - 2
src/views/book/courseware/create/components/question/notes/Notes.vue

@@ -142,11 +142,11 @@ export default {
     // 上移下移
     moveElement(dItem, index, type) {
       let obj = JSON.parse(JSON.stringify(dItem));
-      if (type == 'up' && index > 0) {
+      if (type === 'up' && index > 0) {
         this.data.option.splice(index - 1, 0, obj);
         this.data.option.splice(index + 1, 1);
       }
-      if (type == 'down' && index < this.data.option.length - 1) {
+      if (type === 'down' && index < this.data.option.length - 1) {
         this.data.option[index] = this.data.option.splice(index + 1, 1, this.data.option[index])[0];
       }
     },

+ 2 - 2
src/views/book/courseware/create/components/question/other_word/OtherWord.vue

@@ -281,11 +281,11 @@ export default {
     // 上移下移
     moveElement(dItem, index, type) {
       let obj = JSON.parse(JSON.stringify(dItem));
-      if (type == 'up' && index > 0) {
+      if (type === 'up' && index > 0) {
         this.data.option.splice(index - 1, 0, obj);
         this.data.option.splice(index + 1, 1);
       }
-      if (type == 'down' && index < this.data.option.length - 1) {
+      if (type === 'down' && index < this.data.option.length - 1) {
         this.data.option[index] = this.data.option.splice(index + 1, 1, this.data.option[index])[0];
       }
     },

+ 0 - 1
src/views/book/courseware/create/components/question/video_interaction/VideoInteraction.vue

@@ -93,7 +93,6 @@ import UploadFile from '../../base/common/UploadFile.vue';
 import ExerciseAdd from './ExerciseAdd.vue';
 
 import { getVideoInteractionData } from '@/views/book/courseware/data/videoInteraction';
-import { GetFileURLMap } from '@/api/app';
 import { GetCoursewareExercise } from '@/api/book';
 
 export default {

+ 3 - 3
src/views/book/courseware/data/bookType.js

@@ -37,8 +37,8 @@ import PinyinBaseSetting from '../create/components/question/pinyin_base/PinyinB
 // import CharacterBaseSetting from '../create/components/base/character_base/CharacterBaseSetting.vue';
 import Character from '../create/components/question/character/Character.vue';
 import CharacterSetting from '../create/components/question/character/CharacterSetting.vue';
-import Write from '../create/components/question/write/Write.vue';
-import WriteSetting from '../create/components/question/write/WriteSetting.vue';
+// import Write from '../create/components/question/write/Write.vue';
+// import WriteSetting from '../create/components/question/write/WriteSetting.vue';
 import NewWord from '../create/components/question/new_word/NewWord.vue';
 import NewWordSetting from '../create/components/question/new_word/NewWordSetting.vue';
 import Notes from '../create/components/question/notes/Notes.vue';
@@ -94,7 +94,7 @@ import UploadPreviewPreview from '../preview/components/upload_preview/UploadPre
 import PinyinBasePreview from '../preview/components/pinyin_base/PinyinBasePreview.vue';
 // import CharacterBasePreview from '../preview/components/character_base/CharacterBasePreview.vue';
 import CharacterPreview from '../preview/components/character/CharacterPreview.vue';
-import WritePreview from '../preview/components/write/WritePreview.vue';
+// import WritePreview from '../preview/components/write/WritePreview.vue';
 import NewWordPreview from '../preview/components/new_word/NewWordPreview.vue';
 import NotesPreview from '../preview/components/notes/NotesPreview.vue';
 // import OtherWordPreview from '../preview/components/other_word/OtherWordPreview.vue';

+ 18 - 17
src/views/book/courseware/data/dialogueArticle.js

@@ -81,6 +81,24 @@ export const multilingualList = [
   { value: 'all', label: '整篇' },
 ];
 
+/**
+ * 获取角色对象
+ * @param {number} index 序号
+ * @param {string} name 名称
+ */
+export function getRole(index, name = '') {
+  return {
+    name: name || `角色${index + 1}`,
+    mark: getRandomNumber(),
+    color: roleDefaultColorList[index % 5],
+    simpleHead: '',
+    img_list: [],
+    fullName: '',
+    fullPinyin: '',
+    id: Math.random().toString(36).substr(2),
+  };
+}
+
 export function getArticleProperty() {
   return {
     serial_number: 1,
@@ -102,23 +120,6 @@ export function getArticleProperty() {
   };
 }
 
-/**
- * 获取角色对象
- * @param {number} index 序号
- * @param {string} name 名称
- */
-export function getRole(index, name = '') {
-  return {
-    name: name || `角色${index + 1}`,
-    mark: getRandomNumber(),
-    color: roleDefaultColorList[index % 5],
-    simpleHead: '',
-    img_list: [],
-    fullName: '',
-    fullPinyin: '',
-    id: Math.random().toString(36).substr(2),
-  };
-}
 export function getArticleData() {
   return {
     type: 'dialogue_article',

+ 0 - 2
src/views/book/courseware/preview/CoursewarePreview.vue

@@ -540,9 +540,7 @@ export default {
       // 方案1A:使用Range的边界点精确定位
       try {
         const startContainer = range.startContainer;
-        const endContainer = range.endContainer;
         const startOffset = range.startOffset;
-        const endOffset = range.endOffset;
 
         // 找到选择开始的元素在textFragments中的位置
         let startFragmentIndex = -1;

+ 10 - 13
src/views/book/courseware/preview/components/article/NormalModelChs.vue

@@ -514,9 +514,8 @@
                                 : '',
                           }"
                         >
-                          <template>
+                          <template v-for="(wItem, wIndex) in pItem.leg">
                             <span
-                              v-for="(wItem, wIndex) in pItem.leg"
                               :key="'ci' + wIndex + pIndex + index"
                               :class="[
                                 isPlaying &&
@@ -693,9 +692,8 @@
                             sentIndex == index ? 'wordBlank' : '',
                           ]"
                         >
-                          <template>
+                          <template v-for="(wItem, wIndex) in pItem.leg">
                             <span
-                              v-for="(wItem, wIndex) in pItem.leg"
                               :key="'ci' + wIndex + pIndex + index"
                               :class="[
                                 pItem.timeList[wIndex] &&
@@ -1008,9 +1006,8 @@
                             attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                         }"
                       >
-                        <template>
+                        <template v-for="(wItem, wIndex) in pItem.leg">
                           <span
-                            v-for="(wItem, wIndex) in pItem.leg"
                             :key="'ci' + wIndex + pIndex + index"
                             :class="[
                               pItem.timeList[wIndex] &&
@@ -1246,7 +1243,7 @@ export default {
   },
   watch: {
     noteNum: {
-      handler(val, oldVal) {
+      handler(val) {
         let _this = this;
         if (val) {
           _this.handleNote(val);
@@ -1256,7 +1253,7 @@ export default {
       deep: true,
     },
     isNoteShow: {
-      handler(val, oldVal) {
+      handler(val) {
         let _this = this;
         if (val) {
           setTimeout(() => {
@@ -1273,7 +1270,7 @@ export default {
       deep: true,
     },
     curQue: {
-      handler(val, oldVal) {
+      handler(val) {
         if (val) {
           this.handleData();
         }
@@ -1423,8 +1420,8 @@ export default {
           let sentArr = [];
 
           sItem.forEach((wItem, wIndex) => {
-            let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
-            let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
+            let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
+            let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
             // this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbol(wItem);
             let obj = {
@@ -1450,7 +1447,7 @@ export default {
           });
           let objs = {
             sentArr,
-            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
+            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
           };
           sentArrTotal.push(sentArr);
           resArrs.push(objs);
@@ -1584,8 +1581,8 @@ export default {
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
+
 <style lang="scss" scoped>
-//@import url(); 引入公共css类
 .NNPE-ArticleView {
   width: 100%;
 

+ 30 - 34
src/views/book/courseware/preview/components/article/PhraseModelChs.vue

@@ -482,9 +482,8 @@
                             pItem.words ? 'active' : '',
                           ]"
                         >
-                          <template>
+                          <template v-for="(wItem, wIndex) in pItem.leg">
                             <span
-                              v-for="(wItem, wIndex) in pItem.leg"
                               :key="'ci' + wIndex + pIndex + index"
                               :class="[]"
                               :style="{
@@ -696,9 +695,8 @@
                           pItem.words ? 'active' : '',
                         ]"
                       >
-                        <template>
+                        <template v-for="(wItem, wIndex) in pItem.leg">
                           <span
-                            v-for="(wItem, wIndex) in pItem.leg"
                             :key="'ci' + wIndex + pIndex + index"
                             :class="[]"
                             :style="{
@@ -939,7 +937,6 @@ export default {
       curNoteCon: null,
       isNoteShow: false,
       oldNoteNum: '',
-      clientY: 0,
       clickType: '',
       sentIndex: -1,
       highWords: null,
@@ -952,7 +949,7 @@ export default {
   computed: {},
   watch: {
     hz: {
-      handler(val, oldVal) {
+      handler(val) {
         let _this = this;
         if (val) {
           _this.handleNewWords(val);
@@ -962,7 +959,7 @@ export default {
       deep: true,
     },
     isShow: {
-      handler(val, oldVal) {
+      handler(val) {
         let _this = this;
         if (val) {
           setTimeout(() => {
@@ -979,7 +976,7 @@ export default {
       deep: true,
     },
     noteNum: {
-      handler(val, oldVal) {
+      handler(val) {
         let _this = this;
         if (val) {
           _this.handleNote(val);
@@ -989,7 +986,7 @@ export default {
       deep: true,
     },
     isNoteShow: {
-      handler(val, oldVal) {
+      handler(val) {
         let _this = this;
         if (val) {
           setTimeout(() => {
@@ -1137,8 +1134,8 @@ export default {
           let sentArr = [];
 
           sItem.forEach((wItem, wIndex) => {
-            let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
-            let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
+            let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
+            let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
             // this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbols(wItem);
             let obj = {
@@ -1167,7 +1164,7 @@ export default {
           });
           let objs = {
             sentArr,
-            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
+            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
           };
           sentArrTotal.push(sentArr);
           resArrs.push(objs);
@@ -1191,27 +1188,27 @@ export default {
       let endIndex = 0;
       let words = '';
       this.newWordList.forEach((item) => {
-        if (item.length == 1) {
-          if (item == wItem.chs && !wItem.banLight) {
+        if (item.length === 1) {
+          if (item === wItem.chs && !wItem.banLight) {
             words = wItem.chs;
             endIndex = startIndex + 1;
           }
-        } else if (item[0] == wItem.chs && sentence.indexOf(item) > -1) {
+        } else if (item[0] === wItem.chs && sentence.indexOf(item) > -1) {
           let index = null;
           let chsStr = '';
           for (let i = startIndex; i < sItem.length + 1; i++) {
             index = i;
-            if (chsStr.length == item.length) {
+            if (chsStr.length === item.length) {
               break;
             } else {
               chsStr += sItem[i] ? sItem[i].chs : '';
             }
           }
-          if (chsStr == item && !wItem.banLight) {
+          if (chsStr === item && !wItem.banLight) {
             words = item;
             endIndex = index;
           }
-        } else if (wItem.new_word && wItem.new_word == item && !wItem.banLight) {
+        } else if (wItem.new_word && wItem.new_word === item && !wItem.banLight) {
           words = item;
           endIndex = startIndex + 1;
         }
@@ -1281,7 +1278,7 @@ export default {
     handleTimeList(list) {
       let listRes = [];
       list.forEach((item) => {
-        let res = timeStrToSen(item);
+        let res = this.timeStrToSen(item);
         listRes.push(res);
       });
       return listRes;
@@ -1326,19 +1323,19 @@ export default {
       if (word && this.newWordList.indexOf(word) > -1) {
         this.highWordsArr.push(word);
       }
-      if (words && word != words && this.newWordList.indexOf(words) > -1) {
+      if (words && word !== words && this.newWordList.indexOf(words) > -1) {
         this.highWordsArr.push(words);
       }
       if (this.newWordList.indexOf(word) > -1 || this.newWordList.indexOf(words) > -1) {
         if (word && this.newWordList.indexOf(word) > -1) {
-          if (_this.oldHz != word) {
+          if (_this.oldHz !== word) {
             this.isShow = false;
             setTimeout(() => {
               _this.hz = word;
             }, 50);
           }
         } else if (words && this.newWordList.indexOf(words) > -1) {
-          if (_this.oldHz != words) {
+          if (_this.oldHz !== words) {
             this.isShow = false;
             setTimeout(() => {
               _this.hz = words;
@@ -1349,9 +1346,9 @@ export default {
         let left = e.clientX;
         let width = 0;
 
-        if (word.length == 1 || word.length == 2) {
+        if (word.length === 1 || word.length === 2) {
           width = 304;
-        } else if (word.length == 3 || word.length == 4) {
+        } else if (word.length === 3 || word.length === 4) {
           width = 432;
         } else if (word.length > 3) {
           width = 560;
@@ -1380,7 +1377,7 @@ export default {
         let item = this.NNPENewWordList[i];
         // for (let j = 0; j < pItem.length; j++) {
         // let item = pItem[j];
-        if (item.new_word.trim() == val.trim()) {
+        if (item.new_word.trim() === val.trim()) {
           let wordlist = val.split('');
           this.word = { list: wordlist, detail: item, top, left };
           break;
@@ -1410,14 +1407,14 @@ export default {
       let noteIndex = '';
       if (_this.NumberList.indexOf(noteNum) > -1) {
         for (let i = 0; i < _this.NumberList.length; i++) {
-          if (_this.NumberList[i] == noteNum) {
+          if (_this.NumberList[i] === noteNum) {
             noteIndex = `${String(i)}`;
             break;
           }
         }
         this.showNoteDetail(e, noteIndex);
       } else if (this.newWordList.indexOf(noteNum) > -1) {
-        if (_this.oldHz != noteNum) {
+        if (_this.oldHz !== noteNum) {
           this.isShow = false;
           _this.NNPENewWordList.forEach((items) => {
             // item.forEach((items) => {
@@ -1434,9 +1431,9 @@ export default {
         let left = e.clientX;
         let width = 0;
 
-        if (noteNum.length == 1 || noteNum.length == 2) {
+        if (noteNum.length === 1 || noteNum.length === 2) {
           width = 304;
-        } else if (noteNum.length == 3 || noteNum.length == 4) {
+        } else if (noteNum.length === 3 || noteNum.length === 4) {
           width = 432;
         } else if (noteNum.length > 3) {
           width = 560;
@@ -1448,7 +1445,7 @@ export default {
           _this.left = left;
         }
       } else if (this.newWordList.indexOf(noteNums) > -1) {
-        if (_this.oldHz != noteNums) {
+        if (_this.oldHz !== noteNums) {
           this.isShow = false;
           _this.NNPENewWordList.forEach((items) => {
             // item.forEach((items) => {
@@ -1465,9 +1462,9 @@ export default {
         let left = e.clientX;
         let width = 0;
 
-        if (noteNums.length == 1 || noteNums.length == 2) {
+        if (noteNums.length === 1 || noteNums.length === 2) {
           width = 304;
-        } else if (noteNums.length == 3 || noteNums.length == 4) {
+        } else if (noteNums.length === 3 || noteNums.length === 4) {
           width = 432;
         } else if (noteNums.length > 3) {
           width = 560;
@@ -1482,7 +1479,7 @@ export default {
     },
     showNoteDetail(e, noteNum) {
       let _this = this;
-      if (_this.oldNoteNum != noteNum) {
+      if (_this.oldNoteNum !== noteNum) {
         this.isNoteShow = false;
         setTimeout(() => {
           _this.noteNum = noteNum;
@@ -1519,7 +1516,6 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
-//@import url(); 引入公共css类
 .NNPE-ArticleView {
   width: 100%;
 

+ 13 - 15
src/views/book/courseware/preview/components/article/Practicechs.vue

@@ -134,9 +134,8 @@
                           sentIndex == index ? 'wordBlank' : '',
                         ]"
                       >
-                        <template>
+                        <template v-for="(wItem, wIndex) in pItem.leg">
                           <span
-                            v-for="(wItem, wIndex) in pItem.leg"
                             :key="'ci' + wIndex + pIndex + index"
                             :class="[
                               pItem.timeList[wIndex] &&
@@ -381,9 +380,8 @@
                         sentIndex == index ? 'wordBlank' : '',
                       ]"
                     >
-                      <template>
+                      <template v-for="(wItem, wIndex) in pItem.leg">
                         <span
-                          v-for="(wItem, wIndex) in pItem.leg"
                           :key="'ci' + wIndex + pIndex + index"
                           :class="[
                             pItem.timeList[wIndex] &&
@@ -704,7 +702,7 @@ export default {
     sentIndex: {
       handler(newVal, oldVal) {
         let _this = this;
-        if (newVal != oldVal) {
+        if (newVal !== oldVal) {
           let Bookanswer = _this.curQue.Bookanswer;
           if (
             Bookanswer &&
@@ -722,7 +720,7 @@ export default {
       deep: true,
     },
     isFull: {
-      handler(newVal, oldVal) {
+      handler(newVal) {
         let _this = this;
         _this.refresh = false;
         if (!newVal) {
@@ -769,7 +767,7 @@ export default {
     },
     pauseAudio() {
       let audio = document.getElementsByTagName('audio');
-      if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && audio.forEach) {
+      if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') === -1 && audio.forEach) {
         audio.forEach((item) => {
           item.pause();
         });
@@ -777,7 +775,7 @@ export default {
     },
     pauseVideo() {
       let video = document.getElementsByTagName('video');
-      if (video && video.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && video.forEach) {
+      if (video && video.length > 0 && window.location.href.indexOf('GCLS-Learn') === -1 && video.forEach) {
         video.forEach((item) => {
           item.pause();
         });
@@ -867,8 +865,8 @@ export default {
           let sentArr = [];
 
           sItem.forEach((wItem, wIndex) => {
-            let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
-            let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
+            let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
+            let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
             // this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbol(wItem);
             let obj = {
@@ -898,7 +896,7 @@ export default {
           });
           let objs = {
             sentArr,
-            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
+            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
           };
           sentArrTotal.push(sentArr);
           resArr.push(objs);
@@ -962,7 +960,7 @@ export default {
     handleTimeList(list) {
       let listRes = [];
       list.forEach((item) => {
-        let res = timeStrToSen(item);
+        let res = this.timeStrToSen(item);
         listRes.push(res);
       });
       return listRes;
@@ -1006,11 +1004,11 @@ export default {
       this.ed = undefined;
     },
     handleWav(list, tmIndex) {
-      tmIndex = tmIndex || 0;
-      this.curQue.Bookanswer.practiceModel[tmIndex] = {
+      let _tmIndex = tmIndex || 0;
+      this.curQue.Bookanswer.practiceModel[_tmIndex] = {
         recordList: [],
       };
-      this.$set(this.curQue.Bookanswer.practiceModel[tmIndex], 'recordList', list);
+      this.$set(this.curQue.Bookanswer.practiceModel[_tmIndex], 'recordList', list);
     },
     // 录音时暂停音频播放
     handleParentPlay() {

+ 173 - 198
src/views/book/courseware/preview/components/article/Voicefullscreen.vue

@@ -299,9 +299,8 @@
                         height: hzSize * 1.17 + 'px',
                       }"
                     >
-                      <template>
+                      <template v-for="(wItem, wIndex) in pItem.leg">
                         <span
-                          v-for="(wItem, wIndex) in pItem.leg"
                           :key="'ci' + wIndex + pIndex + curSentIndex"
                           :class="[
                             pItem.timeList &&
@@ -557,8 +556,6 @@
 
 <script>
 import AudioLineSentence from './components/AudioLineSentence.vue';
-import Soundrecorddiff from './components/Soundrecorddiff.vue';
-import AudioCompare from './components/AudioCompare.vue';
 import Wordcard from './components/Wordcard.vue';
 import Notecard from './components/Notecard.vue'; // 注释
 import { LearnWebSI } from '@/api/app';
@@ -567,8 +564,6 @@ export default {
   name: 'VoiceFullScreen',
   components: {
     AudioLineSentence,
-    Soundrecorddiff,
-    AudioCompare,
     Wordcard,
     Notecard,
   },
@@ -658,7 +653,7 @@ export default {
   },
   watch: {
     isRecording: {
-      handler(newVal, oldVal) {
+      handler(newVal) {
         if (newVal) {
           this.isBottomShow = newVal;
         }
@@ -666,7 +661,7 @@ export default {
       deep: true,
     },
     recordPlaying: {
-      handler(newVal, oldVal) {
+      handler(newVal) {
         if (newVal) {
           this.isBottomShow = newVal;
         }
@@ -674,32 +669,30 @@ export default {
       deep: true,
     },
     sentIndex: {
-      handler(newVal, oldVal) {
+      handler(newVal) {
         this.curSentIndex = newVal;
         this.getSentence();
       },
       deep: true,
     },
     hz: {
-      handler(val, oldVal) {
-        let _this = this;
+      handler(val) {
         if (val) {
-          _this.handleNewWords(val);
+          this.handleNewWords(val);
         }
       },
       // 深度观察监听
       deep: true,
     },
     isShow: {
-      handler(val, oldVal) {
-        let _this = this;
+      handler(val) {
         if (val) {
           setTimeout(() => {
-            _this.cardHeight = _this.$refs.wordcard.offsetHeight;
-            if (_this.screenHeight - _this.clientY > _this.cardHeight) {
-              _this.top = _this.clientY + 20;
+            this.cardHeight = this.$refs.wordcard.offsetHeight;
+            if (this.screenHeight - this.clientY > this.cardHeight) {
+              this.top = this.clientY + 20;
             } else {
-              _this.top = _this.clientY - _this.cardHeight - 30;
+              this.top = this.clientY - this.cardHeight - 30;
             }
           }, 50);
         }
@@ -708,15 +701,14 @@ export default {
       deep: true,
     },
     isNoteShow: {
-      handler(val, oldVal) {
-        let _this = this;
+      handler(val) {
         if (val) {
           setTimeout(() => {
-            _this.cardHeight = _this.$refs.notecard.offsetHeight;
-            if (_this.screenHeight - _this.clientY > _this.cardHeight) {
-              _this.top = _this.clientY + 20;
+            this.cardHeight = this.$refs.notecard.offsetHeight;
+            if (this.screenHeight - this.clientY > this.cardHeight) {
+              this.top = this.clientY + 20;
             } else {
-              _this.top = _this.clientY - _this.cardHeight - 30;
+              this.top = this.clientY - this.cardHeight - 30;
             }
           }, 50);
         }
@@ -729,34 +721,33 @@ export default {
   created() {},
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    let _this = this;
     window.addEventListener('resize', this.getScreenHeight);
-    _this.getScreenHeight();
-    document.addEventListener('keyup', function (e) {
-      if (_this.isKeyboard) {
-        if (e.keyCode == 32) {
+    this.getScreenHeight();
+    document.addEventListener('keyup', (e) => {
+      if (this.isKeyboard) {
+        if (e.keyCode === 32) {
           // 空格
-          _this.$nextTick(() => {
-            if (_this.$refs.audioLineSent) {
-              _this.$refs.audioLineSent.PlayAudio();
+          this.$nextTick(() => {
+            if (this.$refs.audioLineSent) {
+              this.$refs.audioLineSent.PlayAudio();
             }
           });
-        } else if (e.keyCode == 38) {
-          _this.prevSentence();
-        } else if (e.keyCode == 40) {
-          _this.nextSentence();
-        } else if (e.keyCode == 13) {
-          _this.$nextTick(() => {
-            _this.$refs.Soundrecorddiff.microphone();
+        } else if (e.keyCode === 38) {
+          this.prevSentence();
+        } else if (e.keyCode === 40) {
+          this.nextSentence();
+        } else if (e.keyCode === 13) {
+          this.$nextTick(() => {
+            this.$refs.Soundrecorddiff.microphone();
           });
         }
       }
     });
-    if (_this.NNPENewWordList) {
-      _this.handleNewword();
+    if (this.NNPENewWordList) {
+      this.handleNewword();
     }
-    _this.curSentIndex = _this.sentIndex;
-    _this.getSentence();
+    this.curSentIndex = this.sentIndex;
+    this.getSentence();
     document.addEventListener('fullscreenchange', () => {
       let isFullscreen =
         document.fullscreenElement ||
@@ -767,7 +758,7 @@ export default {
         document.webkitIsFullScreen;
 
       if (!isFullscreen) {
-        _this.changeFullScreen();
+        this.changeFullScreen();
       }
     });
     document.addEventListener('mozfullscreenchange', () => {
@@ -780,7 +771,7 @@ export default {
         document.webkitIsFullScreen;
 
       if (!isFullscreen) {
-        _this.changeFullScreen();
+        this.changeFullScreen();
       }
     });
     document.addEventListener('webkitfullscreenchange', () => {
@@ -793,7 +784,7 @@ export default {
         document.webkitIsFullScreen;
 
       if (!isFullscreen) {
-        _this.changeFullScreen();
+        this.changeFullScreen();
       }
     });
     document.addEventListener('msfullscreenchange', () => {
@@ -806,7 +797,7 @@ export default {
         document.webkitIsFullScreen;
 
       if (!isFullscreen) {
-        _this.changeFullScreen();
+        this.changeFullScreen();
       }
     });
   },
@@ -833,29 +824,27 @@ export default {
       this.recordPlaying = bool;
     },
     setFontSize(type) {
-      let _this = this;
-      if (type == '-') {
-        if (_this.hzSize >= 34) {
+      if (type === '-') {
+        if (this.hzSize >= 34) {
           this.hzSize -= 4;
         }
       }
-      if (type == '+') {
-        if (_this.hzSize <= 76) {
+      if (type === '+') {
+        if (this.hzSize <= 76) {
           this.hzSize += 4;
         }
       }
-      _this.pySize = parseInt(_this.hzSize / 1.5);
-      _this.enSize = parseInt(_this.hzSize / 2);
+      this.pySize = parseInt(this.hzSize / 1.5);
+      this.enSize = parseInt(this.hzSize / 2);
     },
     playChange(bool) {
       this.isPlaying = bool;
     },
     handleColl() {
-      let _this = this;
-      if (_this.isCollArr[_this.curSentIndex]) {
-        _this.cancleColl();
+      if (this.isCollArr[this.curSentIndex]) {
+        this.cancleColl();
       } else {
-        _this.addColl();
+        this.addColl();
       }
     },
     // 添加收藏
@@ -867,7 +856,7 @@ export default {
       let MethodName = 'order-collection_manager-AddMyCollection';
       let text = '';
       this.item.forEach((item) => {
-        if (item.chs != '#') {
+        if (item.chs !== '#') {
           text += item.chs;
         }
       });
@@ -902,7 +891,7 @@ export default {
     cancleColl() {
       let text = '';
       this.item.forEach((item) => {
-        if (item.chs != '#') {
+        if (item.chs !== '#') {
           text += item.chs;
         }
       });
@@ -925,7 +914,7 @@ export default {
     checkCollStatus() {
       let text = '';
       this.item.forEach((item) => {
-        if (item.chs != '#') {
+        if (item.chs !== '#') {
           text += item.chs;
         }
       });
@@ -936,7 +925,7 @@ export default {
         sentence_text: text,
       };
       LearnWebSI(MethodName, data).then((res) => {
-        let collFlag = res.is_collection == 'true';
+        let collFlag = res.is_collection === 'true';
         this.$set(this.isCollArr, this.curSentIndex, collFlag);
       });
     },
@@ -944,20 +933,19 @@ export default {
       this[key] = bool;
     },
     prevSentence() {
-      let _this = this;
-      if (_this.curSentIndex == 0) {
-        // _this.$message.warning("已经是第一个句子了");
+      if (this.curSentIndex === 0) {
+        // this.$message.warning("已经是第一个句子了");
         return;
       }
-      _this.curSentIndex -= 1;
-      _this.getSentence();
-      if (_this.isAuto) {
-        _this.curTime = _this.bg;
-        _this.$refs.audioLineSent.onTimeupdateTime(_this.bg / 1000);
+      this.curSentIndex -= 1;
+      this.getSentence();
+      if (this.isAuto) {
+        this.curTime = this.bg;
+        this.$refs.audioLineSent.onTimeupdateTime(this.bg / 1000);
       }
     },
     nextSentence() {
-      if (this.curSentIndex == this.sentList.length - 1) {
+      if (this.curSentIndex === this.sentList.length - 1) {
         // this.$message.warning("已经是最后一个句子了");
         return;
       }
@@ -965,7 +953,7 @@ export default {
       this.getSentence();
     },
     rollSentence() {
-      if (this.curSentIndex == this.sentList.length - 1) {
+      if (this.curSentIndex === this.sentList.length - 1) {
         this.curSentIndex = 0;
       } else {
         this.curSentIndex += 1;
@@ -973,7 +961,7 @@ export default {
       this.getSentence();
     },
     changeStatus(key) {
-      if (key == 'config.isShowEN') {
+      if (key === 'config.isShowEN') {
         if (this.enwords) {
           this[key] = !this[key];
         }
@@ -988,21 +976,20 @@ export default {
       this.$emit('changeEN');
     },
     setStatus() {
-      let _this = this;
-      if (_this.key == 'isRepeat') {
-        if (_this.isRepeat) {
-          _this.isRepeat = false;
-          _this.isAuto = true;
-          _this.key = 'isAuto';
+      if (this.key === 'isRepeat') {
+        if (this.isRepeat) {
+          this.isRepeat = false;
+          this.isAuto = true;
+          this.key = 'isAuto';
         } else {
-          _this.isRepeat = true;
-          _this.key = 'isRepeat';
+          this.isRepeat = true;
+          this.key = 'isRepeat';
         }
-      } else if (_this.key == 'isAuto') {
-        if (_this.isAuto) {
-          _this.isRepeat = false;
-          _this.isAuto = false;
-          _this.key = 'isRepeat';
+      } else if (this.key === 'isAuto') {
+        if (this.isAuto) {
+          this.isRepeat = false;
+          this.isAuto = false;
+          this.key = 'isRepeat';
         }
       }
     },
@@ -1019,77 +1006,73 @@ export default {
       this.isRecord = isRecord;
     },
     getCurTime(curTime) {
-      let _this = this;
-      if (_this.isRepeat) {
+      if (this.isRepeat) {
         let time = curTime * 1000;
-        if (time > _this.ed || time < _this.bg) {
-          _this.curTime = _this.bg;
-          this.$refs.audioLineSent.onTimeupdateTime(_this.bg / 1000);
+        if (time > this.ed || time < this.bg) {
+          this.curTime = this.bg;
+          this.$refs.audioLineSent.onTimeupdateTime(this.bg / 1000);
         } else {
-          _this.curTime = curTime * 1000;
+          this.curTime = curTime * 1000;
         }
-      } else if (_this.isAuto) {
+      } else if (this.isAuto) {
         let time = curTime * 1000;
 
-        if (time > _this.ed) {
-          _this.rollSentence();
-          _this.curTime = _this.bg;
-          _this.$refs.audioLineSent.onTimeupdateTime(_this.bg / 1000);
+        if (time > this.ed) {
+          this.rollSentence();
+          this.curTime = this.bg;
+          this.$refs.audioLineSent.onTimeupdateTime(this.bg / 1000);
         } else {
-          _this.curTime = curTime * 1000;
+          this.curTime = curTime * 1000;
         }
       } else {
-        _this.curTime = curTime * 1000;
+        this.curTime = curTime * 1000;
       }
     },
     getCurCompareTime(curTime) {
-      let _this = this;
-      _this.curTime = curTime * 1000;
+      this.curTime = curTime * 1000;
     },
     getCurWordTime(curTime) {
-      let _this = this;
-      _this.curWordTime = curTime * 1000;
+      this.curWordTime = curTime * 1000;
     },
     changeBg(bgIndex) {
       this.bgIndex = bgIndex;
     },
     getSentence() {
-      let _this = this;
-      _this.isShowCompare =
-        _this.curQue.Bookanswer.practiceModel[_this.curSentIndex] &&
-        _this.curQue.Bookanswer.practiceModel[_this.curSentIndex].recordList &&
-        _this.curQue.Bookanswer.practiceModel[_this.curSentIndex].recordList.length > 0;
-      _this.pauseAudio();
-      _this.isPlaying = false;
-      let item = JSON.parse(JSON.stringify(_this.sentList[_this.curSentIndex]));
+      this.isShowCompare =
+        this.curQue.Bookanswer.practiceModel[this.curSentIndex] &&
+        this.curQue.Bookanswer.practiceModel[this.curSentIndex].recordList &&
+        this.curQue.Bookanswer.practiceModel[this.curSentIndex].recordList.length > 0;
+      this.pauseAudio();
+      this.isPlaying = false;
+      let item = JSON.parse(JSON.stringify(this.sentList[this.curSentIndex]));
       if (item.sentArr) {
-        _this.item = item.sentArr;
-        _this.enwords = item.enwords;
+        this.item = item.sentArr;
+        this.enwords = item.enwords;
       } else {
-        _this.item = item;
+        this.item = item;
       }
-      _this.sentList.forEach((item) => {
+      this.sentList.forEach((item) => {
         this.isCollArr.push(false);
       });
-      _this.bg =
-        _this.curQue.wordTime && _this.curQue.wordTime[_this.curSentIndex]
-          ? _this.curQue.wordTime[_this.curSentIndex].bg
+      this.bg =
+        this.curQue.wordTime && this.curQue.wordTime[this.curSentIndex]
+          ? this.curQue.wordTime[this.curSentIndex].bg
           : 0;
-      _this.ed =
-        _this.curQue.wordTime && _this.curQue.wordTime[_this.curSentIndex]
-          ? _this.curQue.wordTime[_this.curSentIndex].ed
+      this.ed =
+        this.curQue.wordTime && this.curQue.wordTime[this.curSentIndex]
+          ? this.curQue.wordTime[this.curSentIndex].ed
           : 0;
-      let maxTime = (_this.ed - _this.bg) / 1000;
+      let maxTime = (this.ed - this.bg) / 1000;
       if (maxTime < 1) {
-        _this.maxTime = 1;
+        this.maxTime = 1;
       } else {
-        _this.maxTime = maxTime;
+        this.maxTime = maxTime;
       }
-      // _this.checkCollStatus();
+      // this.checkCollStatus();
     },
     pauseAudio() {
       let audio = document.getElementsByTagName('audio');
-      if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && audio.forEach) {
+      if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') === -1 && audio.forEach) {
         audio.forEach((item) => {
           item.pause();
         });
@@ -1104,8 +1087,8 @@ export default {
       this.$emit('changeIsFull');
     },
     handleWav(list, tmIndex) {
-      tmIndex = tmIndex || 0;
-      this.$emit('handleWav', list, tmIndex);
+      let _tmIndex = tmIndex || 0;
+      this.$emit('handleWav', list, _tmIndex);
     },
     // 录音时暂停音频播放
     handleParentPlay() {
@@ -1117,42 +1100,41 @@ export default {
     },
     // 播放音频
     // playWord(item) {
-    //   let _this = this;
+    //
     //   if (this.newWordList.indexOf(item.chs) > -1 || item.words) {
-    //     _this.pauseAudio();
-    //     _this.isWordPlay = false;
-    //     _this.wordIndex = item.wordIndex;
+    //     this.pauseAudio();
+    //     this.isWordPlay = false;
+    //     this.wordIndex = item.wordIndex;
     //     setTimeout(() => {
     //       let leg = item.timeList.length;
-    //       _this.wordbg = item.timeList[0].wordBg;
-    //       _this.worded = item.timeList[leg - 1].wordEd;
-    //       let wordMaxTime = (_this.worded - _this.wordbg) / 1000;
+    //       this.wordbg = item.timeList[0].wordBg;
+    //       this.worded = item.timeList[leg - 1].wordEd;
+    //       let wordMaxTime = (this.worded - this.wordbg) / 1000;
     //       if (wordMaxTime < 1) {
-    //         _this.wordMaxTime = 1;
+    //         this.wordMaxTime = 1;
     //       } else {
-    //         _this.wordMaxTime = wordMaxTime;
+    //         this.wordMaxTime = wordMaxTime;
     //       }
-    //       _this.isWordPlay = true;
+    //       this.isWordPlay = true;
     //     }, 50);
     //   }
     // },
     playWord(item) {
-      let _this = this;
       if (this.newWordList.indexOf(item.chs) > -1 || item.words) {
-        _this.pauseAudio();
-        _this.isNewWordPlay = false;
+        this.pauseAudio();
+        this.isNewWordPlay = false;
         let new_word = item.words ? item.words : item.chs;
-        _this.NNPENewWordList.forEach((itemn) => {
+        this.NNPENewWordList.forEach((itemn) => {
           // items.forEach((itemn) => {
           if (itemn.new_word === new_word) {
-            _this.wordbg = itemn.bg;
-            _this.worded = itemn.ed;
-            _this.wordPlayMp3 = itemn.newWordMp3;
+            this.wordbg = itemn.bg;
+            this.worded = itemn.ed;
+            this.wordPlayMp3 = itemn.newWordMp3;
           }
           // });
         });
         setTimeout(() => {
-          _this.isNewWordPlay = true;
+          this.isNewWordPlay = true;
         }, 50);
       }
     },
@@ -1162,18 +1144,16 @@ export default {
       this.wordIndex = -1;
     },
     showWordDetail(e, item) {
-      let _this = this;
-
       let noteIndex = '';
-      if (_this.TaskModel == 'ANSWER') {
+      if (this.TaskModel === 'ANSWER') {
         return;
       }
-      if (_this.chsFhList.indexOf(item.chs) > -1 || /^[a-zA-Z0-9]/.test(item.chs)) {
+      if (this.chsFhList.indexOf(item.chs) > -1 || /^[a-zA-Z0-9]/.test(item.chs)) {
         return;
       }
-      if (_this.NumberList.indexOf(item.chs) > -1) {
-        for (let i = 0; i < _this.NumberList.length; i++) {
-          if (_this.NumberList[i] == item.chs) {
+      if (this.NumberList.indexOf(item.chs) > -1) {
+        for (let i = 0; i < this.NumberList.length; i++) {
+          if (this.NumberList[i] === item.chs) {
             noteIndex = `${String(i)}`;
             break;
           }
@@ -1181,79 +1161,76 @@ export default {
 
         this.showNoteDetail(e, noteIndex);
       } else if (this.newWordList.indexOf(item.chs) > -1) {
-        if (_this.oldHz != item.chs) {
+        if (this.oldHz !== item.chs) {
           this.isShow = false;
 
           setTimeout(() => {
-            _this.hz = item.words ? item.words : item.chs;
-            _this.pinyin = item.pinyin;
-            _this.wordIndex = item.wordIndex;
+            this.hz = item.words ? item.words : item.chs;
+            this.pinyin = item.pinyin;
+            this.wordIndex = item.wordIndex;
           }, 50);
         }
-        _this.clientY = e.clientY;
+        this.clientY = e.clientY;
         let new_word = item.words ? item.words : item.chs;
-        _this.wordPlayMp3 = '';
-        _this.NNPENewWordList.forEach((itemn) => {
+        this.wordPlayMp3 = '';
+        this.NNPENewWordList.forEach((itemn) => {
           // items.forEach((itemn) => {
           if (itemn.new_word === new_word) {
-            _this.wordbgs = itemn.bg;
-            _this.wordeds = itemn.ed;
-            _this.wordPlayMp3 = itemn.newWordMp3;
+            this.wordbgs = itemn.bg;
+            this.wordeds = itemn.ed;
+            this.wordPlayMp3 = itemn.newWordMp3;
           }
           // });
         });
         let left = e.clientX;
         let width = 0;
-        if (item.chs.length == 1 || item.chs.length == 2) {
+        if (item.chs.length === 1 || item.chs.length === 2) {
           width = 304;
-        } else if (item.chs.length == 3 || item.chs.length == 4) {
+        } else if (item.chs.length === 3 || item.chs.length === 4) {
           width = 432;
         } else if (item.chs.length > 3) {
           width = 560;
         }
         // if (left - this.bodyLeft > this.contentWidth / 2) {
-        //   _this.left = left - width + 10;
+        //   this.left = left - width + 10;
         // } else {
-        _this.left = left - width / 2;
+        this.left = left - width / 2;
         // }
       }
     },
     showNoteDetail(e, noteNum) {
-      let _this = this;
-      if (_this.oldNoteNum !== noteNum) {
+      if (this.oldNoteNum !== noteNum) {
         this.isNoteShow = false;
         setTimeout(() => {
-          _this.noteNum = noteNum;
-          _this.handleNote(noteNum);
+          this.noteNum = noteNum;
+          this.handleNote(noteNum);
         }, 50);
       }
-      _this.clientY = e.clientY;
+      this.clientY = e.clientY;
       let left = e.clientX;
       let width = 642;
       if (left - this.bodyLeft > this.contentWidth / 2) {
-        _this.left = left - width + 10;
+        this.left = left - width + 10;
       } else if (left - 200 > 500) {
-        _this.left = 500;
+        this.left = 500;
       } else {
-        _this.left = left - 200;
+        this.left = left - 200;
       }
     },
     changeWordCard(isShow) {
-      let _this = this;
-      _this.isShow = isShow;
-      _this.oldHz = '';
-      _this.hz = '';
-      _this.wordIndex = -1;
+      this.isShow = isShow;
+      this.oldHz = '';
+      this.hz = '';
+      this.wordIndex = -1;
     },
     // 处理分词数据
     handleNewWords(val) {
-      let _this = this;
-      _this.isShow = true;
-      _this.word = null;
-      if (_this.newWordList.indexOf(val) > -1) {
+      this.isShow = true;
+      this.word = null;
+      if (this.newWordList.indexOf(val) > -1) {
         for (let i = 0; i < this.NNPENewWordList.length; i++) {
           let pItem = this.NNPENewWordList[i];
-          if (pItem.new_word.trim() == val.trim()) {
+          if (pItem.new_word.trim() === val.trim()) {
             let wordlist = val.split('');
             this.word = { list: wordlist, detail: pItem };
             break;
@@ -1265,11 +1242,11 @@ export default {
           definition_list: [],
           mp3_list: [],
           new_word: val,
-          pinyin: _this.pinyin,
+          pinyin: this.pinyin,
         };
-        _this.word = { list: wordlist, detail: option };
+        this.word = { list: wordlist, detail: option };
       }
-      _this.oldHz = val;
+      this.oldHz = val;
     },
     handleNewword() {
       let NewWordList = [];
@@ -1285,25 +1262,23 @@ export default {
     },
     // 处理注释数据
     handleNote(val) {
-      let _this = this;
-      _this.isNoteShow = true;
-      _this.oldNoteNum = val;
+      this.isNoteShow = true;
+      this.oldNoteNum = val;
       let noteIndex = Number(val);
-      if (_this.NNPEAnnotationList && _this.NNPEAnnotationList.length > 0) {
-        _this.curNoteCon = _this.NNPEAnnotationList[noteIndex] ? _this.NNPEAnnotationList[noteIndex] : null;
+      if (this.NNPEAnnotationList && this.NNPEAnnotationList.length > 0) {
+        this.curNoteCon = this.NNPEAnnotationList[noteIndex] ? this.NNPEAnnotationList[noteIndex] : null;
       }
     },
     changeCard(isShow) {
-      let _this = this;
-      _this.isNoteShow = isShow;
-      _this.oldNoteNum = '';
-      _this.noteNum = '';
+      this.isNoteShow = isShow;
+      this.oldNoteNum = '';
+      this.noteNum = '';
     },
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
+
 <style lang="scss" scoped>
-//@import url(); 引入公共css类
 .voicefull {
   display: flex;
   flex-direction: column;

+ 12 - 14
src/views/book/courseware/preview/components/article/WordModelChs.vue

@@ -468,9 +468,8 @@
                             sentIndex == index ? 'wordBlank' : '',
                           ]"
                         >
-                          <template>
+                          <template v-for="(wItem, wIndex) in pItem.leg">
                             <span
-                              v-for="(wItem, wIndex) in pItem.leg"
                               :key="'ci' + wIndex + pIndex + index"
                               :class="[]"
                               :style="{
@@ -658,9 +657,8 @@
                           sentIndex == index ? 'wordBlank' : '',
                         ]"
                       >
-                        <template>
+                        <template v-for="(wItem, wIndex) in pItem.leg">
                           <span
-                            v-for="(wItem, wIndex) in pItem.leg"
                             :key="'ci' + wIndex + pIndex + index"
                             :class="[]"
                             :style="{
@@ -1017,7 +1015,7 @@ export default {
         });
 
         let curSentencesLeg = dItem.sentences.length;
-        let startLeg = dIndex == 0 ? 0 : curQue.detail[dIndex - 1].endLeg;
+        let startLeg = dIndex === 0 ? 0 : curQue.detail[dIndex - 1].endLeg;
         let endLeg = startLeg + curSentencesLeg;
         dItem.endLeg = endLeg;
         let timeList = curQue.wordTime.slice(startLeg, endLeg);
@@ -1045,8 +1043,8 @@ export default {
           let sentArr = [];
 
           sItem.forEach((wItem, wIndex) => {
-            let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
-            let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
+            let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
+            let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
             // this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbol(wItem);
             let obj = {
@@ -1072,7 +1070,7 @@ export default {
           });
           let objs = {
             sentArr,
-            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
+            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
           };
           sentArrTotal.push(sentArr);
           resArrs.push(objs);
@@ -1140,7 +1138,7 @@ export default {
     handleTimeList(list) {
       let listRes = [];
       list.forEach((item) => {
-        let res = timeStrToSen(item);
+        let res = this.timeStrToSen(item);
         listRes.push(res);
       });
       return listRes;
@@ -1168,13 +1166,13 @@ export default {
       let _this = this;
       if (
         this.chsFhList.indexOf(item.chs) > -1 ||
-        item.chs == '“' ||
-        item.chs == '(' ||
+        item.chs === '“' ||
+        item.chs === '(' ||
         /^[a-zA-Z0-9]/.test(item.chs)
       ) {
         return false;
       }
-      if (_this.oldHz != item.chs) {
+      if (_this.oldHz !== item.chs) {
         this.isShow = false;
         setTimeout(() => {
           _this.hz = item.chs;
@@ -1187,9 +1185,9 @@ export default {
       _this.clientY = e.clientY;
       let left = e.clientX;
       let width = 0;
-      if (item.chs.length == 1 || item.chs.length == 2) {
+      if (item.chs.length === 1 || item.chs.length === 2) {
         width = 304;
-      } else if (item.chs.length == 3 || item.chs.length == 4) {
+      } else if (item.chs.length === 3 || item.chs.length === 4) {
         width = 432;
       } else if (item.chs.length > 3) {
         width = 560;

+ 2 - 14
src/views/book/courseware/preview/components/article/components/AudioCompare.vue

@@ -79,31 +79,19 @@ export default {
   computed: {},
   watch: {
     isRecord: {
-      handler(newVal, oldVal) {
-        if (this.sentIndex == this.index) {
+      handler(newVal) {
+        if (this.sentIndex === this.index) {
           this.isR = newVal;
         }
       },
       deep: true,
     },
   },
-  // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
-  // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  beforeCreate() {}, // 生命周期 - 创建之前
-  beforeMount() {}, // 生命周期 - 挂载之前
-  beforeUpdate() {}, // 生命周期 - 更新之前
-  updated() {}, // 生命周期 - 更新之后
-  beforeDestroy() {}, // 生命周期 - 销毁之前
-  destroyed() {}, // 生命周期 - 销毁完成
-  activated() {},
   // 方法集合
   methods: {}, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
 <style lang="scss" scoped>
-//@import url(); 引入公共css类
 .compare-box {
   width: 20px;
   height: 20px;

File diff suppressed because it is too large
+ 7 - 8
src/views/book/courseware/preview/components/article/components/Freewrite.vue


+ 7 - 16
src/views/book/courseware/preview/components/article/components/FreewriteLettle.vue

@@ -41,9 +41,9 @@
 </template>
 
 <script>
-import vueEsign from 'vue-esign';
-import Strockplayredline from './Strockplayredline.vue';
-import Strockred from './Strockred.vue';
+// import vueEsign from 'vue-esign';
+// import Strockplayredline from './Strockplayredline.vue';
+// import Strockred from './Strockred.vue';
 import FreeWriteQP from './FreeWriteQP.vue';
 // import ChinaDict from "./ChinaDict";
 // import Audio from "./AudioRed.vue";
@@ -51,12 +51,12 @@ import { LearnWebSI } from '@/api/app';
 
 export default {
   components: {
-    Strockplayredline,
-    Strockred,
+    // Strockplayredline,
+    // Strockred,
     FreeWriteQP,
     // ChinaDict,
     // Audio,
-    vueEsign,
+    // vueEsign,
   },
   props: [
     'cur',
@@ -110,18 +110,9 @@ export default {
     }
     _this.data = JSON.parse(JSON.stringify(_this.currenHzData));
   },
-  // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  beforeCreate() {}, // 生命周期 - 创建之前
-  beforeMount() {}, // 生命周期 - 挂载之前
-  beforeUpdate() {}, // 生命周期 - 更新之前
-  updated() {}, // 生命周期 - 更新之后
-  beforeDestroy() {}, // 生命周期 - 销毁之前
-  destroyed() {}, // 生命周期 - 销毁完成
-  activated() {},
   // 方法集合
   methods: {
-    play(index) {
+    play() {
       let _this = this;
       if (this.currenHzData.history) {
         if (this.hasPlay) {

File diff suppressed because it is too large
+ 10 - 12
src/views/book/courseware/preview/components/article/components/Soundrecorddiff.vue


+ 3 - 3
src/views/book/courseware/preview/components/article/components/Strockplayredline.vue

@@ -83,12 +83,12 @@ export default {
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
+
 <style lang="scss" scoped>
-//@import url(); 引入公共css类
 .strockplayRedInner {
   position: relative;
-  width: 128px; //444px
-  height: 128px; //480px
+  width: 128px; // 444px
+  height: 128px; // 480px
 }
 
 .character-target-div {

+ 1 - 1
src/views/book/courseware/preview/components/article/components/WordPhraseDetail.vue

@@ -377,7 +377,7 @@ export default {
   mounted() {
     let _this = this;
     _this.initData();
-    if (_this.type == 'newWordDetail') {
+    if (_this.type === 'newWordDetail') {
       // _this.getChineseInfo();
     }
   },

+ 4 - 4
src/views/book/courseware/preview/components/article/index.vue

@@ -587,7 +587,7 @@ export default {
           });
           let objs = {
             sentArr,
-            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
+            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
           };
           sentArrTotal.push(sentArr);
           resArr.push(objs);
@@ -668,11 +668,11 @@ export default {
       }
     },
     handleWav(list, tmIndex) {
-      tmIndex = tmIndex || 0;
-      this.data.Bookanswer.practiceModel[tmIndex] = {
+      let _tmIndex = tmIndex || 0;
+      this.data.Bookanswer.practiceModel[_tmIndex] = {
         recordList: [],
       };
-      this.$set(this.data.Bookanswer.practiceModel[tmIndex], 'recordList', list);
+      this.$set(this.data.Bookanswer.practiceModel[_tmIndex], 'recordList', list);
     },
     handleNewword() {
       let NewWordList = [];

+ 3 - 3
src/views/book/courseware/preview/components/dialogue_article/Practicechs.vue

@@ -1187,11 +1187,11 @@ export default {
       this.ed = undefined;
     },
     handleWav(list, tmIndex) {
-      tmIndex = tmIndex || 0;
-      this.curQue.Bookanswer.practiceModel[tmIndex] = {
+      let _tmIndex = tmIndex || 0;
+      this.curQue.Bookanswer.practiceModel[_tmIndex] = {
         recordList: [],
       };
-      this.$set(this.curQue.Bookanswer.practiceModel[tmIndex], 'recordList', list);
+      this.$set(this.curQue.Bookanswer.practiceModel[_tmIndex], 'recordList', list);
     },
     // 录音时暂停音频播放
     handleParentPlay() {

File diff suppressed because it is too large
+ 4 - 5
src/views/book/courseware/preview/components/drawing/DrawingPreview.vue


+ 2 - 2
src/views/book/courseware/preview/components/image_text/ImageTextPreview.vue

@@ -151,7 +151,7 @@ export default {
   },
   watch: {
     'data.image_list': {
-      handler(val) {
+      handler() {
         this.initData();
       },
     },
@@ -166,7 +166,7 @@ export default {
     initData() {
       if (!this.isJudgingRightWrong) {
         this.answer.answer_list = [];
-        this.data.input_list.forEach((item, index) => {
+        this.data.input_list.forEach((item) => {
           let obj = {
             text: '',
             answer: item.text,

+ 1 - 1
src/views/book/courseware/preview/components/new_word/NewWordPreview.vue

@@ -906,6 +906,7 @@
                               {{ item.pinyin.split(' ')[indexh] ? item.pinyin.split(' ')[indexh] : '&nbsp;' }}
                             </p>
                             <Strockplay
+                              v-if="itemh.hzDetail.hz_json"
                               class-name="adult-strockplay"
                               :Book_text="itemh.con"
                               :play-storkes="true"
@@ -927,7 +928,6 @@
                                     ? data.unified_attrib.topic_color
                                     : '#f44444',
                               }"
-                              v-if="itemh.hzDetail.hz_json"
                             />
                           </div>
                         </div>

+ 4 - 4
src/views/book/courseware/preview/components/new_word/components/Strockplay.vue

@@ -101,8 +101,8 @@ export default {
 <style lang="scss" scoped>
 .strockplayInner {
   position: relative;
-  width: 100%; //444px
-  height: 100%; //480px
+  width: 100%; // 444px
+  height: 100%; // 480px
   margin: 0 auto;
 
   .strock-play-box {
@@ -120,8 +120,8 @@ export default {
   display: flex;
   align-items: center;
   justify-content: center;
-  width: 100%; //444px
-  height: 100%; //480px
+  width: 100%; // 444px
+  height: 100%; // 480px
   //   background: #fff url("../../../../assets/NPC/chinaTianRed.png") center
   //     no-repeat;
   background-size: 100% 100%;

+ 1 - 1
src/views/book/courseware/preview/components/new_word/components/writeTableZoom.vue

@@ -129,6 +129,7 @@
                 <Strockplay
                   class-name="adult-strockplay"
                   :Book_text="itemh.con"
+                  v-if="itemh.hzDetail.hz_json"
                   :play-storkes="true"
                   :stroke-play-color="attrib && attrib.topic_color ? attrib.topic_color : '#f44444'"
                   :stroke-color="'#000000'"
@@ -139,7 +140,6 @@
                   :class="[indexh !== 0 ? 'writeTop-item-noLeft' : '']"
                   class="writeTop-item"
                   :style="{ borderColor: attrib && attrib.topic_color ? attrib.topic_color : '#f44444' }"
-                  v-if="itemh.hzDetail.hz_json"
                 />
               </div>
             </div>

+ 0 - 24
src/views/login/userAgreement.vue

@@ -340,30 +340,6 @@ export default {
     // 这里存放数据
     return {};
   },
-  // 计算属性 类似于data概念
-  computed: {},
-  // 监控data中数据变化
-  watch: {},
-  // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
-  // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  // 生命周期-挂载之前
-  beforeMount() {},
-  // 生命周期-更新之后
-  updated() {},
-  // 如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
-  // 方法集合
-  methods: {},
-  // 生命周期-创建之前
-  beforeCreated() {},
-  // 生命周期-更新之前
-  beforUpdate() {},
-  // 生命周期-销毁之前
-  beforeDestory() {},
-  // 生命周期-销毁完成
-  destoryed() {},
 };
 </script>
 <style lang="scss" scoped>

File diff suppressed because it is too large
+ 1 - 1
src/views/personal_workbench/edit_task/edit/index.vue


+ 0 - 181
src/views/personal_workbench/edit_task/preview/index.vue

@@ -4,7 +4,6 @@
 
     <CommonPreview :id="id" ref="preview" :project-id="project_id">
       <template #operator="{ courseware }">
-        <span class="link" @click="selectDirectory">下载离线包</span>
         <span class="link" @click="saveCoursewareAsTemplate">保存为个人模板</span>
         <span v-if="isTrue(courseware.is_can_start_edit)" class="link" @click="editTask">开始编辑</span>
         <span v-if="isTrue(courseware.is_can_submit_audit)" class="link" @click="submitCoursewareToAuditFlow">
@@ -23,7 +22,6 @@ import CommonPreview from '@/components/CommonPreview.vue';
 import { SubmitBookCoursewareToAuditFlow } from '@/api/project';
 import { isTrue } from '@/utils/validate';
 import { SaveCoursewareAsTemplatePersonal } from '@/api/template';
-import { CreateBookChapterStructFileList, CreateCoursewareFileList } from '@/api/offline';
 
 export default {
   name: 'TaskPreviewPage',
@@ -36,41 +34,8 @@ export default {
       id: this.$route.params.id,
       project_id: this.$route.query.project_id,
       isTrue,
-      loadingInstance: null, // 加载中实例
-      tempDir: '', // 临时目录,用于存放下载的文件
-      savePath: '', // 保存离线包的路径
-      packageName: 'EEP 离线包', // 离线包名称
-      file_info_list: [], // 章节结构文件列表
-      downloadTotal: 0, // 下载总数
-      downloadCompleted: 0, // 已下载数量
-      downloadWatcher: null, // 下载进度监听器
     };
   },
-  computed: {
-    downloadProgress() {
-      if (this.downloadTotal === 0) return 0;
-      return (this.downloadCompleted / this.downloadTotal) * 100;
-    },
-  },
-  beforeDestroy() {
-    // 删除临时目录及其内容
-    if (this.tempDir && this.tempDir.length > 0) {
-      window.fileAPI.deleteTempDir(this.tempDir);
-      this.tempDir = '';
-    }
-
-    // 删除 watch 监听器
-    if (this.downloadWatcher) {
-      this.downloadWatcher();
-      this.downloadWatcher = null;
-    }
-
-    // 关闭加载中实例
-    if (this.loadingInstance) {
-      this.loadingInstance.close();
-      this.loadingInstance = null;
-    }
-  },
   methods: {
     goBackBookList() {
       this.$router.push({ path: '/personal_workbench/edit_task' });
@@ -106,152 +71,6 @@ export default {
         })
         .catch(() => {});
     },
-    /**
-     * 选择保存离线包的目录
-     */
-    async selectDirectory() {
-      const result = await window.fileAPI.openFileDialog({
-        title: '选择保存离线包的文件夹',
-        properties: ['openDirectory', 'createDirectory'],
-      });
-      if (result.canceled) {
-        this.$message.warning('未选择文件夹,操作已取消');
-        return;
-      }
-      this.savePath = result.filePaths[0];
-      this.downloadOfflinePackage();
-    },
-
-    /**
-     * 下载离线包
-     */
-    async downloadOfflinePackage() {
-      const { file_info_list, courseware_id_list } = await CreateBookChapterStructFileList({
-        book_id: this.project_id,
-      });
-
-      this.file_info_list = file_info_list;
-      if (file_info_list.length === 0) {
-        this.$message.error('章节结构文件生成失败,无法下载离线包');
-        return;
-      }
-
-      if (this.tempDir.length === 0) {
-        this.tempDir = window.fileAPI.createTempDir(); // 创建临时保存目录
-      }
-
-      this.loadingInstance = this.$loading({
-        lock: true,
-        text: '正在下载离线包,请稍候...',
-        spinner: 'el-icon-loading',
-        background: 'rgba(255, 255, 255, 0.7)',
-      });
-
-      for (const { dir_name, file_name, file_url } of this.file_info_list) {
-        const dirPath = dir_name.length > 0 ? `${this.tempDir}\\${dir_name}` : this.tempDir;
-        await window.fileAPI.downloadFile(file_url, `${dirPath}\\${file_name}`);
-      }
-
-      const struct = await this.readFileContent('struct.json'); // 读取章节结构文件内容
-
-      if (struct.node_list && struct.node_list.length > 0) {
-        this.packageName = struct.node_list[0].name; // 设置离线包名称为课件名称
-      }
-
-      if (courseware_id_list && courseware_id_list.length > 0) {
-        this.downloadWatcher = this.$watch(
-          'downloadProgress',
-          (newVal) => {
-            if (newVal >= 100) {
-              this.downloadWatcher();
-              this.downloadWatcher = null;
-              this.startCompress();
-            } else {
-              // 显示下载进度,预留 10% 的压缩进度
-              this.loadingInstance.text = `正在下载离线包,进度:${((this.downloadCompleted / (this.downloadTotal + this.downloadTotal * 0.1)) * 100).toFixed(2)}%`;
-            }
-          },
-          { immediate: true },
-        );
-
-        Promise.all(courseware_id_list.map((courseware_id) => this.createCoursewareFileList(courseware_id)));
-      }
-    },
-
-    /**
-     * 下载课件文件列表
-     * @param {Number} courseware_id 课件ID
-     * @return {Promise} Promise对象
-     */
-    async createCoursewareFileList(courseware_id) {
-      const { file_info_list } = await CreateCoursewareFileList({ courseware_id });
-      this.downloadTotal += file_info_list.length;
-
-      file_info_list.forEach((fileInfo) => {
-        const { file_name, file_url, dir_name } = fileInfo;
-        window.fileAPI.downloadFile(file_url, `${this.tempDir}\\${dir_name}\\${file_name}`).then(() => {
-          this.downloadCompleted += 1;
-        });
-      });
-    },
-
-    /**
-     * 开始压缩
-     */
-    async startCompress() {
-      const sources = [`${this.tempDir}\\resource`, `${this.tempDir}\\courseware`]; // 要压缩的文件或文件夹路径数组
-      this.file_info_list.forEach(({ dir_name, file_name }) => {
-        const dirPath = dir_name.length > 0 ? `${this.tempDir}\\${dir_name}` : this.tempDir;
-        sources.push(`${dirPath}\\${file_name}`);
-      });
-      const dest = `${this.savePath}\\${this.packageName}.eep`; // 压缩包保存路径
-      try {
-        const offErr = window.fileAPI.onStderr((text) => console.warn('7z stderr:', text));
-
-        await window.fileAPI.compress({
-          sources,
-          dest,
-          format: 'zip',
-          level: 5,
-          password: '1234567a',
-          recurse: true,
-        });
-        offErr();
-      } catch (e) {
-        console.error('压缩失败:', e);
-        this.$message.error('离线包下载失败,请重试!');
-        this.loadingInstance.close();
-        this.loadingInstance = null;
-        return;
-      }
-
-      this.loadingInstance.text = `正在下载离线包,进度:100%`;
-
-      // 删除临时目录及其内容
-      try {
-        await window.fileAPI.deleteTempDir(this.tempDir);
-        this.tempDir = '';
-      } catch (e) {
-        console.error('删除临时目录失败:', e);
-      }
-
-      this.loadingInstance.close();
-      this.loadingInstance = null;
-
-      this.$message.success('离线包下载并保存成功!');
-    },
-
-    /**
-     * 读取文件内容
-     * @param entryName 文件条目名称
-     * @param subdirectory 子目录
-     */
-    async readFileContent(entryName, subdirectory = '') {
-      const content = await window.fileAPI.readZipFileSync(`${this.tempDir}/${subdirectory}`, entryName);
-      const text = new TextDecoder().decode(content);
-      const obj = JSON.parse(text);
-      return obj;
-    },
   },
 };
 </script>

File diff suppressed because it is too large
+ 9 - 12
src/views/personal_workbench/project/ProductionResourceManage.vue


+ 187 - 1
src/views/project_manage/org/book/index.vue

@@ -24,8 +24,9 @@
           </template>
         </el-table-column>
 
-        <el-table-column label="操作" fixed="right" width="160" align="center" header-align="center">
+        <el-table-column label="操作" fixed="right" width="260" align="center" header-align="center">
           <template slot-scope="{ row }">
+            <span class="link" @click="selectDirectory(row.id)">下载离线包</span>
             <span class="link">查看信息</span>
             <span class="link" @click="previewBook(row.id)">预览信息</span>
           </template>
@@ -43,6 +44,7 @@ import PaginationPage from '@/components/PaginationPage.vue';
 
 import { PageQueryYSJBookList_OrgManager } from '@/api/list';
 import { isTrue } from '@/utils/validate';
+import { CreateBookChapterStructFileList, CreateCoursewareFileList } from '@/api/offline';
 
 export default {
   name: 'OrgBookPage',
@@ -56,8 +58,41 @@ export default {
       total: 0,
       cur_page_begin_index: 0,
       isTrue,
+      loadingInstance: null, // 加载中实例
+      tempDir: '', // 临时目录,用于存放下载的文件
+      savePath: '', // 保存离线包的路径
+      packageName: 'EEP 离线包', // 离线包名称
+      file_info_list: [], // 章节结构文件列表
+      downloadTotal: 0, // 下载总数
+      downloadCompleted: 0, // 已下载数量
+      downloadWatcher: null, // 下载进度监听器
     };
   },
+  computed: {
+    downloadProgress() {
+      if (this.downloadTotal === 0) return 0;
+      return (this.downloadCompleted / this.downloadTotal) * 100;
+    },
+  },
+  beforeDestroy() {
+    // 删除临时目录及其内容
+    if (this.tempDir && this.tempDir.length > 0) {
+      window.fileAPI.deleteTempDir(this.tempDir);
+      this.tempDir = '';
+    }
+
+    // 删除 watch 监听器
+    if (this.downloadWatcher) {
+      this.downloadWatcher();
+      this.downloadWatcher = null;
+    }
+
+    // 关闭加载中实例
+    if (this.loadingInstance) {
+      this.loadingInstance.close();
+      this.loadingInstance = null;
+    }
+  },
   methods: {
     pageQueryYSJBookList_OrgManager(data) {
       PageQueryYSJBookList_OrgManager(data).then(({ total_count, book_list, cur_page_begin_index }) => {
@@ -69,6 +104,157 @@ export default {
     previewBook(id) {
       this.$router.push({ path: `/project_manage/org/book/preview/${id}` });
     },
+
+    /**
+     * 选择保存离线包的目录
+     * @param {String} book_id 教材ID
+     */
+    async selectDirectory(book_id) {
+      const result = await window.fileAPI.openFileDialog({
+        title: '选择保存离线包的文件夹',
+        properties: ['openDirectory', 'createDirectory'],
+      });
+      if (result.canceled) {
+        this.$message.warning('未选择文件夹,操作已取消');
+        return;
+      }
+      this.savePath = result.filePaths[0];
+      this.downloadOfflinePackage(book_id);
+    },
+
+    /**
+     * 下载离线包
+     * @param {String} book_id 教材ID
+     */
+    async downloadOfflinePackage(book_id) {
+      const { file_info_list, courseware_id_list } = await CreateBookChapterStructFileList({
+        book_id,
+      });
+
+      this.file_info_list = file_info_list;
+      if (file_info_list.length === 0) {
+        this.$message.error('章节结构文件生成失败,无法下载离线包');
+        return;
+      }
+
+      if (this.tempDir.length === 0) {
+        this.tempDir = window.fileAPI.createTempDir(); // 创建临时保存目录
+      }
+
+      this.loadingInstance = this.$loading({
+        lock: true,
+        text: '正在下载离线包,请稍候...',
+        spinner: 'el-icon-loading',
+        background: 'rgba(255, 255, 255, 0.7)',
+      });
+
+      for (const { dir_name, file_name, file_url } of this.file_info_list) {
+        const dirPath = dir_name.length > 0 ? `${this.tempDir}\\${dir_name}` : this.tempDir;
+        await window.fileAPI.downloadFile(file_url, `${dirPath}\\${file_name}`);
+      }
+
+      const struct = await this.readFileContent('struct.json'); // 读取章节结构文件内容
+
+      if (struct.node_list && struct.node_list.length > 0) {
+        this.packageName = struct.node_list[0].name; // 设置离线包名称为课件名称
+      }
+
+      if (courseware_id_list && courseware_id_list.length > 0) {
+        this.downloadWatcher = this.$watch(
+          'downloadProgress',
+          (newVal) => {
+            if (newVal >= 100) {
+              this.downloadWatcher();
+              this.downloadWatcher = null;
+              this.startCompress();
+            } else {
+              // 显示下载进度,预留 10% 的压缩进度
+              this.loadingInstance.text = `正在下载离线包,进度:${((this.downloadCompleted / (this.downloadTotal + this.downloadTotal * 0.1)) * 100).toFixed(2)}%`;
+            }
+          },
+          { immediate: true },
+        );
+
+        Promise.all(courseware_id_list.map((courseware_id) => this.createCoursewareFileList(courseware_id)));
+      }
+    },
+
+    /**
+     * 下载课件文件列表
+     * @param {Number} courseware_id 课件ID
+     * @return {Promise} Promise对象
+     */
+    async createCoursewareFileList(courseware_id) {
+      const { file_info_list } = await CreateCoursewareFileList({ courseware_id });
+      this.downloadTotal += file_info_list.length;
+
+      file_info_list.forEach((fileInfo) => {
+        const { file_name, file_url, dir_name } = fileInfo;
+        window.fileAPI.downloadFile(file_url, `${this.tempDir}\\${dir_name}\\${file_name}`).then(() => {
+          this.downloadCompleted += 1;
+        });
+      });
+    },
+
+    /**
+     * 开始压缩
+     */
+    async startCompress() {
+      const sources = [`${this.tempDir}\\resource`, `${this.tempDir}\\courseware`]; // 要压缩的文件或文件夹路径数组
+      this.file_info_list.forEach(({ dir_name, file_name }) => {
+        const dirPath = dir_name.length > 0 ? `${this.tempDir}\\${dir_name}` : this.tempDir;
+        sources.push(`${dirPath}\\${file_name}`);
+      });
+      const dest = `${this.savePath}\\${this.packageName}.eep`; // 压缩包保存路径
+      try {
+        const offErr = window.fileAPI.onStderr((text) => console.warn('7z stderr:', text));
+
+        await window.fileAPI.compress({
+          sources,
+          dest,
+          format: 'zip',
+          level: 5,
+          password: '1234567a',
+          recurse: true,
+        });
+        offErr();
+      } catch (e) {
+        console.error('压缩失败:', e);
+        this.$message.error('离线包下载失败,请重试!');
+        this.loadingInstance.close();
+        this.loadingInstance = null;
+        this.tempDir = '';
+        return;
+      }
+
+      this.loadingInstance.text = `正在下载离线包,进度:100%`;
+
+      // 删除临时目录及其内容
+      try {
+        await window.fileAPI.deleteTempDir(this.tempDir);
+        this.tempDir = '';
+      } catch (e) {
+        console.error('删除临时目录失败:', e);
+        this.tempDir = '';
+      }
+
+      this.loadingInstance.close();
+      this.loadingInstance = null;
+
+      this.$message.success('离线包下载并保存成功!');
+    },
+
+    /**
+     * 读取文件内容
+     * @param entryName 文件条目名称
+     * @param subdirectory 子目录
+     */
+    async readFileContent(entryName, subdirectory = '') {
+      const content = await window.fileAPI.readZipFileSync(`${this.tempDir}/${subdirectory}`, entryName);
+      const text = new TextDecoder().decode(content);
+      const obj = JSON.parse(text);
+      return obj;
+    },
   },
 };
 </script>

+ 4 - 4
src/views/project_manage/project/ProjectVisNetwork.vue

@@ -13,7 +13,7 @@
       </div>
     </div>
     <p v-if="isWaiting" class="waiting">数据生成中...请等待</p>
-    <VisNetwork ref="visNetworRef" v-if="isChildDataLoad" :book-id="book_id" :is-edit="true" />
+    <VisNetwork v-if="isChildDataLoad" ref="visNetworRef" :book-id="book_id" :is-edit="true" />
   </div>
 </template>
 
@@ -65,7 +65,7 @@ export default {
       this.isChildDataLoad = false;
       this.isWaiting = true;
       MangerGenerateKnowledgeGraphByBookContent({ book_id: this.book_id }).then((res) => {
-        if (res && res.status == 1) {
+        if (res && res.status === 1) {
           this.isChildDataLoad = true;
           this.isWaiting = false;
         }
@@ -77,8 +77,8 @@ export default {
         this.$message.error('请先生成数据');
         return;
       }
-      var node = { nodes: data.nodes };
-      var edge = { edges: data.edges };
+      let node = { nodes: data.nodes };
+      let edge = { edges: data.edges };
       const loading = this.$loading({
         lock: true,
         text: '保存中...',

+ 1 - 1
vue.config.js

@@ -35,7 +35,7 @@ module.exports = defineConfig({
   publicPath: NODE_ENV === 'development' ? '/' : './',
   outputDir: 'dist',
   assetsDir: 'static',
-  lintOnSave: NODE_ENV === 'development',
+  lintOnSave: false,
   runtimeCompiler: true,
   productionSourceMap: false,
   devServer: {

Some files were not shown because too many files changed in this diff