guhongwei 4 years ago
parent
commit
7559025799
3 changed files with 16 additions and 9 deletions
  1. 2 0
      src/layout/index/mainData.vue
  2. 4 6
      src/views/home/index.vue
  3. 10 3
      src/views/index.vue

+ 2 - 0
src/layout/index/mainData.vue

@@ -73,6 +73,8 @@ export default {
         return _.get(this.classInfo, 'kbyslocation', '');
       } else if (data.subname.includes('拓展')) {
         return _.get(this.classInfo, 'kzjhlocation', '');
+      } else if (data.subname.includes('午餐+休息') || data.subname.includes('晚餐')) {
+        return _.get(this.classInfo, 'yclocation', '');
       }
     },
   },

+ 4 - 6
src/views/home/index.vue

@@ -37,7 +37,7 @@ export default {
       originLesson: [],
       today: {},
       arrange: [],
-      classid: '',
+      classids: '',
       classInfo: {},
       locationList: [],
     };
@@ -48,9 +48,8 @@ export default {
     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.$set(this, `classids`, sessionStorage.getItem('classid'));
       this.searchInfo();
     }
   },
@@ -60,16 +59,15 @@ export default {
     ...lesson({ lessionInfo: 'fetch', lessionlist: 'query' }),
     // 查询课程详情
     async searchInfo() {
+      let classid = this.classids;
       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 = {};
       for (const val of result.data) {
         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);
@@ -138,7 +136,7 @@ export default {
     },
   },
   computed: {
-    ...mapState(['user']),
+    ...mapState(['user', 'classid']),
   },
   mounted() {
     this.title = this.$route.meta.title;

+ 10 - 3
src/views/index.vue

@@ -57,7 +57,7 @@ export default {
     };
   },
   created() {
-    if (this.$route.query.token) {
+    if (!this.$route.query.token) {
       this.searchToken();
       this.search();
     }
@@ -81,7 +81,6 @@ export default {
       this.display = false;
       this.$set(this, `planId`, planid);
       let classList = [];
-      console.log(this.userinfo);
       if (this.userinfo.type === '1') {
         classList = await this.classQuery({ planid: planid, headteacherid: this.userinfo.userid });
       } else if (this.userinfo.type === '3') {
@@ -103,7 +102,15 @@ export default {
     },
     searchToken() {
       let token = this.$route.query.token;
-      let user = jwt.decode(token);
+      // let user = jwt.decode(token);
+      let user = {
+        mobile: '1',
+        name: '班主任6',
+        status: '0',
+        type: '1',
+        uid: '5f2b632f4f8ae07098a7ab63',
+        userid: '5f2b632f4f8ae07098a7ab63',
+      };
       this.$set(this, 'userinfo', user);
       sessionStorage.setItem('user', JSON.stringify(user));
     },