Sfoglia il codice sorgente

Merge branch 'master' of http://git.qmth.com.cn/ExamCloud-3/examcloud-web-admin

chenken 6 anni fa
parent
commit
311b5ee397

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
   },
   "dependencies": {
     "axios": "^0.18.0",
+    "axios-progress-bar": "^1.2.0",
     "bootstrap": "^4.2.1",
     "element-ui": "^2.4.9",
     "lodash": "^4.17.11",

+ 11 - 4
src/modules/portal/views/home/Home.vue

@@ -203,18 +203,25 @@ export default {
       this.$refs.passForm.resetFields();
     },
     logout() {
+      const orgId = this.user.rootOrgId;
+      const getRootOrgId = () => {
+        if (location.hostname.includes("qmth.com.cn")) {
+          return "";
+        } else {
+          return "?orgId=" + orgId;
+        }
+      };
+
       this.$http
         .post(CORE_API + "/auth/logout")
         .then(() => {
-          const orgId = this.user.rootOrgId;
           this.USER_SIGNOUT();
           window.name = "";
           this.$router.replace({
-            path: "/login" + "?orgId=" + orgId
+            path: "/login" + getRootOrgId()
           });
         })
         .catch(response => {
-          const orgId = this.user.rootOrgId;
           if (response.status == 500) {
             this.$notify({
               showClose: true,
@@ -225,7 +232,7 @@ export default {
           this.USER_SIGNOUT();
           window.name = "";
           this.$router.replace({
-            path: "/login" + "?orgId=" + orgId
+            path: "/login" + getRootOrgId()
           });
         });
     }

+ 1 - 1
src/modules/portal/views/tips/Tips.vue

@@ -215,7 +215,7 @@ const ALL_INSTRUCTIONS = {
         {
           name: "试卷评阅-阅卷",
           link: "/marking/mark_setting_work/marking",
-          detail: "评卷员可以对已分配的试卷进行打。"
+          detail: "评卷员可以对已分配的试卷进行打。"
         }
       ]
     }

+ 1 - 1
src/modules/questions/component/ckeditor.vue

@@ -80,7 +80,7 @@ export default {
         { name: "about", groups: ["about"] }
       ],
       removeButtons:
-        "Underline,Subscript,Superscript,Image,HorizontalRule,Unlink,Link,Scayt,Cut,Copy,Paste,PasteText,PasteFromWord,Maximize,Italic,Bold,NumberedList,BulletedList,Indent,Outdent,Blockquote,Styles,Format,About,RemoveFormat,Strike"
+        "Subscript,Superscript,Image,HorizontalRule,Unlink,Link,Scayt,Cut,Copy,Paste,PasteText,PasteFromWord,Maximize,NumberedList,BulletedList,Indent,Outdent,Blockquote,Styles,Format,About,RemoveFormat,Strike"
     };
     if (this.display !== "inline") {
       window.CKEDITOR.replace(this.id, config);

+ 1 - 1
src/modules/questions/directives/directives.js

@@ -12,7 +12,7 @@ function addAudio(el, binding, vnode) {
     var questionAudioId = obj.getAttribute("id");
     if (questionAudioId) {
       console.log("come in");
-      vnode.context.$http
+      vnode.context.$httpWithoutAuth
         .get(QUESTION_API + "/questionAudio/" + questionAudioId)
         .then(response => {
           if (response && response.data) {

+ 2 - 2
src/modules/questions/views/BluePaperStructure.vue

@@ -201,9 +201,9 @@ export default {
     //查询所有
     searchAll() {
       var pageNo = Number(this.currentPage);
+      this.currentPage = 1;
       this.loading = true;
-      var url =
-        QUESTION_API + "/paperStruct/" + this.currentPage + "/" + this.pageSize;
+      var url = QUESTION_API + "/paperStruct/" + pageNo + "/" + this.pageSize;
       this.$http.get(url, { params: this.formSearch }).then(response => {
         this.tableData = response.data.content;
         this.total = response.data.totalElements;

+ 1 - 0
src/modules/questions/views/EditOtherQuestion.vue

@@ -395,6 +395,7 @@ export default {
       };
       if (
         this.quesModel.quesProperties === undefined ||
+        this.quesModel.quesProperties === null ||
         this.quesModel.quesProperties.length == 0
       ) {
         this.quesModel.quesProperties = [];

+ 17 - 3
src/modules/questions/views/EditPaper.vue

@@ -1498,6 +1498,11 @@ export default {
     },
     //打开上传音频弹框
     openDialog() {
+      this.checkResult = false;
+      this.isUpload = true;
+      if (document.getElementById("radioFile")) {
+        document.getElementById("radioFile").value = "";
+      }
       this.dialogRadioFile = true;
       this.fileList = [];
     },
@@ -1507,9 +1512,15 @@ export default {
     },
     //返回
     back() {
-      this.$router.push({
-        path: "/questions/" + this.parentView + "/1"
-      });
+      if (sessionStorage.getItem("question_back") == "true") {
+        this.$router.push({
+          path: "/questions/" + this.parentView + "/0"
+        });
+      } else {
+        this.$router.push({
+          path: "/questions/" + this.parentView + "/1"
+        });
+      }
     },
     paperDetailShow(paperDetail) {
       if (this.reduplicateGroup.length == 0) {
@@ -1591,6 +1602,9 @@ export default {
         .then(() => {
           this.dialogRadioFile = false;
           this.uploadAudioLoading = false;
+          this.checkResult = false;
+          this.isUpload = true;
+          document.getElementById("radioFile").value = "";
           this.initPaper();
         })
         .catch(error => {

+ 1 - 0
src/modules/questions/views/EditSelectQuestion.vue

@@ -493,6 +493,7 @@ export default {
       };
       if (
         this.quesModel.quesProperties === undefined ||
+        this.quesModel.quesProperties === null ||
         this.quesModel.quesProperties.length == 0
       ) {
         this.quesModel.quesProperties = [];

+ 3 - 1
src/modules/questions/views/ExportStructure.vue

@@ -720,7 +720,9 @@ export default {
       this.exportStructure.useable = this.exportStructureCopy.useable;
       this.exportStructure.questionTypeNums = this.exportStructureCopy.questionTypeNums;
       let examId = this.exportStructure.examId;
-      this.exportStructure.examName = _.filter(this.examList, function(item) {
+      this.exportStructure.examName = _.filter(this.examListNew, function(
+        item
+      ) {
         return item.id == examId;
       })[0].name;
       this.$http

+ 4 - 5
src/modules/questions/views/ExtractPaperInfo.vue

@@ -137,9 +137,8 @@
                       @click.prevent="
                         removePaperInfo(examPaper.groupCode, paperInfo)
                       "
-                    ></i>
-                  </span>
-                  <span :class="'errorMsg_' + num + '_' + index"></span>
+                    ></i> </span
+                  >&nbsp; <span :class="'errorMsg_' + num + '_' + index"></span>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -606,7 +605,7 @@ export default {
             )[0].innerHTML = "试卷不能为空";
             document.getElementsByClassName(
               "errorMsg_" + i + "_" + j
-            )[0].style.display = "block";
+            )[0].style.display = "inline";
             break;
           } else {
             //$(".errorMsg_" + i + "_" + j).hide();
@@ -628,7 +627,7 @@ export default {
             )[0].innerHTML = "请输入1-100的整数";
             document.getElementsByClassName(
               "errorMsg_" + i + "_" + j
-            )[0].style.display = "block";
+            )[0].style.display = "inline";
             break;
           } else {
             //$(".errorMsg_" + i + "_" + j).hide();

+ 1 - 0
src/modules/questions/views/GenPaper.vue

@@ -475,6 +475,7 @@ export default {
       }
       sessionStorage.setItem("gen_paper", JSON.stringify(this.formSearch));
       sessionStorage.setItem("gen_paper_currentPage", this.currentPage);
+      sessionStorage.setItem("question_back", "false");
       this.$router.push({
         path: "/edit_paper/" + row.id + "/gen_paper"
       });

+ 1 - 0
src/modules/questions/views/ImportPaper.vue

@@ -453,6 +453,7 @@ export default {
       this.getCourseName(this.formSearch.courseNo);
       sessionStorage.setItem("import_paper", JSON.stringify(this.formSearch));
       sessionStorage.setItem("import_paper_currentPage", this.currentPage);
+      sessionStorage.setItem("question_back", "false");
       this.$router.push({
         path: "/edit_paper/" + row.id + "/import_paper"
       });

+ 1 - 0
src/modules/questions/views/ImportPaperInfo.vue

@@ -169,6 +169,7 @@ export default {
         type: "success"
       });
       this.fileLoading = false;
+      sessionStorage.setItem("question_back", "true");
       this.$router.push({
         path: "/edit_paper/" + response.id + "/import_paper"
       });

+ 1 - 0
src/modules/questions/views/InsertPaperTitle.vue

@@ -10,6 +10,7 @@
               @change="searchGenPaper"
               v-model="paperTitleForm.courseNo"
               filterable
+              clearable
               remote
               placeholder="请输入课程名称(代码)"
               :remote-method="queryCoursesByKeyword"

+ 3 - 3
src/modules/questions/views/PaperStructure.vue

@@ -96,7 +96,7 @@
         @selection-change="selectionChange"
       >
         <el-table-column type="selection" width="35"></el-table-column>
-        <el-table-column label="预设精确结构名称" width="190">
+        <el-table-column label="预设精确结构名称">
           <template slot-scope="scope">
             <span>{{ scope.row.name }}</span>
           </template>
@@ -210,9 +210,9 @@ export default {
     },
     searchPaperStructs() {
       var pageNo = Number(this.currentPage);
+      this.currentPage = 1;
       this.loading = true;
-      var url =
-        QUESTION_API + "/paperStruct/" + this.currentPage + "/" + this.pageSize;
+      var url = QUESTION_API + "/paperStruct/" + pageNo + "/" + this.pageSize;
       this.$http.get(url, { params: this.formSearch }).then(response => {
         this.tableData = response.data.content;
         this.total = response.data.totalElements;

+ 6 - 4
src/modules/questions/views/PreviewPaper.vue

@@ -167,10 +167,12 @@ export default {
     //初始化试卷
     initPaper() {
       this.loading = true;
-      this.$http.get(QUESTION_API + "/paper/" + this.paperId).then(response => {
-        this.paper = response.data;
-        this.loading = false;
-      });
+      this.$httpWithoutAuth
+        .get(QUESTION_API + "/paper/" + this.paperId)
+        .then(response => {
+          this.paper = response.data;
+          this.loading = false;
+        });
     },
     back() {
       debugger;

+ 0 - 1
src/modules/questions/views/Question.vue

@@ -715,7 +715,6 @@ export default {
           firstPropertyId: "",
           secondPropertyId: ""
         };
-        this.currentPage = 1;
       }
       this.searchQues();
     }

+ 58 - 16
src/plugins/axios.js

@@ -1,6 +1,7 @@
 import Vue from "vue";
 import axios from "axios";
 import router from "../router";
+import { loadProgressBar } from "axios-progress-bar";
 
 const ERROR_MSG_CONFIG = require("./errorMsgConfig").default;
 
@@ -15,8 +16,8 @@ let config = {
   withCredentials: true // Check cross-site Access-Control
 };
 
-const _axios = axios.create(config);
-const _axiosWithoutResponseInterceptors = axios.create(config);
+const _$httpWith500Msg = axios.create(config);
+const _$http = axios.create(config); // no auto 500 error UI
 
 /**
  * A. token lifecycle
@@ -29,7 +30,15 @@ const _axiosWithoutResponseInterceptors = axios.create(config);
 let wk_token, wk_key;
 let wk_orgId;
 
-_axios.interceptors.request.use(
+function getRootOrgId() {
+  if (location.hostname.includes("qmth.com.cn")) {
+    return "";
+  } else {
+    return "?orgId=" + (wk_orgId === undefined ? "" : wk_orgId);
+  }
+}
+
+_$httpWith500Msg.interceptors.request.use(
   function(config) {
     // Do something before request is sent
     if (
@@ -47,7 +56,7 @@ _axios.interceptors.request.use(
               // } else {
               //   router.push("/login");
               // }
-              router.push("/login/" + "?orgId=" + wk_orgId);
+              router.push("/login/" + getRootOrgId());
             }
           });
           return;
@@ -76,7 +85,8 @@ _axios.interceptors.request.use(
   }
 );
 
-_axiosWithoutResponseInterceptors.interceptors.request.use(
+_$http.interceptors.request.use(
+  // no auto 500 error UI
   function(config) {
     // Do something before request is sent
     if (config.url.includes("/login") === false) {
@@ -86,7 +96,7 @@ _axiosWithoutResponseInterceptors.interceptors.request.use(
           Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
             confirmButtonText: "确定",
             callback: () => {
-              router.push("/login/" + "?orgId=" + wk_orgId);
+              router.push("/login/" + getRootOrgId());
             }
           });
           return;
@@ -116,8 +126,14 @@ _axiosWithoutResponseInterceptors.interceptors.request.use(
 );
 
 // Add a response interceptor
-_axios.interceptors.response.use(
+_$httpWith500Msg.interceptors.response.use(
   response => {
+    window._hmt.push([
+      "_trackEvent",
+      `页面-${location.pathname}`,
+      "网络请求-响应",
+      new URL(response.config.url, "http://www.qmth.com.cn").pathname
+    ]);
     return response;
   },
   error => {
@@ -140,7 +156,7 @@ _axios.interceptors.response.use(
       Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -148,7 +164,7 @@ _axios.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -191,8 +207,15 @@ _axios.interceptors.response.use(
 );
 
 // Add a response interceptor
-_axiosWithoutResponseInterceptors.interceptors.response.use(
+_$http.interceptors.response.use(
+  // no auto 500 error UI
   response => {
+    window._hmt.push([
+      "_trackEvent",
+      `页面-${location.pathname}`,
+      "网络请求-响应",
+      new URL(response.config.url, "http://www.qmth.com.cn").pathname
+    ]);
     return response;
   },
   error => {
@@ -212,7 +235,7 @@ _axiosWithoutResponseInterceptors.interceptors.response.use(
       Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -220,7 +243,7 @@ _axiosWithoutResponseInterceptors.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -238,19 +261,33 @@ _axiosWithoutResponseInterceptors.interceptors.response.use(
 );
 
 Plugin.install = function(Vue) {
-  Vue.$http = _axiosWithoutResponseInterceptors;
+  Vue.$http = _$http; // no auto 500 error UI
   Object.defineProperties(Vue.prototype, {
     $http: {
       get() {
-        return _axiosWithoutResponseInterceptors;
+        return _$http; // no auto 500 error UI
       }
     }
   });
-  Vue.$httpWithMsg = _axios;
+
+  Vue.$httpWithMsg = _$httpWith500Msg;
   Object.defineProperties(Vue.prototype, {
     $httpWithMsg: {
       get() {
-        return _axios;
+        return _$httpWith500Msg;
+      }
+    }
+  });
+
+  // for below request
+  // config.url.includes("/api/ecs_ques/paper/") === false &&
+  // config.url.includes("/api/ecs_ques/questionAudio") === false
+  const _a = axios.create(config);
+  Vue.$httpWithoutAuth = _a;
+  Object.defineProperties(Vue.prototype, {
+    $httpWithoutAuth: {
+      get() {
+        return _a;
       }
     }
   });
@@ -258,4 +295,9 @@ Plugin.install = function(Vue) {
 
 Vue.use(Plugin);
 
+loadProgressBar({}, Vue.$http);
+loadProgressBar({}, Vue.$httpWithMsg);
+loadProgressBar({}, Vue.$httpWithoutAuth);
+
+import "axios-progress-bar/dist/nprogress.css";
 export default Plugin;

+ 8 - 0
src/router.js

@@ -26,6 +26,14 @@ let router = new Router({
 });
 
 router.beforeEach((to, from, next) => {
+  if (to.path) {
+    window._hmt.push(["_trackPageview", "/admin" + to.fullPath]);
+  }
+
+  if (to.path.includes("/preview_paper/")) {
+    next();
+    return;
+  }
   if (!to.meta.privilegeCodes) {
     next();
   } else {

+ 1 - 0
src/styles/global.css

@@ -1,4 +1,5 @@
 @import "./elementuiCustomize.css";
+@import "./nprogress.css";
 
 body {
   margin: 0;

+ 12 - 0
src/styles/nprogress.css

@@ -0,0 +1,12 @@
+#nprogress .bar {
+  background: yellow !important;
+}
+
+#nprogress .peg {
+  box-shadow: 0 0 10px yellow, 0 0 5px yellow !important;
+}
+
+#nprogress .spinner-icon {
+  border-top-color: yellow !important;
+  border-left-color: yellow !important;
+}

+ 5 - 0
yarn.lock

@@ -1488,6 +1488,11 @@ aws4@^1.8.0:
   resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
   integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==
 
+axios-progress-bar@^1.2.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/axios-progress-bar/-/axios-progress-bar-1.2.0.tgz#f9ee88dc9af977246be1ef07eedfa4c990c639c5"
+  integrity sha512-PEgWb/b2SMyHnKJ/cxA46OdCuNeVlo8eqL0HxXPtz+6G/Jtpyo49icPbW+jpO1wUeDEjbqpseMoCyWxESxf5pA==
+
 axios@^0.18.0:
   version "0.18.0"
   resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102"