guhongwei преди 4 години
родител
ревизия
c579439db4
променени са 2 файла, в които са добавени 31 реда и са изтрити 2 реда
  1. 13 1
      src/layout/index/mainData.vue
  2. 18 1
      src/views/home/index.vue

+ 13 - 1
src/layout/index/mainData.vue

@@ -25,9 +25,11 @@
               </el-col>
               <el-col :span="12" class="contextclass">
                 <p>{{ item.subname }}</p>
+
                 <p class="title">
                   <span @click="click(item)">{{ item.teaname }}</span>
                 </p>
+                <p>{{ getLocaltion(item) }}</p>
               </el-col>
               <el-col :span="24">
                 <p></p>
@@ -48,6 +50,8 @@ export default {
     lesson: null,
     today: null,
     arrange: null,
+    classInfo: { type: Object, default: () => {} },
+    locationList: { type: Array, default: () => [] },
   },
   components: {},
   data: () => ({}),
@@ -59,10 +63,18 @@ export default {
     changeLesson(date) {
       this.$emit('getLesson', date);
     },
-
     click(item) {
       this.$router.push({ path: '/home/teacher', query: { teaid: item.teaid, lessonid: item._id } });
     },
+    getLocaltion(data) {
+      if (data.subid) {
+        return _.get(this.classInfo, 'jslocation', '');
+      } else if (data.subname.includes('报道') || data.subname.includes('开班')) {
+        return _.get(this.classInfo, 'kbyslocation', '');
+      } else if (data.subname.includes('拓展')) {
+        return _.get(this.classInfo, 'kzjhlocation', '');
+      }
+    },
   },
   filters: {
     getMD(date) {

+ 18 - 1
src/views/home/index.vue

@@ -6,7 +6,7 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <mainData :lesson="lesson" :today="today" @getLesson="getLesson" :arrange="arrange"></mainData>
+          <mainData :lesson="lesson" :today="today" @getLesson="getLesson" :arrange="arrange" :locationList="locationList" :classInfo="classInfo"></mainData>
         </el-col>
       </el-col>
     </el-row>
@@ -18,6 +18,9 @@ import NavBar from '@/layout/common/topInfo.vue';
 import mainData from '@/layout/index/mainData.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: lesson } = createNamespacedHelpers('lesson');
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: util } = createNamespacedHelpers('util');
+const { mapActions: location } = createNamespacedHelpers('location');
 export default {
   name: 'index',
   props: {},
@@ -34,22 +37,31 @@ export default {
       originLesson: [],
       today: {},
       arrange: [],
+      classid: '',
+      classInfo: {},
+      locationList: [],
     };
   },
   created() {
+    this.getOtherList();
     let today = this.getDay();
     let todate = this.getDate();
     this.$set(this.today, `date`, todate);
     this.$set(this.today, `day`, today);
 
     if (this.user !== undefined) {
+      this.$set(this, `classid`, this.user.classid);
       this.searchInfo();
     }
   },
   methods: {
+    ...location({ getLocalList: 'query' }),
+    ...classes({ classesInfo: 'fetch', classeslist: 'query' }),
     ...lesson({ lessionInfo: 'fetch', lessionlist: 'query' }),
     // 查询课程详情
     async searchInfo() {
+      const res = await this.classesInfo(this.classid);
+      if (res.errcode == '0') this.$set(this, `classInfo`, res.data);
       let classid = sessionStorage.getItem('classid');
       const result = await this.lessionlist({ classid });
       let lessones = {};
@@ -57,6 +69,7 @@ export default {
         lessones = val;
       }
       var lesson = lessones.lessons.find(item => item.date === this.getDate());
+      console.log(lesson);
       this.$set(this, `lesson`, lesson);
       // 获取课程开始-结束日期
       this.$set(this, `originLesson`, lessones.lessons);
@@ -119,6 +132,10 @@ export default {
       var res = this.originLesson.filter(item => item.date === date.date);
       this.$set(this, `lesson`, res);
     },
+    async getOtherList() {
+      const res = await this.getLocalList();
+      if (this.$checkRes(res)) this.$set(this, `locationList`, res.data);
+    },
   },
   computed: {
     ...mapState(['user']),