Michael Wang 4 rokov pred
rodič
commit
5d24763019

+ 1 - 0
.env.development

@@ -1,4 +1,5 @@
 VUE_APP_SKIP_CHECK_NATIVE=true
+VUE_APP_CORE_HOST_URL=https://192.168.10.38:8878
 VUE_APP_CONFIG_FILE_SEVER_URL=https://ecs-test-static.qmth.com.cn
 VUE_APP_ROUTER_PATH=/oe-web/
 VUE_APP_PUBLIC_PATH=/oe-web/

+ 15 - 4
.eslintrc.js

@@ -3,7 +3,10 @@ module.exports = {
   env: {
     node: true,
   },
-  extends: ["plugin:vue/recommended", "@vue/prettier"],
+  extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"],
+  parserOptions: {
+    parser: "babel-eslint"
+  },
   rules: {
     // "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
     "no-console": "off",
@@ -11,7 +14,15 @@ module.exports = {
     "vue/no-parsing-error": [2, { "x-invalid-end-tag": false }],
     "vue/no-v-html": "off",
   },
-  parserOptions: {
-    parser: "babel-eslint",
-  },
+  overrides: [
+    {
+      files: [
+        "**/__tests__/*.{j,t}s?(x)",
+        "**/tests/unit/**/*.spec.{j,t}s?(x)"
+      ],
+      env: {
+        jest: true
+      }
+    }
+  ]
 };

+ 3 - 1
.gitignore

@@ -11,6 +11,7 @@ node_modules
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*
+pnpm-debug.log*
 
 # Editor directories and files
 .idea
@@ -19,8 +20,9 @@ yarn-error.log*
 *.ntvs*
 *.njsproj
 *.sln
-*.sw*
+*.sw?
 
 # quokka test files
 quokka*.js
 
+proxy.config.js

+ 1 - 1
babel.config.js

@@ -1,5 +1,5 @@
 module.exports = {
-  presets: ["@vue/app"],
+  presets: ["@vue/cli-plugin-babel/preset"],
   plugins: [
     [
       "import",

+ 1 - 20
jest.config.js

@@ -1,22 +1,3 @@
 module.exports = {
-  moduleFileExtensions: ["js", "jsx", "json", "vue"],
-  transform: {
-    "^.+\\.vue$": "vue-jest",
-    ".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$":
-      "jest-transform-stub",
-    "^.+\\.jsx?$": "babel-jest",
-  },
-  transformIgnorePatterns: ["/node_modules/"],
-  moduleNameMapper: {
-    "^@/(.*)$": "<rootDir>/src/$1",
-  },
-  snapshotSerializers: ["jest-serializer-vue"],
-  testMatch: [
-    "**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)",
-  ],
-  testURL: "http://localhost/",
-  watchPlugins: [
-    "jest-watch-typeahead/filename",
-    "jest-watch-typeahead/testname",
-  ],
+  preset: "@vue/cli-plugin-unit-jest"
 };

+ 7 - 3
jsconfig.json

@@ -1,8 +1,12 @@
 {
   "compilerOptions": {
-    "baseUrl": ".",
+    "target": "es2020",
+    "module": "commonjs",
+    "allowSyntheticDefaultImports": true,
+    "baseUrl": "./",
     "paths": {
-      "@/*": ["./src/*"]
+      "@/*": ["src/*"]
     }
-  }
+  },
+  "exclude": ["node_modules", "**/node_modules/*"]
 }

+ 11 - 11
package.json

@@ -39,7 +39,7 @@
     "core-js": "^3.6.5",
     "face-api.js": "0.21.0",
     "intro.js": "^2.9.3",
-    "iview": "^3.5.2",
+    "iview": "^3.5.4",
     "js-md5": "^0.7.3",
     "lodash-es": "^4.17.15",
     "moment": "^2.27.0",
@@ -47,26 +47,26 @@
     "ua-parser-js": "^0.7.21",
     "viewerjs": "^1.6.1",
     "vue": "^2.6.11",
-    "vue-router": "^3.3.4",
+    "vue-router": "^3.4.3",
     "vue-spinner": "^1.0.4",
     "vue-splitpane": "^1.0.6",
     "vuedraggable": "^2.24.0",
     "vuex": "^3.5.1",
-    "webrtc-adapter": "^7.6.3"
+    "webrtc-adapter": "^7.7.0"
   },
   "devDependencies": {
-    "@vue/cli-plugin-babel": "^4.4.6",
-    "@vue/cli-plugin-eslint": "^4.4.6",
-    "@vue/cli-plugin-pwa": "^4.4.6",
-    "@vue/cli-plugin-unit-jest": "^4.4.6",
-    "@vue/cli-service": "^4.4.6",
+    "@vue/cli-plugin-babel": "^4.5.3",
+    "@vue/cli-plugin-eslint": "^4.5.3",
+    "@vue/cli-plugin-pwa": "^4.5.3",
+    "@vue/cli-plugin-router": "~4.5.3",
+    "@vue/cli-plugin-unit-jest": "^4.5.3",
+    "@vue/cli-plugin-vuex": "~4.5.3",
+    "@vue/cli-service": "^4.5.3",
     "@vue/eslint-config-prettier": "^6.0.0",
     "@vue/test-utils": "^1.0.3",
-    "babel-core": "7.0.0-bridge.0",
     "babel-eslint": "^10.1.0",
-    "babel-jest": "^26.1.0",
     "babel-plugin-import": "^1.13.0",
-    "eslint": "^7.5.0",
+    "eslint": "^7.6.0",
     "eslint-plugin-prettier": "^3.1.4",
     "eslint-plugin-vue": "^6.2.2",
     "iview-loader": "^1.2.2",

+ 0 - 10
src/features/Login/Login.vue

@@ -156,7 +156,6 @@ import {
   createEncryptLog,
 } from "@/utils/logger";
 import VerifyCode from "./VerifyCode.vue";
-import logNewVersion from "./HiddenRequest";
 
 // 检测devtools.  仅在chrome 72+ 有效。
 let element = new Image();
@@ -313,14 +312,6 @@ export default {
       );
     },
   },
-  watch: {
-    "loginForm.tid": function (val) {
-      logNewVersion(val);
-    },
-    // "loginForm.accountValue": function(val) {
-    //   console.log(val);
-    // },
-  },
   async mounted() {
     // this.testServiceWorker();
 
@@ -700,7 +691,6 @@ export default {
       let myHeaders = new Headers();
       myHeaders.append("Content-Type", "application/javascript");
       myHeaders.append("Cache-Control", "no-cache");
-      // logNewVersion(this.loginForm.tid);
       const response = await fetch(
         document.scripts[document.scripts.length - 1].src + "?x" + Date.now(),
         {

+ 1 - 1
src/features/OfflineExam/OfflineExamUpload.vue

@@ -441,7 +441,7 @@ export default {
         duration: 5,
         closable: true,
       });
-      const res = await this.$http.post(
+      await this.$http.post(
         "/api/ecs_oe_admin/offlineExam/batchSubmitPaper",
         params,
         { headers: { "Content-Type": "multipart/form-data" } }

+ 100 - 0
src/global.d.ts

@@ -0,0 +1,100 @@
+// Type definitions for [~THE LIBRARY NAME~] [~OPTIONAL VERSION NUMBER~]
+// Project: [~THE PROJECT NAME~]
+// Definitions by: [~YOUR NAME~] <[~A URL FOR YOU~]>
+
+/*~ If this library is callable (e.g. can be invoked as myLib(3)),
+ *~ include those call signatures here.
+ *~ Otherwise, delete this section.
+ */
+// declare function myLib(a: string): string;
+// declare function myLib(a: number): number;
+
+// /*~ If you want the name of this library to be a valid type name,
+//  *~ you can do so here.
+//  *~
+//  *~ For example, this allows us to write 'var x: myLib';
+//  *~ Be sure this actually makes sense! If it doesn't, just
+//  *~ delete this declaration and add types inside the namespace below.
+//  */
+// interface myLib {
+//   name: string;
+//   length: number;
+//   extras?: string[];
+// }
+
+// /*~ If your library has properties exposed on a global variable,
+//  *~ place them here.
+//  *~ You should also place types (interfaces and type alias) here.
+//  */
+// declare namespace myLib {
+//   //~ We can write 'myLib.timeout = 50;'
+//   let timeout: number;
+
+//   //~ We can access 'myLib.version', but not change it
+//   const version: string;
+
+//   //~ There's some class we can create via 'let c = new myLib.Cat(42)'
+//   //~ Or reference e.g. 'function f(c: myLib.Cat) { ... }
+//   class Cat {
+//     constructor(n: number);
+
+//     //~ We can read 'c.age' from a 'Cat' instance
+//     readonly age: number;
+
+//     //~ We can invoke 'c.purr()' from a 'Cat' instance
+//     purr(): void;
+//   }
+
+//   //~ We can declare a variable as
+//   //~   'var s: myLib.CatSettings = { weight: 5, name: "Maru" };'
+//   interface CatSettings {
+//     weight: number;
+//     name: string;
+//     tailLength?: number;
+//   }
+
+//   //~ We can write 'const v: myLib.VetID = 42;'
+//   //~  or 'const v: myLib.VetID = "bob";'
+//   type VetID = string | number;
+
+//   //~ We can invoke 'myLib.checkCat(c)' or 'myLib.checkCat(c, v);'
+//   function checkCat(c: Cat, s?: VetID);
+// }
+
+import Vue from "vue";
+import { AxiosInstance, AxiosRequestConfig } from "axios";
+
+// 可惜内部代码不能通过此类型推导
+//import * as api from "./api";
+
+declare module "vue/types/vue" {
+  interface Vue {
+    $http: AxiosInstance;
+    // $api: api;
+  }
+}
+
+// declare module "axios/index" {
+//   interface AxiosRequestConfig {
+//     noErrorMessage?: boolean | false;
+//   }
+// }
+// declare module "*.vue" {
+//   import Vue from "vue";
+//   export default Vue;
+//   interface Vue {
+//     $isLocalEnv: boolean;
+//   }
+// }
+
+// import Vue, { VueConstructor } from "vue";
+
+// declare module "vue/types/vue" {
+//   interface Vue {
+//     $ga: any;
+//   }
+
+//   interface VueConstructor {
+//     $ga: any;
+//   }
+// }

+ 0 - 1
src/utils/axios.js

@@ -228,7 +228,6 @@ qmInstance.defaults.timeout = 30 * 1000; //超时时间
 qmInstance.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; //标识这是一个 ajax 请求
 
 qmInstance.get = cachingGet(qmInstance.get, [
-  /\/api\/exam_question\/question\/\?question_id/,
   /\/api\/exam_question\/paper_struct\/\?exam_record_id=/,
   /\/api\/ecs_oe_student\/examQuestion\/getQuestionContent\?questionId=.*&exam_record_id=/,
   // /\/api\/ecs_exam_work\/exam\/\d+$/,

+ 14 - 35
vue.config.js

@@ -1,16 +1,4 @@
 let proxy = {
-  "/api/ecs_oe_admin": {
-    target:
-      process.env.VUE_APP_OE_ADMIN_HOST_URL ||
-      process.env.VUE_APP_CORE_HOST_URL,
-    changeOrigin: true,
-  },
-  "/api/ecs_oe_student": {
-    target:
-      process.env.VUE_APP_OE_STUDENT_HOST_URL ||
-      process.env.VUE_APP_CORE_HOST_URL,
-    changeOrigin: true,
-  },
   "/api": {
     target: process.env.VUE_APP_CORE_HOST_URL,
     changeOrigin: true,
@@ -18,29 +6,20 @@ let proxy = {
   },
 };
 
-// const stu = [
-//   "/api/ecs_oe",
-//   "/api/ecs_oe_student/",
-//   "/api/sys_param",
-//   "/api/exam_record",
-//   "/api/exam_control",
-//   "/api/exam_question",
-//   "/api/exam_score",
-//   "/api/practice_course",
-//   "/api/practice_detail",
-//   "/api/practice_record",
-//   "/api/exam_captures",
-//   "/api/face_capture",
-//   "/api/face_verify",
-//   "/api/offline_exam"
-// ];
-
-// for (const s of stu) {
-//   proxy[s] = {
-//     target: "http://ecs-dev.qmth.com.cn:8003", // 陈恳
-//     changeOrigin: true
-//   };
-// }
+const fs = require("fs");
+if (fs.existsSync("./proxy.config.js")) {
+  // 项目根目录下,创建 proxy.config.js,内容如下。把需要代理到本地服务器的api添加到下面。
+  // exports.default = {
+  //   "/api/test": {
+  //     target: "http://localhost:8001",
+  //     changeOrigin: true,
+  //     ws: true,
+  //   },
+  // };
+  const localProxy = require("./proxy.config.js").default;
+  proxy = { ...localProxy, ...proxy };
+  console.log(proxy);
+}
 
 // const mock = [{ source: "/api/mock/exam_question", dest: "/examQuestions" }];
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 389 - 193
yarn.lock


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov