Commit 8522efa2 authored by 黄奎's avatar 黄奎

页面修改

parent 8b52d12e
......@@ -10,8 +10,9 @@
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.TeacherName" ref="TeacherName"
class="col-6 q-pr-lg q-pb-lg" label="教师名称" :rules="[val => !!val || '请填写教师姓名']" />
<q-select filled stack-label option-value="SId" option-label="SName" v-model="objOption.School_Id"
ref="School_Id" :options="schoolList" label="所属校区" :dense="false" class="col-6 q-pb-lg"
:rules="[val => !!val || '请选择所属校区']" />
ref="School_Id" :options="schoolList" label="所属校区" :dense="false" class="col-6 q-pb-lg" emit-value
map-options :rules="[val => !!val || '请选择所属校区']" />
<q-input type="tel" filled stack-label maxlength="100" :dense="false" v-model="objOption.TeacherTel"
ref="TeacherTel" class="col-6 q-pr-lg q-pb-lg" label="联系电话" :rules="[val => !!val || '请填写教师联系电话']" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="objOption.TeacherSay" ref="TeacherSay"
......@@ -21,8 +22,6 @@
:style="{'background-image':'url(' + objOption.TeacherHead + ')'}" max-files="1" hide-upload-btn
@rejected="onRejected" label="教师头像" :max-file-size="512*1024" accept=".jpg, image/*" auto-upload
:factory="uploadFile" no-thumbnails @added="getType(1)">
<template v-slot:list="scope">
</template>
</q-uploader>
</div>
<div class="col-6 q-pb-lg">
......@@ -30,8 +29,6 @@
:style="{'background-image':'url(' + objOption.TeacherIcon + ')'}" max-files="1" hide-upload-btn
@rejected="onRejected" label="教师形象照" :max-file-size="512*1024" accept=".jpg, image/*" auto-upload
:factory="uploadFile" no-thumbnails @added="getType(2)">
<template v-slot:list="scope">
</template>
</q-uploader>
</div>
<ext-editor :defaultMsg="objOption.TeacherIntro" classStr="col-12" @getEditValue="getEditValue"></ext-editor>
......@@ -95,7 +92,20 @@
data() {
return {
persistent: true,
objOption: {},
objOption: {
TId: 0,
School_Id: '',
TeacherName: "",
TeacherTel: '',
TeacherHead: '',
TeacherIcon: '',
TeacherSay: '',
TeacherIntro: '',
IsShow: 1,
IsRecommend: 0,
SortNum: 1,
TeachTag: ""
},
optionTitle: "",
schoolList: [],
uploadType: 0,
......@@ -104,8 +114,10 @@
tags: [],
}
},
mounted() {
created() {
this.getSchool()
},
mounted() {
this.initObj()
},
methods: {
......@@ -119,25 +131,23 @@
initObj() {
if (this.saveObj) {
this.optionTitle = "修改教师信息"
this.objOption = this.saveObj
this.objOption.TId = this.saveObj.TId;
this.objOption.School_Id = this.saveObj.School_Id;
this.objOption.TeacherName = this.saveObj.TeacherName;
this.objOption.TeacherTel = this.saveObj.TeacherTel;
this.objOption.TeacherHead = this.saveObj.TeacherHead;
this.objOption.TeacherIcon = this.saveObj.TeacherIcon;
this.objOption.TeacherSay = this.saveObj.TeacherSay;
this.objOption.TeacherIntro = this.saveObj.TeacherIntro;
this.objOption.IsShow = this.saveObj.IsShow;
this.objOption.IsRecommend = this.saveObj.IsRecommend;
this.objOption.SortNum = this.saveObj.SortNum;
this.objOption.TeachTag = this.saveObj.TeachTag;
if (this.objOption.TeachTag && this.objOption.TeachTag.length > 0) {
this.tags = JSON.parse(this.objOption.TeachTag)
}
} else {
this.optionTitle = "新增教师"
this.objOption = {
TId: 0,
School_Id: '',
TeacherName: "",
TeacherTel: '',
TeacherHead: '',
TeacherIcon: '',
TeacherSay: '',
TeacherIntro: '',
IsShow: 1,
IsRecommend: 0,
SortNum: 1
}
}
},
removeTag(i) {
......@@ -145,14 +155,9 @@
},
getSchool() {
getSchoolDropdown({}).then(res => {
this.schoolList = res.Data
if (this.objOption.School_Id != '') {
this.objOption.School_Id = this.schoolList.filter(x => {
if (this.objOption.School_Id == x.SId) {
return x
}
})[0]
}
this.schoolList = res.Data;
console.log("this.schoolList", this.schoolList);
this.$forceUpdate();
})
},
onRejected(rejectedEntries) {
......@@ -188,7 +193,6 @@
this.$refs.School_Id.validate()
this.$refs.TeacherName.validate()
this.$refs.TeacherTel.validate()
let tempSchool = null
if (
!this.$refs.School_Id.hasError &&
!this.$refs.TeacherName.hasError &&
......@@ -201,8 +205,6 @@
err_msg = "请上传用户头像"
}
if (err_msg == "") {
tempSchool = this.objOption.School_Id
this.objOption.School_Id = this.objOption.School_Id.SId
this.objOption.TeachTag = JSON.stringify(this.tags)
saveTeacher(this.objOption).then(res => {
this.saveLoading = false
......@@ -217,7 +219,7 @@
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
this.objOption.School_Id = tempSchool
})
} else {
this.$q.notify({
......
......@@ -48,7 +48,7 @@
<q-badge :color="props.value==0?'negative':'primary'" :label="props.value==0?'隐藏':'显示'" />
</q-td>
</template>
<template v-slot:body-cell-TeacherIcon="props">
<template v-slot:body-cell-TeacherHead="props">
<q-td :props="props">
<q-avatar size="md">
<img :src="props.value" />
......@@ -140,9 +140,9 @@
return {
currentUrl: "",
columns: [{
name: 'TeacherIcon',
name: 'TeacherHead',
label: '',
field: 'TeacherIcon',
field: 'TeacherHead',
align: 'left',
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment