|
@@ -20,7 +20,7 @@
|
|
|
<el-upload
|
|
|
class="upload-width"
|
|
|
ref="upload"
|
|
|
- accept="image/*"
|
|
|
+ accept=".png"
|
|
|
:action="uploadAction"
|
|
|
:headers="uploadHeaders"
|
|
|
:data="uploadData"
|
|
@@ -32,6 +32,8 @@
|
|
|
:file-list="fileList"
|
|
|
:auto-upload="false"
|
|
|
:multiple="false"
|
|
|
+ :limit="1"
|
|
|
+ :on-exceed="handleExceed"
|
|
|
list-type="picture"
|
|
|
>
|
|
|
<el-button size="small" slot="trigger" type="primary"
|
|
@@ -44,7 +46,7 @@
|
|
|
>清空文件</el-button
|
|
|
>
|
|
|
<div slot="tip" class="el-upload__tip">
|
|
|
- 图片大小为400*100的png文件
|
|
|
+ 图片大小(长*宽)为400*100的png文件
|
|
|
</div>
|
|
|
</el-upload>
|
|
|
<el-input v-show="false" v-model="ruleForm.LOGO_FILE_URL"></el-input>
|
|
@@ -74,7 +76,11 @@
|
|
|
>
|
|
|
</el-checkbox-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="窗口默认大小" prop="STUDENT_CLIENT_DEFAULT_SIZE">
|
|
|
+ <el-form-item
|
|
|
+ v-show="false"
|
|
|
+ label="窗口默认大小"
|
|
|
+ prop="STUDENT_CLIENT_DEFAULT_SIZE"
|
|
|
+ >
|
|
|
<el-input
|
|
|
v-model="ruleForm.STUDENT_CLIENT_DEFAULT_SIZE"
|
|
|
placeholder="窗口大小格式为:宽度*高度"
|
|
@@ -90,14 +96,12 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button
|
|
|
- class="btn-margin-left"
|
|
|
+ :disabled="btnSaveDiabled"
|
|
|
type="primary"
|
|
|
@click="submitForm('ruleForm')"
|
|
|
>保 存</el-button
|
|
|
>
|
|
|
- <el-button class="btn-margin-left" @click="resetForm('ruleForm')"
|
|
|
- >取 消</el-button
|
|
|
- >
|
|
|
+ <!-- <el-button class="btn-margin-left" @click="resetForm('ruleForm')">取 消</el-button> -->
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-main>
|
|
@@ -117,6 +121,8 @@ export default {
|
|
|
loginTypes: LOGIN_TYPE,
|
|
|
propertyGroupId: "",
|
|
|
preventCheatingConfigs: PREVENT_CHEATING_CONFIG,
|
|
|
+ formDataChanged: false,
|
|
|
+ originalRuleForm: {},
|
|
|
ruleForm: {
|
|
|
relatedPropertyGroupIdList: [],
|
|
|
orgId: null,
|
|
@@ -148,7 +154,7 @@ export default {
|
|
|
{ min: 1, max: 50, message: "长度在 1 到 50 个字符", trigger: "blur" }
|
|
|
],
|
|
|
LOGO_FILE_URL: [
|
|
|
- { required: true, message: "请选择学校logo", trigger: "change" }
|
|
|
+ { required: true, message: "请上传学校logo", trigger: "change" }
|
|
|
],
|
|
|
loginType: [
|
|
|
{
|
|
@@ -195,6 +201,8 @@ export default {
|
|
|
message: "保存成功",
|
|
|
type: "success"
|
|
|
});
|
|
|
+ this.originalRuleForm = Object.assign({}, this.ruleForm);
|
|
|
+ this.formDataChanged = false;
|
|
|
},
|
|
|
() => {}
|
|
|
);
|
|
@@ -276,12 +284,18 @@ export default {
|
|
|
} else {
|
|
|
this.fileList = [];
|
|
|
}
|
|
|
+ this.originalRuleForm = Object.assign({}, this.ruleForm);
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ message: "学生客户端信息暂未初始化,请立即初始化",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- resetForm(formName) {
|
|
|
- this.$refs[formName].resetFields();
|
|
|
- },
|
|
|
+ // resetForm(formName) {
|
|
|
+ // this.$refs[formName].resetFields();
|
|
|
+ // },
|
|
|
initUpload() {
|
|
|
this.fileList = [];
|
|
|
},
|
|
@@ -349,12 +363,12 @@ export default {
|
|
|
for (let file of fileList) {
|
|
|
var fileName = file.name;
|
|
|
if (
|
|
|
- !fileName.endsWith(".jpg") &&
|
|
|
- !fileName.endsWith(".gif") &&
|
|
|
+ // !fileName.endsWith(".jpg") &&
|
|
|
+ // !fileName.endsWith(".gif") &&
|
|
|
!fileName.endsWith(".png")
|
|
|
) {
|
|
|
this.$notify({
|
|
|
- message: "上传文件必须为[jpg,gif,png]",
|
|
|
+ message: "上传文件格式必须为[png]",
|
|
|
type: "error"
|
|
|
});
|
|
|
this.initUpload();
|
|
@@ -374,6 +388,30 @@ export default {
|
|
|
handleRemove(file, fileList) {
|
|
|
console.log(file, fileList);
|
|
|
this.removeFile();
|
|
|
+ },
|
|
|
+ handleExceed() {
|
|
|
+ this.$notify({
|
|
|
+ message: "当前限制选择 1 个文件,请先清空文件再试",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ },
|
|
|
+ equalArrayIgnoreSequence(arr1, arr2) {
|
|
|
+ // 判断数组的长度
|
|
|
+ if (arr1.length !== arr2.length) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ let a = Object.assign([], arr1);
|
|
|
+ let b = Object.assign([], arr2);
|
|
|
+ a.sort();
|
|
|
+ b.sort();
|
|
|
+ // 循环遍历数组的值进行比较
|
|
|
+ for (let i = 0; i < a.length; i++) {
|
|
|
+ if (a[i] !== b[i]) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -387,19 +425,49 @@ export default {
|
|
|
console.log(this.propertyGroupId);
|
|
|
this.initForm();
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ ruleForm: {
|
|
|
+ deep: true,
|
|
|
+ handler: function(newForm) {
|
|
|
+ if (Object.keys(this.originalRuleForm).length > 0) {
|
|
|
+ this.formDataChanged = !(
|
|
|
+ newForm.OE_STUDENT_SYS_NAME ==
|
|
|
+ this.originalRuleForm.OE_STUDENT_SYS_NAME &&
|
|
|
+ newForm.LOGO_FILE_URL == this.originalRuleForm.LOGO_FILE_URL &&
|
|
|
+ this.equalArrayIgnoreSequence(
|
|
|
+ newForm.loginType,
|
|
|
+ this.originalRuleForm.loginType
|
|
|
+ ) &&
|
|
|
+ this.equalArrayIgnoreSequence(
|
|
|
+ newForm.preventCheatingConfig,
|
|
|
+ this.originalRuleForm.preventCheatingConfig
|
|
|
+ ) &&
|
|
|
+ newForm.STUDENT_CLIENT_CONSOLE_CONFIG ==
|
|
|
+ this.originalRuleForm.STUDENT_CLIENT_CONSOLE_CONFIG
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.formDataChanged = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
- ...mapState({ user: state => state.user })
|
|
|
+ ...mapState({ user: state => state.user }),
|
|
|
+ btnSaveDiabled() {
|
|
|
+ console.log(this.formDataChanged);
|
|
|
+ return !this.formDataChanged;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
.input-width {
|
|
|
- width: 600px;
|
|
|
+ width: 638px;
|
|
|
}
|
|
|
.upload-width {
|
|
|
- width: 600px;
|
|
|
-}
|
|
|
-.btn-margin-left {
|
|
|
- margin-left: 200px;
|
|
|
+ width: 638px;
|
|
|
}
|
|
|
+/* .btn-margin-left {
|
|
|
+ margin-left: 20px;
|
|
|
+} */
|
|
|
</style>
|