|
@@ -5,9 +5,12 @@
|
|
|
<el-col :span="24" class="top">
|
|
|
<NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" class="main">
|
|
|
+ <el-col :span="24" class="main" v-if="view === 'arrange'">
|
|
|
<mainData :lesson="lesson" :today="today" :arrange="arrange" @getLesson="getLesson"></mainData>
|
|
|
</el-col>
|
|
|
+ <el-col :span="24" class="main" v-if="view === 'class'">
|
|
|
+ <teaClass :classList="classList" @turnto="turnto" title="查看班级"></teaClass>
|
|
|
+ </el-col>
|
|
|
<el-col :span="24" class="foot">
|
|
|
<footInfo></footInfo>
|
|
|
</el-col>
|
|
@@ -19,6 +22,7 @@
|
|
|
<script>
|
|
|
import NavBar from '@/layout/common/topInfo.vue';
|
|
|
import footInfo from '@/layout/common/footInfo.vue';
|
|
|
+import teaClass from '@/layout/question/teaClass.vue';
|
|
|
import mainData from '@/layout/index/mainData.vue';
|
|
|
import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
@@ -31,8 +35,10 @@ export default {
|
|
|
NavBar, //头部导航
|
|
|
footInfo, //底部导航
|
|
|
mainData, //课程安排主体
|
|
|
+ teaClass,
|
|
|
},
|
|
|
data: () => ({
|
|
|
+ view: 'class',
|
|
|
lesson: {},
|
|
|
originLesson: [],
|
|
|
arrange: [],
|
|
@@ -40,13 +46,22 @@ export default {
|
|
|
title: '日程安排',
|
|
|
isleftarrow: '',
|
|
|
navShow: true,
|
|
|
+ classid: undefined,
|
|
|
+ classList: [],
|
|
|
}),
|
|
|
created() {
|
|
|
let today = this.getDay();
|
|
|
let todate = this.getDate();
|
|
|
this.$set(this.today, `date`, todate);
|
|
|
this.$set(this.today, `day`, today);
|
|
|
- this.searchInfo();
|
|
|
+ if (this.user.type === '1') {
|
|
|
+ this.view = 'class';
|
|
|
+ this.getClass();
|
|
|
+ } else {
|
|
|
+ this.$set(this, `classid`, this.user.classid);
|
|
|
+ this.searchInfo();
|
|
|
+ this.view = 'arrange';
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -66,7 +81,7 @@ export default {
|
|
|
...classes({ classesInfo: 'fetch', classeslist: 'query' }),
|
|
|
// 查询课程详情
|
|
|
async searchInfo() {
|
|
|
- const res = await this.classesInfo(this.user.classid);
|
|
|
+ const res = await this.classesInfo(this.classid);
|
|
|
const result = await this.lessionInfo(res.data.lessonid);
|
|
|
var ahh = result.data.lessons.map((i, index) => {
|
|
|
let word = '';
|
|
@@ -82,11 +97,11 @@ export default {
|
|
|
var lesson = result.data.lessons.find(item => item.date === this.getDate());
|
|
|
this.$set(this, `lesson`, lesson);
|
|
|
// 获取课程开始-结束日期
|
|
|
- let ltime = result.data.lessons.map(i => {
|
|
|
+ let ltime = result.data.lessons.map((i, index) => {
|
|
|
let object = { date: i.date, day: this.getDay(i.date) };
|
|
|
- return object;
|
|
|
+ if (index !== 0) return object;
|
|
|
});
|
|
|
- this.$set(this, `arrange`, ltime);
|
|
|
+ this.$set(this, `arrange`, _.compact(ltime));
|
|
|
},
|
|
|
// 获取时间
|
|
|
getDay(date = new Date()) {
|
|
@@ -105,9 +120,20 @@ export default {
|
|
|
},
|
|
|
//点击日期获取课程
|
|
|
getLesson(date) {
|
|
|
+ console.log(date);
|
|
|
let res = this.originLesson.find(f => f.date === date.date);
|
|
|
this.$set(this, `lesson`, res);
|
|
|
},
|
|
|
+ //班主任获取班级列表
|
|
|
+ async getClass() {
|
|
|
+ const res = await this.classeslist({ headteacherid: this.user.userid });
|
|
|
+ this.$set(this, `classList`, res.data);
|
|
|
+ },
|
|
|
+ turnto(data) {
|
|
|
+ this.$set(this, `classid`, data._id);
|
|
|
+ this.searchInfo();
|
|
|
+ this.view = 'arrange';
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|