LiveBroadcast.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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. defaultDate: '2019-05-01',
  86. // allDay:true,
  87. header: {//表头信息
  88. left: 'prev, next',
  89. center: 'title',
  90. right: 'hide, custom'
  91. },
  92. dayClick: function getDay(day, jsEvent) {
  93. console.log(day);
  94. console.log(jsEvent);
  95. },
  96. eventClick: () => {
  97. sessionStorage.setItem('_lesson_rowKey', 1);
  98. this.$router.push({ path: 'lessonDetails' });
  99. },
  100. eventMouseover: function (event, jsEvent, view) {
  101. self.eventContent = event.title;
  102. },
  103. },
  104. lessonList: [],
  105. schoolList: [],
  106. allList:[],
  107. selectSchool:""
  108. }
  109. },
  110. created() {
  111. this.allList = require("@/static/lessonList.json");
  112. this.lessonList = require("@/static/lessonList.json");
  113. },
  114. methods: {
  115. chooseSchool(val) {
  116. if (val == "全部课程") {
  117. this.initCalendar(this.allList);
  118. } else {
  119. this.$nextTick(() => {
  120. this.initCalendar(this.allList.filter(item => item.schoolName == val));
  121. })
  122. }
  123. },
  124. initCalendar(arr) {
  125. this.fcEvents = [];
  126. this._this = this;
  127. for (let i = 0; i < arr.length; i++) {
  128. var sdate = new Date(arr[i].startTime.time);
  129. let sY = sdate.getFullYear() + '-';
  130. let sM = (sdate.getMonth() + 1 < 10 ? '0' + (sdate.getMonth() + 1) : sdate.getMonth() + 1) + '-';
  131. let sD = sdate.getDate() + ' ';
  132. var edate = new Date(arr[i].endTime.time);
  133. let eY = edate.getFullYear() + '-';
  134. let eM = (edate.getMonth() + 1 < 10 ? '0' + (edate.getMonth() + 1) : edate.getMonth() + 1) + '-';
  135. let eD = edate.getDate() + ' ';
  136. let dateArr = this.fcEvents.map(item => item.start);
  137. //如果已存在
  138. if (dateArr.indexOf(sY + sM + sD) == -1) {
  139. this.fcEvents.push({
  140. title: '名称:' + arr[i].name
  141. + ' \n 学校:' + arr[i].schoolName
  142. + ' \n 主讲人:' + arr[i].employeeName
  143. + ' \n 学科:' + arr[i].parentCategoryName
  144. + ' \n 课题:' + arr[i].parentProjectName
  145. + ' \n 时间:' + arr[i].timeRangeTipHHmm
  146. + ' \n ',
  147. start: sY + sM + sD,
  148. end: eY + eM + eD
  149. });
  150. } else {
  151. let index = dateArr.indexOf(sY + sM + sD);
  152. let newEvent = {
  153. title: arr[i].name + ' \n\n 等多个活动',
  154. start: sY + sM + sD,
  155. end: eY + eM + eD,
  156. }
  157. this.fcEvents.splice(index, 1, newEvent);
  158. }
  159. }
  160. }
  161. },
  162. mounted() {
  163. this.schoolList = [...new Set(this.allList.map(item => item.schoolName))];
  164. this.lessonList = this.allList;
  165. this.schoolList.unshift("全部课程");
  166. this.selectSchool = this.schoolList[0];
  167. this.initCalendar(this.lessonList);
  168. }
  169. }
  170. </script>
  171. <style>
  172. html, body, #app {
  173. height: 100% !important;
  174. user-select: none;
  175. }
  176. .main-content {
  177. background: rgb(241,242,243) !important;
  178. }
  179. .container {
  180. width: 1200px;
  181. margin: 100px auto;
  182. display: flex;
  183. flex-direction: row;
  184. justify-content: space-between;
  185. }
  186. .review-main {
  187. background: #fff;
  188. width: 100%;
  189. padding: 10px 25px;
  190. }
  191. .review-main .full-calendar-header {
  192. display: none;
  193. }
  194. .review-main .comp-full-calendar {
  195. padding: 0px;
  196. max-width: 1200px;
  197. }
  198. .review-main .weeks {
  199. background: -webkit-linear-gradient(#E1E7EC, #B9C6D1); /* Safari 5.1 - 6.0 */
  200. background: -o-linear-gradient(#E1E7EC, #B9C6D1); /* Opera 11.1 - 12.0 */
  201. background: -moz-linear-gradient(#E1E7EC, #B9C6D1); /* Firefox 3.6 - 15 */
  202. background: linear-gradient(#E1E7EC, #B9C6D1); /* 标准的语法 */
  203. height: 40px;
  204. line-height: 40px;
  205. }
  206. .review-main .full-calendar-body .dates .week-row .day-cell.today {
  207. background: #dfe6ec;
  208. }
  209. .review-main .week-row > .not-cur-month {
  210. background: linear-gradient( -45deg, #ecf0f4 25%, #ffffff 0, #ffffff 50%, #ecf0f4 0, #ecf0f4 75%, #ffffff 0 ); /* 标准的语法(必须放在最后) */
  211. background-size: 20px 20px;
  212. }
  213. .review-main .week-row {
  214. height: 140px;
  215. }
  216. .review-main .events-week {
  217. height: 140px;
  218. }
  219. .review-main .full-calendar-body .dates .dates-events .events-week .events-day .event-box .event-item {
  220. background: none;
  221. height: 15px;
  222. }
  223. /*.review-main .full-calendar-body .dates .dates-events .events-week .events-day .event-box .more-link {
  224. display:none;
  225. }*/
  226. .review-main .fc-event, .fc-event:hover {
  227. color: black;
  228. }
  229. .review-main .fc-day-grid-event .fc-time {
  230. display: none;
  231. }
  232. .review-main .fc-event, .fc-event-dot {
  233. background: none;
  234. }
  235. .review-main .fc-week {
  236. min-height:120px;
  237. height:120px !important;
  238. }
  239. .review-main .fc-event {
  240. border: none;
  241. }
  242. .review-main .fc-content {
  243. padding-left: 5px;
  244. }
  245. .review-main .fc-title {
  246. width: 140px;
  247. display: block;
  248. overflow: hidden;
  249. text-overflow: ellipsis;
  250. white-space: nowrap;
  251. }
  252. .review-main .fc-day-header {
  253. background: -webkit-linear-gradient(#E1E7EC, #B9C6D1); /* Safari 5.1 - 6.0 */
  254. background: -o-linear-gradient(#E1E7EC, #B9C6D1); /* Opera 11.1 - 12.0 */
  255. background: -moz-linear-gradient(#E1E7EC, #B9C6D1); /* Firefox 3.6 - 15 */
  256. background: linear-gradient(#E1E7EC, #B9C6D1); /* 标准的语法 */
  257. height: 40px;
  258. line-height: 40px;
  259. }
  260. .review-main .fc-other-month {
  261. background: linear-gradient( -45deg, #ecf0f4 25%, #ffffff 0, #ffffff 50%, #ecf0f4 0, #ecf0f4 75%, #ffffff 0 ); /* 标准的语法(必须放在最后) */
  262. background-size: 20px 20px;
  263. }
  264. .review-main .fc-left {
  265. float: right;
  266. }
  267. .review-main .fc-widget-content:hover {
  268. /*background:#eee;*/
  269. }
  270. .condition-wrap {
  271. display: flex;
  272. flex-direction: row;
  273. justify-content: space-between;
  274. }
  275. </style>