|
@@ -6,7 +6,7 @@
|
|
|
<NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="main">
|
|
|
- <mainData :teacherinfo="teacherinfo" :xsscore="xsscore" :form="form" @onsave="onsave" :disabled="disabled"></mainData>
|
|
|
+ <mainData :teacherinfo="teacherinfo" :form="form" @onsave="onsave" :disabled="disabled"></mainData>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="foot">
|
|
|
<footInfo></footInfo>
|
|
@@ -23,6 +23,7 @@ import mainData from '@/layout/teacherscore/mainData.vue';
|
|
|
import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
const { mapActions: teacher } = createNamespacedHelpers('teacher');
|
|
|
const { mapActions: mapScore } = createNamespacedHelpers('score');
|
|
|
+const { mapActions: util } = createNamespacedHelpers('util');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -32,13 +33,12 @@ export default {
|
|
|
mainData, //课程安排主体
|
|
|
},
|
|
|
data: () => ({
|
|
|
- teacherinfo: {},
|
|
|
- xsscore: '',
|
|
|
- form: {},
|
|
|
title: '',
|
|
|
isleftarrow: '',
|
|
|
navShow: true,
|
|
|
disabled: false,
|
|
|
+ teacherinfo: {},
|
|
|
+ form: {},
|
|
|
}),
|
|
|
created() {
|
|
|
this.searchInfo();
|
|
@@ -64,29 +64,46 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...teacher({ columnList: 'query', teacherInfo: 'fetch' }),
|
|
|
- ...mapScore(['fetch', 'create', 'update']),
|
|
|
+ ...mapScore(['query', 'fetch', 'create', 'update']),
|
|
|
+ ...util({ modelFetch: 'fetch' }),
|
|
|
// 查询教师详情
|
|
|
async searchInfo() {
|
|
|
- const res = await this.teacherInfo(this.teaid);
|
|
|
- let xsscore = parseFloat(res.data.xsscore).toFixed(2);
|
|
|
+ let res = await this.teacherInfo(this.teaid);
|
|
|
this.$set(this, `teacherinfo`, res.data);
|
|
|
- this.$set(this, `xsscore`, xsscore);
|
|
|
+ res = await this.modelFetch({ model: 'score', stuid: this.user.id, lessonid: this.lessonid, teacherid: this.teaid });
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ console.log(res.data);
|
|
|
+ let data = res.data;
|
|
|
+ data.score = Number(res.data.score);
|
|
|
+ console.log(data);
|
|
|
+ this.$set(this, `form`, data);
|
|
|
+ }
|
|
|
},
|
|
|
// 为教师打分
|
|
|
- async onsave(form) {
|
|
|
- this.disabled = true;
|
|
|
- this.form.stuid = this.user.id;
|
|
|
- this.form.lessonid = this.lessonid;
|
|
|
- this.form.teacherid = this.teaid;
|
|
|
- let data = this.form;
|
|
|
- const res = await this.create(data);
|
|
|
- this.$notify({
|
|
|
- message: '评分成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- this.form = {};
|
|
|
- this.disabled = false;
|
|
|
- this.searchInfo();
|
|
|
+ async onsave({ data }) {
|
|
|
+ if (data) {
|
|
|
+ let res = await this.update(data);
|
|
|
+ this.$notify({
|
|
|
+ message: '修改评分成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.form = {};
|
|
|
+ this.disabled = false;
|
|
|
+ this.searchInfo();
|
|
|
+ } else {
|
|
|
+ this.disabled = true;
|
|
|
+ data.stuid = this.user.id;
|
|
|
+ data.lessonid = this.lessonid;
|
|
|
+ data.teacherid = this.teaid;
|
|
|
+ const res = await this.create(data);
|
|
|
+ this.$notify({
|
|
|
+ message: '评分成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.form = {};
|
|
|
+ this.disabled = false;
|
|
|
+ this.searchInfo();
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|