Browse Source

客户端配置新加学生端版本属性

lideyin 5 years ago
parent
commit
ce74d27000
2 changed files with 91 additions and 6 deletions
  1. 5 0
      src/constants/constants.js
  2. 86 6
      src/modules/basic/view/clientConfig.vue

+ 5 - 0
src/constants/constants.js

@@ -83,3 +83,8 @@ export const PREVENT_CHEATING_CONFIG = [
   { code: "FULL_SCREEN_TOP", name: "强制全屏置顶" },
   { code: "DISABLE_MULTISCREEN", name: "禁用双屏" }
 ];
+//学生端版本
+export const STUDNET_CLIENT_VERSION = [
+  { code: "1.0.0", name: "1.0.0" },
+  { code: "2.0.0", name: "2.0.0" }
+];

+ 86 - 6
src/modules/basic/view/clientConfig.vue

@@ -118,6 +118,18 @@
             class="input-width"
           ></el-input>
         </el-form-item>
+        <el-form-item label="学生端版本" prop="studentClientVersion">
+          <el-checkbox-group v-model="ruleForm.studentClientVersion">
+            <el-checkbox
+              v-for="pcc in studentClientVersions"
+              name="studentClientVersion"
+              :label="pcc.code"
+              v-model="pcc.code"
+              :key="pcc.code"
+              >{{ pcc.name }}</el-checkbox
+            >
+          </el-checkbox-group>
+        </el-form-item>
         <el-form-item label="控制台配置" prop="STUDENT_CLIENT_CONSOLE_CONFIG">
           <el-input
             v-model="ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG"
@@ -143,6 +155,7 @@ import { mapState } from "vuex";
 import {
   LOGIN_TYPE,
   PREVENT_CHEATING_CONFIG,
+  STUDENT_CLIENT_VERSION,
   CORE_API
 } from "@/constants/constants.js";
 export default {
@@ -152,6 +165,7 @@ export default {
       loginTypes: LOGIN_TYPE,
       propertyGroupId: "",
       preventCheatingConfigs: PREVENT_CHEATING_CONFIG,
+      studentClientVersions: STUDENT_CLIENT_VERSION,
       formDataChanged: false,
       originalRuleForm: {},
       ruleForm: {
@@ -161,6 +175,7 @@ export default {
         LOGO_FILE_URL: "",
         LOGIN_TYPE: "",
         PREVENT_CHEATING_CONFIG: "",
+        STUDENT_CLIENT_VERSION: "",
         STUDENT_CLIENT_DEFAULT_SIZE: "",
         STUDENT_CLIENT_CONSOLE_CONFIG: "",
         STUDENT_CODE_LOGIN_ALIAS: "学号登录",
@@ -170,13 +185,15 @@ export default {
           LOGO_FILE_URL: "",
           LOGIN_TYPE: "",
           PREVENT_CHEATING_CONFIG: "",
+          STUDENT_CLIENT_VERSION: "",
           STUDENT_CLIENT_DEFAULT_SIZE: "",
           STUDENT_CLIENT_CONSOLE_CONFIG: "",
           STUDENT_CODE_LOGIN_ALIAS: "学号登录",
           IDENTITY_NUMBER_LOGIN_ALIAS: "身份证号登录"
         },
         loginType: [],
-        preventCheatingConfig: []
+        preventCheatingConfig: [],
+        studentClientVersion: []
       },
       logoDialog: false,
       uploadAction: "",
@@ -213,6 +230,14 @@ export default {
             trigger: "blur"
           },
           { min: 1, max: 10, message: "长度在 1 到 10 个字符", trigger: "blur" }
+        ],
+        studentClientVersion: [
+          {
+            type: "array",
+            required: true,
+            message: "请至少选择一个学生端版本",
+            trigger: "change"
+          }
         ]
       }
     };
@@ -244,11 +269,11 @@ export default {
             let validArr = [];
             //保存时清理一下历史数据
             for (
-              var i = 0;
+              let i = 0;
               i < this.ruleForm.preventCheatingConfig.length;
               i++
             ) {
-              var code = this.ruleForm.preventCheatingConfig[i];
+              let code = this.ruleForm.preventCheatingConfig[i];
               if (defaultArr.indexOf(code) > -1) {
                 validArr.push(code);
               }
@@ -262,6 +287,38 @@ export default {
             this.ruleForm.properties.PREVENT_CHEATING_CONFIG = this.ruleForm.PREVENT_CHEATING_CONFIG = res;
           }
 
+          if (
+            this.ruleForm.studentClientVersion == null ||
+            this.ruleForm.studentClientVersion.length == 0
+          ) {
+            this.ruleForm.properties.STUDENT_CLIENT_VERSION = this.ruleForm.STUDENT_CLIENT_VERSION =
+              "NONE";
+          } else {
+            let defaultArr = [];
+            for (let lt of STUDENT_CLIENT_VERSION) {
+              defaultArr.push(lt.code);
+            }
+            let validArr = [];
+            //保存时清理一下历史数据
+            for (
+              let i = 0;
+              i < this.ruleForm.studentClientVersion.length;
+              i++
+            ) {
+              let code = this.ruleForm.studentClientVersion[i];
+              if (defaultArr.indexOf(code) > -1) {
+                validArr.push(code);
+              }
+            }
+            let res = "";
+            if (validArr.length == 0) {
+              res = "NONE";
+            } else {
+              res = validArr.join(",");
+            }
+            this.ruleForm.properties.STUDENT_CLIENT_VERSION = this.ruleForm.STUDENT_CLIENT_VERSION = res;
+          }
+
           this.$httpWithMsg
             .put(CORE_API + "/org/saveOrgProperties", this.ruleForm)
             .then(
@@ -286,7 +343,7 @@ export default {
       this.uploadAction = CORE_API + "/org/importLogo/" + this.ruleForm.orgId;
       this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE = "1400*900";
       this.ruleForm.relatedPropertyGroupIdList = ["studentClientConfig"];
-      var url =
+      let url =
         CORE_API +
         "/org/getOrgPropertiesByGroupWithoutCache/" +
         this.ruleForm.orgId +
@@ -311,6 +368,9 @@ export default {
           this.ruleForm.PREVENT_CHEATING_CONFIG =
             this.ruleForm.properties.PREVENT_CHEATING_CONFIG ||
             this.ruleForm.PREVENT_CHEATING_CONFIG;
+          this.ruleForm.STUDENT_CLIENT_VERSION =
+            this.ruleForm.properties.STUDENT_CLIENT_VERSION ||
+            this.ruleForm.STUDENT_CLIENT_VERSION;
           this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE =
             this.ruleForm.properties.STUDENT_CLIENT_DEFAULT_SIZE ||
             this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE;
@@ -353,6 +413,22 @@ export default {
             this.ruleForm.preventCheatingConfig = defaultValue;
             console.log(defaultValue);
           }
+          if (this.ruleForm.properties.STUDENT_CLIENT_VERSION) {
+            if (this.ruleForm.properties.STUDENT_CLIENT_VERSION != "NONE") {
+              this.ruleForm.studentClientVersion = this.ruleForm.properties.STUDENT_CLIENT_VERSION.split(
+                ","
+              );
+            } else {
+              this.ruleForm.studentClientVersion = [];
+            }
+          } else {
+            let defaultValue = [];
+            // for (let lt of STUDENT_CLIENT_VERSION) {
+            //   defaultValue.push(lt.code);
+            // }
+            this.ruleForm.studentClientVersion = defaultValue;
+            console.log(defaultValue);
+          }
           let fileUrl = response.data.LOGO_FILE_URL;
           let fname = "";
           if (fileUrl) {
@@ -424,7 +500,7 @@ export default {
       this.fileLoading = true;
     },
     checkUpload() {
-      var fileList = this.$refs.upload.uploadFiles;
+      let fileList = this.$refs.upload.uploadFiles;
       if (fileList.length == 0) {
         this.$notify({
           message: "上传文件不能为空",
@@ -440,7 +516,7 @@ export default {
         return false;
       }
       for (let file of fileList) {
-        var fileName = file.name;
+        let fileName = file.name;
         if (
           // !fileName.endsWith(".jpg") &&
           // !fileName.endsWith(".gif") &&
@@ -529,6 +605,10 @@ export default {
               newForm.preventCheatingConfig,
               this.originalRuleForm.preventCheatingConfig
             ) &&
+            this.equalArrayIgnoreSequence(
+              newForm.studentClientVersion,
+              this.originalRuleForm.studentClientVersion
+            ) &&
             newForm.STUDENT_CLIENT_CONSOLE_CONFIG ==
               this.originalRuleForm.STUDENT_CLIENT_CONSOLE_CONFIG &&
             newForm.STUDENT_CODE_LOGIN_ALIAS ==