guhongwei 4 years ago
parent
commit
7f6d7b2087
2 changed files with 17 additions and 18 deletions
  1. 3 4
      src/layout/teacherscore/mainData.vue
  2. 14 14
      src/views/teacherscore/index.vue

+ 3 - 4
src/layout/teacherscore/mainData.vue

@@ -10,14 +10,13 @@
           <el-col :span="24"></el-col>
           <el-col :span="24" class="pingfen">
             <el-form-item>
-              <!-- <el-rate v-model="form.score"></el-rate> -->
               <van-rate v-model="form.score" :max="10" :count="10" />
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-col :span="16" class="title">工作量</el-col>
-            <el-col :span="8" class="fenshu">评分:{{ xsscore === undefined ? '0' : xsscore }}分</el-col>
-            <el-col :span="24" class="work">{{ xsscore > 5 ? '本月工作量饱满' : '本月工作量干枯' }}</el-col>
+            <el-col :span="8" class="fenshu">评分:{{ form.score === undefined ? 0 : form.score }}分</el-col>
+            <el-col :span="24" class="work">{{ form.score > 5 ? '本月工作量饱满' : '本月工作量干枯' }}</el-col>
           </el-col>
           <el-col :span="24" class="beizhu">
             <span>备注</span>
@@ -38,7 +37,7 @@
 <script>
 export default {
   name: 'mainData',
-  props: { teacherinfo: null, xsscore: null, form: null, disabled: Boolean },
+  props: { teacherinfo: null, form: null, disabled: Boolean },
   components: {},
   data: () => ({
     srcurl: require('@/assets/circle.png'),

+ 14 - 14
src/views/teacherscore/index.vue

@@ -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>
@@ -33,13 +33,12 @@ export default {
     mainData, //课程安排主体
   },
   data: () => ({
-    teacherinfo: {},
-    xsscore: '',
-    form: {},
     title: '',
     isleftarrow: '',
     navShow: true,
     disabled: false,
+    teacherinfo: {},
+    form: {},
   }),
   created() {
     this.searchInfo();
@@ -73,15 +72,17 @@ export default {
       this.$set(this, `teacherinfo`, res.data);
       res = await this.modelFetch({ model: 'score', stuid: this.user.id, lessonid: this.lessonid, teacherid: this.teaid });
       if (res.errcode == 0) {
-        this.$set(this, `xsscore`, res.data.score);
-        this.$set(this.form, `score`, res.data.score);
+        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) {
-      if (form.id) {
-        let data = this.form;
-        const res = await this.update(data);
+    async onsave({ data }) {
+      if (data) {
+        let res = await this.update(data);
         this.$notify({
           message: '修改评分成功',
           type: 'success',
@@ -91,10 +92,9 @@ export default {
         this.searchInfo();
       } else {
         this.disabled = true;
-        this.form.stuid = this.user.id;
-        this.form.lessonid = this.lessonid;
-        this.form.teacherid = this.teaid;
-        let data = this.form;
+        data.stuid = this.user.id;
+        data.lessonid = this.lessonid;
+        data.teacherid = this.teaid;
         const res = await this.create(data);
         this.$notify({
           message: '评分成功',