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

页面修改

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