mainData.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div id="mainData">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="beijing">
  6. <el-row type="flex">
  7. <el-col :span="4" v-for="(i, index) in arrange" :key="index" @click.native="changeLesson(i)">
  8. <el-row style="text-align:center">
  9. <el-col :span="24">{{ i.day }}</el-col>
  10. <el-col :span="24">{{ i.date | getMD }}</el-col>
  11. </el-row>
  12. </el-col>
  13. </el-row>
  14. <el-col :span="24" class="top">
  15. <el-col :span="12" class="time">上课时间</el-col>
  16. <el-col :span="12" class="date">
  17. <el-col :span="24"> {{ today.date }}</el-col>
  18. <el-col :span="24">{{ today.day }}</el-col>
  19. </el-col>
  20. </el-col>
  21. <template v-if="lesson">
  22. <el-col :span="24" class="context" v-for="(item, index) in lesson" :key="index">
  23. <el-col :span="12" class="contexttime">
  24. <span>{{ item.time }}</span>
  25. </el-col>
  26. <el-col :span="12" class="contextclass">
  27. <p>{{ item.subname }}</p>
  28. <p class="title">
  29. <span @click="click(item)">{{ item.teaname }}</span>
  30. </p>
  31. <p>{{ getLocaltion(item) }}</p>
  32. </el-col>
  33. <el-col :span="24">
  34. <p></p>
  35. </el-col>
  36. </el-col>
  37. </template>
  38. </el-col>
  39. </el-col>
  40. </el-row>
  41. </div>
  42. </template>
  43. <script>
  44. import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
  45. export default {
  46. name: 'mainData',
  47. props: {
  48. lesson: null,
  49. today: null,
  50. arrange: null,
  51. classInfo: { type: Object, default: () => {} },
  52. locationList: { type: Array, default: () => [] },
  53. },
  54. components: {},
  55. data: () => ({}),
  56. created() {},
  57. computed: {
  58. ...mapState(['user']),
  59. },
  60. methods: {
  61. changeLesson(date) {
  62. this.$emit('getLesson', date);
  63. },
  64. click(item) {
  65. this.$router.push({ path: '/home/teacher', query: { teaid: item.teaid, lessonid: item._id } });
  66. },
  67. getLocaltion(data) {
  68. if (data.subid) {
  69. return _.get(this.classInfo, 'jslocation', '');
  70. } else if (data.subname.includes('报到') || data.subname.includes('开班')) {
  71. return _.get(this.classInfo, 'kbyslocation', '');
  72. } else if (data.subname.includes('拓展')) {
  73. return _.get(this.classInfo, 'kzjhlocation', '');
  74. } else if (data.subname.includes('午餐+休息') || data.subname.includes('晚餐')) {
  75. return _.get(this.classInfo, 'yclocation', '');
  76. }
  77. },
  78. },
  79. filters: {
  80. getMD(date) {
  81. let arr = date.split('-');
  82. //${arr[1]}-
  83. return `${arr[1]}-${arr[2]}`;
  84. },
  85. },
  86. };
  87. </script>
  88. <style lang="less" scoped>
  89. p {
  90. padding: 0;
  91. margin: 0;
  92. }
  93. .info {
  94. text-align: center;
  95. padding: 7px 0 0 0;
  96. }
  97. .beijing {
  98. background-color: #f9fafc;
  99. }
  100. .top {
  101. margin: 10px 0 0 0;
  102. }
  103. /deep/.el-button {
  104. border-radius: 11px;
  105. padding: 10px 10px 10px 10px;
  106. }
  107. .time {
  108. background-color: #ffffff;
  109. font-size: 16px;
  110. color: #222222;
  111. text-align: center;
  112. padding: 15px 0;
  113. }
  114. .date {
  115. background-color: #ffffff;
  116. font-size: 16px;
  117. color: #222222;
  118. text-align: center;
  119. padding: 6px 0;
  120. }
  121. .context {
  122. background-color: #ffffff;
  123. width: 92%;
  124. margin: 15px 15px 0 15px;
  125. color: #bbbbbb;
  126. padding: 15px 0;
  127. }
  128. .contexttime {
  129. padding: 15px 20px 0 20px;
  130. }
  131. .contextclass {
  132. background-color: #ffffff;
  133. }
  134. .contextclass p {
  135. padding: 15px 0 0 0;
  136. text-align: center;
  137. }
  138. .title {
  139. color: blueviolet;
  140. }
  141. </style>