|
@@ -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']),
|