head.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. {{ userInfo.companyWechatId ? userInfo.companyName : '工单客服管理系统' }}
  18. </div>
  19. <div class="asright">{{ timeStr }}</div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import { dateFormat2 } from '@/utils/util.js'
  25. import img0 from '@/assets/head8.png'
  26. import img1 from '@/assets/head1.png'
  27. import img2 from '@/assets/head2.png'
  28. import { bigWaterGet } from '@/api/common.js'
  29. export default {
  30. props: {
  31. swindex: {
  32. type: Number,
  33. default: 0
  34. }
  35. },
  36. data() {
  37. return {
  38. img0,
  39. img1,
  40. img2,
  41. timeStr: '',
  42. timeId: null,
  43. info: {},
  44. tianqi: null
  45. }
  46. },
  47. computed: {
  48. // 用户信息
  49. userInfo() {
  50. return JSON.parse(localStorage.getItem('greemall_user'))
  51. }
  52. },
  53. watch: {
  54. $IpAdd: {
  55. handler(newVal, oldVal) {
  56. if (newVal?.city) {
  57. bigWaterGet({
  58. city: newVal.city
  59. }).then(res => {
  60. this.tianqi = res.data
  61. console.log(res.data)
  62. })
  63. }
  64. },
  65. deep: true,
  66. immediate: true
  67. }
  68. },
  69. mounted() {
  70. this.jishikaishi()
  71. },
  72. beforeUnmount() {
  73. this.timeId && clearInterval(this.timeId)
  74. },
  75. methods: {
  76. jishikaishi() {
  77. let date = new Date()
  78. this.timeStr = dateFormat2('YYYY-mm-dd HH:MM:SS WWW', date)
  79. this.timeId = setTimeout(this.jishikaishi, 1000)
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .jajajaj {
  86. height: 24px;
  87. line-height: 24px;
  88. font-size: 20px;
  89. font-family: Source Han Sans CN, Source Han Sans CN-Regular;
  90. font-weight: 400;
  91. text-align: left;
  92. color: #34c7ff;
  93. }
  94. ::v-deep .dv-scroll-board {
  95. background: none !important;
  96. .row,
  97. .row-item {
  98. background: none !important;
  99. height: 24px !important;
  100. }
  101. }
  102. .headview {
  103. width: 100%;
  104. height: 100%;
  105. position: relative;
  106. overflow: hidden;
  107. .dierjibie {
  108. width: 100%;
  109. min-width: 1600px;
  110. height: 100%;
  111. position: absolute;
  112. top: 0;
  113. left: 50%;
  114. transform: translateX(-50%);
  115. }
  116. img {
  117. position: absolute;
  118. bottom: 0;
  119. width: 100%;
  120. min-width: 1600px;
  121. height: 58px;
  122. }
  123. .aszhongjian {
  124. font-family: Source Han Sans CN;
  125. font-weight: 500;
  126. font-size: 30px;
  127. color: #ffffff;
  128. line-height: 35px;
  129. background: linear-gradient(0deg, #ffffff 0%, #b0d7ff 100%);
  130. -webkit-background-clip: text;
  131. -webkit-text-fill-color: transparent;
  132. position: absolute;
  133. bottom: 12px;
  134. left: 50%;
  135. transform: translateX(-50%);
  136. text-align: center;
  137. }
  138. .asleft {
  139. height: 24px;
  140. overflow: hidden;
  141. position: absolute;
  142. bottom: 12px;
  143. left: 160px;
  144. }
  145. .asright {
  146. font-size: 20px;
  147. font-family: Source Han Sans CN, Source Han Sans CN-Regular;
  148. font-weight: 400;
  149. text-align: left;
  150. color: #34c7ff;
  151. position: absolute;
  152. bottom: 12px;
  153. right: 160px;
  154. }
  155. }
  156. </style>