ソースを参照

Merge branch 'dev_1.2.0' of http://git.qmth.com.cn/union-question/union-question-web into dev_1.2.0

zhangjie 3 年 前
コミット
9191fa3a66

+ 5 - 0
src/modules/questions/routes/routes.js

@@ -32,6 +32,7 @@ import EditPaperPendingTrial from "../views/EditPaperPendingTrial.vue";
 import ExamPaperPendingTrial from "../views/ExamPaperPendingTrial.vue";
 import CheckDuplicateList from "../views/CheckDuplicateList.vue";
 import CheckDuplicateInfo from "../views/CheckDuplicateInfo.vue";
+import License from "../views/License.vue";
 
 import { menuRoutes, editRoutes } from "../../card/router";
 
@@ -169,6 +170,10 @@ export default [
         path: "paper_storage/:isClear",
         component: PaperStorage,
       },
+      {
+        path: "license", //授权管理
+        component: License,
+      },
       ...menuRoutes,
     ],
   },

+ 0 - 306
src/modules/questions/views/Course.vue

@@ -40,25 +40,6 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="专业" prop="specialtyId">
-          <el-select
-            v-model="formSearch.specialtyId"
-            remote
-            :remote-method="getSpecialtyList4Search"
-            :loading="specialtyLoading4Search"
-            filterable
-            clearable
-            placeholder="请选择"
-            @focus="(e) => getSpecialtyList4Search(e.target.value)"
-          >
-            <el-option
-              v-for="item in specialtyList4SearchWrapper"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id"
-            />
-          </el-select>
-        </el-form-item>
 
         <el-form-item>
           <el-button type="danger" @click="handleSearchBtn">查询</el-button>
@@ -351,133 +332,6 @@
         <el-button @click="errDialog = false">确定</el-button>
       </span>
     </el-dialog>
-
-    <!-- 关联专业弹出框 -->
-    <el-dialog
-      :title="specialtyDialogTitle"
-      :visible.sync="specialtyDialog"
-      width="800px"
-      :modal="false"
-      append-to-body
-      custom-class="side-dialog"
-    >
-      <!-- 表单 -->
-      <el-form :inline="true" :model="specialtySearchForm">
-        <el-form-item label="专业名称">
-          <el-input
-            v-model="specialtySearchForm.name"
-            placeholder="请输入专业名称"
-          />
-        </el-form-item>
-        <el-form-item label="专业代码">
-          <el-input
-            v-model="specialtySearchForm.code"
-            placeholder="请输入专业代码"
-          />
-        </el-form-item>
-        <el-form-item>
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-search"
-            @click="searchSpecialtyPage"
-          >
-            查询
-          </el-button>
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-plus"
-            @click="addRelation"
-          >
-            新增
-          </el-button>
-        </el-form-item>
-      </el-form>
-
-      <!-- 专业列表 -->
-      <el-table :data="specialtyTableData" border>
-        <el-table-column prop="id" label="ID" width="100" />
-        <el-table-column prop="name" label="专业名称" width="250" />
-        <el-table-column prop="code" label="专业代码" />
-        <el-table-column
-          sortable
-          prop="updateTime"
-          label="更新时间"
-          width="170"
-        />
-        <el-table-column label="操作">
-          <div slot-scope="scope">
-            <span>
-              <el-button
-                size="mini"
-                type="primary"
-                icon="el-icon-edit"
-                plain
-                @click="deleteRelation(scope.row)"
-              >
-                取消关联
-              </el-button>
-            </span>
-          </div>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          :current-page="currentSpecialtyPage"
-          :page-size="10"
-          :total="specialtyTotal"
-          @current-change="handleSpecialtyCurrentChange"
-        />
-      </div>
-    </el-dialog>
-
-    <!-- 添加关联 -->
-    <el-dialog
-      title="添加关联专业"
-      :visible.sync="addRelationDialog"
-      width="520px"
-      :modal="false"
-      append-to-body
-      custom-class="side-dialog"
-      @close="() => $refs.addRelationForm.clearValidate()"
-    >
-      <el-form
-        ref="addRelationForm"
-        :inline="true"
-        inline-message
-        class="form-tight"
-        :model="addRelationForm"
-        :rules="addRelationRules"
-      >
-        <el-form-item label="专业" prop="specialtyId">
-          <el-select
-            v-model="addRelationForm.specialtyId"
-            class="dialog-input-width"
-            remote
-            :remote-method="getSpecialtyList4AddRelation"
-            :loading="specialtyLoading4AddRelation"
-            filterable
-            clearable
-            placeholder="请选择"
-            @focus="(e) => getSpecialtyList4AddRelation(e.target.value)"
-          >
-            <el-option
-              v-for="item in specialtyList4AddRelationWrapper"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id"
-            />
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer">
-        <el-button type="primary" @click="submitAddRelationForm">
-          保存
-        </el-button>
-        <el-button @click="addRelationDialog = false">取消</el-button>
-      </div>
-    </el-dialog>
   </section>
 </template>
 
@@ -490,14 +344,11 @@ export default {
   name: "Course",
   data() {
     return {
-      specialtyLoading4Search: false,
-      specialtyList4Search: [],
       formSearch: {
         name: "",
         code: "",
         enable: "",
         level: "",
-        specialtyId: "",
       },
       courseForm: {
         id: null,
@@ -513,11 +364,6 @@ export default {
       currentPage: 1,
       pageSize: 10,
       total: 10,
-      specialtyAllList: [],
-      specialtyList: [],
-      selectedSpecialtyList: [],
-      specialtys: [],
-      specialtyAll: [],
 
       impDialog: false,
       uploadAction: QUESTION_API + "/course/import",
@@ -562,35 +408,6 @@ export default {
           },
         ],
       },
-      specialtyDialog: false,
-      specialtyDialogTitle: null,
-      specialtySearchForm: {
-        courseId: null,
-        code: "",
-        name: "",
-      },
-      specialtyTableData: [],
-      currentSpecialtyPage: 1,
-      specialtyPageSize: 10,
-      specialtyTotal: 10,
-
-      addRelationDialog: false,
-      addRelationForm: {
-        specialtyId: null,
-        courseId: null,
-      },
-      specialtyLoading4AddRelation: false,
-      specialtyList4AddRelation: [],
-      addRelationRules: {
-        specialtyId: [
-          {
-            required: true,
-            type: "number",
-            message: "请选择专业",
-            trigger: "change",
-          },
-        ],
-      },
     };
   },
   computed: {
@@ -611,43 +428,6 @@ export default {
       }
       return courseIds;
     },
-    specialtyAllListSelect() {
-      let specialtyList = [];
-      for (let specialty of this.specialtyAllList) {
-        let specialtyInfo = specialty.name + "(" + specialty.code + ")";
-        specialtyList.push({ id: specialty.id, specialtyInfo: specialtyInfo });
-      }
-      return specialtyList;
-    },
-    getSpecialtyAllSelect4Search() {
-      let specialtyList4Search = [];
-      for (let specialty of this.specialtys) {
-        let specialtyInfo = specialty.name + "(" + specialty.code + ")";
-        specialtyList4Search.push({
-          id: specialty.id,
-          specialtyInfo: specialtyInfo,
-        });
-      }
-      return specialtyList4Search;
-    },
-    specialtyList4SearchWrapper() {
-      var specialtyList = [];
-      for (let course of this.specialtyList4Search) {
-        var name = course.name + " - " + course.code;
-        var id = course.id;
-        specialtyList.push({ id: id, name: name });
-      }
-      return specialtyList;
-    },
-    specialtyList4AddRelationWrapper() {
-      var specialtyList = [];
-      for (let course of this.specialtyList4AddRelation) {
-        var name = course.name + " - " + course.code;
-        var id = course.id;
-        specialtyList.push({ id: id, name: name });
-      }
-      return specialtyList;
-    },
   },
   //初始化查询
   created() {
@@ -666,22 +446,6 @@ export default {
     dialogBeforeClose() {
       this.$refs.courseForm.clearValidate();
     },
-    deleteRelation(row) {
-      var specialtyId = row.id;
-      var courseId = this.specialtySearchForm.courseId;
-      var param = new URLSearchParams({
-        courseId: courseId,
-        specialtyId: specialtyId,
-      });
-      var url = QUESTION_API + "/courseSpeciatlyRelation/delete?" + param;
-      this.$httpWithMsg.delete(url).then(() => {
-        this.$notify({
-          type: "success",
-          message: "取消关联成功!",
-        });
-        this.searchSpecialtyPage();
-      });
-    },
     submitAddRelationForm() {
       this.$refs.addRelationForm.validate((valid) => {
         if (valid) {
@@ -692,7 +456,6 @@ export default {
               type: "success",
               message: "添加成功!",
             });
-            this.searchSpecialtyPage();
             this.addRelationDialog = false;
           });
         } else {
@@ -701,50 +464,6 @@ export default {
         }
       });
     },
-    getSpecialtyList4AddRelation(query) {
-      this.specialtyLoading4AddRelation = true;
-      this.$httpWithMsg
-        .get(QUESTION_API + "/specialty/query?name=" + query)
-        .then((response) => {
-          this.specialtyList4AddRelation = response.data;
-          this.specialtyLoading4AddRelation = false;
-        });
-    },
-    addRelation() {
-      this.addRelationForm.specialtyId = null;
-      this.addRelationForm.courseId = this.specialtySearchForm.courseId;
-      this.addRelationDialog = true;
-      if (this.$refs.addRelationForm) {
-        this.$refs.addRelationForm.resetFields();
-      }
-    },
-    handleSpecialtyCurrentChange(val) {
-      this.currentSpecialtyPage = val;
-      this.searchSpecialtyPage();
-    },
-    searchSpecialtyPage() {
-      var param = new URLSearchParams(this.specialtySearchForm);
-      var url =
-        QUESTION_API +
-        "/specialty/specialtyPage/" +
-        (this.currentSpecialtyPage - 1) +
-        "/" +
-        this.pageSize +
-        "?" +
-        param;
-      this.$httpWithMsg
-        .get(url)
-        .then((response) => {
-          this.specialtyTableData = response.data.content;
-          this.specialtyTotal = response.data.totalElements;
-        })
-        .then(() => {
-          if (this.specialtyTableData.length === 0 && this.specialtyTotal > 0) {
-            this.currentSpecialtyPage = this.currentSpecialtyPage - 1;
-            this.searchSpecialtyPage();
-          }
-        });
-    },
     getTag(status) {
       if (status == true) {
         return "success";
@@ -764,15 +483,6 @@ export default {
         return "不限";
       }
     },
-    getSpecialtyList4Search(query) {
-      this.specialtyLoading4Search = true;
-      this.$httpWithMsg
-        .get(QUESTION_API + "/specialty/query?name=" + query)
-        .then((response) => {
-          this.specialtyList4Search = response.data;
-          this.specialtyLoading4Search = false;
-        });
-    },
     handleSearchBtn() {
       this.currentPage = 1;
       this.searchForm();
@@ -846,21 +556,6 @@ export default {
       );
     },
 
-    //关联课程
-    relation(row) {
-      this.specialtyDialogTitle =
-        "关联专业列表 【课程名称:" +
-        row.name +
-        "】【       课程代码:" +
-        row.code +
-        "】";
-      this.specialtySearchForm.courseId = row.id;
-      this.specialtySearchForm.name = "";
-      this.specialtySearchForm.code = "";
-
-      this.searchSpecialtyPage();
-      this.specialtyDialog = true;
-    },
     closeCourse() {
       this.courseDialog = false;
     },
@@ -915,7 +610,6 @@ export default {
         code: "",
         enable: "",
         level: "",
-        specialtyId: "",
       };
       this.$refs.primaryForm.resetFields();
     },

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

@@ -803,7 +803,9 @@
           <v-editor
             v-model="quesModel.quesBody"
             :enable-answer-point="
-              quesModel.questionType == 'FILL_BLANK_QUESTION'
+              quesModel.questionType == 'FILL_BLANK_QUESTION' ||
+              quesModel.questionType == 'CLOZE' ||
+              quesModel.questionType == 'BANKED_CLOZE'
             "
           ></v-editor>
         </el-form-item>
@@ -2134,7 +2136,8 @@ export default {
         score: this.quesModel.score,
       };
       if (
-        this.quesModel.quesOptions &&
+        (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION" ||
+          this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") &&
         this.quesModel.quesOptions.length == 0
       ) {
         this.$confirm("无选项将删除该试题, 是否继续?", "提示", {

+ 2 - 0
src/modules/questions/views/ExportTemplate.vue

@@ -597,6 +597,8 @@ export default {
           .get(QUESTION_API + "/org/getRootOrgList")
           .then((response) => {
             this.rootOrgList = response.data;
+            this.formSearch.rootOrgId = this.user.rootOrgId;
+            this.searchForm();
           });
       } else {
         this.formSearch.rootOrgId = this.user.rootOrgId;

+ 221 - 0
src/modules/questions/views/License.vue

@@ -0,0 +1,221 @@
+<template>
+  <section class="content">
+    <!-- 正文信息 -->
+    <div class="part-box">
+      <h1 class="part-box-title">授权管理</h1>
+      <div class="part-box-action">
+        <el-form
+          class="padding-tb-20 form-tight"
+          :model="info"
+          label-width="150px"
+        >
+          <el-form-item label="当前信息">
+            <span class="input">{{ info.activation }}</span>
+          </el-form-item>
+          <el-form-item label="人数限制">
+            <span class="input">{{ info.maxCount }}</span>
+          </el-form-item>
+          <el-form-item label="当前人数">
+            <span class="input">{{ info.onlineCount }}</span>
+          </el-form-item>
+          <el-form-item label="过期时间">
+            <span class="input">{{ info.expire }}</span>
+          </el-form-item>
+          <el-form-item label="授权模式">
+            <span class="input">{{ info.type }}</span>
+          </el-form-item>
+        </el-form>
+      </div>
+      <el-form
+        ref="form"
+        class="padding-tb-20 form-tight"
+        :rules="rules"
+        :model="form"
+        label-width="150px"
+      >
+        <el-form-item label="授权模式">
+          <el-select v-model="form.type" class="input">
+            <el-option label="在线激活" value="ONLINE"></el-option>
+            <el-option label="离线激活" value="OFFLINE"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          v-show="form.type == 'ONLINE'"
+          label="密匙"
+          class="input"
+          prop="accessKey"
+        >
+          <el-input v-model="form.accessKey" maxlength="255" />
+        </el-form-item>
+        <el-form-item
+          v-show="form.type == 'ONLINE'"
+          label="密钥"
+          class="input"
+          prop="accessSecret"
+        >
+          <el-input v-model="form.accessSecret" maxlength="255" />
+        </el-form-item>
+        <el-form-item v-show="form.type == 'OFFLINE'" label="导入授权文件">
+          <el-upload
+            ref="upload"
+            class="form_left"
+            accept=".lic"
+            :action="uploadAction"
+            :headers="uploadHeaders"
+            :data="uploadData"
+            :on-success="uploadSuccess"
+            :on-error="uploadError"
+            :file-list="fileList"
+            :auto-upload="false"
+            :multiple="false"
+          >
+            <el-button
+              slot="trigger"
+              size="small"
+              type="primary"
+              icon="icon icon-search-white"
+            >
+              选择文件
+            </el-button>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label=" ">
+          <el-button
+            v-show="form.type == 'OFFLINE'"
+            type="primary"
+            size="small"
+            @click="exportFile"
+            >导出硬件信息</el-button
+          >
+          <el-button type="primary" size="small" @click="submitForm"
+            >保存</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </div>
+  </section>
+</template>
+<script>
+import { QUESTION_API } from "@/constants/constants";
+import { mapState } from "vuex";
+export default {
+  data() {
+    return {
+      uploadAction: QUESTION_API + "/system/auth/offline",
+      uploadHeaders: {},
+      uploadData: {},
+      fileList: [],
+      info: {
+        activation: "",
+        expire: "",
+        type: "",
+        maxCount: "",
+        onlineCount: 0,
+      },
+      form: {
+        type: "ONLINE",
+        accessKey: "",
+        accessSecret: "",
+      },
+      rules: {
+        accessKey: [
+          {
+            required: true,
+            message: "请输入密匙",
+            trigger: ["blur", "change"],
+          },
+        ],
+        accessSecret: [
+          {
+            required: true,
+            message: "请输入密钥",
+            trigger: ["blur", "change"],
+          },
+        ],
+      },
+    };
+  },
+  computed: {
+    ...mapState({ user: (state) => state.user }),
+  },
+  created() {
+    this.init();
+  },
+  methods: {
+    init() {
+      this.uploadHeaders = {
+        key: this.user.key,
+        token: this.user.token,
+      };
+      this.searchForm();
+    },
+    searchForm() {
+      var url = QUESTION_API + "/system/auth/info";
+      this.$httpWithMsg.get(url).then((response) => {
+        if (response.data.auth == true) {
+          this.info.activation = "已授权";
+          this.info.expire = response.data.expireTime;
+          this.info.maxCount = response.data.maxOnlineUserCount;
+          this.info.onlineCount = response.data.onlineUserCount;
+          this.info.type =
+            response.data.type == "ONLINE" ? "在线激活" : "离线激活";
+        } else {
+          this.info.activation = "未授权";
+        }
+      });
+    },
+    //提交
+    submitForm() {
+      if (this.form.type == "OFFLINE") {
+        this.submitUpload();
+      } else {
+        var url = QUESTION_API + "/system/auth/online";
+        this.$refs.form.validate((valid) => {
+          if (valid) {
+            this.$httpWithMsg.post(url, this.form).then(() => {
+              this.$notify({
+                type: "success",
+                message: "授权成功",
+              });
+              this.searchForm();
+              this.addingDialog = false;
+            });
+          } else {
+            return false;
+          }
+        });
+      }
+    },
+    exportFile() {
+      window.open(
+        QUESTION_API +
+          "/system/auth/device/info?$key=" +
+          this.user.key +
+          "&$token=" +
+          this.user.token
+      );
+    },
+    submitUpload() {
+      this.$refs.upload.submit();
+    },
+    uploadSuccess(response) {
+      if (!response.hasError) {
+        this.$notify({
+          message: "授权成功",
+          type: "success",
+        });
+        this.searchForm();
+      }
+    },
+    uploadError(response) {
+      var json = JSON.parse(response.message);
+      if (response.status == 500) {
+        this.$notify({
+          message: json.desc,
+          type: "error",
+        });
+      }
+    },
+  },
+};
+</script>

+ 15 - 1
src/modules/questions/views/School.vue

@@ -46,10 +46,15 @@
             >禁用</el-button
           >
         </div>
-        <div>
+        <!-- <div>
           <el-button type="primary" icon="icon icon-plus-white" @click="insert"
             >新增</el-button
           >
+        </div> -->
+        <div>
+          <el-button type="primary" icon="icon icon-plus-white" @click="syncOrg"
+            >同步</el-button
+          >
         </div>
       </div>
     </div>
@@ -434,6 +439,15 @@ export default {
     resetForm() {
       this.$refs.schoolForm.resetFields();
     },
+    syncOrg() {
+      var url = QUESTION_API + "/org/sync";
+      this.$httpWithMsg.put(url, this.schoolForm).then(() => {
+        this.$notify({
+          type: "success",
+          message: "操作成功",
+        });
+      });
+    },
     //提交
     submitForm() {
       this.$refs.schoolForm.validate((valid) => {

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

@@ -941,8 +941,8 @@ export default {
         .get(url)
         .then((response) => {
           // console.log(response);
-          this.tableData = response.data.list;
-          this.total = response.data.total;
+          this.tableData = response.data.content;
+          this.total = response.data.totalElements;
           this.loading = false;
         })
         .finally(() => {