Ver código fonte

包更新和试题导入调整

zhangjie 2 anos atrás
pai
commit
185dc9b0d7

+ 9 - 4
.eslintrc.js

@@ -3,14 +3,19 @@ module.exports = {
   env: {
     node: true,
   },
-  extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"],
+  extends: [
+    "plugin:vue/essential",
+    "eslint:recommended",
+    "plugin:prettier/recommended",
+  ],
   parserOptions: {
-    parser: "babel-eslint",
+    parser: "@babel/eslint-parser",
   },
   rules: {
-    "no-console": process.env.NODE_ENV === "production" ? "off" : "off",
-    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
+    "no-console": "off",
+    "no-debugger": "off",
     "vue/no-v-html": "off",
+    "vue/multi-word-component-names": "off",
   },
   overrides: [
     {

+ 13 - 5
jsconfig.json

@@ -1,12 +1,20 @@
 {
   "compilerOptions": {
-    "target": "es2020",
-    "module": "commonjs",
-    "allowSyntheticDefaultImports": true,
+    "target": "es5",
+    "module": "esnext",
     "baseUrl": "./",
+    "moduleResolution": "node",
     "paths": {
-      "@/*": ["src/*"]
-    }
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": [
+      "esnext",
+      "dom",
+      "dom.iterable",
+      "scripthost"
+    ]
   },
   "exclude": ["node_modules", "**/node_modules/*"]
 }

+ 3 - 0
lint-staged.config.js

@@ -0,0 +1,3 @@
+module.exports = {
+  "*.{js,jsx,vue}": "vue-cli-service lint",
+};

+ 23 - 19
package.json

@@ -1,6 +1,6 @@
 {
   "name": "ecs-web-admin",
-  "version": "0.1.0",
+  "version": "1.2.5",
   "private": true,
   "scripts": {
     "start": "vue-cli-service serve --port 7006",
@@ -17,6 +17,7 @@
     "axios": "^0.21.1",
     "axios-progress-bar": "^1.2.0",
     "bootstrap": "^4.6.0",
+    "core-js": "^3.8.3",
     "echarts": "^4.9.0",
     "element-ui": "2.15.6",
     "html2canvas": "^1.4.1",
@@ -36,26 +37,29 @@
     "vuex": "^3.6.2"
   },
   "devDependencies": {
-    "@vue/cli-plugin-babel": "~4.5.11",
-    "@vue/cli-plugin-eslint": "~4.5.11",
-    "@vue/cli-plugin-pwa": "~4.5.11",
-    "@vue/cli-plugin-router": "~4.5.11",
-    "@vue/cli-plugin-unit-jest": "~4.5.11",
-    "@vue/cli-plugin-vuex": "~4.5.11",
-    "@vue/cli-service": "~4.5.11",
-    "@vue/eslint-config-prettier": "^6.0.0",
-    "@vue/test-utils": "^1.0.3",
+    "@babel/core": "^7.12.16",
+    "@babel/eslint-parser": "^7.12.16",
+    "@vue/cli-plugin-babel": "~5.0.0",
+    "@vue/cli-plugin-eslint": "~5.0.0",
+    "@vue/cli-plugin-router": "~5.0.0",
+    "@vue/cli-plugin-unit-jest": "~5.0.0",
+    "@vue/cli-plugin-vuex": "~5.0.0",
+    "@vue/cli-service": "~5.0.0",
+    "@vue/test-utils": "^1.1.3",
+    "@vue/vue2-jest": "^27.0.0-alpha.2",
     "babel-eslint": "^10.1.0",
-    "eslint": "^7.15.0",
-    "eslint-plugin-prettier": "^3.3.0",
-    "eslint-plugin-vue": "^7.3.0",
+    "eslint": "^7.32.0",
+    "eslint-config-prettier": "^8.3.0",
+    "eslint-plugin-prettier": "^4.0.0",
+    "eslint-plugin-vue": "^8.0.3",
+    "jest": "^27.0.5",
     "lint-staged": "^10.5.3",
-    "prettier": "^2.2.1",
-    "sass": "^1.30.0",
-    "sass-loader": "^10.1.0",
+    "prettier": "^2.4.1",
+    "sass": "^1.32.7",
+    "sass-loader": "^12.0.0",
+    "vue-template-compiler": "^2.6.14",
     "vue-cli-plugin-axios": "0.0.4",
-    "vue-cli-plugin-element": "^1.0.1",
-    "vue-template-compiler": "^2.6.12"
+    "vue-cli-plugin-element": "^1.0.1"
   },
   "gitHooks": {
     "pre-commit": "lint-staged"
@@ -66,4 +70,4 @@
       "git add"
     ]
   }
-}
+}

+ 5 - 1
src/components/vEditor/toJSON.js

@@ -148,7 +148,11 @@ function toJSONBlock(e) {
     block.type = "cloze";
     block.value = e.dataset.order * 1;
     block.param = null;
-  } else if (e.nodeType == Node.ELEMENT_NODE && e.nodeName === "BR") {
+  } else if (
+    e.nodeType == Node.ELEMENT_NODE &&
+    (e.nodeName === "BR" || e.nodeName === "DIV")
+  ) {
+    // 空div和br直接返回空段落
     block.type = "text";
     block.value = "";
     block.param = null;

+ 10 - 0
src/modules/portal/views/Component404.vue

@@ -1,3 +1,13 @@
 <template>
   <div>找不到该页面!请联系管理员。</div>
 </template>
+
+<script>
+export default {
+  name: "NotFound",
+  data() {
+    return {};
+  },
+  methods: {},
+};
+</script>

+ 1 - 0
src/modules/portal/views/Login.vue

@@ -65,6 +65,7 @@ import { USER_SIGNIN } from "../store/user";
 import { QUESTION_API } from "@/constants/constants";
 
 export default {
+  name: "Login",
   data() {
     return {
       isSubmit: false,

+ 3 - 1
src/modules/question/api.js

@@ -284,5 +284,7 @@ export function questionImportPaperSave(paperData) {
   return $httpWithMsg.post(`${QUESTION_API}/word/parse/save`, paperData);
 }
 export function questionImportDownloadTemplate(datas) {
-  return $httpWithMsg.post(`${QUESTION_API}/word/parse/export`, datas);
+  return $httpWithMsg.post(`${QUESTION_API}/word/parse/export`, datas, {
+    responseType: "blob",
+  });
 }

+ 4 - 4
src/modules/question/components/QuestionImportDialog.vue

@@ -205,9 +205,9 @@ export default {
       this.$refs.ImportFile.setLoading(true);
 
       let formData = new FormData();
-      Object.entries(this.modalForm).forEach(([key, val]) => {
-        if (val !== null) formData.append(key, val);
-      });
+      // Object.entries(this.modalForm).forEach(([key, val]) => {
+      //   if (val !== null) formData.append(key, val);
+      // });
       formData.append("file", this.fileData.file);
 
       const res = await questionImportFileUpload(formData, {
@@ -218,7 +218,7 @@ export default {
 
       if (!res) return;
 
-      this.$message.success("导入成功!");
+      // this.$message.success("导入成功!");
       this.$emit("modified", {
         ...res.data,
         importData: this.modalForm,

+ 6 - 5
src/modules/question/components/QuestionImportEdit.vue

@@ -161,9 +161,6 @@ export default {
       uploadAnswerData: {},
     };
   },
-  beforeDestroy() {
-    window.sessionStorage.removeItem("coursePropertys");
-  },
   methods: {
     async visibleChange() {
       await this.getCourseProperty();
@@ -184,6 +181,7 @@ export default {
     initData() {
       this.paperData = [];
       this.paperRichJson = { sections: [] };
+      window.sessionStorage.removeItem("coursePropertys");
     },
     cancel() {
       this.modalIsShow = false;
@@ -428,10 +426,13 @@ export default {
       this.$emit("modified");
       this.cancel();
     },
-    // 导入答案
+    // 导入答案属性
     toImportAnswer() {
       const detailInfo = this.getImportPaperData();
-      this.uploadAnswerData = { detailInfo, ...this.data.importData };
+      this.uploadAnswerData = {
+        detailInfo: JSON.stringify(detailInfo),
+        ...this.data.importData,
+      };
       this.$refs.ImportAnswerDialog.open();
     },
     async answerTemplateDownload() {

+ 6 - 5
src/modules/questions/views/data_previllege.vue

@@ -118,7 +118,6 @@
 <script>
 import { mapState } from "vuex";
 import { QUESTION_API } from "@/constants/constants.js";
-import { object2QueryString } from "@/utils/utils";
 import DataPrevillegeAddCourseDialog from "./data_previllege_add_course";
 
 export default {
@@ -276,13 +275,15 @@ export default {
     async saveDefaultStatus(type, enabled) {
       try {
         await this.$httpWithMsg.post(
-          QUESTION_API +
-            "/user/data/rule/default/status/update?" +
-            object2QueryString({
+          QUESTION_API + "/user/data/rule/default/status/update",
+          {},
+          {
+            params: {
               enabled,
               type: type.toUpperCase(),
               userId: this.form.userId,
-            })
+            },
+          }
         );
         this.$notify({
           type: "success",

+ 0 - 6
src/utils/utils.js

@@ -1,9 +1,3 @@
-import queryString from "query-string";
-
-export function object2QueryString(obj) {
-  return queryString.stringify(obj);
-}
-
 /**
  * 判断富文本是否是一个空,用来判断富文本是否为空
  *

+ 5 - 1
vue.config.js

@@ -20,7 +20,11 @@ module.exports = {
     // devtool: "source-map",  // for vscode debug
     plugins: [
       // Ignore all locale files of moment.js
-      new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
+      new webpack.IgnorePlugin({
+        resourceRegExp: /^\.\/locale$/,
+        contextRegExp: /moment$/,
+      }),
+      // new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
     ],
   },
   transpileDependencies: [

Diferenças do arquivo suprimidas por serem muito extensas
+ 443 - 239
yarn.lock


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff