lesson-table.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div id="lesson-table" style="padding:10px 0">
  3. <van-row type="flex" gutter="5">
  4. <van-col span="6">
  5. <van-sidebar v-model="active">
  6. <van-sidebar-item v-for="(i, index) in dayList" :key="`${index}`" :title="dateTOPoint(i)"> </van-sidebar-item>
  7. </van-sidebar>
  8. </van-col>
  9. <van-col span="18">
  10. <van-cell v-for="(item, itemIndex) in getData(active)" :key="`${itemIndex}`">
  11. <template #title> <i class="el-icon-timer" style="padding-right:3px"></i>{{ item.time }} </template>
  12. <template>
  13. <i class="el-icon-notebook-2" style="padding-right:3px"></i><span style="color:#323233;">{{ item.subname }}</span>
  14. </template>
  15. <template v-if="item.teaid" #label>
  16. <i class="el-icon-user" style="padding-right:3px"></i><span style="color:#323233;">{{ item.teaname }}</span>
  17. </template>
  18. </van-cell>
  19. </van-col>
  20. </van-row>
  21. </div>
  22. </template>
  23. <script>
  24. import { mapState, createNamespacedHelpers } from 'vuex';
  25. export default {
  26. name: 'lesson-table',
  27. props: {
  28. dayList: { type: Array, default: () => [] },
  29. lessonList: { type: Object, default: () => {} },
  30. },
  31. components: {},
  32. data: function() {
  33. return {
  34. active: 0,
  35. };
  36. },
  37. created() {},
  38. methods: {
  39. getData(index) {
  40. return this.lessonList[this.dayList[index]];
  41. },
  42. getContent(date) {
  43. return date;
  44. },
  45. dateTOPoint(date) {
  46. let arr = date.split('-');
  47. if (arr.length > 0) return `${arr[1]}-${arr[2]}`;
  48. else return date;
  49. },
  50. },
  51. computed: {
  52. ...mapState(['user']),
  53. pageTitle() {
  54. return `${this.$route.meta.title}`;
  55. },
  56. },
  57. metaInfo() {
  58. return { title: this.$route.meta.title };
  59. },
  60. };
  61. </script>
  62. <style lang="less" scoped></style>