فهرست منبع

close #1034 学段筛选我的课程

liqk 3 سال پیش
والد
کامیت
5f7af2c96b
1فایلهای تغییر یافته به همراه39 افزوده شده و 9 حذف شده
  1. 39 9
      TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

+ 39 - 9
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -21,11 +21,12 @@
                     <div class="cus-list-tab">
                         <div v-for="(item,index) in courseListShow" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
                             <p class="course-name">
-                                <!-- <span class="period-tag">{{item.period.name}}</span> -->
+                                <!-- 这里是标准课程学段tag -->
+                                <!-- <span class="period-tag" v-show="listType == 'school'">{{getPeriodName(item.period.id)}}</span> -->
                                 {{item.name}}
                             </p>
                             <p class="course-code">
-                                
+
                                 <Icon type="md-pricetags" />
                                 {{item.no}}
                             </p>
@@ -352,6 +353,7 @@ export default {
             }
         }
         return {
+            filterPeriod: '',
             editIrs: null,
             setIrsStatus: false,
             editIndex: -1,
@@ -528,6 +530,19 @@ export default {
         }
     },
     methods: {
+        //根据学段id获取学段名称
+        getPeriodName(id) {
+            if (this.periods) {
+                let period = this.periods.find(item => item.id === id)
+                if (period) {
+                    return period.name
+                } else {
+                    return '暂无学段'
+                }
+            } else {
+                return '暂无学段'
+            }
+        },
         confirmSetNo(row, rowIndex) {
             //检查irs重复
             let irsRep = this.students.some((item, index) => {
@@ -638,15 +653,16 @@ export default {
                 this.getStuList()
             }
         },
-        dropdownStates(flag) {
-            if (!flag) this.tabClick()
-        },
         //课程选项卡点击事件
         tabClick(tab) {
             this.curCusIndex = 0
             this.listType = tab
             this.courseListShow = this.courseList.filter(item => {
-                return item.scope == this.listType
+                if (this.listType == 'school' && this.filterPeriod) {
+                    return item.scope == this.listType && item.period.id === this.filterPeriod
+                } else {
+                    return item.scope == this.listType
+                }
             })
             this.selectCourse(0)
 
@@ -1415,9 +1431,10 @@ export default {
                     if (res.error == null) {
                         this.courseList = res.courses
                         //设置当前课程列表 
-                        this.courseListShow = this.courseList.filter(item => {
-                            return item.scope == this.listType
-                        })
+                        // this.courseListShow = this.courseList.filter(item => {
+                        //     return item.scope == this.listType
+                        // })
+                        this.tabClick(this.listType)
                         if (this.courseListShow.length == 0) { //如果没有标准课程,则设置默认为个人课程
                             this.listType = 'private'
                             this.courseListShow = this.courseList.filter(item => {
@@ -1579,12 +1596,25 @@ export default {
             handler(n, o) {
                 this.getCourseList()
             }
+        },
+        '$store.state.user.curPeriod': {
+            deep: true,
+            immediate: true,
+            handler(n, o) {
+                if (n) {
+                    this.filterPeriod = n.id
+                    // this.curPdInfo = n
+                    // this.filterByPeriod()
+                    this.tabClick(this.listType)
+                }
+            }
         }
     },
     computed: {
         ...mapGetters({
             classList: 'user/getClasses', // 教室ID,
             schoolBase: 'user/getSchoolBase', // 学校基础设置
+            periods: 'user/getPeriods'
         }),
         //课程学段
         cusPd() {