lrf402788946 4 years ago
parent
commit
d8ed46f005
1 changed files with 6 additions and 5 deletions
  1. 6 5
      layout/admin/navBar/default-select.vue

+ 6 - 5
layout/admin/navBar/default-select.vue

@@ -135,7 +135,10 @@ export default {
         res = await this.teaclass({ planid: planid, teaid: this.user.userid });
       }
       if (!res) return;
-      if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
+      if (this.$checkRes(res)) {
+        const d = res.data.filter(f => f.termid === termid);
+        this.$set(this, `classList`, d);
+      }
       // 检查是否是初始化,如果是初始化(由上级来),需要检查classid是不是在这里,不在就清除掉
       const r = this.classList.find(f => f._id === classid);
       if (!r) this.toClear('classid');
@@ -147,12 +150,10 @@ export default {
       //教师/班主任,如果今天有班级选择
       for (const i of this.classList) {
         const { startdate, enddate } = i;
-        const r = moment().isBetween(startdate, enddate, null, '[]');
+        const r = moment(moment().format('YYYY-MM-DD')).isBetween(startdate, enddate, null, '[]');
         if (r) {
           const { _id, termid } = i;
-          let options = _.cloneDeep(this.topOptions);
-          options.classid = _id;
-          this.$set(this, `options`, options);
+          this.$set(this.topOptions, `classid`, _id);
           break;
         }
       }