소스 검색

首页+教师评分更改更新

guhongwei 5 년 전
부모
커밋
531c55d012
5개의 변경된 파일52개의 추가작업 그리고 119개의 파일을 삭제
  1. 11 18
      src/layout/index/mainData.vue
  2. 4 7
      src/layout/teacherscore/mainData.vue
  3. 0 42
      src/layout/teacherscore/topInfo.vue
  4. 22 30
      src/views/index.vue
  5. 15 22
      src/views/teacherscore/index.vue

+ 11 - 18
src/layout/index/mainData.vue

@@ -1,25 +1,20 @@
-6<template>
+<template>
   <div id="mainData">
-    <el-row v-for="(item, index) in lessionclassInfo.lessons" :key="index">
+    <el-row v-for="(item, index) in lessons" :key="index">
       <el-col :span="24">
-        <!-- <el-col :span="24" class="info">
-          <el-button type="primary">教师评分</el-button>
-        </el-col> -->
         <el-col :span="24" class="beijing">
           <el-col :span="24" class="top">
-            <el-col :span="12" class="time">时间</el-col
-            ><el-col :span="6" class="date"
-              ><el-col :span="24"> {{ item.date }}</el-col
-              ><el-col :span="24">{{ week }}</el-col>
+            <el-col :span="12" class="time">时间</el-col>
+            <el-col :span="6" class="date">
+              <el-col :span="24"> {{ item.date }}</el-col>
+              <el-col :span="24">{{ week }}</el-col>
             </el-col>
-            <el-col :span="6" class="date"
-              ><el-col :span="24" class="info">
-                <el-button
-                  type="primary"
-                  @click="$router.push({ path: 'teacherscore/index', query: { id: item.teaid, lessonid: item._id, subid: item.subid } })"
+            <el-col :span="6" class="date">
+              <el-col :span="24" class="info">
+                <el-button type="primary" @click="$router.push({ path: 'teacherscore/index', query: { teaid: item.teaid, lessonid: item._id } })"
                   >教师评分</el-button
-                ></el-col
-              >
+                >
+              </el-col>
             </el-col>
           </el-col>
           <el-col :span="24" class="context">
@@ -32,7 +27,6 @@
               <p></p>
             </el-col>
           </el-col>
-
           <el-col :span="24" class="context">
             <el-col :span="12" class="contexttime"><span>11:30—13:30</span></el-col
             ><el-col :span="12" class="contextclass"><p>午餐+休息</p> </el-col>
@@ -67,7 +61,6 @@
 export default {
   name: 'mainData',
   props: {
-    lessionclassInfo: null,
     lessons: null,
     week: null,
   },

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

@@ -15,8 +15,8 @@
           </el-col>
           <el-col :span="24">
             <el-col :span="16" class="title">工作量</el-col>
-            <el-col :span="8" class="fenshu">评分:{{ grade }}</el-col>
-            <el-col :span="24" class="work">本周工作饱满</el-col>
+            <el-col :span="8" class="fenshu">评分:{{ xsscore }}分</el-col>
+            <el-col :span="24" class="work">{{ xsscore > 5 ? '本月工作量饱满' : '本月工作量干枯' }}</el-col>
           </el-col>
           <el-col :span="24" class="beizhu">
             <span>备注</span>
@@ -37,7 +37,7 @@
 <script>
 export default {
   name: 'mainData',
-  props: { teacherinfo: null, form: null, grade: null },
+  props: { teacherinfo: null, xsscore: null, form: null },
   components: {},
   data: () => ({
     srcurl: require('@/assets/circle.png'),
@@ -80,17 +80,14 @@ export default {
   padding: 10px 0 0 20px;
 }
 .beizhu {
-  margin: 20px;
+  padding: 10px 20px 0 20px;
 }
 /deep/.beizhu .el-textarea__inner {
   background-color: #f5f5f5;
-  width: 90%;
   margin: 20px 0 0 0;
   height: 100px;
 }
-
 .anniu {
-  padding: 20px 0 0 0;
   text-align: center;
 }
 </style>

+ 0 - 42
src/layout/teacherscore/topInfo.vue

@@ -1,42 +0,0 @@
-<template>
-  <div id="topInfo">
-    <el-row>
-      <el-col :span="24" class="topInfos">
-        <van-nav-bar title="教师评分" left-text="返回" left-arrow fixed @click-left="onClickLeft" />
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'topInfo',
-  props: {},
-  components: {},
-  data: () => ({}),
-  created() {},
-  computed: {},
-  methods: {
-    onClickLeft() {
-      Toast('返回');
-    },
-  },
-};
-</script>
-
-<style lang="less" scoped>
-.topInfos {
-}
-/deep/.van-nav-bar {
-  background: #2c69fe;
-}
-/deep/.van-nav-bar__title {
-  color: #fff;
-}
-/deep/.van-nav-bar__text {
-  color: #fff;
-}
-/deep/.van-nav-bar .van-icon {
-  color: #fff;
-}
-</style>

+ 22 - 30
src/views/index.vue

@@ -3,11 +3,10 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <!-- <topInfo></topInfo> -->
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <mainData :lessionclassInfo="lessionclassInfo" :week="week"></mainData>
+          <mainData :lessons="lessons" :week="week"></mainData>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -21,8 +20,9 @@
 import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import mainData from '@/layout/index/mainData.vue';
-const { mapActions: lesson } = createNamespacedHelpers('lesson');
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
+const { mapActions: classes } = createNamespacedHelpers('classes');
 
 export default {
   name: 'index',
@@ -33,12 +33,11 @@ export default {
     mainData, //课程安排主体
   },
   data: () => ({
-    lessionclassInfo: { lessons: [] },
+    lessons: [],
     dates: '',
     week: '',
     title: '日程安排',
     isleftarrow: '',
-    transitionName: 'fade',
     navShow: true,
   }),
   created() {
@@ -60,38 +59,31 @@ export default {
   },
   methods: {
     ...lesson({ lessionInfo: 'fetch', lessionlist: 'query' }),
-    async searchInfo({ ...info } = {}) {
-      const res = await this.lessionlist({ ...info });
-      for (const val of res.data) {
-        console.log(this.user.classid);
-        var arr = res.data.filter(item => item.class === this.user.classid);
-        console.log(arr);
-        var aff = res.data[0].lessons;
-        console.log(aff);
-        var ahh = aff.map((i, index) => {
-          let word = '';
-          if (index == 1) word = '拓展交流';
-          if (index == 2) word = '课程作业小组展示';
-          if (index == 3) word = '课程作业';
-          if (index == 4) word = '礼仪课小组面试';
-          if (index == 5) word = '结业仪式';
-          i.lastLesson = word;
-          return i;
-        });
-        for (const aqq of aff) {
-          var aee = aff.filter(item => item.date === '2020-01-04');
-          this.$set(this.lessionclassInfo, `lessons`, aee);
-          console.log(aee);
-        }
-      }
+    ...classes({ classesInfo: 'fetch', classeslist: 'query' }),
+    // 查询课程详情
+    async searchInfo() {
+      const res = await this.classesInfo(this.user.classid);
+      const result = await this.lessionInfo(res.data.lessonid);
+      var ahh = result.data.lessons.map((i, index) => {
+        let word = '';
+        if (index == 1) word = '拓展交流';
+        if (index == 2) word = '课程作业小组展示';
+        if (index == 3) word = '课程作业';
+        if (index == 4) word = '礼仪课小组面试';
+        if (index == 5) word = '结业仪式';
+        i.lastLesson = word;
+        return i;
+      });
+      var aee = result.data.lessons.filter(item => item.date === '2020-01-02');
+      this.$set(this, `lessons`, aee);
     },
+    // 获取时间
     getDate() {
       var adate = new Date();
       this.value = adate.getFullYear() + '-' + (adate.getMonth() + 1) + '-' + adate.getDate();
       this.$set(this, `dates`, this.value);
       var str = '星期' + '日一二三四五六'.charAt(new Date().getDay());
       this.$set(this, `week`, str);
-      console.log(str);
     },
   },
 };

+ 15 - 22
src/views/teacherscore/index.vue

@@ -3,11 +3,10 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <!-- <topInfo></topInfo> -->
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <mainData :teacherinfo="teacherinfo" :grade="grade" :form="form" @onsave="onsave"></mainData>
+          <mainData :teacherinfo="teacherinfo" :xsscore="xsscore" :form="form" @onsave="onsave"></mainData>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -18,12 +17,11 @@
 </template>
 
 <script>
-import NavBar from '@/layout/teacherscore/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import mainData from '@/layout/teacherscore/mainData.vue';
-const { mapActions: teacher } = createNamespacedHelpers('teacher');
-// import { createNamespacedHelpers, mapGetters } from 'vuex';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: teacher } = createNamespacedHelpers('teacher');
 const { mapActions: mapScore } = createNamespacedHelpers('score');
 export default {
   name: 'index',
@@ -35,11 +33,10 @@ export default {
   },
   data: () => ({
     teacherinfo: {},
+    xsscore: '',
     form: {},
-    grade: {},
     title: '',
     isleftarrow: '',
-    transitionName: 'fade',
     navShow: true,
   }),
   created() {
@@ -47,15 +44,12 @@ export default {
   },
   computed: {
     ...mapState(['user']),
-    id() {
-      return this.$route.query.id;
+    teaid() {
+      return this.$route.query.teaid;
     },
     lessonid() {
       return this.$route.query.lessonid;
     },
-    subid() {
-      return this.$route.query.subid;
-    },
   },
   mounted() {
     this.title = this.$route.meta.title;
@@ -70,26 +64,25 @@ export default {
   methods: {
     ...teacher({ columnList: 'query', teacherInfo: 'fetch' }),
     ...mapScore(['fetch', 'create', 'update']),
-
+    // 查询教师详情
     async searchInfo() {
-      const res = await this.teacherInfo(this.id);
-      let b = parseInt(res.data.xsscore);
+      const res = await this.teacherInfo(this.teaid);
+      let xsscore = parseFloat(res.data.xsscore).toFixed(2);
       this.$set(this, `teacherinfo`, res.data);
-      this.$set(this, `grade`, b);
+      this.$set(this, `xsscore`, xsscore);
     },
+    // 为教师打分
     async onsave(form) {
-      this.form.teacherid = this.id;
-      this.form.lessonid = this.lessonid;
-      console.log(this.user.id);
       this.form.stuid = this.user.id;
+      this.form.lessonid = this.lessonid;
+      this.form.teacherid = this.teaid;
       let data = this.form;
-      let res = await this.create(data);
-      console.log(res);
-
+      const res = await this.create(data);
       this.$message({
         message: '评分成功',
         type: 'success',
       });
+      this.searchInfo();
     },
   },
 };