head.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div class="headview">
  3. <div class="dierjibie">
  4. <img :src="[img0, img1, img2][swindex]" alt="" srcset="" />
  5. <div class="asleft">
  6. <div class="jajajaj" v-if="tianqi">
  7. {{
  8. tianqi.result.city
  9. ? `${tianqi.result.city} :${tianqi.result.weather || ''} ${tianqi.result.templow || ''}℃ ~${
  10. tianqi.result.temphigh || ''
  11. }℃`
  12. : ''
  13. }}
  14. </div>
  15. </div>
  16. <div class="aszhongjian">
  17. <template v-if="userInfo.type == 1">{{ userInfo.companyName }}</template>
  18. <template v-else-if="userInfo.type == 2">{{ '平台管理员' }}</template>
  19. <el-carousel v-else-if="userInfo && userInfo.adminWebsits">
  20. <el-carousel-item v-for="(item, index) in userInfo.adminWebsits.map(item => item.name)" :key="index">
  21. <div class="aszhongjianText">{{ item }}</div>
  22. </el-carousel-item>
  23. </el-carousel>
  24. </div>
  25. <div class="asright">{{ timeStr }}</div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import { dateFormat2 } from '@/utils/util.js'
  31. import img0 from '@/assets/head8.png'
  32. import img1 from '@/assets/head1.png'
  33. import img2 from '@/assets/head2.png'
  34. import { bigWaterGet } from '@/api/common.js'
  35. export default {
  36. props: {
  37. swindex: {
  38. type: Number,
  39. default: 0
  40. }
  41. },
  42. data() {
  43. return {
  44. img0,
  45. img1,
  46. img2,
  47. timeStr: '',
  48. timeId: null,
  49. info: {},
  50. tianqi: null
  51. }
  52. },
  53. computed: {
  54. // 用户信息
  55. userInfo() {
  56. return JSON.parse(localStorage.getItem('greemall_user'))
  57. }
  58. },
  59. watch: {
  60. $IpAdd: {
  61. handler(newVal, oldVal) {
  62. if (newVal?.city) {
  63. bigWaterGet({
  64. city: newVal.city
  65. }).then(res => {
  66. this.tianqi = res.data
  67. console.log(res.data)
  68. })
  69. }
  70. },
  71. deep: true,
  72. immediate: true
  73. }
  74. },
  75. mounted() {
  76. this.jishikaishi()
  77. },
  78. beforeUnmount() {
  79. this.timeId && clearInterval(this.timeId)
  80. },
  81. methods: {
  82. jishikaishi() {
  83. let date = new Date()
  84. this.timeStr = dateFormat2('YYYY-mm-dd HH:MM:SS WWW', date)
  85. this.timeId = setTimeout(this.jishikaishi, 1000)
  86. }
  87. }
  88. }
  89. </script>
  90. <style scoped lang="scss">
  91. ::v-deep .el-carousel__arrow {
  92. display: none !important;
  93. }
  94. ::v-deep .el-carousel__indicators {
  95. display: none !important;
  96. }
  97. .jajajaj {
  98. height: 24px;
  99. line-height: 24px;
  100. font-size: 20px;
  101. font-family: Source Han Sans CN, Source Han Sans CN-Regular;
  102. font-weight: 400;
  103. text-align: left;
  104. color: #34c7ff;
  105. }
  106. ::v-deep .dv-scroll-board {
  107. background: none !important;
  108. .row,
  109. .row-item {
  110. background: none !important;
  111. height: 24px !important;
  112. }
  113. }
  114. .headview {
  115. width: 100%;
  116. height: 100%;
  117. position: relative;
  118. overflow: hidden;
  119. .dierjibie {
  120. width: 100%;
  121. min-width: 1600px;
  122. height: 100%;
  123. position: absolute;
  124. top: 0;
  125. left: 50%;
  126. transform: translateX(-50%);
  127. }
  128. img {
  129. position: absolute;
  130. bottom: 0;
  131. width: 100%;
  132. min-width: 1600px;
  133. height: 58px;
  134. }
  135. .aszhongjianText {
  136. width: 400px;
  137. height: 35px;
  138. font-family: Source Han Sans CN;
  139. font-weight: 500 !important;
  140. font-size: 30px !important;
  141. color: #ffffff !important;
  142. line-height: 35px !important;
  143. text-align: center !important;
  144. z-index: 9999999999999999999;
  145. }
  146. .aszhongjian {
  147. text-align: center;
  148. width: 400px;
  149. height: 35px;
  150. background: linear-gradient(0deg, #ffffff 0%, #b0d7ff 100%);
  151. -webkit-background-clip: text;
  152. -webkit-text-fill-color: transparent;
  153. position: absolute;
  154. bottom: 12px;
  155. left: 50%;
  156. transform: translateX(-50%);
  157. font-family: Source Han Sans CN;
  158. font-weight: 500 !important;
  159. font-size: 30px !important;
  160. color: #ffffff !important;
  161. line-height: 35px !important;
  162. text-align: center !important;
  163. z-index: 9999999999999999999;
  164. }
  165. .asleft {
  166. height: 24px;
  167. overflow: hidden;
  168. position: absolute;
  169. bottom: 12px;
  170. left: 160px;
  171. }
  172. .asright {
  173. font-size: 20px;
  174. font-family: Source Han Sans CN, Source Han Sans CN-Regular;
  175. font-weight: 400;
  176. text-align: left;
  177. color: #34c7ff;
  178. position: absolute;
  179. bottom: 12px;
  180. right: 160px;
  181. }
  182. }
  183. </style>