LiveBroadcast.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div class="container">
  3. <div class="review-main">
  4. <div class="condition-wrap">
  5. <!--<div class="condition-wrap-left">
  6. <Button type="primary">新媒体新技术</Button>
  7. <Button type="success">创新实验室</Button>
  8. </div>-->
  9. <Select v-model="selectSchool" style="width:200px" @on-change="chooseSchool">
  10. <Option v-for="(item,index) in schoolList" :value="item" :key="index">{{ item }}</Option>
  11. </Select>
  12. <div class="condition-wrap-right" style="display:none;">
  13. <Select v-model="yearDefault" size="large" style="width:100px">
  14. <Option v-for="item in years" :value="item" :key="item">{{ item }}</Option>
  15. </Select>
  16. <Select v-model="monthDefault" size="large" style="width:100px">
  17. <Option v-for="item in monthes" :value="item" :key="item">{{ item }}</Option>
  18. </Select>
  19. <Button size="large">返回今天</Button>
  20. </div>
  21. </div>
  22. <Tooltip :content="eventContent" placement="right" transfer max-width="300px">
  23. <full-calendar :config="config"
  24. :events="fcEvents"
  25. ref="calendar">
  26. </full-calendar>
  27. </Tooltip>
  28. <br><br>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import { FullCalendar } from 'vue-full-calendar'
  34. import 'fullcalendar/dist/fullcalendar.css'
  35. export default {
  36. components: {
  37. FullCalendar
  38. },
  39. data() {
  40. const self = this;
  41. return {
  42. eventContent: "",
  43. yearDefault: '2019年',
  44. years: [
  45. "2012年",
  46. "2013年",
  47. "2014年",
  48. "2015年",
  49. "2016年",
  50. "2017年",
  51. "2018年",
  52. "2019年",
  53. "2020年",
  54. "2021年",
  55. "2022年",
  56. "2023年",
  57. "2024年",
  58. ],
  59. monthDefault: '1月',
  60. monthes: [
  61. '1月',
  62. '2月',
  63. '3月',
  64. '4月',
  65. '5月',
  66. '6月',
  67. '7月',
  68. '8月',
  69. '9月',
  70. '11月',
  71. '12月',
  72. ],
  73. _this: null,
  74. fcEvents: [],
  75. config: {
  76. firstDay: '7',//以周日为每周的第一天
  77. // weekends: true,//是否在日历中显示周末
  78. locale: 'zh-cn',//语言
  79. defaultView: 'month',//默认按月显示
  80. height: 'auto',//高度
  81. fixedWeekCount: false,//是否固定显示六周
  82. // weekMode:"liquid",//周数不定,每周的高度可变,整个日历高度不变
  83. allDaySlot: false,
  84. eventLimit: 1,
  85. // allDay:true,
  86. header: {//表头信息
  87. left: 'prev, next',
  88. center: 'title',
  89. right: 'hide, custom'
  90. },
  91. dayClick: function getDay(day, jsEvent) {
  92. console.log(day);
  93. console.log(jsEvent);
  94. },
  95. eventClick: () => {
  96. this.$router.push({ path: 'lessonDetails' });
  97. },
  98. eventMouseover: function (event, jsEvent, view) {
  99. self.eventContent = event.title;
  100. },
  101. },
  102. lessonList: [],
  103. schoolList: [],
  104. allList:[],
  105. selectSchool:""
  106. }
  107. },
  108. created() {
  109. this.allList = require("@/static/lessonList.json");
  110. this.lessonList = require("@/static/lessonList.json");
  111. },
  112. methods: {
  113. chooseSchool(val) {
  114. if (val == "全部课程") {
  115. this.initCalendar(this.allList);
  116. } else {
  117. this.$nextTick(() => {
  118. this.initCalendar(this.allList.filter(item => item.schoolName == val));
  119. })
  120. }
  121. },
  122. initCalendar(arr) {
  123. this.fcEvents = [];
  124. this._this = this;
  125. for (let i = 0; i < arr.length; i++) {
  126. var sdate = new Date(arr[i].startTime.time);
  127. let sY = sdate.getFullYear() + '-';
  128. let sM = (sdate.getMonth() + 1 < 10 ? '0' + (sdate.getMonth() + 1) : sdate.getMonth() + 1) + '-';
  129. let sD = sdate.getDate() + ' ';
  130. var edate = new Date(arr[i].endTime.time);
  131. let eY = edate.getFullYear() + '-';
  132. let eM = (edate.getMonth() + 1 < 10 ? '0' + (edate.getMonth() + 1) : edate.getMonth() + 1) + '-';
  133. let eD = edate.getDate() + ' ';
  134. let dateArr = this.fcEvents.map(item => item.start);
  135. //如果已存在
  136. if (dateArr.indexOf(sY + sM + sD) == -1) {
  137. this.fcEvents.push({
  138. title: '名称:' + arr[i].name
  139. + ' \n 学校:' + arr[i].schoolName
  140. + ' \n 主讲人:' + arr[i].employeeName
  141. + ' \n 学科:' + arr[i].parentCategoryName
  142. + ' \n 课题:' + arr[i].parentProjectName
  143. + ' \n 时间:' + arr[i].timeRangeTipHHmm
  144. + ' \n ',
  145. start: sY + sM + sD,
  146. end: eY + eM + eD
  147. });
  148. } else {
  149. let index = dateArr.indexOf(sY + sM + sD);
  150. let newEvent = {
  151. title: arr[i].name + ' \n\n 等多个活动',
  152. start: sY + sM + sD,
  153. end: eY + eM + eD,
  154. }
  155. this.fcEvents.splice(index, 1, newEvent);
  156. }
  157. }
  158. }
  159. },
  160. mounted() {
  161. this.schoolList = [...new Set(this.allList.map(item => item.schoolName))];
  162. this.lessonList = this.allList;
  163. this.schoolList.unshift("全部课程");
  164. this.selectSchool = this.schoolList[0];
  165. this.initCalendar(this.lessonList);
  166. }
  167. }
  168. </script>
  169. <style>
  170. html, body, #app {
  171. height: 100% !important;
  172. user-select: none;
  173. }
  174. .main-content {
  175. background: rgb(241,242,243) !important;
  176. }
  177. .container {
  178. width: 1200px;
  179. margin: 100px auto;
  180. display: flex;
  181. flex-direction: row;
  182. justify-content: space-between;
  183. }
  184. .review-main {
  185. background: #fff;
  186. width: 100%;
  187. padding: 10px 25px;
  188. }
  189. .review-main .full-calendar-header {
  190. display: none;
  191. }
  192. .review-main .comp-full-calendar {
  193. padding: 0px;
  194. max-width: 1200px;
  195. }
  196. .review-main .weeks {
  197. background: -webkit-linear-gradient(#E1E7EC, #B9C6D1); /* Safari 5.1 - 6.0 */
  198. background: -o-linear-gradient(#E1E7EC, #B9C6D1); /* Opera 11.1 - 12.0 */
  199. background: -moz-linear-gradient(#E1E7EC, #B9C6D1); /* Firefox 3.6 - 15 */
  200. background: linear-gradient(#E1E7EC, #B9C6D1); /* 标准的语法 */
  201. height: 40px;
  202. line-height: 40px;
  203. }
  204. .review-main .full-calendar-body .dates .week-row .day-cell.today {
  205. background: #dfe6ec;
  206. }
  207. .review-main .week-row > .not-cur-month {
  208. background: linear-gradient( -45deg, #ecf0f4 25%, #ffffff 0, #ffffff 50%, #ecf0f4 0, #ecf0f4 75%, #ffffff 0 ); /* 标准的语法(必须放在最后) */
  209. background-size: 20px 20px;
  210. }
  211. .review-main .week-row {
  212. height: 140px;
  213. }
  214. .review-main .events-week {
  215. height: 140px;
  216. }
  217. .review-main .full-calendar-body .dates .dates-events .events-week .events-day .event-box .event-item {
  218. background: none;
  219. height: 15px;
  220. }
  221. /*.review-main .full-calendar-body .dates .dates-events .events-week .events-day .event-box .more-link {
  222. display:none;
  223. }*/
  224. .review-main .fc-event, .fc-event:hover {
  225. color: black;
  226. }
  227. .review-main .fc-day-grid-event .fc-time {
  228. display: none;
  229. }
  230. .review-main .fc-event, .fc-event-dot {
  231. background: none;
  232. }
  233. .review-main .fc-week {
  234. min-height:120px;
  235. height:120px !important;
  236. }
  237. .review-main .fc-event {
  238. border: none;
  239. }
  240. .review-main .fc-content {
  241. padding-left: 5px;
  242. }
  243. .review-main .fc-title {
  244. width: 140px;
  245. display: block;
  246. overflow: hidden;
  247. text-overflow: ellipsis;
  248. white-space: nowrap;
  249. }
  250. .review-main .fc-day-header {
  251. background: -webkit-linear-gradient(#E1E7EC, #B9C6D1); /* Safari 5.1 - 6.0 */
  252. background: -o-linear-gradient(#E1E7EC, #B9C6D1); /* Opera 11.1 - 12.0 */
  253. background: -moz-linear-gradient(#E1E7EC, #B9C6D1); /* Firefox 3.6 - 15 */
  254. background: linear-gradient(#E1E7EC, #B9C6D1); /* 标准的语法 */
  255. height: 40px;
  256. line-height: 40px;
  257. }
  258. .review-main .fc-other-month {
  259. background: linear-gradient( -45deg, #ecf0f4 25%, #ffffff 0, #ffffff 50%, #ecf0f4 0, #ecf0f4 75%, #ffffff 0 ); /* 标准的语法(必须放在最后) */
  260. background-size: 20px 20px;
  261. }
  262. .review-main .fc-left {
  263. float: right;
  264. }
  265. .review-main .fc-widget-content:hover {
  266. /*background:#eee;*/
  267. }
  268. .condition-wrap {
  269. display: flex;
  270. flex-direction: row;
  271. justify-content: space-between;
  272. }
  273. </style>