index.vue 2.9 KB

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