|
@@ -81,10 +81,12 @@
|
|
|
v-show="currentView == 'table'"
|
|
|
:disabled-hover="true"
|
|
|
>
|
|
|
+ <!-- 时间 -->
|
|
|
<template slot-scope="{ row }" slot="time">
|
|
|
<p class="list-name">{{ row.time }}</p>
|
|
|
<p>{{ row.label }}</p>
|
|
|
</template>
|
|
|
+ <!-- 周一 -->
|
|
|
<template slot-scope="{ row }" slot="Mon">
|
|
|
<div v-for="(item, index) in row.fixList" :key="index">
|
|
|
<div v-if="item.timeWeek == 'MON'"
|
|
@@ -97,6 +99,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <!-- 周二 -->
|
|
|
<template slot-scope="{ row }" slot="Tue">
|
|
|
<div v-for="(item, index) in row.fixList" :key="index">
|
|
|
<div v-if="item.timeWeek == 'TUE'"
|
|
@@ -109,6 +112,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <!-- 周三 -->
|
|
|
<template slot-scope="{ row }" slot="Wed">
|
|
|
<div v-for="(item, index) in row.fixList" :key="index">
|
|
|
<div v-if="item.timeWeek == 'WED'"
|
|
@@ -121,6 +125,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <!-- 周四 -->
|
|
|
<template slot-scope="{ row }" slot="Thu">
|
|
|
<div v-for="(item, index) in row.fixList" :key="index">
|
|
|
<div v-if="item.timeWeek == 'THU'"
|
|
@@ -133,6 +138,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <!-- 周五 -->
|
|
|
<template slot-scope="{ row }" slot="Fri">
|
|
|
<div v-for="(item, index) in row.fixList" :key="index">
|
|
|
<div v-if="item.timeWeek == 'FRI'"
|
|
@@ -197,13 +203,13 @@
|
|
|
</ul>
|
|
|
</li> -->
|
|
|
<!--剛加入的課程-->
|
|
|
- <div v-if="personList.length > 0">
|
|
|
- <div v-for="(item, index) in timeTable" :key="index">
|
|
|
+ <div v-if="personList.length">
|
|
|
+ <!-- <div v-for="(item, index) in timeTable" :key="index"> -->
|
|
|
<li
|
|
|
class="list-item"
|
|
|
- v-for="(person, num) in item.personList"
|
|
|
- @click="clickCell(item, num, 'list')"
|
|
|
+ v-for="(person, num) in personList"
|
|
|
:class="{ 'list-item-selected': unique == person.unique }"
|
|
|
+ @click="clickCell(person, num, 'list')"
|
|
|
:key="`j+${num}`"
|
|
|
>
|
|
|
<ul>
|
|
@@ -215,7 +221,7 @@
|
|
|
</li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
- </div>
|
|
|
+ <!-- </div> -->
|
|
|
</div>
|
|
|
<div v-else class="list-item-no">
|
|
|
暂无课程
|
|
@@ -286,10 +292,10 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
courseList: this.$api.studentWeb.courseList, //moke数据
|
|
|
- fixList: [],
|
|
|
- personList: [],
|
|
|
+ fixList: [], //表定课程
|
|
|
+ personList: [], //临时课程
|
|
|
nowClassInfor: {},
|
|
|
- timeTable: [],
|
|
|
+ timeTable: [], //页面所有的课程
|
|
|
unique: '',
|
|
|
};
|
|
|
},
|
|
@@ -311,9 +317,6 @@ export default {
|
|
|
})
|
|
|
this.getClassList()
|
|
|
},
|
|
|
- mounted () {
|
|
|
- // console.log(this.timeTable);
|
|
|
- },
|
|
|
methods: {
|
|
|
getClassList() {
|
|
|
this.isLoad = true
|
|
@@ -333,39 +336,119 @@ export default {
|
|
|
// 临时课程
|
|
|
var personList = []
|
|
|
var list = res.courses
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- if(list[i].course) {
|
|
|
- for (let j = 0; j < list[i].course.schedule.length; j++) {
|
|
|
- // 有classId,表定课程
|
|
|
- if(list[i].course.schedule[j].classId == list[i].stuCourse.classId[0]) {
|
|
|
- if(list[i].course.schedule[j].time.length > 0) {
|
|
|
- for (let m = 0; m < list[i].course.schedule[j].time.length; m++) {
|
|
|
- var data = this._.cloneDeep(list[i].course)
|
|
|
- delete data.schedule
|
|
|
- data.school = list[i].stuCourse.school
|
|
|
- data.scope = list[i].stuCourse.scope
|
|
|
- // 拼接得到一个唯一的标识(目前有同一天的同一节数的课程,所以加入j 和m 来区分)
|
|
|
- data.unique = 'class' + list[i].course.no + list[i].course.schedule[j].time[m].week + list[i].course.schedule[j].time[m].id + j + m
|
|
|
- fixList.push(this.getNewClass(data, list[i].course.schedule[j], m))
|
|
|
+ // 学生
|
|
|
+ if(this.onlyStu) {
|
|
|
+ list.forEach(item => {
|
|
|
+ if(item.course) {
|
|
|
+ item.course.schedule.forEach((sch, sI) => {
|
|
|
+ // 有classId,表定课程
|
|
|
+ if(sch.classId == item.stuCourse.classId[0]) {
|
|
|
+ if(sch.time.length > 0) {
|
|
|
+ for (let m = 0; m < sch.time.length; m++) {
|
|
|
+ var data = this._.cloneDeep(item.course)
|
|
|
+ delete data.schedule
|
|
|
+ data.school = item.stuCourse.school
|
|
|
+ data.scope = item.stuCourse.scope
|
|
|
+ // 拼接得到一个唯一的标识(目前有同一天的同一节数的课程,所以加入j 和m 来区分)
|
|
|
+ data.unique = 'class' + item.course.no + sch.time[m].week + sch.time[m].id + sI + m
|
|
|
+ fixList.push(this.getNewClass(data, sch, m))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- // 有stulist,临时课程
|
|
|
- else if (list[i].course.schedule[j].stulist) {
|
|
|
- if(list[i].course.schedule[j].time.length > 0) {
|
|
|
- for (let m = 0; m < list[i].course.schedule[j].time.length; m++) {
|
|
|
- var data = this._.cloneDeep(list[i].course)
|
|
|
- delete data.schedule
|
|
|
- data.school = list[i].stuCourse.school
|
|
|
- data.scope = list[i].stuCourse.scope
|
|
|
- data.unique = 'person' + list[i].course.no + list[i].course.schedule[j].time[m].week + list[i].course.schedule[j].time[m].id + j + m
|
|
|
- personList.push(this.getNewClass(data, list[i].course.schedule[j], m))
|
|
|
+ // 有stulist,临时课程
|
|
|
+ else if (sch.stulist) {
|
|
|
+ if(sch.time.length) {
|
|
|
+ for (let m = 0; m < sch.time.length; m++) {
|
|
|
+ var data = this._.cloneDeep(item.course)
|
|
|
+ delete data.schedule
|
|
|
+ data.school = item.stuCourse.school
|
|
|
+ data.scope = item.stuCourse.scope
|
|
|
+ data.unique = 'person' + item.course.no + sch.time[m].week + sch.time[m].id + sI + m
|
|
|
+ personList.push(this.getNewClass(data, sch, m))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 没有时间
|
|
|
+ else {
|
|
|
+ let datas = this._.cloneDeep(item.course)
|
|
|
+ delete datas.schedule
|
|
|
+ datas.school = item.stuCourse.school
|
|
|
+ datas.scope = item.stuCourse.scope
|
|
|
+ datas.unique = 'person' + item.course.no + "008" + "000" + sI + "-1"
|
|
|
+ datas.classId = sch.classId
|
|
|
+ datas.room = sch.room
|
|
|
+ datas.teacherId = sch.teacherId
|
|
|
+ datas.notice = sch.notice
|
|
|
+ datas.stuList = sch.stulist
|
|
|
+ datas.time = "暂未安排时间"
|
|
|
+ datas.timeId = 0
|
|
|
+ datas.timeWeek = 0
|
|
|
+ datas.teaName = ""
|
|
|
+ // 获取老师名单
|
|
|
+ if(this.teaList.length > 0) {
|
|
|
+ this.teaList.map(item => {
|
|
|
+ if(item.id == sch.teacherId) {
|
|
|
+ datas.teaName = item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ personList.push(datas)
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 醍摩豆
|
|
|
+ else {
|
|
|
+ list.forEach(item => {
|
|
|
+ if(item.course) {
|
|
|
+ // item.stuCourse.stulist.forEach(stu => {
|
|
|
+ item.course.schedule.forEach(sch => {
|
|
|
+ // if (sch.stulist == stu) {
|
|
|
+ if(sch.time.length) {
|
|
|
+ for (let m = 0; m < sch.time.length; m++) {
|
|
|
+ var data = this._.cloneDeep(item.course)
|
|
|
+ delete data.schedule
|
|
|
+ data.school = item.stuCourse.school
|
|
|
+ data.scope = item.stuCourse.scope
|
|
|
+ data.unique = 'person' + item.course.no + sch.time[m].week + sch.time[m].id + j + m
|
|
|
+ personList.push(this.getNewClass(data, sch, m))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 没有时间
|
|
|
+ else {
|
|
|
+ let datas = this._.cloneDeep(item.course)
|
|
|
+ delete datas.schedule
|
|
|
+ datas.school = item.stuCourse.school
|
|
|
+ datas.scope = item.stuCourse.scope
|
|
|
+ datas.unique = 'person' + item.course.no + "008" + "000" + Math.round(Math.random()*10) + "-1"
|
|
|
+ datas.classId = sch.classId
|
|
|
+ datas.room = sch.room
|
|
|
+ datas.teacherId = sch.teacherId
|
|
|
+ datas.notice = sch.notice
|
|
|
+ datas.stuList = sch.stulist
|
|
|
+ datas.time = "暂未安排时间"
|
|
|
+ datas.timeId = 0
|
|
|
+ datas.timeWeek = 0
|
|
|
+ datas.teaName = ""
|
|
|
+ // 获取老师名单
|
|
|
+ if(this.teaList.length > 0) {
|
|
|
+ this.teaList.map(item => {
|
|
|
+ if(item.id == sch.teacherId) {
|
|
|
+ datas.teaName = item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ personList.push(datas)
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ })
|
|
|
+
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
console.log(fixList)
|
|
|
console.log(personList)
|
|
|
this.fixList = fixList
|
|
@@ -399,7 +482,68 @@ export default {
|
|
|
},
|
|
|
// 处理上课时间
|
|
|
getClassTime() {
|
|
|
- if(this.period != undefined && this.fixList.length) {
|
|
|
+ // 学生登陆
|
|
|
+ if(this.onlyStu) {
|
|
|
+ this.timeTable = (this.period.find(item => {
|
|
|
+ return item.id == this.$store.state.user.studentProfile.classinfo.periodId
|
|
|
+ })).timetable
|
|
|
+ this.timeTable.forEach(item => {
|
|
|
+ let newfixlist = []
|
|
|
+ let notime = [] //没有时间的标准课程
|
|
|
+ this.fixList.forEach(fix => {
|
|
|
+ if(fix.timeId == item.id && fix.timeId) {
|
|
|
+ newfixlist.push(fix)
|
|
|
+ }
|
|
|
+ // 没有时间的标准课程
|
|
|
+ else if (!fix.timeId) {
|
|
|
+ notime.push(fix)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ item.fixList = newfixlist
|
|
|
+ item.noTime = notime
|
|
|
+ })
|
|
|
+ // 个人课程
|
|
|
+ this.personList.forEach(per => {
|
|
|
+ if(per.timeId) {
|
|
|
+ this.timeTable.forEach(item => {
|
|
|
+ if(per.timeId == item.id) {
|
|
|
+ per.time = item.time
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 醍摩豆登陆
|
|
|
+ else if (this.personList.length) {
|
|
|
+ // 年级id 存在
|
|
|
+ if(this.personList[0].period.id != undefined) {
|
|
|
+ this.timetable = this.period.find(item => {
|
|
|
+ return item.id == this.personList[0].period.id
|
|
|
+ })
|
|
|
+ this.timeTable.forEach(item => {
|
|
|
+ let newpersonList = []
|
|
|
+ this.personList.forEach(per => {
|
|
|
+ if(per.timeId == item.id && per.timeId) {
|
|
|
+ newpersonList.push(per)
|
|
|
+ } else if (!per.timeId) {
|
|
|
+ newpersonList.push(per)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ item.personList = newpersonList
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 年级id 不存在
|
|
|
+ else {
|
|
|
+ this.timeTable = [{
|
|
|
+ personList: []
|
|
|
+ }]
|
|
|
+ this.personList.forEach(per => {
|
|
|
+ this.timeTable[0].personList.push(per)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* if(this.period != undefined && this.fixList.length) {
|
|
|
// 选出该年级的上课时间
|
|
|
var grades = this._.cloneDeep(this.period)
|
|
|
for (let i = 0; i < grades.length; i++) {
|
|
@@ -412,20 +556,26 @@ export default {
|
|
|
for (let j = 0; j < this.timeTable.length; j++) {
|
|
|
var newfixLis = []
|
|
|
var newpersonList = []
|
|
|
+ let noTime = []
|
|
|
for (let i = 0; i < this.fixList.length; i++) {
|
|
|
- if(this.timeTable[j].id == this.fixList[i].timeId) {
|
|
|
+ if(this.timeTable[j].id == this.fixList[i].timeId && this.fixList[i].timeId) {
|
|
|
newfixLis.push(this.fixList[i])
|
|
|
+ } else if(!this.fixList[i].timeId) {
|
|
|
+ noTime.push(this.fixList[i])
|
|
|
}
|
|
|
}
|
|
|
for (let i = 0; i < this.personList.length; i++) {
|
|
|
- if(this.timeTable[j].id == this.personList[i].timeId) {
|
|
|
+ if(this.timeTable[j].id == this.personList[i].timeId && this.personList[i].timeId) {
|
|
|
+ newpersonList.push(this.personList[i])
|
|
|
+ } else if(!this.personList[i].timeId) {
|
|
|
newpersonList.push(this.personList[i])
|
|
|
}
|
|
|
}
|
|
|
this.timeTable[j].fixList = newfixLis
|
|
|
this.timeTable[j].personList = newpersonList
|
|
|
+ this.timeTable[j].noTime = noTime
|
|
|
}
|
|
|
- }
|
|
|
+ } */
|
|
|
},
|
|
|
// 点击单节课,显示基本信息
|
|
|
/* row:timeTable的某一个
|
|
@@ -435,7 +585,7 @@ export default {
|
|
|
clickCell(row, index, type) {
|
|
|
this.nowClassInfor = this._.cloneDeep(row)
|
|
|
if(type) {
|
|
|
- this.nowClassInfor.course = this._.cloneDeep(row.personList[index])
|
|
|
+ this.nowClassInfor.course = this._.cloneDeep(row)
|
|
|
} else {
|
|
|
this.nowClassInfor.course = this._.cloneDeep(row.fixList[index])
|
|
|
}
|