index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <!-- <topInfo></topInfo> -->
  7. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  8. </el-col>
  9. <el-col :span="24" class="main">
  10. <mainData :lessionclassInfo="lessionclassInfo" :week="week"></mainData>
  11. </el-col>
  12. <el-col :span="24" class="foot">
  13. <footInfo></footInfo>
  14. </el-col>
  15. </el-col>
  16. </el-row>
  17. </div>
  18. </template>
  19. <script>
  20. import NavBar from '@/layout/common/topInfo.vue';
  21. import footInfo from '@/layout/common/footInfo.vue';
  22. import mainData from '@/layout/index/mainData.vue';
  23. const { mapActions: lesson } = createNamespacedHelpers('lesson');
  24. import { createNamespacedHelpers, mapGetters } from 'vuex';
  25. const { mapActions: mapStudent } = createNamespacedHelpers('student');
  26. export default {
  27. name: 'index',
  28. props: {},
  29. components: {
  30. NavBar, //头部导航
  31. footInfo, //底部导航
  32. mainData, //课程安排主体
  33. },
  34. data: () => ({
  35. lessionclassInfo: { lessons: [] },
  36. dates: '',
  37. week: '',
  38. title: '日程安排',
  39. isleftarrow: '',
  40. transitionName: 'fade',
  41. navShow: true,
  42. }),
  43. created() {
  44. this.getDate();
  45. this.searchInfo();
  46. this.searchSite();
  47. },
  48. computed: {},
  49. mounted() {
  50. this.title = this.$route.meta.title;
  51. this.isleftarrow = this.$route.meta.isleftarrow;
  52. },
  53. watch: {
  54. $route(to, from) {
  55. this.title = to.meta.title;
  56. this.isleftarrow = to.meta.isleftarrow;
  57. },
  58. },
  59. methods: {
  60. ...lesson({ lessionInfo: 'fetch', lessionlist: 'query' }),
  61. ...mapStudent(['fetch']),
  62. async searchSite() {
  63. const res = await this.fetch('5e4f3d096a90e861b0f30871');
  64. sessionStorage.setItem('site', JSON.stringify(res.data));
  65. },
  66. async searchInfo({ ...info } = {}) {
  67. const res = await this.lessionlist({ ...info });
  68. for (const val of res.data) {
  69. var arr = res.data.filter(item => item.class === '5e4df0c93ffa245d6065f526');
  70. var aff = res.data[0].lessons;
  71. console.log(aff);
  72. var ahh = aff.map((i, index) => {
  73. let word = '';
  74. if (index == 1) word = '拓展交流';
  75. if (index == 2) word = '课程作业小组展示';
  76. if (index == 3) word = '课程作业';
  77. if (index == 4) word = '礼仪课小组面试';
  78. if (index == 5) word = '结业仪式';
  79. i.lastLesson = word;
  80. return i;
  81. });
  82. for (const aqq of aff) {
  83. var aee = aff.filter(item => item.date === '2020-01-04');
  84. this.$set(this.lessionclassInfo, `lessons`, aee);
  85. }
  86. }
  87. },
  88. getDate() {
  89. var adate = new Date();
  90. this.value = adate.getFullYear() + '-' + (adate.getMonth() + 1) + '-' + adate.getDate();
  91. this.$set(this, `dates`, this.value);
  92. var str = '星期' + '日一二三四五六'.charAt(new Date().getDay());
  93. this.$set(this, `week`, str);
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang="less" scoped>
  99. .style {
  100. width: 100%;
  101. min-height: 667px;
  102. position: relative;
  103. background-color: #f9fafc;
  104. }
  105. .top {
  106. height: 46px;
  107. overflow: hidden;
  108. }
  109. .main {
  110. min-height: 570px;
  111. }
  112. .foot {
  113. height: 50px;
  114. overflow: hidden;
  115. }
  116. </style>