header.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <!--
  2. * @Description:
  3. * @Author: wangcc
  4. * @Date: 2022-06-14 18:11:54
  5. * @LastEditors: gcz
  6. * @LastEditTime: 2022-06-30 09:02:02
  7. * @FilePath: \castgroup_bigscreen\src\components\header.vue
  8. * @Copyright: Copyright (c) 2016~2022 by wangcc, All Rights Reserved.
  9. -->
  10. <!--
  11. * @LastEditors: gcz
  12. -->
  13. <template>
  14. <div class="top-box">
  15. <span class="top-time">{{nowTime}}</span>
  16. <h2>贵州民投林业数字化工作平台</h2>
  17. <div class="weather">
  18. <div id="he-plugin-simple"></div>
  19. </div>
  20. <img v-if="!isFull" src="@/assets/img/full.png" @click="toggleFullScreen" />
  21. <img v-else src="@/assets/img/back.png" @click="toggleFullScreen" />
  22. </div>
  23. </template>
  24. <script>
  25. import timeFormat from '@/utils/timeFormat'
  26. export default {
  27. name: 'Header',
  28. components: {},
  29. data () {
  30. return {
  31. nowTime:'',
  32. isFull:false,
  33. };
  34. },
  35. created(){
  36. setInterval(() => {
  37. this.nowTime = timeFormat(new Date(),'yyyy年mm月dd日 hh时MM分ss秒');
  38. }, 1000);
  39. },
  40. mounted(){
  41. window.WIDGET = {
  42. CONFIG: {
  43. modules: '01234',
  44. background: '5',
  45. tmpColor: 'FFFFFF',
  46. tmpSize: '16',
  47. cityColor: 'FFFFFF',
  48. citySize: '16',
  49. aqiColor: 'FFFFFF',
  50. aqiSize: '16',
  51. weatherIconSize: '24',
  52. alertIconSize: '18',
  53. padding: '5px 10px 5px 10px',
  54. shadow: '0',
  55. language: 'auto',
  56. borderRadius: '5',
  57. fixed: 'false',
  58. vertical: 'top',
  59. horizontal: 'left',
  60. key: '4c47862a466540e881cc8e942c56fedf'
  61. }
  62. };
  63. let script = document.createElement('script');
  64. script.type = 'text/javascript';
  65. script.src =
  66. 'https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0';
  67. document.getElementsByTagName('head')[0].appendChild(script);
  68. },
  69. methods: {
  70. toggleFullScreen(){
  71. // alternative standard method
  72. if (!document.fullscreenElement &&
  73. !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { // current working methods
  74. this.isFull = true;
  75. if (document.documentElement.requestFullscreen) {
  76. document.documentElement.requestFullscreen();
  77. } else if (document.documentElement.msRequestFullscreen) {
  78. document.documentElement.msRequestFullscreen();
  79. } else if (document.documentElement.mozRequestFullScreen) {
  80. document.documentElement.mozRequestFullScreen();
  81. } else if (document.documentElement.webkitRequestFullscreen) {
  82. document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
  83. }
  84. } else {
  85. this.isFull = false;
  86. if (document.exitFullscreen) {
  87. document.exitFullscreen();
  88. } else if (document.msExitFullscreen) {
  89. document.msExitFullscreen();
  90. } else if (document.mozCancelFullScreen) {
  91. document.mozCancelFullScreen();
  92. } else if (document.webkitExitFullscreen) {
  93. document.webkitExitFullscreen();
  94. }
  95. }
  96. }
  97. },
  98. }
  99. </script>
  100. <style lang='scss' scoped>
  101. .top-box {
  102. position: fixed;
  103. top: 0;
  104. left: 0;
  105. right: 0;
  106. height: 85px;
  107. background-image: url('../assets/img/index-top.png');
  108. background-size: 100% 100%;
  109. background-repeat: no-repeat;
  110. z-index: 999;
  111. h2 {
  112. margin: 0;
  113. line-height: 48px;
  114. color: #05d6e5;
  115. position: absolute;
  116. width: 100%;
  117. top: 20px;
  118. text-align: center;
  119. letter-spacing: 1px;
  120. font-size: 40px;
  121. text-indent: -0.8em;
  122. text-shadow: 0 2px #04213b;
  123. }
  124. span {
  125. color: #0c6e7a;
  126. font-size: 1.2em;
  127. position: absolute;
  128. line-height: 36px;
  129. left: 7%;
  130. top: 40px;
  131. font-weight: bold;
  132. }
  133. img {
  134. width: 27px;
  135. height: 27px;
  136. cursor: pointer;
  137. position: absolute;
  138. top: 5px;
  139. right: 10px;
  140. top: 40px;
  141. }
  142. .weather {
  143. font-weight: bold;
  144. /deep/ .s-sticker >div{
  145. color: #0c6e7a!important;
  146. }
  147. position: absolute;
  148. line-height: 40px;
  149. width: 120px;
  150. right: 100px;
  151. top: 40px;
  152. }
  153. }
  154. @media only screen and (max-width : 1200px) {
  155. .top-box{
  156. h2{
  157. letter-spacing: 1px;
  158. font-size: 28px;
  159. text-indent: -0.8em;
  160. }
  161. }
  162. }
  163. @media only screen and (min-height : 800px) and (max-width : 1280px) {
  164. .top-box{
  165. h2{
  166. letter-spacing: 1px;
  167. font-size: 30px;
  168. text-indent: -0.8em;
  169. }
  170. }
  171. }
  172. @media only screen and (min-height : 768px) and (max-width : 1024px) {
  173. .top-box{
  174. h2{
  175. letter-spacing: 1px;
  176. font-size: 24px;
  177. text-indent: -0.8em;
  178. }
  179. .top-time{
  180. font-size: 16px;
  181. }
  182. }
  183. }
  184. </style>