calendar.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div id="self-calendar">
  3. <el-row style="background:#598bed;height:476px;">
  4. <el-col :span="24" class="info">
  5. <el-col :span="24" class="calendar">
  6. <el-calendar>
  7. <template #dateCell="{date, data}">
  8. <el-row>
  9. <el-col :span="24" @click.native="search(data)">{{ date | getDay }}</el-col>
  10. </el-row>
  11. </template>
  12. </el-calendar>
  13. </el-col>
  14. <el-col :span="24" class="list">
  15. <span class="jiantou"></span>
  16. <el-col :span="24" class="listInfo" v-if="info.id">
  17. <el-col :span="24" class="title">
  18. <p class="textOver">{{ info.title }}</p>
  19. </el-col>
  20. <el-col :span="24" class="organizer">
  21. <p class="textOver">主办方:{{ info.organizer }}</p>
  22. </el-col>
  23. <el-col :span="12" class="address">
  24. <p class="textOver">地点:{{ info.address }}</p>
  25. </el-col>
  26. <el-col :span="12" class="date">
  27. <p>时间:{{ info.date }}</p>
  28. </el-col>
  29. </el-col>
  30. <el-col :span="24" class="listInfo" v-else>
  31. <el-col :span="24" class="none">
  32. 2020年毕业季大型招聘会 7月敬请关注
  33. </el-col>
  34. </el-col>
  35. </el-col>
  36. </el-col>
  37. <el-col :span="24" class="loginBtn">
  38. <el-button type="primary">学生登录</el-button>
  39. <el-button type="success">企业登录</el-button>
  40. </el-col>
  41. </el-row>
  42. </div>
  43. </template>
  44. <script>
  45. import { mapActions, mapState } from 'vuex';
  46. export default {
  47. name: 'self-calendar',
  48. props: {},
  49. components: {},
  50. data: () => ({
  51. calendar: new Date(),
  52. list: [],
  53. loading: false,
  54. infoList: [],
  55. info: {
  56. id: 1,
  57. title: '应届毕业生大型招聘会',
  58. organizer: '一汽大众大型招聘会',
  59. date: '2019-11-7',
  60. address: '长春会展中心',
  61. },
  62. }),
  63. created() {
  64. this.search();
  65. },
  66. computed: {},
  67. methods: {
  68. ...mapActions(['jobfairOperation']),
  69. async search(date) {
  70. let options = { date: date ? date.day : undefined };
  71. // 1直接拿着参数发送请求
  72. let result = await this.jobfairOperation({ type: 'list', data: { ...options } });
  73. if (`${result.errcode}` === '0') {
  74. //给this=>vue的实例下在中的list属性,赋予result。data的值
  75. this.$set(this, `infoList`, result.data);
  76. if (result.data.length > 0) this.$set(this, `info`, result.data[0]);
  77. else this.$set(this, `info`, {});
  78. } else {
  79. this.$set(this, `info`, {});
  80. this.$message.error(result.errmsg ? result.errmsg : 'error');
  81. }
  82. },
  83. },
  84. filters: {
  85. getDay(data) {
  86. return data.getDate();
  87. },
  88. getTime(date) {
  89. if (date) {
  90. let arr = date.split(' ');
  91. return arr[1];
  92. }
  93. },
  94. },
  95. };
  96. </script>
  97. <style lang="less" scoped>
  98. p {
  99. padding: 0;
  100. margin: 0;
  101. }
  102. .textOver {
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. white-space: nowrap;
  106. }
  107. .info {
  108. height: 396px;
  109. }
  110. .calendar {
  111. height: 280px;
  112. }
  113. .list {
  114. position: relative;
  115. height: 116px;
  116. }
  117. .loginBtn {
  118. height: 80px;
  119. line-height: 80px;
  120. text-align: center;
  121. }
  122. /deep/.el-calendar {
  123. background-color: #598bed;
  124. }
  125. /deep/.el-calendar__title {
  126. color: yellow;
  127. font-weight: 微软雅黑;
  128. font-size: 20px;
  129. }
  130. /deep/.el-calendar__body {
  131. padding: 0 40px;
  132. }
  133. /deep/.el-calendar-table thead th {
  134. padding: 0;
  135. color: #ffff;
  136. font-weight: bold;
  137. }
  138. /deep/.el-calendar-table .el-calendar-day {
  139. line-height: 35px;
  140. height: 35px;
  141. text-align: center;
  142. padding: 0;
  143. color: #fff;
  144. }
  145. /deep/.el-calendar-table tr td:first-child {
  146. border-left: none;
  147. }
  148. /deep/.el-calendar-table tr:first-child td {
  149. border-top: none;
  150. }
  151. /deep/.el-calendar-table td {
  152. border-bottom: none;
  153. border-right: none;
  154. }
  155. /deep/.el-calendar__header {
  156. border-bottom: none;
  157. padding: 12px 50px;
  158. }
  159. /deep/.el-calendar__button-group {
  160. display: none;
  161. }
  162. /deep/.el-calendar-table td.is-today {
  163. color: #0066ff;
  164. background: #f8ab55;
  165. border-radius: 90px;
  166. }
  167. /deep/.el-calendar-table td.is-selected {
  168. background-color: #54f77f;
  169. color: yellow;
  170. border-radius: 50px;
  171. }
  172. .listInfo {
  173. height: 100px;
  174. width: 89%;
  175. background: #fff;
  176. margin: 13px 20px;
  177. border-radius: 10px;
  178. }
  179. .jiantou {
  180. display: inline-block;
  181. position: absolute;
  182. top: -7px;
  183. left: 45%;
  184. width: 0px;
  185. height: 0;
  186. border-width: 10px;
  187. border-style: solid;
  188. border-color: #598bed #598bed #fff #598bed;
  189. }
  190. .listInfo .title p {
  191. text-align: center;
  192. padding: 5px 0;
  193. font-size: 20px;
  194. }
  195. .listInfo .organizer {
  196. padding: 5px 15px;
  197. }
  198. .listInfo .address {
  199. padding: 5px 0 0 12px;
  200. }
  201. .listInfo .date {
  202. padding: 5px 0;
  203. }
  204. .none {
  205. font-size: 24px;
  206. color: #676767;
  207. text-align: center;
  208. padding: 19px 28px;
  209. }
  210. </style>