Browse Source

组卷界面新增多套试卷间试题不能重复配置

zhangjie 2 năm trước cách đây
mục cha
commit
201f6c9215

+ 7 - 1
src/App.vue

@@ -18,7 +18,13 @@ export default {
     $route: {
       immediate: true,
       handler(val) {
-        const unSignalRoutes = ["Root", "Login", "NotFound", "CardBuild"];
+        const unSignalRoutes = [
+          "Root",
+          "Login",
+          "NotFound",
+          "CardBuild",
+          "LoginOpen",
+        ];
         if (val.name && unSignalRoutes.includes(val.name)) {
           this.signalWaiting = false;
           this.clearSetTs();

+ 6 - 0
src/modules/portal/routes/routes.js

@@ -1,4 +1,5 @@
 import Login from "../views/Login.vue";
+import LoginOpen from "../views/LoginOpen.vue";
 import Component404 from "../views/Component404.vue";
 export default [
   {
@@ -12,6 +13,11 @@ export default [
     name: "Login",
     component: Login,
   },
+  {
+    path: "/login-open",
+    name: "LoginOpen",
+    component: LoginOpen,
+  },
   {
     // will match everything
     path: "*",

+ 59 - 0
src/modules/portal/views/LoginOpen.vue

@@ -0,0 +1,59 @@
+<template>
+  <div class="login-open">正在登录……</div>
+</template>
+
+<script>
+/**
+ * returnUrl
+ * 所有需要重新登录的地方都要使用returnUrl。包括:
+ * axios
+ * router
+ * home:logout
+ */
+
+import { QUESTION_API } from "@/constants/constants";
+import { USER_SIGNIN } from "../store/user";
+import { mapActions } from "vuex";
+
+export default {
+  name: "LoginOpen",
+  data() {
+    return {};
+  },
+  created() {
+    this.autoLogin();
+  },
+  methods: {
+    ...mapActions([USER_SIGNIN]),
+    async autoLogin() {
+      const query = this.$route.query;
+      let data = {};
+      Object.keys(query).forEach((key) => {
+        data[key] = decodeURIComponent(query[key]);
+      });
+
+      if (data["returnUrl"]) {
+        window.sessionStorage.setItem("returnUrl", data["returnUrl"]);
+      }
+
+      const url = QUESTION_API + "/sso/login";
+
+      data.path = "/admin/login-open";
+      const res = await this.$httpWithMsg.post(url, data).catch(() => {});
+
+      if (!res) {
+        // window.history.go(-1);
+        return;
+      }
+
+      this.USER_SIGNIN(res.data);
+      this.$router.replace({ path: "/questions/tips" });
+      this.$notify({
+        message: "登录成功",
+        type: "success",
+        duration: 1000,
+      });
+    },
+  },
+};
+</script>

+ 14 - 0
src/modules/portal/views/home/Home.vue

@@ -335,6 +335,13 @@ export default {
         .then(() => {
           this.USER_SIGNOUT();
           window.name = "";
+
+          const returnUrl = window.sessionStorage.getItem("returnUrl");
+          if (returnUrl) {
+            window.location.href = returnUrl;
+            return;
+          }
+
           this.$router.replace({
             path: "/login" + getRootOrgId(),
           });
@@ -349,6 +356,13 @@ export default {
           }
           this.USER_SIGNOUT();
           window.name = "";
+
+          const returnUrl = window.sessionStorage.getItem("returnUrl");
+          if (returnUrl) {
+            window.location.href = returnUrl;
+            return;
+          }
+
           this.$router.replace({
             path: "/login" + getRootOrgId(),
           });

+ 4 - 2
src/modules/questions/views/EditPaper.vue

@@ -737,7 +737,9 @@
               <el-tag
                 :key="content.id"
                 style="margin-right: 5px"
-                :closable="!updatePorperty"
+                :closable="
+                  isNested(quesModel.questionType) ? false : !updatePorperty
+                "
                 type="primary"
                 effect="dark"
                 @close="handleClose(content)"
@@ -748,7 +750,7 @@
           </el-tooltip>
         </el-form-item>
 
-        <el-row :gutter="10">
+        <el-row v-if="!isNested(quesModel.questionType)" :gutter="10">
           <el-col :span="8">
             <el-form-item label="属性名" label-width="80px">
               <el-select

+ 6 - 0
src/modules/questions/views/GenPaperDetail.vue

@@ -55,6 +55,11 @@
             :disabled="genModelType == 'M-Type'"
           ></el-input>
         </el-form-item>
+        <el-form-item style="border: none">
+          <el-checkbox v-model="genPaper.topicRepeat"
+            >多套试卷间试题不能重复</el-checkbox
+          >
+        </el-form-item>
         <br />
       </el-form>
       <el-form>
@@ -717,6 +722,7 @@ export default {
         courseId: "",
         courseNo: "",
         courseName: "",
+        topicRepeat: false,
         level: "",
         paperName: "",
         paperIds: [],

+ 48 - 2
src/modules/questions/views/SelectQuestion.vue

@@ -37,7 +37,8 @@
           <el-select
             v-model="formSearch.questionType"
             placeholder="请选择题型"
-            @change="searchQuestionPaper"
+            clearable
+            @change="quesTypeChange"
           >
             <el-option
               v-for="item in questionTypes"
@@ -48,7 +49,26 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item> </el-form-item>
+        <el-form-item label="来源大题">
+          <el-select
+            v-model="formSearch.quesName"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in quesNameList"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="searchQuestionPaper"
+            >查询</el-button
+          >
+        </el-form-item>
       </el-form>
     </div>
 
@@ -80,6 +100,11 @@
             </span>
           </template>
         </el-table-column>
+        <el-table-column
+          prop="difficulty"
+          label="难度"
+          width="80"
+        ></el-table-column>
       </el-table>
       <!--分页栏-->
       <div class="part-page">
@@ -115,6 +140,7 @@ export default {
       formSearch: {
         questionType: "",
         quesBody: "",
+        quesName: "",
       },
       course: "",
       paperId: "",
@@ -123,6 +149,7 @@ export default {
       courseList: [],
       tableData: [],
       multipleSelection: [],
+      quesNameList: [], // 来源大题
       currentPage: 1,
       pageSize: 10,
       total: 10,
@@ -165,6 +192,7 @@ export default {
         this.courseList.push(response.data);
       });
     this.searchQuestionPaper();
+    this.getQuesNames();
   },
   mounted() {
     setTimeout(() => {
@@ -172,6 +200,24 @@ export default {
     }, 200);
   },
   methods: {
+    // 查询来源大题
+    async getQuesNames() {
+      const url = QUESTION_API + "/paperStruct/quesNames";
+
+      let params = {
+        courseId: this.courseId,
+        quesType: this.formSearch.questionType,
+      };
+      const res = await this.$http.get(url, {
+        params,
+      });
+
+      this.quesNameList = res.data || [];
+    },
+    quesTypeChange() {
+      this.formSearch.quesName = "";
+      this.getQuesNames();
+    },
     //查询列表
     searchQuestionPaper() {
       this.loading = true;

+ 18 - 8
src/plugins/axios.js

@@ -40,6 +40,16 @@ function getRootOrgId() {
   }
 }
 
+function returnLogin() {
+  const returnUrl = window.sessionStorage.getItem("returnUrl");
+  if (returnUrl) {
+    window.location.href = returnUrl;
+    return;
+  }
+
+  router.push("/login/" + getRootOrgId());
+}
+
 _$httpWith500Msg.interceptors.request.use(
   function (config) {
     networkInformationHint();
@@ -63,7 +73,7 @@ _$httpWith500Msg.interceptors.request.use(
                 // } else {
                 //   router.push("/login");
                 // }
-                router.push("/login/" + getRootOrgId());
+                returnLogin();
               },
             });
             window.___lastInvalidDate = Date.now();
@@ -110,7 +120,7 @@ _$http.interceptors.request.use(
             Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
               confirmButtonText: "确定",
               callback: () => {
-                router.push("/login/" + getRootOrgId());
+                returnLogin();
               },
             });
             window.___lastInvalidDate = Date.now();
@@ -192,7 +202,7 @@ _$httpWith500Msg.interceptors.response.use(
         Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
           confirmButtonText: "确定",
           callback: () => {
-            router.push("/login/" + getRootOrgId());
+            returnLogin();
           },
         });
         window.___lastInvalidDate = Date.now();
@@ -202,7 +212,7 @@ _$httpWith500Msg.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + getRootOrgId());
+          returnLogin();
         },
       });
       return Promise.reject(error);
@@ -277,7 +287,7 @@ _$http.interceptors.response.use(
         Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
           confirmButtonText: "确定",
           callback: () => {
-            router.push("/login/" + getRootOrgId());
+            returnLogin();
           },
         });
         window.___lastInvalidDate = Date.now();
@@ -287,7 +297,7 @@ _$http.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + getRootOrgId());
+          returnLogin();
         },
       });
       return Promise.reject(error);
@@ -325,7 +335,7 @@ _$httpWithoutBar.interceptors.request.use(
             Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
               confirmButtonText: "确定",
               callback: () => {
-                router.push("/login/" + getRootOrgId());
+                returnLogin();
               },
             });
             window.___lastInvalidDate = Date.now();
@@ -386,7 +396,7 @@ _$httpWithoutBar.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + getRootOrgId());
+          returnLogin();
         },
       });
       return Promise.reject(error);