zhangjie 3 年之前
父節點
當前提交
d6af92c1d0
共有 4 個文件被更改,包括 126 次插入121 次删除
  1. 123 119
      src/main.js
  2. 1 1
      src/modules/client/views/GroupScan.vue
  3. 1 1
      src/modules/client/views/LineScan.vue
  4. 1 0
      src/plugins/encryptProcess.js

+ 123 - 119
src/main.js

@@ -1,119 +1,123 @@
-import Vue from "vue";
-import axios from "axios";
-
-import App from "./App.vue";
-import router from "./router";
-import store from "./store";
-import globalVuePlugins from "./plugins/globalVuePlugins";
-// 系统初始采集配置
-import CONFIG from "./config";
-
-// https://github.com/RobinCK/vue-ls
-import VueLocalStorage from "vue-ls";
-import ViewUI from "view-design";
-// import "view-design/dist/styles/iview.css";
-import "cropperjs/dist/cropper.min.css";
-import "./assets/styles/index.less";
-
-import { initConfigData } from "@/plugins/env";
-import log4js from "./plugins/logger";
-const logger = log4js.getLogger("request");
-
-Vue.use(ViewUI);
-ViewUI.Message.config({
-  top: 10
-});
-Vue.use(VueLocalStorage);
-Vue.use(globalVuePlugins);
-
-// 加载采集配置
-const GLOBAL = initConfigData(CONFIG);
-Vue.prototype.GLOBAL = GLOBAL;
-
-Vue.config.productionTip = false;
-
-// logger
-const addLog = (datas, type) => {
-  if (type === "start") {
-    const msg = `${datas.url},开始请求`;
-    logger.info(msg);
-  } else if (type === "success") {
-    const msg = `${datas.config.url},请求成功`;
-    logger.info(msg);
-  } else {
-    const msg = `${datas.config.url},请求错误,错误信息:${datas.response.data.status} - ${datas.response.data.message}`;
-    logger.error(msg);
-  }
-};
-
-// axios interceptors
-var load = "";
-// 同一时间有多个请求时,会形成队列。在第一个请求创建loading,在最后一个响应关闭loading
-var queue = [];
-axios.interceptors.request.use(
-  config => {
-    // 显示loading提示
-    if (!queue.length && !config["showTinyTips"] && !config["silentRequest"]) {
-      load = ViewUI.Message.loading({
-        content: "Loading...",
-        duration: 0
-      });
-    }
-
-    queue.push(1);
-
-    // 为请求地址添加全局domain
-    if (config.url.indexOf("http://") < 0) {
-      config.url = GLOBAL.domain + config.url;
-    }
-
-    // 为请求头添加信息
-    let organizationId = Vue.ls.get("organizationId");
-    if (organizationId) {
-      config.headers["organizationId"] = organizationId;
-    }
-    // 设置延迟时效
-    config.timeout = 10 * 60 * 1000;
-
-    addLog(config, "start");
-    return config;
-  },
-  error => {
-    // console.log(error);
-    // logger.error("");
-    // 关闭loading提示
-    // 串联并发请求,延时处理是为防止多个loading实例闪屏。
-    setTimeout(() => {
-      queue.shift();
-      if (!queue.length) load && load();
-    }, 100);
-    return Promise.reject(error);
-  }
-);
-axios.interceptors.response.use(
-  response => {
-    addLog(response, "success");
-    // 关闭loading提示
-    setTimeout(() => {
-      queue.shift();
-      if (!queue.length) load && load();
-    }, 100);
-    return response;
-  },
-  error => {
-    addLog(error, "error");
-
-    // 关闭loading提示
-    setTimeout(() => {
-      queue.shift();
-      if (!queue.length) load && load();
-    }, 100);
-    return Promise.reject(error);
-  }
-);
-
-new Vue({
-  router,
-  store,
-  render: h => h(App)
-}).$mount("#app");
+import Vue from "vue";
+import axios from "axios";
+
+import App from "./App.vue";
+import router from "./router";
+import store from "./store";
+import globalVuePlugins from "./plugins/globalVuePlugins";
+// 系统初始采集配置
+import CONFIG from "./config";
+
+// https://github.com/RobinCK/vue-ls
+import VueLocalStorage from "vue-ls";
+import ViewUI from "view-design";
+// import "view-design/dist/styles/iview.css";
+import "cropperjs/dist/cropper.min.css";
+import "./assets/styles/index.less";
+
+import { initConfigData } from "@/plugins/env";
+import log4js from "./plugins/logger";
+const logger = log4js.getLogger("request");
+
+Vue.use(ViewUI);
+ViewUI.Message.config({
+  top: 10
+});
+Vue.use(VueLocalStorage);
+Vue.use(globalVuePlugins);
+
+// 加载采集配置
+const GLOBAL = initConfigData(CONFIG);
+Vue.prototype.GLOBAL = GLOBAL;
+
+Vue.config.productionTip = false;
+
+// logger
+const addLog = (datas, type) => {
+  if (type === "start") {
+    const msg = `${datas.url},开始请求`;
+    logger.info(msg);
+  } else if (type === "success") {
+    const msg = `${datas.config.url},请求成功`;
+    logger.info(msg);
+  } else {
+    const msg = `${datas.config.url},请求错误,错误信息:${datas.response.data.status} - ${datas.response.data.message}`;
+    logger.error(msg);
+  }
+};
+
+// axios interceptors
+var load = "";
+// 同一时间有多个请求时,会形成队列。在第一个请求创建loading,在最后一个响应关闭loading
+var queue = [];
+axios.interceptors.request.use(
+  config => {
+    // 显示loading提示
+    if (!queue.length && !config["showTinyTips"] && !config["silentRequest"]) {
+      load = ViewUI.Message.loading({
+        content: "Loading...",
+        duration: 0
+      });
+    }
+
+    queue.push(1);
+
+    // 为请求地址添加全局domain
+    if (config.url.indexOf("http://") < 0) {
+      config.url = GLOBAL.domain + config.url;
+    }
+
+    // 为请求头添加信息
+    let organizationId = Vue.ls.get("organizationId");
+    if (organizationId) {
+      config.headers["organizationId"] = organizationId;
+    }
+    let user = Vue.ls.get("user", { userId: "", examId: "" });
+    config.headers["userId"] = user.userId;
+    config.headers["examId"] = user.examId;
+
+    // 设置延迟时效
+    config.timeout = 10 * 60 * 1000;
+
+    addLog(config, "start");
+    return config;
+  },
+  error => {
+    // console.log(error);
+    // logger.error("");
+    // 关闭loading提示
+    // 串联并发请求,延时处理是为防止多个loading实例闪屏。
+    setTimeout(() => {
+      queue.shift();
+      if (!queue.length) load && load();
+    }, 100);
+    return Promise.reject(error);
+  }
+);
+axios.interceptors.response.use(
+  response => {
+    addLog(response, "success");
+    // 关闭loading提示
+    setTimeout(() => {
+      queue.shift();
+      if (!queue.length) load && load();
+    }, 100);
+    return response;
+  },
+  error => {
+    addLog(error, "error");
+
+    // 关闭loading提示
+    setTimeout(() => {
+      queue.shift();
+      if (!queue.length) load && load();
+    }, 100);
+    return Promise.reject(error);
+  }
+);
+
+new Vue({
+  router,
+  store,
+  render: h => h(App)
+}).$mount("#app");

+ 1 - 1
src/modules/client/views/GroupScan.vue

@@ -418,7 +418,7 @@ export default {
       // 添加上传任务
       // 添加上传任务
       for (let i = 0, len = this.students.length; i < len; i++) {
       for (let i = 0, len = this.students.length; i < len; i++) {
         const curStudent = this.students[i];
         const curStudent = this.students[i];
-        await this.$parent.addUploadTask({
+        await this.$parent.$parent.addUploadTask({
           id: null,
           id: null,
           examId: this.user.examId,
           examId: this.user.examId,
           examName: this.user.examName,
           examName: this.user.examName,

+ 1 - 1
src/modules/client/views/LineScan.vue

@@ -349,7 +349,7 @@ export default {
       this.restartInitFile();
       this.restartInitFile();
     },
     },
     async appendUploadTask() {
     async appendUploadTask() {
-      await this.$parent.addUploadTask({
+      await this.$parent.$parent.addUploadTask({
         id: null,
         id: null,
         examId: this.user.examId,
         examId: this.user.examId,
         examName: this.user.examName,
         examName: this.user.examName,

+ 1 - 0
src/plugins/encryptProcess.js

@@ -1,6 +1,7 @@
 import { getEncryptPath } from "./env";
 import { getEncryptPath } from "./env";
 import { formatDate } from "./utils";
 import { formatDate } from "./utils";
 const request = require("request");
 const request = require("request");
+// const isDevelopment = true;
 const isDevelopment = process.env.NODE_ENV !== "production";
 const isDevelopment = process.env.NODE_ENV !== "production";
 
 
 const childProcess = require("child_process");
 const childProcess = require("child_process");