lrf402788946 4 лет назад
Родитель
Сommit
2df8d57d4b
2 измененных файлов с 40 добавлено и 87 удалено
  1. 36 86
      src/views/index.vue
  2. 4 1
      src/views/worker/lesson-table.vue

+ 36 - 86
src/views/index.vue

@@ -1,18 +1,14 @@
 <template>
 <template>
   <div id="index">
   <div id="index">
-    <el-row>
-      {{ notice.content }}
-      <!--<el-col :span="24">
-         <span v-if="type == '1'">
-          学校
-        </span>
-        <span v-else-if="type == '2'">
-          普通
-        </span>
-        <span v-else-if="type == '3'">
+    <el-row v-loading="loading" style="height:100vh">
+      <el-col :span="24" v-if="!loading">
+        <span v-if="notice.type == '4'">
           <class-index :dayList="dayList" :lessonList="lessonList" :classInfo="classInfo" />
           <class-index :dayList="dayList" :lessonList="lessonList" :classInfo="classInfo" />
         </span>
         </span>
-      </el-col> -->
+        <span v-else>
+          {{ notice.content }}
+        </span>
+      </el-col>
     </el-row>
     </el-row>
   </div>
   </div>
 </template>
 </template>
@@ -22,106 +18,60 @@ import _ from 'lodash';
 import classIndex from './worker/index.vue';
 import classIndex from './worker/index.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: notice } = createNamespacedHelpers('notice');
 const { mapActions: notice } = createNamespacedHelpers('notice');
+const { mapActions: util } = createNamespacedHelpers('util');
+const { mapActions: classes } = createNamespacedHelpers('classes');
 export default {
 export default {
   name: 'index',
   name: 'index',
   props: {},
   props: {},
-  components: {}, //classIndex
+  components: { classIndex }, //
   data: function() {
   data: function() {
     return {
     return {
+      loading: true,
       notice: {},
       notice: {},
-      type: '3',
-      lessonList: [
-        { _id: '5f2a10297f40d16be433e81b', subname: '报到+开班仪式', day: '0', date: '2020-04-07', time: '13:30-16:30' },
-        { _id: '5f2a10297f40d16be433e81c', subid: '', subname: '晚餐', date: '2020-04-07', time: '16:30-17:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e81d', subid: '', subname: '团队组建', date: '2020-04-07', time: '17:30-19:45', day: '0' },
-        {
-          _id: '5f2a10297f40d16be433e81e',
-          teaid: '5ef08199fbf5d71a24881f11',
-          teaname: '吉林大学测试科目一教师',
-          subid: '5f27bb47dd73cc2308f7b978',
-          subname: '测试科目1',
-          day: '0',
-          date: '2020-04-08',
-          time: '08:00-11:30',
-        },
-        { _id: '5f2a10297f40d16be433e81f', subid: '', subname: '午餐+休息', date: '2020-04-08', time: '11:30-13:30', day: '0' },
-        {
-          _id: '5f2a10297f40d16be433e820',
-          subid: '5f27bb47dd73cc2308f7b978',
-          subname: '测试科目1',
-          date: '2020-04-08',
-          time: '13:30-16:30',
-          day: '0',
-          teaid: '5ef08199fbf5d71a24881f11',
-          teaname: '吉林大学测试科目一教师',
-        },
-        { _id: '5f2a10297f40d16be433e821', subid: '', subname: '晚餐', date: '2020-04-08', time: '16:30-17:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e822', subid: '', subname: '拓展交流', date: '2020-04-08', time: '17:30-19:45', day: '0' },
-        { _id: '5f2a10297f40d16be433e823', subid: '5e730d755a52a378a817ec7d', subname: '测试科目二', day: '0', date: '2020-04-09', time: '08:00-11:30' },
-        { _id: '5f2a10297f40d16be433e824', subid: '', subname: '午餐+休息', date: '2020-04-09', time: '11:30-13:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e825', subid: '5e730d755a52a378a817ec7d', subname: '测试科目二', date: '2020-04-09', time: '13:30-16:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e826', subid: '', subname: '晚餐', date: '2020-04-09', time: '16:30-17:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e827', subid: '', subname: '课程作业小组展示\t', date: '2020-04-09', time: '17:30-19:45', day: '0' },
-        { _id: '5f2a10297f40d16be433e828', subid: '5e730d7e5a52a378a817ec7e', subname: '测试科目三', day: '0', date: '2020-04-10', time: '08:00-11:30' },
-        { _id: '5f2a10297f40d16be433e829', subid: '', subname: '午餐+休息', date: '2020-04-10', time: '11:30-13:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e82a', subid: '5e730d7e5a52a378a817ec7e', subname: '测试科目三', date: '2020-04-10', time: '13:30-16:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e82b', subid: '', subname: '晚餐', date: '2020-04-10', time: '16:30-17:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e82c', subid: '', subname: '课程作业', date: '2020-04-10', time: '17:30-19:45', day: '0' },
-        { _id: '5f2a10297f40d16be433e82d', subid: '5e730d855a52a378a817ec7f', subname: '测试科目四', day: '0', date: '2020-04-11', time: '08:00-11:30' },
-        { _id: '5f2a10297f40d16be433e82e', subid: '', subname: '午餐+休息', date: '2020-04-11', time: '11:30-13:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e82f', subid: '5e730d855a52a378a817ec7f', subname: '测试科目四', date: '2020-04-11', time: '13:30-16:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e830', subid: '', subname: '晚餐', date: '2020-04-11', time: '16:30-17:30', day: '0' },
-        { _id: '5f2a10297f40d16be433e831', subid: '', subname: '礼仪课小组面试\t', date: '2020-04-11', time: '17:30-19:45', day: '0' },
-        { _id: '5f2a10297f40d16be433e832', subname: '结业仪式', day: '0', date: '2020-04-12', time: '17:30-19:45' },
-      ],
-      classInfo: {
-        meta: { state: 0, createdAt: '2020-08-01T08:12:03.344Z', updatedAt: '2020-08-05T09:23:15.928Z' },
-        _id: '5f2523d3a0109c964c60495e',
-        name: '2',
-        number: '56',
-        batchid: '5f1f8bdc26941e8a38670364',
-        termid: '5f1f8bdc26941e8a38670363',
-        planid: '5f110d2ee48f4e6ff461283d',
-        type: '0',
-        headteacherid: '5f228f3936578693741c3e78',
-        __v: 0,
-        jslocationid: '5e730ca35a52a378a817ec75',
-        kbyslocationid: '5e730d535a52a378a817ec7b',
-        kzjhlocationid: '5e730d135a52a378a817ec77',
-        lyteacherid: '5f228f3936578693741c3e78',
-        yclocationid: '5e730d3d5a52a378a817ec78',
-        id: '5f2523d3a0109c964c60495e',
-        term: '1',
-        batch: '1',
-        startdate: '2020-04-07',
-        enddate: '2020-04-12',
-        yclocation: '食堂',
-        kzjhlocation: '室外拓展训练场地',
-        kbyslocation: '会议室',
-        jslocation: '第一教室',
-        headteacher: '顾红伟2',
-        lyteacher: '顾红伟2',
-      },
+      type: '4',
+      lessonList: [],
+      classInfo: {},
       dayList: [],
       dayList: [],
     };
     };
   },
   },
   created() {
   created() {
-    this.dealLesson();
     this.search();
     this.search();
   },
   },
   methods: {
   methods: {
     ...notice(['fetch', 'lookFetch']),
     ...notice(['fetch', 'lookFetch']),
+    ...util({ modelFetch: 'fetch' }),
+    ...classes({ getClass: 'fetch' }),
     async search() {
     async search() {
       if (!this.noticeid) {
       if (!this.noticeid) {
         this.$toast.fail('没有消息相关信息,无法找到消息来源');
         this.$toast.fail('没有消息相关信息,无法找到消息来源');
         return;
         return;
       }
       }
       const res = await this.fetch(this.noticeid);
       const res = await this.fetch(this.noticeid);
+      let notice;
       if (res.errcode == '0') {
       if (res.errcode == '0') {
+        notice = _.get(res, `data`);
         this.$set(this, `notice`, res.data);
         this.$set(this, `notice`, res.data);
         const r = await this.lookFetch({ noticeid: this.noticeid, userid: this.userid });
         const r = await this.lookFetch({ noticeid: this.noticeid, userid: this.userid });
         if (r.errcode == '0') this.$toast.success('消息已确认');
         if (r.errcode == '0') this.$toast.success('消息已确认');
       }
       }
+      if (notice) {
+        if (notice.type === '4') {
+          await this.getLesson(notice.classid);
+        }
+      }
+      this.loading = false;
+    },
+    async getLesson(classid) {
+      const cRes = await this.getClass(classid);
+      if (this.$checkRes(cRes)) {
+        this.$set(this, `classInfo`, cRes.data);
+      }
+      const lRes = await this.modelFetch({ model: 'lesson', classid });
+      if (this.$checkRes(lRes)) {
+        const { lessons } = lRes.data;
+        this.$set(this, `lessonList`, lessons);
+        this.dealLesson();
+      }
     },
     },
     dealLesson() {
     dealLesson() {
       let dl = _.cloneDeep(this.lessonList);
       let dl = _.cloneDeep(this.lessonList);

+ 4 - 1
src/views/worker/lesson-table.vue

@@ -9,9 +9,12 @@
       <van-col span="18">
       <van-col span="18">
         <van-cell v-for="(item, itemIndex) in getData(active)" :key="`${itemIndex}`">
         <van-cell v-for="(item, itemIndex) in getData(active)" :key="`${itemIndex}`">
           <template #title> <i class="el-icon-timer" style="padding-right:3px"></i>{{ item.time }} </template>
           <template #title> <i class="el-icon-timer" style="padding-right:3px"></i>{{ item.time }} </template>
-          <template>
+          <template v-if="item.subname !== '--'">
             <i class="el-icon-notebook-2" style="padding-right:3px"></i><span style="color:#323233;">{{ item.subname }}</span>
             <i class="el-icon-notebook-2" style="padding-right:3px"></i><span style="color:#323233;">{{ item.subname }}</span>
           </template>
           </template>
+          <template v-else>
+            <span style="color:#323233;">{{ item.subname }}</span>
+          </template>
           <template v-if="item.teaid" #label>
           <template v-if="item.teaid" #label>
             <i class="el-icon-user" style="padding-right:3px"></i><span style="color:#323233;">{{ item.teaname }}</span>
             <i class="el-icon-user" style="padding-right:3px"></i><span style="color:#323233;">{{ item.teaname }}</span>
           </template>
           </template>