LiveBroadcast.vue 8.7 KB

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