Browse Source

Merge branch 'master' of http://221.216.211.14:3000/GCLS/GCLS_Page_Book_Component_NPC

gcj 3 years ago
parent
commit
14bfb0a764
59 changed files with 845 additions and 1202 deletions
  1. 2 1
      package.json
  2. 4 5
      src/components/Adult/common/Lrc.vue
  3. 0 1
      src/components/Adult/common/UploadArt.vue
  4. 0 2
      src/components/Adult/inputModules/ Engineaudio.vue
  5. 0 1
      src/components/Adult/inputModules/ArticleTemChs/components/ArticleChs.vue
  6. 4 5
      src/components/Adult/inputModules/ArticleTemChs/index.vue
  7. 0 6
      src/components/Adult/inputModules/AudioControl.vue
  8. 0 1
      src/components/Adult/inputModules/Catelog.vue
  9. 0 6
      src/components/Adult/inputModules/Dialogue.vue
  10. 1 1
      src/components/Adult/inputModules/DialogueArticleChs/components/RoleChs.vue
  11. 2 3
      src/components/Adult/inputModules/DialogueArticleChs/index.vue
  12. 1 1
      src/components/Adult/inputModules/DialogueTem/components/RoleChs.vue
  13. 2 3
      src/components/Adult/inputModules/DialogueTem/index.vue
  14. 0 6
      src/components/Adult/inputModules/Ligature.vue
  15. 0 6
      src/components/Adult/inputModules/MatrixSingle.vue
  16. 7 9
      src/components/Adult/inputModules/Neword.vue
  17. 0 2
      src/components/Adult/inputModules/Notes.vue
  18. 0 2
      src/components/Adult/inputModules/NumberCombination.vue
  19. 0 9
      src/components/Adult/inputModules/Picture.vue
  20. 1 1
      src/components/Adult/inputModules/PlayInputReacord.vue
  21. 7 7
      src/components/Adult/inputModules/PurePreview.vue
  22. 0 6
      src/components/Adult/inputModules/Record.vue
  23. 5 10
      src/components/Adult/inputModules/Sentence.vue
  24. 1 1
      src/components/Adult/inputModules/SentenceModule.vue
  25. 2 2
      src/components/Adult/inputModules/Single.vue
  26. 1 1
      src/components/Adult/inputModules/Tinydemo.vue
  27. 6 63
      src/components/Adult/inputModules/ToneSelect.vue
  28. 2 2
      src/components/Adult/inputModules/VoiceMatrix.vue
  29. 1 1
      src/components/Adult/inputModules/ZiLine.vue
  30. 1 3
      src/components/Adult/preview/DialogueArticleViewChs/AnswerModel.vue
  31. 0 2
      src/components/Adult/preview/DialogueArticleViewChs/NormalModelChs.vue
  32. 3 5
      src/components/Adult/preview/DialogueArticleViewChs/Practicechs.vue
  33. 4 4
      src/components/Adult/preview/NewWordShow.vue
  34. 0 1
      src/components/Adult/preview/Single.vue
  35. 0 1
      src/components/Adult/preview/Soundrecord.vue
  36. 0 1
      src/components/Adult/preview/Soundrecorddiff.vue
  37. 0 9
      src/components/Adult/preview/Voicefullscreen.vue
  38. 1 1
      src/components/Adult/preview/components/FreeWriteQP.vue
  39. 0 4
      src/components/Adult/preview/components/WordPhraseDetail.vue
  40. 1 2
      src/components/Adult/preview/components/Wordcard.vue
  41. 1 1
      src/components/Header.vue
  42. 0 2
      src/components/TreeView.vue
  43. 0 3
      src/components/common/Soundrecord.vue
  44. 0 1
      src/components/pyment/Audit.vue
  45. 0 223
      src/data.js
  46. 20 21
      src/main.js
  47. 38 39
      src/permission.js
  48. 23 25
      src/store/modules/lang.js
  49. 64 65
      src/store/modules/user.js
  50. 144 149
      src/utils/index.js
  51. 308 355
      src/utils/pinyinUtil.js
  52. 76 77
      src/utils/request.js
  53. 15 15
      src/utils/validate.js
  54. 16 17
      src/utils/wuziqi/AiringGo.js
  55. 2 3
      src/utils/wuziqi/main.js
  56. 0 1
      src/views/adultInput.vue
  57. 0 1
      src/views/bookView.vue
  58. 1 2
      src/views/courseList.vue
  59. 78 5
      src/views/login.vue

+ 2 - 1
package.json

@@ -24,6 +24,7 @@
     "js-audio-recorder": "^1.0.7",
     "js-base64": "^3.6.1",
     "js-cookie": "2.2.0",
+    "js-md5": "^0.7.3",
     "jsplumb": "^2.15.6",
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
@@ -82,4 +83,4 @@
     "npm": ">= 3.0.0"
   },
   "license": "MIT"
-}
+}

+ 4 - 5
src/components/Adult/common/Lrc.vue

@@ -52,7 +52,6 @@
 <script>
 import Upload from "../common/Upload.vue";
 import {
-  BatchSegContent,
   getWordTime,
   getContentFile,
   prepareTranscribe,
@@ -200,14 +199,14 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },
-    changeLrc(fileList) {
+    changeLrc(fileLists) {
       let lrc_list = [];
-      fileList.forEach(({ response, name }) => {
+      fileLists.forEach(({ response, name }) => {
         if (response) {
           let fileList = response.file_info_list[0];
           lrc_list.push({

+ 0 - 1
src/components/Adult/common/UploadArt.vue

@@ -38,7 +38,6 @@
 </template>
 
 <script>
-import Cookies from "js-cookie";
 import { getToken } from "../../../utils/auth";
 export default {
   components: {},

+ 0 - 2
src/components/Adult/inputModules/ Engineaudio.vue

@@ -28,11 +28,9 @@
 import {
   prepareTranscribe,
   getWordTime,
-  compareSenTenceTime,
   textCreadMp3,
   getContentFile,
 } from "@/api/ajax";
-const Base64 = require("js-base64").Base64;
 export default {
   components: {},
   props: ["curQue"],

+ 0 - 1
src/components/Adult/inputModules/ArticleTemChs/components/ArticleChs.vue

@@ -22,7 +22,6 @@
 </template>
 
 <script>
-import { textCreadMp3 } from "@/api/ajax";
 export default {
   components: {},
   props: ["curQue", "changeIsPara"],

+ 4 - 5
src/components/Adult/inputModules/ArticleTemChs/index.vue

@@ -179,7 +179,6 @@
 import {
   segSentences,
   BatchSegContent,
-  createPinyin,
   prepareTranscribe,
   getWordTime,
   compareSenTenceTime,
@@ -272,8 +271,8 @@ export default {
               speechBase64: res.base64_text,
               language: "ch",
             };
-            prepareTranscribe(taskIddata).then((res) => {
-              _this.$set(_this.curQue, "taskId", res.data.taskId);
+            prepareTranscribe(taskIddata).then((ress) => {
+              _this.$set(_this.curQue, "taskId", ress.data.taskId);
               _this.loading = false;
               resolve();
             });
@@ -454,8 +453,8 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((ress) => {
+          _this.$set(_this.curQue, "taskId", ress.data.taskId);
         });
       });
     },

+ 0 - 6
src/components/Adult/inputModules/AudioControl.vue

@@ -43,12 +43,6 @@ export default {
   methods: {
     //添加一个选项
     addOption() {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
-      // if (!last.hanzi && !last.pinyin && !last.definition_list[0]) {
-      //   this.$message.warning("数据不能全是空");
-      //   return;
-      // }
       let type = this.curQue.type;
       let cur_fn_data_arr = this.fn_data.filter((item) => item.type == type);
       let cur_fn_data = JSON.parse(JSON.stringify(cur_fn_data_arr[0]));

+ 0 - 1
src/components/Adult/inputModules/Catelog.vue

@@ -136,7 +136,6 @@ import "he-tree-vue/dist/he-tree-vue.css";
 import { getContent } from "@/api/ajax";
 import Cookies from "js-cookie";
 import { Tree, Fold, Draggable } from "he-tree-vue";
-import * as hp from "helper-js";
 
 export default {
   components: {

+ 0 - 6
src/components/Adult/inputModules/Dialogue.vue

@@ -114,12 +114,6 @@ export default {
     },
     // 新增选项
     addOption() {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
-      // if (!last.hanzi && !last.pinyin) {
-      //   this.$message.warning("数据不能全是空");
-      //   return;
-      // }
       let type = this.curQue.type;
       let cur_fn_data_arr = this.fn_data.filter((item) => item.type == type);
       let cur_fn_data = JSON.parse(JSON.stringify(cur_fn_data_arr[0]));

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

@@ -65,7 +65,7 @@
 import Upload from "../../../common/Upload.vue";
 import Pinyin from "./Pinyin.vue";
 const Base64 = require("js-base64").Base64;
-import { segSentences, BatchSegContent, createPinyin } from "@/api/ajax";
+import { BatchSegContent, createPinyin } from "@/api/ajax";
 export default {
   name: "role",
   components: {

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

@@ -250,7 +250,6 @@
 import {
   segSentences,
   BatchSegContent,
-  createPinyin,
   prepareTranscribe,
   getWordTime,
   compareSenTenceTime,
@@ -592,8 +591,8 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },

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

@@ -59,7 +59,7 @@
 import Upload from "../../../common/Upload.vue";
 import Pinyin from "./Pinyin.vue";
 const Base64 = require("js-base64").Base64;
-import { segSentences, BatchSegContent, createPinyin } from "@/api/ajax";
+import { BatchSegContent, createPinyin } from "@/api/ajax";
 export default {
   name: "role",
   components: {

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

@@ -200,7 +200,6 @@
 import {
   segSentences,
   BatchSegContent,
-  createPinyin,
   prepareTranscribe,
   getWordTime,
 } from "@/api/ajax";
@@ -529,8 +528,8 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },

+ 0 - 6
src/components/Adult/inputModules/Ligature.vue

@@ -231,12 +231,6 @@ export default {
     },
     //添加一个选项
     addOption(CorO) {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
-      // if (!last.hanzi && !last.pinyin) {
-      //   this.$message.warning("数据不能全是空");
-      //   return;
-      // }
       if (CorO == "con") {
         let obj = this.data_structure.con[0];
         this.curQue.con.push(obj);

+ 0 - 6
src/components/Adult/inputModules/MatrixSingle.vue

@@ -160,12 +160,6 @@ export default {
     },
     // 新增选项
     addOption(conOrtion) {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
-      // if (!last.hanzi && !last.pinyin && !last.definition_list[0]) {
-      //   this.$message.warning("数据不能全是空");
-      //   return;
-      // }
       let type = this.curQue.type;
       let cur_fn_data_arr = this.fn_data.filter((item) => item.type == type);
       let cur_fn_data = JSON.parse(JSON.stringify(cur_fn_data_arr[0]));

+ 7 - 9
src/components/Adult/inputModules/Neword.vue

@@ -164,8 +164,6 @@ export default {
       item[field] = item[field] ? item[field].trim() : "";
     },
     addoption() {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
       let res_data = JSON.parse(JSON.stringify(this.data_structure));
       let obj = res_data.option[0];
       obj.index = this.curQue.option.push(obj);
@@ -302,8 +300,8 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },
@@ -311,13 +309,13 @@ export default {
       let lrc_list = [];
       fileList.forEach(({ response, name }) => {
         if (response) {
-          let fileList = response.file_info_list[0];
+          let fileLists = response.file_info_list[0];
           lrc_list.push({
             name,
-            duration: fileList.media_duration,
-            url: fileList.file_url,
-            id: "[FID##" + fileList.file_id + "##FID]",
-            file_id: fileList.file_id,
+            duration: fileLists.media_duration,
+            url: fileLists.file_url,
+            id: "[FID##" + fileLists.file_id + "##FID]",
+            file_id: fileLists.file_id,
           });
         }
       });

+ 0 - 2
src/components/Adult/inputModules/Notes.vue

@@ -127,8 +127,6 @@ export default {
       item[field] = item[field] ? item[field].trim() : "";
     },
     addoption() {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
       let res_data = JSON.parse(JSON.stringify(this.data_structure));
       let obj = res_data.option[0];
       this.curQue.option.push(obj);

+ 0 - 2
src/components/Adult/inputModules/NumberCombination.vue

@@ -83,8 +83,6 @@ export default {
       item[field] = item[field] ? item[field].trim() : "";
     },
     addoption() {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
       let res_data = JSON.parse(JSON.stringify(this.data_structure));
       let obj = res_data.option[0];
       this.curQue.option.push(obj);

+ 0 - 9
src/components/Adult/inputModules/Picture.vue

@@ -204,15 +204,6 @@ export default {
     },
     //添加一个选项
     addOption(index) {
-      // let leg = this.curQue.option.length;
-      // let last = this.curQue.option[leg - 1];
-      // // if (!last.hanzi && !last.pinyin && !last.definition_list[0]) {
-      // //   this.$message.warning("数据不能全是空");
-      // //   return;
-      // // }
-      // let type = this.curQue.type;
-      // let cur_fn_data_arr = this.fn_data.filter((item) => item.type == type);
-      // let cur_fn_data = JSON.parse(JSON.stringify(cur_fn_data_arr[0]));
       let obj = this.data_structure.option[0].option[0];
       this.curQue.option[index].option.push(obj);
     },

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

@@ -171,7 +171,7 @@ export default {
       this.changeCurQue(data);
     },
     // 选项的音频
-    changeMp3(fileList, item, index) {
+    changeMp3(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {

+ 7 - 7
src/components/Adult/inputModules/PurePreview.vue

@@ -351,7 +351,7 @@
 <script>
 import Upload from "../common/Upload";
 import SentenceSegwordChs from "../common/SentenceSegwordChs/index.vue";
-import { getWordTime, getContentFile, prepareTranscribe } from "@/api/ajax";
+import { getWordTime, getContentFile, prepareTranscribe, compareSenTenceTime } from "@/api/ajax";
 import CompareTime from "./ArticleTemChs/components/CompareTime.vue";
 export default {
   name: "PurePreview",
@@ -619,7 +619,7 @@ export default {
       );
     },
     // 选项的音频
-    changeMp3(fileList, item, index) {
+    changeMp3(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {
@@ -638,7 +638,7 @@ export default {
       );
     },
     // 听录音选择音调的上传音频
-    listenchangeMp3(fileList, item, index) {
+    listenchangeMp3(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {
@@ -681,8 +681,8 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },
@@ -759,9 +759,9 @@ export default {
       this.isWordTime = false;
       this.$set(this.curQue, "wordTime", []);
     },
-    changeLrc(fileList) {
+    changeLrc(fileLists) {
       let lrc_list = [];
-      fileList.forEach(({ response, name }) => {
+      fileLists.forEach(({ response, name }) => {
         if (response) {
           let fileList = response.file_info_list[0];
           lrc_list.push({

+ 0 - 6
src/components/Adult/inputModules/Record.vue

@@ -49,12 +49,6 @@ export default {
   methods: {
     //添加一个选项
     addOption() {
-      let leg = this.curQue.option.length;
-      let last = this.curQue.option[leg - 1];
-      // if (!last.hanzi && !last.pinyin && !last.definition_list[0]) {
-      //   this.$message.warning("数据不能全是空");
-      //   return;
-      // }
       let type = this.curQue.type;
       let cur_fn_data_arr = this.fn_data.filter((item) => item.type == type);
       let cur_fn_data = JSON.parse(JSON.stringify(cur_fn_data_arr[0]));

+ 5 - 10
src/components/Adult/inputModules/Sentence.vue

@@ -106,11 +106,7 @@
 <script>
 import SentenceModule from "../common/SentenceModule.vue";
 import Upload from "../common/Upload";
-const Base64 = require("js-base64").Base64;
 import {
-  segSentences,
-  BatchSegContent,
-  createPinyin,
   prepareTranscribe,
   getWordTime,
   getContentFile,
@@ -185,7 +181,6 @@ export default {
         lrc_list: [],
         wordTime: [],
         taskId: "",
-        wordTime: [],
         detail: [],
         sentenceType: "chinese",
         option: [
@@ -327,7 +322,7 @@ export default {
       if (a.length > 1) {
         // 加上小数部分(如果有小数部分)
         re += BB[6];
-        for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
+        for (let i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
       }
       if (re == "yishi") re = "shi";
       if (re.match(/^一/) && re.length == 3) re = re.replace("yi", "");
@@ -343,14 +338,14 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },
-    changeLrc(fileList) {
+    changeLrc(fileLists) {
       let lrc_list = [];
-      fileList.forEach(({ response, name }) => {
+      fileLists.forEach(({ response, name }) => {
         if (response) {
           let fileList = response.file_info_list[0];
           lrc_list.push({

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

@@ -1118,7 +1118,7 @@ export default {
         _this.curQue.option[_this.col][_this.row].detail.push(optionItem);
       }
     },
-    timuchangeImage(fileList, item) {
+    timuchangeImage(fileList, items) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {

+ 2 - 2
src/components/Adult/inputModules/Single.vue

@@ -385,7 +385,7 @@ export default {
       }
       this.curQue[index].option.push(obj);
     },
-    timuchangeMp3(fileList, item, index) {
+    timuchangeMp3(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {
@@ -403,7 +403,7 @@ export default {
         JSON.stringify(articleImgRes)
       );
     },
-    timuchangeImage(fileList, item, index) {
+    timuchangeImage(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {

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

@@ -111,7 +111,7 @@ export default {
     copyHttp(id) {
       CopyToClipboard(id, this);
     },
-    changeImage(fileList, item, index) {
+    changeImage(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {

+ 6 - 63
src/components/Adult/inputModules/ToneSelect.vue

@@ -173,9 +173,6 @@ import "tinymce/plugins/contextmenu";
 import "tinymce/plugins/textcolor";
 import "tinymce/plugins/colorpicker";
 import {
-  segSentences,
-  BatchSegContent,
-  createPinyin,
   prepareTranscribe,
   getWordTime,
   getContentFile,
@@ -268,10 +265,6 @@ export default {
 
       if (this.curQue.taskId) {
         let verseList = [];
-        let numberArr = [];
-        this.curQue.detail.forEach((item, i) => {
-          numberArr.push(this.numberToChinese(i + 1));
-        });
         for (let i = 0; i < this.curQue.detail.length; i++) {
           verseList = verseList.concat(this.curQue.detail[i].pinyin);
         }
@@ -296,59 +289,9 @@ export default {
       this.isWordTime = false;
       this.$set(this.curQue, "wordTime", []);
     },
-    numberToChinese(num) {
-      var AA = new Array(
-        "ling",
-        "yi",
-        "er",
-        "san",
-        "si",
-        "wu",
-        "liu",
-        "qi",
-        "ba",
-        "jiu",
-        "shi"
-      );
-      var BB = new Array("", "shi", "bai", "qian", "wan", "yi", "dian", "");
-      var a = ("" + num).replace(/(^0*)/g, "").split("."),
-        k = 0,
-        re = "";
-      for (var i = a[0].length - 1; i >= 0; i--) {
-        switch (k) {
-          case 0:
-            re = BB[7] + re;
-            break;
-          case 4:
-            if (
-              !new RegExp("0{4}//d{" + (a[0].length - i - 1) + "}$").test(a[0])
-            )
-              re = BB[4] + re;
-            break;
-          case 8:
-            re = BB[5] + re;
-            BB[7] = BB[5];
-            k = 0;
-            break;
-        }
-        if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0)
-          re = AA[0] + re;
-        if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re;
-        k++;
-      }
-
-      if (a.length > 1) {
-        // 加上小数部分(如果有小数部分)
-        re += BB[6];
-        for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
-      }
-      if (re == "yishi") re = "shi";
-      if (re.match(/^一/) && re.length == 3) re = re.replace("yi", "");
-      return re;
-    },
-    changeLrc(fileList) {
+    changeLrc(fileLists) {
       let lrc_list = [];
-      fileList.forEach(({ response, name }) => {
+      fileLists.forEach(({ response, name }) => {
         if (response) {
           let fileList = response.file_info_list[0];
           lrc_list.push({
@@ -376,7 +319,7 @@ export default {
     onBlur(item, field) {
       item[field] = item[field] ? item[field].trim() : "";
     },
-    changeMp3(fileList, item, index) {
+    changeMp3(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {
@@ -396,7 +339,7 @@ export default {
         JSON.stringify(articleImgRes)
       );
     },
-    timuchangeMp3(fileList, item) {
+    timuchangeMp3(fileList, items) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {
@@ -440,8 +383,8 @@ export default {
           speechBase64: base_res[1],
           language: "ch",
         };
-        prepareTranscribe(data).then((res) => {
-          _this.$set(_this.curQue, "taskId", res.data.taskId);
+        prepareTranscribe(data).then((reses) => {
+          _this.$set(_this.curQue, "taskId", reses.data.taskId);
         });
       });
     },

+ 2 - 2
src/components/Adult/inputModules/VoiceMatrix.vue

@@ -492,9 +492,9 @@ export default {
       this.curQue.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
     },
 
-    changeLrc(fileList) {
+    changeLrc(fileLists) {
       let lrc_list = [];
-      fileList.forEach(({ response, name }) => {
+      fileLists.forEach(({ response, name }) => {
         if (response) {
           let fileList = response.file_info_list[0];
           lrc_list.push({

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

@@ -451,7 +451,7 @@ export default {
       this.changeCurQue(data);
     },
     // 选项的音频
-    changeMp3(fileList, item, index) {
+    changeMp3(fileList, items, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {

+ 1 - 3
src/components/Adult/preview/DialogueArticleViewChs/AnswerModel.vue

@@ -530,9 +530,7 @@ export default {
     handlePY(pinyin) {
       let reg = /_{2,}/g;
       let py = "";
-      if (reg.test(pinyin)) {
-        py = "";
-      } else {
+      if (!reg.test(pinyin)) {
         py = pinyin;
       }
       return py;

+ 0 - 2
src/components/Adult/preview/DialogueArticleViewChs/NormalModelChs.vue

@@ -453,8 +453,6 @@ export default {
         "⑳",
       ],
       newWords: [],
-      top: 0,
-      left: 0,
       articleImg: {}, // 文章图片
       isHasRemark: false,
       isNoteShow: false,

+ 3 - 5
src/components/Adult/preview/DialogueArticleViewChs/Practicechs.vue

@@ -695,9 +695,7 @@ export default {
     },
     handleData() {
       let resArr = [],
-        timeArr = [],
-        sentArrTotal = [],
-        enList = [];
+        sentArrTotal = [];
       let curQue = JSON.parse(JSON.stringify(this.curQue));
       let wordTimeList = curQue.wordTime;
       curQue.detail.forEach((dItem, dIndex) => {
@@ -733,13 +731,13 @@ export default {
             };
             sentArr.push(obj);
           });
-          let obj = {
+          let objs = {
             roleDetail: roleDetail,
             sentArr: sentArr,
             enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex],
           };
           sentArrTotal.push(sentArr);
-          resArr.push(obj);
+          resArr.push(objs);
         });
       });
       if (wordTimeList && wordTimeList.length > 0) {

+ 4 - 4
src/components/Adult/preview/NewWordShow.vue

@@ -154,9 +154,9 @@ export default {
       }
       this.playStatus = true;
       let ref = null;
-      this.$refs.cans.forEach((item) => {
-        if (item.$el.id == `cans${rowIndex}${colIndex}`) {
-          ref = item;
+      this.$refs.cans.forEach((items) => {
+        if (items.$el.id == `cans${rowIndex}${colIndex}`) {
+          ref = items;
         }
       });
       ref.reset();
@@ -254,7 +254,7 @@ export default {
         stem: [
           {
             con: words ? words : "",
-            pinyin: pinyin && pinyin ? pinyin : "",
+            pinyin: pinyin ? pinyin : "",
             mp3_url: "",
             TChinese: TChinese.text,
           },

+ 0 - 1
src/components/Adult/preview/Single.vue

@@ -85,7 +85,6 @@ export default {
         });
         if (!this.curQue.Bookanswer) {
             this.$set(this.curQue, "Bookanswer", single);
-            debugger
         }
     },
     handleWav(data) {

+ 0 - 1
src/components/Adult/preview/Soundrecord.vue

@@ -264,7 +264,6 @@ export default {
           let toltime = this.recorder.duration; // 录音总时长
           let fileSize = this.recorder.fileSize; // 录音总大小
           // 录音结束,获取取录音数据
-          let PCMBlob = this.recorder.getPCMBlob(); // 获取 PCM 数据
           let wav = this.recorder.getWAVBlob(); // 获取 WAV 数据
           // this.wavblob = wav;
           this.microphoneStatus = false;

+ 0 - 1
src/components/Adult/preview/Soundrecorddiff.vue

@@ -187,7 +187,6 @@ export default {
         let toltime = this.recorder.duration; // 录音总时长
         let fileSize = this.recorder.fileSize; // 录音总大小
         // 录音结束,获取取录音数据
-        let PCMBlob = this.recorder.getPCMBlob(); // 获取 PCM 数据
         let wav = this.recorder.getWAVBlob(); // 获取 WAV 数据
         // this.wavblob = wav;
         this.microphoneStatus = false;

+ 0 - 9
src/components/Adult/preview/Voicefullscreen.vue

@@ -1162,7 +1162,6 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    let _this = this;
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
@@ -1196,14 +1195,6 @@ export default {
     }
     _this.curSentIndex = _this.sentIndex;
     _this.getSentence();
-    let isFullscreen =
-      document.fullscreenElement ||
-      document.mozFullScreenElement ||
-      document.webkitFullscreenElement ||
-      document.fullScreen ||
-      document.mozFullScreen ||
-      document.webkitIsFullScreen;
-    isFullscreen = !!isFullscreen;
     document.addEventListener("fullscreenchange", () => {
       let isFullscreen =
         document.fullscreenElement ||

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

@@ -198,7 +198,7 @@ export default {
         this.canvasTxt.globalCompositeOperation = "source-over";
         if (this.isCrop) {
           const crop_area = this.getCropArea(resImgData.data);
-          var crop_canvas = document.createElement("canvas");
+          let crop_canvas = document.createElement("canvas");
           const crop_ctx = crop_canvas.getContext("2d");
           crop_canvas.width = crop_area[2] - crop_area[0];
           crop_canvas.height = crop_area[3] - crop_area[1];

+ 0 - 4
src/components/Adult/preview/components/WordPhraseDetail.vue

@@ -352,10 +352,8 @@ export default {
         });
     },
     handleExample(list) {
-      let _this = this;
       // let list1Ora = JSON.parse(JSON.stringify(_this.data.list1))
       list = list.map((item, index) => {
-        let position_str = [];
         let sentence = JSON.parse(JSON.stringify(item.sentence));
         let res = "";
         for (let i = 0; i < item.position_list.length; i++) {
@@ -374,14 +372,12 @@ export default {
                 item.position_list[i + 1].begin
               );
             } else if (i == item.position_list.length - 1) {
-              part1 = "";
               part2 = sentence.substring(
                 item.position_list[i].begin,
                 item.position_list[i].end
               );
               part3 = sentence.substring(item.position_list[i].end);
             } else {
-              part1 = "";
               part2 = sentence.substring(
                 item.position_list[i].begin,
                 item.position_list[i].end

+ 1 - 2
src/components/Adult/preview/components/Wordcard.vue

@@ -306,7 +306,6 @@ export default {
       });
     },
     async writeWord(words, pinyin) {
-      let _this = this;
       const MethodName = "tool-ChineseSCConvert";
       const data = {
         text: words,
@@ -317,7 +316,7 @@ export default {
         stem: [
           {
             con: words ? words : "",
-            pinyin: pinyin && pinyin ? pinyin : "",
+            pinyin: pinyin ? pinyin : "",
             mp3_url: "",
             TChinese: TChinese.text,
           },

+ 1 - 1
src/components/Header.vue

@@ -95,7 +95,7 @@ import {
   getContentFile,
 } from "@/api/ajax";
 //import { setI18nLang } from "@/utils/i18n";
-import { saveSession, getSession, removeSession } from "@/utils/role";
+import { removeSession } from "@/utils/role";
 export default {
   name: "LayoutHeader",
   props: [],

+ 0 - 2
src/components/TreeView.vue

@@ -69,9 +69,7 @@
 <script>
 import "he-tree-vue/dist/he-tree-vue.css";
 import { getContent } from "@/api/ajax";
-import Cookies from "js-cookie";
 import { Tree, Fold, Draggable } from "he-tree-vue";
-import * as hp from "helper-js";
 
 export default {
   components: {

+ 0 - 3
src/components/common/Soundrecord.vue

@@ -61,10 +61,7 @@ export default {
                 this.microphoneBtn = "录音完成";
                 this.hasMicro = "normal";
                 this.recorder.stop();
-                let toltime = this.recorder.duration; //录音总时长
-                let fileSize = this.recorder.fileSize; //录音总大小
                 //录音结束,获取取录音数据
-                let PCMBlob = this.recorder.getPCMBlob(); //获取 PCM 数据
                 let wav = this.recorder.getWAVBlob(); //获取 WAV 数据
                 this.wavblob = wav;
                 this.microphoneStatus = false;

+ 0 - 1
src/components/pyment/Audit.vue

@@ -49,7 +49,6 @@
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
-import { LearnWebSI } from "@/api/api";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},

+ 0 - 223
src/data.js

@@ -1,223 +0,0 @@
-const demoDataList =  [
-    {
-      id: 110,
-      parent_id: 0,
-      order: 0,
-      name: "客户管理",
-      uri: "无",
-      open: true,
-      lists: [
-        {
-          id: 201,
-          parent_id: 110,
-          order: 0,
-          name: "联系人",
-          uri: "/customer/contacts",
-          lists: null,
-          isShowCheckbox: false,
-          highlight: true
-        },
-        {
-          id: 173,
-          parent_id: 110,
-          order: 1,
-          name: "客户",
-          uri: "/customer/customerList",
-          lists: null,
-          checked: true,
-        },
-        {
-          id: 117,
-          parent_id: 110,
-          order: 2,
-          name: "客户维护记录",
-          uri: "/customer/maintain",
-          lists: null
-        },
-        {
-          id: 383,
-          parent_id: 110,
-          order: 3,
-          name: "客户冲突",
-          uri: "无",
-          lists: [
-            {
-              id: 390,
-              parent_id: 383,
-              order: 0,
-              name: "个人冲突",
-              uri: "/customer/personalConflict",
-              lists: null
-            },
-            {
-              id: 397,
-              parent_id: 383,
-              order: 1,
-              name: "团队冲突",
-              uri: "/customer/teamConflict",
-              lists: null
-            },
-            {
-              id: 215,
-              parent_id: 383,
-              order: 2,
-              name: "客户查询",
-              uri: "/customer/inquiry",
-              lists: null
-            }
-          ]              
-        },
-        {
-          id: 138,
-          parent_id: 110,
-          order: 4,
-          name: "线索管理",
-          uri: "/customer/clue",
-          lists: null
-        },
-        {
-          id: 159,
-          parent_id: 110,
-          order: 5,
-          name: "集团信息",
-          uri: "/customer/agent",
-          lists: null
-        }
-      ]
-    },
-    {
-      id: 404,
-      parent_id: 0,
-      order: 1,
-      name: "审核中心",
-      uri: "无",
-      lists: [
-        {
-          id: 187,
-          parent_id: 404,
-          order: 0,
-          name: "资质审核",
-          uri: "/customer/qualifications",
-          lists: null
-        }
-      ]
-    },
-    {
-      id: 306,
-      parent_id: 0,
-      order: 2,
-      name: "数据统计",
-      uri: "无",
-      lists: [
-        {
-          id: 222,
-          parent_id: 306,
-          order: 0,
-          name: "线索",
-          uri: "/customer/clueStatistics",
-          lists: null
-        },
-        {
-          id: 124,
-          parent_id: 306,
-          order: 1,
-          name: "客户",
-          uri: "/customer/statistics",
-          lists: null
-        }
-      ]
-    },
-    {
-      id: 334,
-      parent_id: 0,
-      order: 3,
-      name: "基础数据",
-      uri: "",
-      lists: [
-        {
-          id: 152,
-          parent_id: 334,
-          order: 0,
-          name: "行业信息",
-          uri: "/customer/industry",
-          lists: null
-        },
-        {
-          id: 166,
-          parent_id: 334,
-          order: 1,
-          name: "客户部门",
-          uri: "/customer/departmentType",
-          lists: null
-        }
-      ]
-    },
-    {
-      id: 9,
-      parent_id: 0,
-      order: 4,
-      name: "系统管理",
-      uri: "",
-      open: false,
-      lists: [
-        {
-          id: 313,
-          parent_id: 9,
-          order: 0,
-          name: "员工管理",
-          uri: "/rbac/userManagement",
-          lists: [
-            {
-              id: 412,
-              parent_id: 313,
-              order: 0,
-              name: "员工管理-子节点",
-              uri: "/rbac/userManagement",
-              lists: null
-            }
-          ]
-        },
-        {
-          id: 320,
-          parent_id: 9,
-          order: 1,
-          name: "部门管理",
-          uri: "/rbac/departmentManagement",
-          lists: null
-        },
-        {
-          id: 23,
-          parent_id: 9,
-          order: 2,
-          name: "角色管理",
-          uri: "/rbac/roleManagement",
-          lists: null
-        },
-        {
-          id: 16,
-          parent_id: 9,
-          order: 3,
-          name: "权限管理",
-          uri: "/rbac/authorityManagement",
-          lists: null
-        },
-        {
-          id: 2,
-          parent_id: 9,
-          order: 4,
-          name: "菜单管理",
-          uri: "/menu/menuManagement",
-          lists: null
-        },
-        {
-          id: 107,
-          parent_id: 9,
-          order: 5,
-          name: "操作日志",
-          uri: "/operation/log",
-          lists: null
-        }
-      ]
-    }
-  ]
-  export default demoDataList;

+ 20 - 21
src/main.js

@@ -5,7 +5,6 @@ import '@/common/font/font.css'
 
 import ElementUI from 'element-ui'
 import 'element-ui/lib/theme-chalk/index.css'
-import locale from 'element-ui/lib/locale/lang/en' // lang i18n
 import elementUtils from 'vue-element-utils'
 
 import '@/styles/index.scss' // global css
@@ -39,16 +38,16 @@ Vue.prototype.$jsPlumb = jsPlumb.jsPlumb
 // 如果想要中文版 element-ui,按如下方式声明
 // element 下拉框下拉加载
 Vue.directive('loadmore', {
-  bind(el, binding) {
-    // 获取element-ui定义好的scroll盒子
-    const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
-    SELECTWRAP_DOM.addEventListener('scroll', function () {
-      const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight
-      if (CONDITION) {
-        binding.value()
-      }
-    })
-  }
+    bind(el, binding) {
+        // 获取element-ui定义好的scroll盒子
+        const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
+        SELECTWRAP_DOM.addEventListener('scroll', function() {
+            const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight
+            if (CONDITION) {
+                binding.value()
+            }
+        })
+    }
 })
 
 Vue.use(ElementUI)
@@ -59,14 +58,14 @@ Vue.use(elementUtils)
 Vue.config.productionTip = false
 
 new Vue({
-  el: '#app',
-  router,
-  store,
-  i18n,
-  data: function () {
-    return {
-      isRecording: false
-    }
-  },
-  render: h => h(App)
+    el: '#app',
+    router,
+    store,
+    i18n,
+    data: function() {
+        return {
+            isRecording: false
+        }
+    },
+    render: h => h(App)
 })

+ 38 - 39
src/permission.js

@@ -1,5 +1,4 @@
 import router from './router'
-import store from './store'
 import { Message } from 'element-ui'
 import NProgress from 'nprogress' // progress bar
 import 'nprogress/nprogress.css' // progress bar style
@@ -10,49 +9,49 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
 const whiteList = ['/login'] // no redirect whitelist
 
-router.beforeEach(async (to, from, next) => {
-  // start progress bar
-  NProgress.start()
-  // set page title
-  document.title = getPageTitle(to.meta.title)
-  //next();
-  NProgress.done()
-  const hasToken = getToken()
+router.beforeEach(async(to, from, next) => {
+    // start progress bar
+    NProgress.start()
+        // set page title
+    document.title = getPageTitle(to.meta.title)
+        //next();
+    NProgress.done()
+    const hasToken = getToken()
 
-  if (hasToken) {
-    let config = getConfig();
-    if (config) {
-      if (to.path === '/login') {
-        // if is logged in, redirect to the home page
-        next({ path: '/EnterSys' })
-        NProgress.done()
-      } else {
-        try {
-          next()
-        } catch (error) {
-          Message.error(error || 'Has Error')
-          next(`/login?redirect=${to.path}`)
-          NProgress.done()
+    if (hasToken) {
+        let config = getConfig();
+        if (config) {
+            if (to.path === '/login') {
+                // if is logged in, redirect to the home page
+                next({ path: '/EnterSys' })
+                NProgress.done()
+            } else {
+                try {
+                    next()
+                } catch (error) {
+                    Message.error(error || 'Has Error')
+                    next(`/login?redirect=${to.path}`)
+                    NProgress.done()
+                }
+            }
+        } else {
+            next(`/login?redirect=${to.path}`)
+            NProgress.done()
         }
-      }
     } else {
-      next(`/login?redirect=${to.path}`)
-      NProgress.done()
-    }
-  } else {
-    /* has no token*/
-    if (whiteList.indexOf(to.path) !== -1) {
-      // in the free login whitelist, go directly
-      next()
-    } else {
-      // other pages that do not have permission to access are redirected to the login page.
-      next(`/login?redirect=${to.path}`)
-      NProgress.done()
+        /* has no token*/
+        if (whiteList.indexOf(to.path) !== -1) {
+            // in the free login whitelist, go directly
+            next()
+        } else {
+            // other pages that do not have permission to access are redirected to the login page.
+            next(`/login?redirect=${to.path}`)
+            NProgress.done()
+        }
     }
-  }
 })
 
 router.afterEach(() => {
-  // finish progress bar
-  NProgress.done()
+    // finish progress bar
+    NProgress.done()
 })

+ 23 - 25
src/store/modules/lang.js

@@ -1,38 +1,36 @@
-import Cookies from 'js-cookie';
 import { getContentFile } from '@/api/ajax';
 
 const state = {
-  language_type: localStorage.getItem('language_type') || 'ZH'
+    language_type: localStorage.getItem('language_type') || 'ZH'
 }
 
 const mutations = {
-  SET_UPDATE_LANGUAGE_TYPE: (state, language_type) => {
-    localStorage.setItem('language_type', language_type);
-    state.language_type = language_type;
-  },
+    SET_UPDATE_LANGUAGE_TYPE: (state, language_type) => {
+        localStorage.setItem('language_type', language_type);
+        state.language_type = language_type;
+    },
 }
 
 const actions = {
-  // 用户更换语言类型
-  updateLanguageType({ commit }, language_type) {
-    return new Promise((reslove, reject) => {
-      let MethodName = "login_control-UpdateLanguageType";
-      getContentFile(MethodName, { language_type })
-        .then(() => {
-          commit('SET_UPDATE_LANGUAGE_TYPE', language_type);
-          reslove();
-        })
-        .catch(error => {
-          reject(error);
+    // 用户更换语言类型
+    updateLanguageType({ commit }, language_type) {
+        return new Promise((reslove, reject) => {
+            let MethodName = "login_control-UpdateLanguageType";
+            getContentFile(MethodName, { language_type })
+                .then(() => {
+                    commit('SET_UPDATE_LANGUAGE_TYPE', language_type);
+                    reslove();
+                })
+                .catch(error => {
+                    reject(error);
+                });
         });
-    });
-  },
+    },
 }
 
 export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions
-}
-
+    namespaced: true,
+    state,
+    mutations,
+    actions
+}

+ 64 - 65
src/store/modules/user.js

@@ -1,85 +1,84 @@
-import { getToken, setToken, removeToken } from '@/utils/auth'
-import { resetRouter } from '@/router'
+import { getToken, setToken } from '@/utils/auth'
 
 const getDefaultState = () => {
-  return {
-    token: getToken(),
-    name: '',
-    avatar: ''
-  }
+    return {
+        token: getToken(),
+        name: '',
+        avatar: ''
+    }
 }
 
 const state = getDefaultState()
 
 const mutations = {
-  RESET_STATE: state => {
-    Object.assign(state, getDefaultState())
-  },
-  SET_TOKEN: (state, token) => {
-    state.token = token
-  },
-  SET_NAME: (state, name) => {
-    state.name = name
-  },
-  SET_AVATAR: (state, avatar) => {
-    state.avatar = avatar
-  }
+    RESET_STATE: state => {
+        Object.assign(state, getDefaultState())
+    },
+    SET_TOKEN: (state, token) => {
+        state.token = token
+    },
+    SET_NAME: (state, name) => {
+        state.name = name
+    },
+    SET_AVATAR: (state, avatar) => {
+        state.avatar = avatar
+    }
 }
 
 const actions = {
-  // user login
-  login({ commit }, userInfo) {
-    const { username, password } = userInfo
-    return new Promise((resolve, reject) => {
-      login({ username: username.trim(), password: password })
-        .then(response => {
-          const { data } = response
-          commit('SET_TOKEN', data.token)
-          setToken(data.token)
-          resolve()
+    // user login
+    login({ commit }, userInfo) {
+        const { username, password } = userInfo
+        return new Promise((resolve, reject) => {
+            login({ username: username.trim(), password: password })
+                .then(response => {
+                    const { data } = response
+                    commit('SET_TOKEN', data.token)
+                    setToken(data.token)
+                    resolve()
+                })
+                .catch(error => {
+                    reject(error)
+                })
         })
-        .catch(error => {
-          reject(error)
-        })
-    })
-  },
+    },
 
-  // get user info
-  getInfo({ commit, state }) {
-    return new Promise((resolve, reject) => {
-      getInfo(state.token)
-        .then(response => {
-          const { data } = response
+    // get user info
+    getInfo({ commit, state }) {
+        return new Promise((resolve, reject) => {
+            getInfo(state.token)
+                .then(response => {
+                    const { data } = response
 
-          if (!data) {
-            return reject('Verification failed, please Login again.')
-          }
+                    if (!data) {
+                        return reject('Verification failed, please Login again.')
+                    }
 
-          const { name, avatar } = data
+                    const { name, avatar } = data
 
-          commit('SET_NAME', name)
-          commit('SET_AVATAR', avatar)
-          resolve(data)
-        })
-        .catch(error => {
-          reject(error)
+                    commit('SET_NAME', name)
+                    commit('SET_AVATAR', avatar)
+                    resolve(data)
+                })
+                .catch(error => {
+                    reject(error)
+                })
         })
-    })
-  },
+    },
 
-  // remove token
-  resetToken({ commit }) {
-    return new Promise(resolve => {
-      // removeToken() // must remove  token  first
-      commit('RESET_STATE')
-      resolve()
-    })
-  }
+    // remove token
+    resetToken({ commit }) {
+        return new Promise(resolve => {
+            // removeToken() // must remove  token  first
+            commit('RESET_STATE')
+            resolve()
+        })
+    }
 }
 
 export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions
-}
+    namespaced: true,
+    state,
+    mutations,
+    actions
+}

+ 144 - 149
src/utils/index.js

@@ -5,29 +5,30 @@ import { getStaticContent } from '@/api/ajax';
 import { setConfig } from './auth'
 
 export function getConfigInfor() {
-  return new Promise((resolve, reject) => {
-    let MethodName = 'sys_config_manager-GetLogo';
-    getStaticContent(MethodName, {}).then(res => {
-      setConfig(res);
-      resolve(res)
-    }).catch(err => {
-      reject(err);
+    return new Promise((resolve, reject) => {
+        let MethodName = 'sys_config_manager-GetLogo';
+        getStaticContent(MethodName, {}).then(res => {
+            setConfig(res);
+            resolve(res)
+        }).catch(err => {
+            reject(err);
+        })
     })
-  })
 }
 
 //分:秒转秒
 export function timeStrToSen(time) {
-  if (!time) {
-    return -1;
-  }
-  var pos = time.indexOf(':');
-  var min = 0, sec = 0;;
-  if (pos > 0) {
-    min = parseInt(time.substring(0, pos));
-    sec = parseFloat(time.substring(pos + 1))
-  }
-  return min * 60 + sec;
+    if (!time) {
+        return -1;
+    }
+    var pos = time.indexOf(':');
+    var min = 0,
+        sec = 0;;
+    if (pos > 0) {
+        min = parseInt(time.substring(0, pos));
+        sec = parseFloat(time.substring(pos + 1))
+    }
+    return min * 60 + sec;
 }
 
 /**
@@ -41,46 +42,46 @@ export function timeStrToSen(time) {
  * @returns {string | null}
  */
 export function parseTime(time, cFormat) {
-  if (arguments.length === 0 || !time) {
-    return null
-  }
-  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
-  let date
-  if (typeof time === 'object') {
-    date = time
-  } else {
-    if ((typeof time === 'string')) {
-      if ((/^[0-9]+$/.test(time))) {
-        // support "1548221490638"
-        time = parseInt(time)
-      } else {
-        // support safari
-        // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
-        time = time.replace(new RegExp(/-/gm), '/')
-      }
+    if (arguments.length === 0 || !time) {
+        return null
     }
+    const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
+    let date
+    if (typeof time === 'object') {
+        date = time
+    } else {
+        if ((typeof time === 'string')) {
+            if ((/^[0-9]+$/.test(time))) {
+                // support "1548221490638"
+                time = parseInt(time)
+            } else {
+                // support safari
+                // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
+                time = time.replace(new RegExp(/-/gm), '/')
+            }
+        }
 
-    if ((typeof time === 'number') && (time.toString().length === 10)) {
-      time = time * 1000
+        if ((typeof time === 'number') && (time.toString().length === 10)) {
+            time = time * 1000
+        }
+        date = new Date(time)
+    }
+    const formatObj = {
+        y: date.getFullYear(),
+        m: date.getMonth() + 1,
+        d: date.getDate(),
+        h: date.getHours(),
+        i: date.getMinutes(),
+        s: date.getSeconds(),
+        a: date.getDay()
     }
-    date = new Date(time)
-  }
-  const formatObj = {
-    y: date.getFullYear(),
-    m: date.getMonth() + 1,
-    d: date.getDate(),
-    h: date.getHours(),
-    i: date.getMinutes(),
-    s: date.getSeconds(),
-    a: date.getDay()
-  }
-  const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
-    const value = formatObj[key]
-    // Note: getDay() returns 0 on Sunday
-    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
-    return value.toString().padStart(2, '0')
-  })
-  return time_str
+    const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
+        const value = formatObj[key]
+            // Note: getDay() returns 0 on Sunday
+        if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
+        return value.toString().padStart(2, '0')
+    })
+    return time_str
 }
 
 /**
@@ -89,41 +90,41 @@ export function parseTime(time, cFormat) {
  * @returns {string}
  */
 export function formatTime(time, option) {
-  if (('' + time).length === 10) {
-    time = parseInt(time) * 1000
-  } else {
-    time = +time
-  }
-  const d = new Date(time)
-  const now = Date.now()
+    if (('' + time).length === 10) {
+        time = parseInt(time) * 1000
+    } else {
+        time = +time
+    }
+    const d = new Date(time)
+    const now = Date.now()
 
-  const diff = (now - d) / 1000
+    const diff = (now - d) / 1000
 
-  if (diff < 30) {
-    return '刚刚'
-  } else if (diff < 3600) {
-    // less 1 hour
-    return Math.ceil(diff / 60) + '分钟前'
-  } else if (diff < 3600 * 24) {
-    return Math.ceil(diff / 3600) + '小时前'
-  } else if (diff < 3600 * 24 * 2) {
-    return '1天前'
-  }
-  if (option) {
-    return parseTime(time, option)
-  } else {
-    return (
-      d.getMonth() +
-      1 +
-      '月' +
-      d.getDate() +
-      '日' +
-      d.getHours() +
-      '时' +
-      d.getMinutes() +
-      '分'
-    )
-  }
+    if (diff < 30) {
+        return '刚刚'
+    } else if (diff < 3600) {
+        // less 1 hour
+        return Math.ceil(diff / 60) + '分钟前'
+    } else if (diff < 3600 * 24) {
+        return Math.ceil(diff / 3600) + '小时前'
+    } else if (diff < 3600 * 24 * 2) {
+        return '1天前'
+    }
+    if (option) {
+        return parseTime(time, option)
+    } else {
+        return (
+            d.getMonth() +
+            1 +
+            '月' +
+            d.getDate() +
+            '日' +
+            d.getHours() +
+            '时' +
+            d.getMinutes() +
+            '分'
+        )
+    }
 }
 
 /**
@@ -131,80 +132,74 @@ export function formatTime(time, option) {
  * @returns {Object}
  */
 export function param2Obj(url) {
-  const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
-  if (!search) {
-    return {}
-  }
-  const obj = {}
-  const searchArr = search.split('&')
-  searchArr.forEach(v => {
-    const index = v.indexOf('=')
-    if (index !== -1) {
-      const name = v.substring(0, index)
-      const val = v.substring(index + 1, v.length)
-      obj[name] = val
+    const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
+    if (!search) {
+        return {}
     }
-  })
-  return obj
+    const obj = {}
+    const searchArr = search.split('&')
+    searchArr.forEach(v => {
+        const index = v.indexOf('=')
+        if (index !== -1) {
+            const name = v.substring(0, index)
+            const val = v.substring(index + 1, v.length)
+            obj[name] = val
+        }
+    })
+    return obj
 }
 
 
 export function createComprisonFunction(propertyName) {
-  return function (object1, object2) {
-    var value1 = object1[propertyName];
-    var value2 = object2[propertyName];
-    if (value1 < value2) {
-      return -1;
-    } else if (value1 > value2) {
-      return 1;
-    } else {
-      return 0;
+    return function(object1, object2) {
+        var value1 = object1[propertyName];
+        var value2 = object2[propertyName];
+        if (value1 < value2) {
+            return -1;
+        } else if (value1 > value2) {
+            return 1;
+        } else {
+            return 0;
+        }
     }
-  }
 }
 
 // 混淆数字
 export function handleNumber(number) {
-  let numberArr;
-  numberArr = [
-    number - 3,
-    number - 2,
-    number - 1,
-    number + 1,
-    number + 2,
-    number + 3,
-  ];
-  numberArr = getRandomArrayElements(
-    numberArr,
-    3
-  );
-  numberArr.push(number);
-  numberArr.sort();
-  return numberArr;
+    let numberArr;
+    numberArr = [
+        number - 3,
+        number - 2,
+        number - 1,
+        number + 1,
+        number + 2,
+        number + 3,
+    ];
+    numberArr = getRandomArrayElements(
+        numberArr,
+        3
+    );
+    numberArr.push(number);
+    numberArr.sort();
+    return numberArr;
 }
 export function getRandomArrayElements(arr, count) {
-  var shuffled = arr.slice(0),
-    i = arr.length,
-    min = i - count,
-    temp,
-    index;
-  while (i-- > min) {
-    index = Math.floor((i + 1) * Math.random());
-    temp = shuffled[index];
-    shuffled[index] = shuffled[i];
-    shuffled[i] = temp;
-  }
-  return shuffled.slice(min);
+    var shuffled = arr.slice(0),
+        i = arr.length,
+        min = i - count,
+        temp,
+        index;
+    while (i-- > min) {
+        index = Math.floor((i + 1) * Math.random());
+        temp = shuffled[index];
+        shuffled[index] = shuffled[i];
+        shuffled[i] = temp;
+    }
+    return shuffled.slice(min);
 }
 
 //判断是不是中文
 export function isChn(str) {
-  var reg = /^[\u4E00-\u9FA5]+$/;
-  if (!reg.test(str)) {
-    //alert("不全是中文");
-    return false;
-  } else {
-    //alert("全是中文");
-    return true;
-  }
-}
+    var reg = /^[\u4E00-\u9FA5]+$/;
+    return reg.test(str)
+}

+ 308 - 355
src/utils/pinyinUtil.js

@@ -1,372 +1,325 @@
-
-/**
+/**
  * 汉字与拼音互转工具,根据导入的字典文件的不同支持不同
  * 对于多音字目前只是将所有可能的组合输出,准确识别多音字需要完善的词库,而词库文件往往比字库还要大,所以不太适合web环境。
  * @start 2016-09-26
  * @last 2016-09-29
  */
-;(function(global, factory) {
-	if (typeof module === "object" && typeof module.exports === "object") {
-		module.exports = factory(global);
-	} else {
-		factory(global);
-	}
+;
+(function(global, factory) {
+    if (typeof module === "object" && typeof module.exports === "object") {
+        module.exports = factory(global);
+    } else {
+        factory(global);
+    }
 })(typeof window !== "undefined" ? window : this, function(window) {
 
-	var toneMap = 
-	{
-		"ā": "a1",
-		"á": "a2",
-		"ǎ": "a3",
-		"à": "a4",
-		"ō": "o1",
-		"ó": "o2",
-		"ǒ": "o3",
-		"ò": "o4",
-		"ē": "e1",
-		"é": "e2",
-		"ě": "e3",
-		"è": "e4",
-		"ī": "i1",
-		"í": "i2",
-		"ǐ": "i3",
-		"ì": "i4",
-		"ū": "u1",
-		"ú": "u2",
-		"ǔ": "u3",
-		"ù": "u4",
-		"ü": "v0",
-		"ǖ": "v1",
-		"ǘ": "v2",
-		"ǚ": "v3",
-		"ǜ": "v4",
-		"ń": "n2",
-		"ň": "n3",
-		"": "m2"
-	};
+    var toneMap = {
+        "ā": "a1",
+        "á": "a2",
+        "ǎ": "a3",
+        "à": "a4",
+        "ō": "o1",
+        "ó": "o2",
+        "ǒ": "o3",
+        "ò": "o4",
+        "ē": "e1",
+        "é": "e2",
+        "ě": "e3",
+        "è": "e4",
+        "ī": "i1",
+        "í": "i2",
+        "ǐ": "i3",
+        "ì": "i4",
+        "ū": "u1",
+        "ú": "u2",
+        "ǔ": "u3",
+        "ù": "u4",
+        "ü": "v0",
+        "ǖ": "v1",
+        "ǘ": "v2",
+        "ǚ": "v3",
+        "ǜ": "v4",
+        "ń": "n2",
+        "ň": "n3",
+        "": "m2"
+    };
 
-	var dict = {}; // 存储所有字典数据
-	var pinyinUtil =
-	{
-		/**
-		 * 解析各种字典文件,所需的字典文件必须在本JS之前导入
-		 */
-		parseDict: function()
-		{
-			// 如果导入了 pinyin_dict_firstletter.js
-			if(window.pinyin_dict_firstletter)
-			{
-				dict.firstletter = pinyin_dict_firstletter;
-			}
-			// 如果导入了 pinyin_dict_notone.js
-			if(window.pinyin_dict_notone)
-			{
-				dict.notone = {};
-				dict.py2hz = pinyin_dict_notone; // 拼音转汉字
-				for(var i in pinyin_dict_notone)
-				{
-					var temp = pinyin_dict_notone[i];
-					for(var j=0, len=temp.length; j<len; j++)
-					{
-						if(!dict.notone[temp[j]]) dict.notone[temp[j]] = i; // 不考虑多音字
-					}
-				}
-			}
-			// 如果导入了 pinyin_dict_withtone.js
-			if(window.pinyin_dict_withtone)
-			{
-				dict.withtone = {}; // 汉字与拼音映射,多音字用空格分开,类似这种结构:{'大': 'da tai'}
-				var temp = pinyin_dict_withtone.split(',');
-				for(var i=0, len = temp.length; i<len; i++)
-				{
-					// 这段代码耗时28毫秒左右,对性能影响不大,所以一次性处理完毕
-					dict.withtone[String.fromCharCode(i + 19968)] = temp[i]; // 这里先不进行split(' '),因为一次性循环2万次split比较消耗性能
-				}
+    var dict = {}; // 存储所有字典数据
+    var pinyinUtil = {
+        /**
+         * 解析各种字典文件,所需的字典文件必须在本JS之前导入
+         */
+        parseDict: function() {
+            // 如果导入了 pinyin_dict_firstletter.js
+            if (window.pinyin_dict_firstletter) {
+                dict.firstletter = pinyin_dict_firstletter;
+            }
+            // 如果导入了 pinyin_dict_notone.js
+            if (window.pinyin_dict_notone) {
+                dict.notone = {};
+                dict.py2hz = pinyin_dict_notone; // 拼音转汉字
+                for (var i in pinyin_dict_notone) {
+                    let temp = pinyin_dict_notone[i];
+                    for (let j = 0, len = temp.length; j < len; j++) {
+                        if (!dict.notone[temp[j]]) dict.notone[temp[j]] = i; // 不考虑多音字
+                    }
+                }
+            }
+            // 如果导入了 pinyin_dict_withtone.js
+            if (window.pinyin_dict_withtone) {
+                dict.withtone = {}; // 汉字与拼音映射,多音字用空格分开,类似这种结构:{'大': 'da tai'}
+                let temp = pinyin_dict_withtone.split(',');
+                for (let i = 0, len = temp.length; i < len; i++) {
+                    // 这段代码耗时28毫秒左右,对性能影响不大,所以一次性处理完毕
+                    dict.withtone[String.fromCharCode(i + 19968)] = temp[i]; // 这里先不进行split(' '),因为一次性循环2万次split比较消耗性能
+                }
 
-				// 拼音 -> 汉字
-				if(window.pinyin_dict_notone)
-				{
-					// 对于拼音转汉字,我们优先使用pinyin_dict_notone字典文件
-					// 因为这个字典文件不包含生僻字,且已按照汉字使用频率排序
-					dict.py2hz = pinyin_dict_notone; // 拼音转汉字
-				}
-				else
-				{
-					// 将字典文件解析成拼音->汉字的结构
-					// 与先分割后逐个去掉声调相比,先一次性全部去掉声调然后再分割速度至少快了3倍,前者大约需要120毫秒,后者大约只需要30毫秒(Chrome下)
-					var notone = pinyinUtil.removeTone(pinyin_dict_withtone).split(',');
-					var py2hz = {}, py, hz;
-					for(var i=0, len = notone.length; i<len; i++)
-					{
-						hz = String.fromCharCode(i + 19968); // 汉字
-						py = notone[i].split(' '); // 去掉了声调的拼音数组
-						for(var j=0; j<py.length; j++)
-						{
-							py2hz[py[j]] = (py2hz[py[j]] || '') + hz;
-						}
-					}
-					dict.py2hz = py2hz;
-				}
-			}
-		},
-		/**
-		 * 根据汉字获取拼音,如果不是汉字直接返回原字符
-		 * @param chinese 要转换的汉字
-		 * @param splitter 分隔字符,默认用空格分隔
-		 * @param withtone 返回结果是否包含声调,默认是
-		 * @param polyphone 是否支持多音字,默认否
-		 */
-		getPinyin: function(chinese, splitter, withtone, polyphone)
-		{
-			if(!chinese || /^ +$/g.test(chinese)) return '';
-			splitter = splitter == undefined ? ' ' : splitter;
-			withtone = withtone == undefined ? true : withtone;
-			polyphone = polyphone == undefined ? false : polyphone;
-			var result = [];
-			if(dict.withtone) // 优先使用带声调的字典文件
-			{
-				var noChinese = '';
-				for (var i=0, len = chinese.length; i < len; i++)
-				{
-					var pinyin = dict.withtone[chinese[i]];
-					if(pinyin)
-					{
-						// 如果不需要多音字,默认返回第一个拼音,后面的直接忽略
-						// 所以这对数据字典有一定要求,常见字的拼音必须放在最前面
-						if(!polyphone) pinyin = pinyin.replace(/ .*$/g, '');
-						if(!withtone) pinyin = this.removeTone(pinyin); // 如果不需要声调
-						//空格,把noChinese作为一个词插入
-						noChinese && ( result.push( noChinese), noChinese = '' );
-						result.push( pinyin ); 
-					}
-					else if ( !chinese[i] || /^ +$/g.test(chinese[i]) ){
-						//空格,把noChinese作为一个词插入
-						noChinese && ( result.push( noChinese), noChinese = '' );
-					}
-					else{
-						noChinese += chinese[i];
-					}
-				}
-				if ( noChinese ){
-					result.push( noChinese);
-					noChinese = '';
-				}
-			}
-			else if(dict.notone) // 使用没有声调的字典文件
-			{
-				if(withtone) console.warn('pinyin_dict_notone 字典文件不支持声调!');
-				if(polyphone) console.warn('pinyin_dict_notone 字典文件不支持多音字!');
-				var noChinese = '';
-				for (var i=0, len = chinese.length; i < len; i++)
-				{
-					var temp = chinese.charAt(i),
-						pinyin = dict.notone[temp];
-					if ( pinyin ){ //插入拼音
-						//空格,把noChinese作为一个词插入
-						noChinese && ( result.push( noChinese), noChinese = '' );
-						result.push( pinyin );
-					}
-					else if ( !temp || /^ +$/g.test(temp) ){
-						//空格,插入之前的非中文字符
-						noChinese && ( result.push( noChinese), noChinese = '' );
-					}
-					else {
-						//非空格,关联到noChinese中
-						noChinese += temp;
-					}
-				}
+                // 拼音 -> 汉字
+                if (window.pinyin_dict_notone) {
+                    // 对于拼音转汉字,我们优先使用pinyin_dict_notone字典文件
+                    // 因为这个字典文件不包含生僻字,且已按照汉字使用频率排序
+                    dict.py2hz = pinyin_dict_notone; // 拼音转汉字
+                } else {
+                    // 将字典文件解析成拼音->汉字的结构
+                    // 与先分割后逐个去掉声调相比,先一次性全部去掉声调然后再分割速度至少快了3倍,前者大约需要120毫秒,后者大约只需要30毫秒(Chrome下)
+                    var notone = pinyinUtil.removeTone(pinyin_dict_withtone).split(',');
+                    var py2hz = {},
+                        py, hz;
+                    for (let i = 0, len = notone.length; i < len; i++) {
+                        hz = String.fromCharCode(i + 19968); // 汉字
+                        py = notone[i].split(' '); // 去掉了声调的拼音数组
+                        for (let j = 0; j < py.length; j++) {
+                            py2hz[py[j]] = (py2hz[py[j]] || '') + hz;
+                        }
+                    }
+                    dict.py2hz = py2hz;
+                }
+            }
+        },
+        /**
+         * 根据汉字获取拼音,如果不是汉字直接返回原字符
+         * @param chinese 要转换的汉字
+         * @param splitter 分隔字符,默认用空格分隔
+         * @param withtone 返回结果是否包含声调,默认是
+         * @param polyphone 是否支持多音字,默认否
+         */
+        getPinyin: function(chinese, splitter, withtone, polyphone) {
+            if (!chinese || /^ +$/g.test(chinese)) return '';
+            splitter = splitter == undefined ? ' ' : splitter;
+            withtone = withtone == undefined ? true : withtone;
+            polyphone = polyphone == undefined ? false : polyphone;
+            var result = [];
+            if (dict.withtone) // 优先使用带声调的字典文件
+            {
+                var noChinese = '';
+                for (var i = 0, len = chinese.length; i < len; i++) {
+                    var pinyin = dict.withtone[chinese[i]];
+                    if (pinyin) {
+                        // 如果不需要多音字,默认返回第一个拼音,后面的直接忽略
+                        // 所以这对数据字典有一定要求,常见字的拼音必须放在最前面
+                        if (!polyphone) pinyin = pinyin.replace(/ .*$/g, '');
+                        if (!withtone) pinyin = this.removeTone(pinyin); // 如果不需要声调
+                        //空格,把noChinese作为一个词插入
+                        noChinese && (result.push(noChinese), noChinese = '');
+                        result.push(pinyin);
+                    } else if (!chinese[i] || /^ +$/g.test(chinese[i])) {
+                        //空格,把noChinese作为一个词插入
+                        noChinese && (result.push(noChinese), noChinese = '');
+                    } else {
+                        noChinese += chinese[i];
+                    }
+                }
+                if (noChinese) {
+                    result.push(noChinese);
+                    noChinese = '';
+                }
+            } else if (dict.notone) // 使用没有声调的字典文件
+            {
+                if (withtone) console.warn('pinyin_dict_notone 字典文件不支持声调!');
+                if (polyphone) console.warn('pinyin_dict_notone 字典文件不支持多音字!');
+                let noChinese = '';
+                for (let i = 0, len = chinese.length; i < len; i++) {
+                    let temp = chinese.charAt(i),
+                        pinyin = dict.notone[temp];
+                    if (pinyin) { //插入拼音
+                        //空格,把noChinese作为一个词插入
+                        noChinese && (result.push(noChinese), noChinese = '');
+                        result.push(pinyin);
+                    } else if (!temp || /^ +$/g.test(temp)) {
+                        //空格,插入之前的非中文字符
+                        noChinese && (result.push(noChinese), noChinese = '');
+                    } else {
+                        //非空格,关联到noChinese中
+                        noChinese += temp;
+                    }
+                }
 
-				if ( noChinese ){
-					result.push( noChinese );
-					noChinese = '';
-				}
-			}
-			else
-			{
-				throw '抱歉,未找到合适的拼音字典文件!';
-			}
-			if(!polyphone) return result.join(splitter);
-			else
-			{
-				if(window.pinyin_dict_polyphone) return parsePolyphone(chinese, result, splitter, withtone);
-				else return handlePolyphone(result, ' ', splitter);
-			}
-		},
-		/**
-		 * 获取汉字的拼音首字母
-		 * @param str 汉字字符串,如果遇到非汉字则原样返回
-		 * @param polyphone 是否支持多音字,默认false,如果为true,会返回所有可能的组合数组
-		 */
-		getFirstLetter: function(str, polyphone)
-		{
-			polyphone = polyphone == undefined ? false : polyphone;
-			if(!str || /^ +$/g.test(str)) return '';
-			if(dict.firstletter) // 使用首字母字典文件
-			{
-				var result = [];
-				for(var i=0; i<str.length; i++)
-				{
-					var unicode = str.charCodeAt(i);
-					var ch = str.charAt(i);
-					if(unicode >= 19968 && unicode <= 40869)
-					{
-						ch = dict.firstletter.all.charAt(unicode-19968);
-						if(polyphone) ch = dict.firstletter.polyphone[unicode] || ch;
-					}
-					result.push(ch);
-				}
-				if(!polyphone) return result.join(''); // 如果不用管多音字,直接将数组拼接成字符串
-				else return handlePolyphone(result, '', ''); // 处理多音字,此时的result类似于:['D', 'ZC', 'F']
-			}
-			else
-			{
-				var py = this.getPinyin(str, ' ', false, polyphone);
-				py = py instanceof Array ? py : [py];
-				var result = [];
-				for(var i=0; i<py.length; i++)
-				{
-					result.push(py[i].replace(/(^| )(\w)\w*/g, function(m,$1,$2){return $2.toUpperCase();}));
-				}
-				if(!polyphone) return result[0];
-				else return simpleUnique(result);
-			}
-		},
-		/**
-		 * 拼音转汉字,只支持单个汉字,返回所有匹配的汉字组合
-		 * @param pinyin 单个汉字的拼音,可以包含声调
-		 */
-		getHanzi: function(pinyin)
-		{
-			if(!dict.py2hz)
-			{
-				throw '抱歉,未找到合适的拼音字典文件!';
-			}
-			return dict.py2hz[this.removeTone(pinyin)] || '';
-		},
-		/**
-		 * 获取某个汉字的同音字,本方法暂时有问题,待完善
-		 * @param hz 单个汉字
-		 * @param sameTone 是否获取同音同声调的汉字,必须传进来的拼音带声调才支持,默认false
-		 */
-		getSameVoiceWord: function(hz, sameTone)
-		{
-			sameTone = sameTone || false
-			return this.getHanzi(this.getPinyin(hz, ' ', false))
-		},
-		/**
-		 * 去除拼音中的声调,比如将 xiǎo míng tóng xué 转换成 xiao ming tong xue
-		 * @param pinyin 需要转换的拼音
-		 */
-		removeTone: function(pinyin)
-		{
-			return pinyin.replace(/[āáǎàōóǒòēéěèīíǐìūúǔùüǖǘǚǜńň]/g, function(m){ return toneMap[m][0]; });
-		},
-		/**
-		 * 将数组拼音转换成真正的带标点的拼音
-		 * @param pinyinWithoutTone 类似 xu2e这样的带数字的拼音
-		 */
-		getTone: function(pinyinWithoutTone)
-		{
-			var newToneMap = {};
-			for(var i in toneMap) newToneMap[toneMap[i]] = i;
-			return (pinyinWithoutTone || '').replace(/[a-z]\d/g, function(m) {
-				return newToneMap[m] || m;
-			});
-		}
-	};
+                if (noChinese) {
+                    result.push(noChinese);
+                    noChinese = '';
+                }
+            } else {
+                throw '抱歉,未找到合适的拼音字典文件!';
+            }
+            if (!polyphone) return result.join(splitter);
+            else {
+                if (window.pinyin_dict_polyphone) return parsePolyphone(chinese, result, splitter, withtone);
+                else return handlePolyphone(result, ' ', splitter);
+            }
+        },
+        /**
+         * 获取汉字的拼音首字母
+         * @param str 汉字字符串,如果遇到非汉字则原样返回
+         * @param polyphone 是否支持多音字,默认false,如果为true,会返回所有可能的组合数组
+         */
+        getFirstLetter: function(str, polyphone) {
+            polyphone = polyphone == undefined ? false : polyphone;
+            if (!str || /^ +$/g.test(str)) return '';
+            if (dict.firstletter) // 使用首字母字典文件
+            {
+                var result = [];
+                for (var i = 0; i < str.length; i++) {
+                    var unicode = str.charCodeAt(i);
+                    var ch = str.charAt(i);
+                    if (unicode >= 19968 && unicode <= 40869) {
+                        ch = dict.firstletter.all.charAt(unicode - 19968);
+                        if (polyphone) ch = dict.firstletter.polyphone[unicode] || ch;
+                    }
+                    result.push(ch);
+                }
+                if (!polyphone) return result.join(''); // 如果不用管多音字,直接将数组拼接成字符串
+                else return handlePolyphone(result, '', ''); // 处理多音字,此时的result类似于:['D', 'ZC', 'F']
+            } else {
+                var py = this.getPinyin(str, ' ', false, polyphone);
+                py = py instanceof Array ? py : [py];
+                let result = [];
+                for (let i = 0; i < py.length; i++) {
+                    result.push(py[i].replace(/(^| )(\w)\w*/g, function(m, $1, $2) { return $2.toUpperCase(); }));
+                }
+                if (!polyphone) return result[0];
+                else return simpleUnique(result);
+            }
+        },
+        /**
+         * 拼音转汉字,只支持单个汉字,返回所有匹配的汉字组合
+         * @param pinyin 单个汉字的拼音,可以包含声调
+         */
+        getHanzi: function(pinyin) {
+            if (!dict.py2hz) {
+                throw '抱歉,未找到合适的拼音字典文件!';
+            }
+            return dict.py2hz[this.removeTone(pinyin)] || '';
+        },
+        /**
+         * 获取某个汉字的同音字,本方法暂时有问题,待完善
+         * @param hz 单个汉字
+         * @param sameTone 是否获取同音同声调的汉字,必须传进来的拼音带声调才支持,默认false
+         */
+        getSameVoiceWord: function(hz, sameTone) {
+            sameTone = sameTone || false
+            return this.getHanzi(this.getPinyin(hz, ' ', false))
+        },
+        /**
+         * 去除拼音中的声调,比如将 xiǎo míng tóng xué 转换成 xiao ming tong xue
+         * @param pinyin 需要转换的拼音
+         */
+        removeTone: function(pinyin) {
+            return pinyin.replace(/[āáǎàōóǒòēéěèīíǐìūúǔùüǖǘǚǜńň]/g, function(m) { return toneMap[m][0]; });
+        },
+        /**
+         * 将数组拼音转换成真正的带标点的拼音
+         * @param pinyinWithoutTone 类似 xu2e这样的带数字的拼音
+         */
+        getTone: function(pinyinWithoutTone) {
+            var newToneMap = {};
+            for (var i in toneMap) newToneMap[toneMap[i]] = i;
+            return (pinyinWithoutTone || '').replace(/[a-z]\d/g, function(m) {
+                return newToneMap[m] || m;
+            });
+        }
+    };
 
 
-	/**
-	 * 处理多音字,将类似['D', 'ZC', 'F']转换成['DZF', 'DCF']
-	 * 或者将 ['chang zhang', 'cheng'] 转换成 ['chang cheng', 'zhang cheng']
-	 */
-	function handlePolyphone(array, splitter, joinChar)
-	{
-		splitter = splitter || '';
-		var result = [''], temp = [];
-		for(var i=0; i<array.length; i++)
-		{
-			temp = [];
-			var t = array[i].split(splitter);
-			for(var j=0; j<t.length; j++)
-			{
-				for(var k=0; k<result.length; k++)
-					temp.push(result[k] + (result[k]?joinChar:'') + t[j]);
-			}
-			result = temp;
-		}
-		return simpleUnique(result);
-	}
+    /**
+     * 处理多音字,将类似['D', 'ZC', 'F']转换成['DZF', 'DCF']
+     * 或者将 ['chang zhang', 'cheng'] 转换成 ['chang cheng', 'zhang cheng']
+     */
+    function handlePolyphone(array, splitter, joinChar) {
+        splitter = splitter || '';
+        var result = [''],
+            temp = [];
+        for (var i = 0; i < array.length; i++) {
+            temp = [];
+            var t = array[i].split(splitter);
+            for (var j = 0; j < t.length; j++) {
+                for (var k = 0; k < result.length; k++)
+                    temp.push(result[k] + (result[k] ? joinChar : '') + t[j]);
+            }
+            result = temp;
+        }
+        return simpleUnique(result);
+    }
 
-	/**
-	 * 根据词库找出多音字正确的读音
-	 * 这里只是非常简单的实现,效率和效果都有一些问题
-	 * 推荐使用第三方分词工具先对句子进行分词,然后再匹配多音字
-	 * @param chinese 需要转换的汉字
-	 * @param result 初步匹配出来的包含多个发音的拼音结果
-	 * @param splitter 返回结果拼接字符
-	 */
-	function parsePolyphone(chinese, result, splitter, withtone)
-	{
-		var poly = window.pinyin_dict_polyphone;
-		var max = 7; // 最多只考虑7个汉字的多音字词,虽然词库里面有10个字的,但是数量非常少,为了整体效率暂时忽略之
-		var temp = poly[chinese];
-		if(temp) // 如果直接找到了结果
-		{
-			temp = temp.split(' ');
-			for(var i=0; i<temp.length; i++)
-			{
-				result[i] = temp[i] || result[i];
-				if(!withtone) result[i] = pinyinUtil.removeTone(result[i]);
-			}
-			return result.join(splitter);
-		}
-		for(var i=0; i<chinese.length; i++)
-		{
-			temp = '';
-			for(var j=0; j<max && (i+j)<chinese.length; j++)
-			{
-				if(!/^[\u2E80-\u9FFF]+$/.test(chinese[i+j])) break; // 如果碰到非汉字直接停止本次查找
-				temp += chinese[i+j];
-				var res = poly[temp];
-				if(res) // 如果找到了多音字词语
-				{
-					res = res.split(' ');
-					for(var k=0; k<=j; k++)
-					{
-						if(res[k]) result[i+k] = withtone ? res[k] : pinyinUtil.removeTone(res[k]);
-					}
-					break;
-				}
-			}
-		}
-		// 最后这一步是为了防止出现词库里面也没有包含的多音字词语
-		for(var i=0; i<result.length; i++)
-		{
-			result[i] = result[i].replace(/ .*$/g, '');
-		}
-		return result.join(splitter);
-	}
+    /**
+     * 根据词库找出多音字正确的读音
+     * 这里只是非常简单的实现,效率和效果都有一些问题
+     * 推荐使用第三方分词工具先对句子进行分词,然后再匹配多音字
+     * @param chinese 需要转换的汉字
+     * @param result 初步匹配出来的包含多个发音的拼音结果
+     * @param splitter 返回结果拼接字符
+     */
+    function parsePolyphone(chinese, result, splitter, withtone) {
+        var poly = window.pinyin_dict_polyphone;
+        var max = 7; // 最多只考虑7个汉字的多音字词,虽然词库里面有10个字的,但是数量非常少,为了整体效率暂时忽略之
+        var temp = poly[chinese];
+        if (temp) // 如果直接找到了结果
+        {
+            temp = temp.split(' ');
+            for (var i = 0; i < temp.length; i++) {
+                result[i] = temp[i] || result[i];
+                if (!withtone) result[i] = pinyinUtil.removeTone(result[i]);
+            }
+            return result.join(splitter);
+        }
+        for (let i = 0; i < chinese.length; i++) {
+            temp = '';
+            for (var j = 0; j < max && (i + j) < chinese.length; j++) {
+                if (!/^[\u2E80-\u9FFF]+$/.test(chinese[i + j])) break; // 如果碰到非汉字直接停止本次查找
+                temp += chinese[i + j];
+                var res = poly[temp];
+                if (res) // 如果找到了多音字词语
+                {
+                    res = res.split(' ');
+                    for (var k = 0; k <= j; k++) {
+                        if (res[k]) result[i + k] = withtone ? res[k] : pinyinUtil.removeTone(res[k]);
+                    }
+                    break;
+                }
+            }
+        }
+        // 最后这一步是为了防止出现词库里面也没有包含的多音字词语
+        for (let i = 0; i < result.length; i++) {
+            result[i] = result[i].replace(/ .*$/g, '');
+        }
+        return result.join(splitter);
+    }
 
-	// 简单数组去重
-	function simpleUnique(array)
-	{
-		var result = [];
-		var hash = {};
-		for(var i=0; i<array.length; i++)
-		{
-			var key = (typeof array[i]) + array[i];
-			if(!hash[key])
-			{
-				result.push(array[i]);
-				hash[key] = true;
-			}
-		}
-		return result;
-	}
+    // 简单数组去重
+    function simpleUnique(array) {
+        var result = [];
+        var hash = {};
+        for (var i = 0; i < array.length; i++) {
+            var key = (typeof array[i]) + array[i];
+            if (!hash[key]) {
+                result.push(array[i]);
+                hash[key] = true;
+            }
+        }
+        return result;
+    }
 
-	pinyinUtil.parseDict();
-	pinyinUtil.dict = dict;
-	window.pinyinUtil = pinyinUtil;
+    pinyinUtil.parseDict();
+    pinyinUtil.dict = dict;
+    window.pinyinUtil = pinyinUtil;
 
 });

+ 76 - 77
src/utils/request.js

@@ -1,6 +1,5 @@
 import axios from 'axios'
 import router from '../router'
-import store from '../store'
 import Cookies from 'js-cookie'
 import { Message } from 'element-ui'
 import { removeToken } from './auth';
@@ -14,92 +13,92 @@ axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'
 
 // 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 => {
-    // console.log(res)
-    const res = response.data;
-    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 => {
+        // console.log(res)
+        const res = response.data;
+        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

+ 15 - 15
src/utils/validate.js

@@ -7,7 +7,7 @@
  * @returns {Boolean}
  */
 export function isExternal(path) {
-  return /^(https?:|mailto:|tel:)/.test(path)
+    return /^(https?:|mailto:|tel:)/.test(path)
 }
 
 /**
@@ -15,10 +15,10 @@ export function isExternal(path) {
  * @returns {Boolean}
  */
 export function validUsername(str) {
-  console.log(str)
-  if (str) {
-    return true
-  }
+    console.log(str)
+    if (str) {
+        return true
+    }
 }
 
 /**
@@ -28,8 +28,8 @@ export function validUsername(str) {
  */
 
 export function validPass(str) {
-  const PASS_REGEXP = /^(\w){6,16}$/
-  return PASS_REGEXP.test(str)
+    const PASS_REGEXP = /^(\w){6,16}$/
+    return PASS_REGEXP.test(str)
 }
 
 /**
@@ -39,10 +39,10 @@ export function validPass(str) {
  */
 
 export function validNull(str) {
-  let data = str && str !== '' ? str.trim() : ''
-  if (data) {
-    return true
-  }
+    let data = str ? str.trim() : ''
+    if (data) {
+        return true
+    }
 }
 
 /**
@@ -51,7 +51,7 @@ export function validNull(str) {
  * 价格
  */
 export function validPrice(str) {
-  if (str) {
-    return true
-  }
-}
+    if (str) {
+        return true
+    }
+}

+ 16 - 17
src/utils/wuziqi/AiringGo.js

@@ -19,9 +19,9 @@ var myWin = [];
 var airingWin = [];
 
 // 阳线纵向90°的赢法
-for (var i = 0; i < 15; i++) {
-    for (var j = 0; j < 11; j++) {
-        for (var k = 0; k < 5; k++) {
+for (let i = 0; i < 15; i++) {
+    for (let j = 0; j < 11; j++) {
+        for (let k = 0; k < 5; k++) {
             wins[i][j + k][count] = true;
         }
         count++;
@@ -29,9 +29,9 @@ for (var i = 0; i < 15; i++) {
 }
 
 // 阳线横向0°的赢法
-for (var i = 0; i < 15; i++) {
-    for (var j = 0; j < 11; j++) {
-        for (var k = 0; k < 5; k++) {
+for (let i = 0; i < 15; i++) {
+    for (let j = 0; j < 11; j++) {
+        for (let k = 0; k < 5; k++) {
             wins[j + k][i][count] = true;
         }
         count++;
@@ -39,9 +39,9 @@ for (var i = 0; i < 15; i++) {
 }
 
 // 阴线斜向135°的赢法
-for (var i = 0; i < 11; i++) {
-    for (var j = 0; j < 11; j++) {
-        for (var k = 0; k < 5; k++) {
+for (let i = 0; i < 11; i++) {
+    for (let j = 0; j < 11; j++) {
+        for (let k = 0; k < 5; k++) {
             wins[i + k][j + k][count] = true;
         }
         count++;
@@ -49,9 +49,9 @@ for (var i = 0; i < 11; i++) {
 }
 
 // 阴线斜向45°的赢法
-for (var i = 0; i < 11; i++) {
-    for (var j = 14; j > 3; j--) {
-        for (var k = 0; k < 5; k++) {
+for (let i = 0; i < 11; i++) {
+    for (let j = 14; j > 3; j--) {
+        for (let k = 0; k < 5; k++) {
             wins[i + k][j - k][count] = true;
         }
         count++;
@@ -61,7 +61,7 @@ for (var i = 0; i < 11; i++) {
 /**
  * AI
  */
-function airingGo() {
+function airingGo(over, me) {
     if (over) {
         return;
     }
@@ -83,8 +83,8 @@ function airingGo() {
     }
 
     // 通过赢法统计数组为两个二维数组分别计分
-    for (var i = 0; i < 15; i++) {
-        for (var j = 0; j < 15; j++) {
+    for (let i = 0; i < 15; i++) {
+        for (let j = 0; j < 15; j++) {
             if (chessBoard[i][j] == 0) {
                 for (var k = 0; k < count; k++) {
                     if (wins[i][j][k]) {
@@ -141,12 +141,11 @@ function airingGo() {
     oneStep(u, v, false);
     chessBoard[u][v] = 2;
 
-    for (var k = 0; k < count; k++) {
+    for (let k = 0; k < count; k++) {
         if (wins[u][v][k]) {
             airingWin[k]++;
             myWin[k] = 6;
             if (airingWin[k] == 5) {
-                window.alert("You Fail!");
                 over = true;
             }
         }

+ 2 - 3
src/utils/wuziqi/main.js

@@ -28,7 +28,7 @@ function startGame() {
     over = false;
 
     // 初始化赢法统计数组
-    for (var i = 0; i < count; i++) {
+    for (let i = 0; i < count; i++) {
         myWin[i] = 0;
         airingWin[i] = 0;
     }
@@ -118,7 +118,6 @@ canvas.onclick = function(e) {
                 airingWin[k] = 6;
                 // 玩家落子后,此处赢法数组凑够5,玩家取胜
                 if (myWin[k] == 5) {
-                    window.alert("You Win");
                     // 游戏结束
                     over = true;
                 }
@@ -130,7 +129,7 @@ canvas.onclick = function(e) {
         // 如果游戏没有结束,轮到电脑行棋
         if (!over) {
             me = !me;
-            airingGo();
+            airingGo(over, me);
         }
     }
 };

+ 0 - 1
src/views/adultInput.vue

@@ -881,7 +881,6 @@ import SentenceSortQP from "@/components/Adult/preview/SentenceSortQP.vue";
 import TableView from "@/components/Adult/preview/TableView.vue";
 import PlayRecordView from "@/components/Adult/preview/PlayRecordView.vue";
 
-import DialogueAnswerViewChs from "@/components/Adult/preview/DialogueArticleViewChs/DialogueAnswerViewChs.vue";
 import Preview from "@/components/Adult/Preview.vue";
 import fn from "@/components/Adult/common/data.js";
 import { getContent, getStaticContent } from "@/api/ajax";

+ 0 - 1
src/views/bookView.vue

@@ -59,7 +59,6 @@
 <script>
 // import TreeView from '@/components/inputModules/common/TreeView'
 import { getContent } from "@/api/ajax";
-import Cookies from "js-cookie";
 // import Preview from '@/componentsAnswer/PreviewAnswer.vue'
 import Preview from "@/components/Adult/Preview";
 export default {

+ 1 - 2
src/views/courseList.vue

@@ -477,8 +477,7 @@
 import Header from "@/components/Header";
 import { validNull, validPrice } from "@/utils/validate";
 // import Nav from "@/components/inputModules/common/Nav";
-import { getContent, getContentFile, getStaticContent } from "@/api/ajax";
-import Cookies from "js-cookie";
+import { getContent, getContentFile } from "@/api/ajax";
 import { getToken } from "@/utils/auth";
 
 export default {

+ 78 - 5
src/views/login.vue

@@ -51,6 +51,22 @@
                             />
                         </span>-->
           </el-form-item>
+          <p class="input-title">验证码</p>
+          <div class="verificationCode-box">
+              <el-form-item prop="verificationCode">
+                <el-input
+                autocomplete="off"
+                name="verificationCode"
+                ref="verificationCode"
+                tabindex="3"
+                type="text"
+                v-model="loginForm.verificationCode"
+                />
+            </el-form-item>
+            <div class="verificationCode-img">
+                <img v-if="verificationCodeimg&&verificationCodeLoading" :src="verificationCodeimg" alt="图形验证码" @click="getVerificationCodeimg"/>
+            </div>
+          </div>
           <p class="input-title">用户类型</p>
           <el-form-item class="el-form-item-type" prop="type">
             <el-radio label="TEACHER" v-model="loginForm.type">教师</el-radio>
@@ -82,13 +98,13 @@
 </template>
 
 <script>
-import { validUsername, validPass } from "@/utils/validate";
-import { getContent, getLogin } from "@/api/ajax";
-import { getObjArr, saveObjArr } from "@/utils/role";
-import Cookies from "js-cookie";
+import { validUsername } from "@/utils/validate";
+import { getStaticContent, getLogin } from "@/api/ajax";
+import { getObjArr } from "@/utils/role";
 import { setToken } from "@/utils/auth";
 import { removeSession } from "@/utils/role";
 import { getConfigInfor } from "@/utils/index";
+import md5 from 'js-md5'
 export default {
   name: "Login",
   data() {
@@ -106,6 +122,13 @@ export default {
         callback();
       }
     };
+    const validateVerificationCode = (rule, value, callback) => {
+      if (!value) {
+        callback(new Error("请输入验证码"));
+      } else {
+        callback();
+      }
+    };
     return {
       options: [],
       select: "1",
@@ -116,6 +139,7 @@ export default {
         username: getObjArr("userName") || "",
         password: "",
         type: "TEACHER",
+        verificationCode:''
       },
       //input 规则
       loginRules: {
@@ -125,12 +149,18 @@ export default {
         password: [
           { required: true, trigger: "blur", validator: validatePassword },
         ],
+        verificationCode: [
+          { required: true, trigger: "blur", validator: validateVerificationCode },
+        ]
       },
       loading: false,
       passwordType: "password",
       redirect: undefined,
       loginCheck: "login",
       configInfor: null,
+      verificationCodeimg: '', // 图形验证码
+      verificationCodeimgID: '', // 图形验证码ID
+      verificationCodeLoading: true, // 图形验证码的flag
     };
   },
   watch: {
@@ -162,7 +192,10 @@ export default {
           let data = {
             user_type: this.loginForm.type,
             user_name: this.loginForm.username,
-            password: this.loginForm.password,
+            is_password_md5: "true",
+            password: md5(this.loginForm.password).toUpperCase(),
+            verification_code_image_text: this.loginForm.verificationCode,
+            verification_code_image_id: this.verificationCodeimgID
           };
           getLogin(MethodName, data)
             .then((res) => {
@@ -171,6 +204,7 @@ export default {
             })
             .catch(() => {
               this.loading = false;
+              this.getVerificationCodeimg()
             });
         } else {
           this.loading = false;
@@ -181,10 +215,29 @@ export default {
     async _getConfig() {
       this.configInfor = await getConfigInfor();
     },
+    // 图形验证码
+    getVerificationCodeimg(){
+        if(!this.verificationCodeLoading) return
+        this.verificationCodeLoading = false
+        let MethodName = "login_control-GetVerificationCodeImage";
+        let data = {};
+        getStaticContent(MethodName, data).then((res) => {
+            if(res){
+                this.verificationCodeLoading = true
+                this.verificationCodeimgID = res.image_id
+                this.verificationCodeimg = 'data:image/jpeg;base64,'+res.image_content_base64
+            }else{
+                this.verificationCodeLoading = true;
+            }
+        }).catch(() => {
+            this.verificationCodeLoading = true;
+        });
+    },
   },
   mounted() {
     removeSession("SysList");
     this._getConfig();
+    this.getVerificationCodeimg()
   },
 };
 </script>
@@ -430,5 +483,25 @@ $fc: rgb(24, 144, 255);
     width: 100%;
     vertical-align: bottom;
   }
+}   
+.verificationCode-box{
+    display: flex;
+    >div{
+        flex: 1;
+        max-width: 171px;
+        &.verificationCode-img{
+            min-width: 90px;
+            height: 34px;
+            margin-left: 5px;
+            flex: initial;
+            background: #C5C5C5;
+            border-radius: 4px;    
+            overflow: hidden;
+            >img{
+                height: 34px;
+                cursor: pointer;
+            }
+        }
+    }
 }
 </style>