ソースを参照

Merge branch 'master' of http://git.cc-lotus.info/new_train/frame

guhongwei 4 年 前
コミット
dbeec33bc8
2 ファイル変更41 行追加2 行削除
  1. 37 2
      layout/admin/navBar/default-select.vue
  2. 4 0
      store/notice.js

+ 37 - 2
layout/admin/navBar/default-select.vue

@@ -47,6 +47,7 @@
 
 <script>
 import _ from 'lodash';
+const moment = require('moment');
 import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
 const { mapActions: trainBatch } = createNamespacedHelpers('trainBatch');
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
@@ -147,15 +148,49 @@ export default {
       let planid = _.get(this.defaultOption, 'planid');
       if (!termid) return;
       let res;
+      let orginList = [];
       if (this.user.type == 1) {
-        res = await this.getClassList({ termid: this.defaultOption.termid, headteacherid: this.user.userid });
-        if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
+        res = await this.getClassList({ planid: planid, headteacherid: this.user.userid });
+        if (this.$checkRes(res)) {
+          orginList = res.data;
+          this.$set(
+            this,
+            `classList`,
+            res.data.filter(f => f.termid == termid)
+          );
+        }
       }
       if (this.user.type == 3) {
         res = await this.teaclass({ planid: planid, teaid: this.user.userid });
+        orginList = res.data;
         const elm = res.data.filter(item => item.termid == termid);
         this.$set(this, `classList`, elm);
       }
+      //班级数据正确验证
+      let options = _.cloneDeep(this.options);
+      if (this.classList.length <= 0) {
+        delete options.classid;
+        this.$set(this, `options`, options);
+      } else {
+        let res = await this.classList.find(f => f._id === options.classid);
+        if (!res) {
+          delete options.classid;
+          this.$set(this, `options`, options);
+        }
+      }
+      //教师/班主任,如果今天有班级选择
+      for (const i of orginList) {
+        const { startdate, enddate } = i;
+        const r = moment().isBetween(startdate, enddate, null, '[]');
+        if (r) {
+          const { _id, termid } = i;
+          let options = _.cloneDeep(this.options);
+          options.classid = _id;
+          options.termid = termid;
+          this.$set(this, `options`, options);
+          break;
+        }
+      }
     },
   },
   watch: {

+ 4 - 0
store/notice.js

@@ -32,6 +32,10 @@ const actions = {
     const res = await this.$axios.$get(`${api.classInfo(payload)}`);
     return res;
   },
+  async resend({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.noticeInfo}/resend`, payload);
+    return res;
+  },
   async mergeRequest({ commit, dispatch }, { method, data }) {
     let toRequest = () => {
       let res = [];