index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="tabPage" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='首页' :titleStyle="{color:'transparent'}" :showback='false' bgColor='transparent'></cus-header>
  4. <image class="topbg" :src="imgBase+'home/home_top_bg.png'" mode="widthFix"></image>
  5. <div class="header">
  6. <div class="top">
  7. <div class="left">
  8. <div class="title">
  9. <text>谷锐特</text>
  10. <u-icon name="arrow-right" color="#FFFFFF" size="32"></u-icon>
  11. </div>
  12. <div class="tip">{{time}},天气{{weatherInfo.weather||''}}</div>
  13. </div>
  14. <div class="right" @tap="tuTurn('/pages/my/info')">
  15. <image :src="avatar"></image>
  16. </div>
  17. </div>
  18. <div class="weather">
  19. <div class="item line">
  20. <div class="text">{{deviceNum}}<span></span></div>
  21. <p>运行设备</p>
  22. </div>
  23. <div class="item line">
  24. <div class="text">{{weatherInfo.temperature||''}}<span>℃</span></div>
  25. <p>温度</p>
  26. </div>
  27. <div class="item">
  28. <div class="text">{{weatherInfo.humidity||''}}<span>%</span></div>
  29. <p>湿度</p>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="boxs">
  34. <div class="box" @tap="tuTurn('/pagesHome/video/index')">
  35. <image :src="imgBase+'home/home_icon_spjk.png'"></image>
  36. <text>视频监控</text>
  37. </div>
  38. <div class="box" @tap="tuTurn('/pagesHome/airConditioner/index')">
  39. <image :src="imgBase+'home/home_icon_zhkt.png'"></image>
  40. <text>智慧空调</text>
  41. </div>
  42. <div class="box" @tap="tuTurn('/pagesHome/entranceGuard/index')">
  43. <image :src="imgBase+'home/home_icon_mjgl.png'"></image>
  44. <text>门禁管理</text>
  45. </div>
  46. <div class="box" @tap="tuTurn('/pagesHome/energyMeter/index')">
  47. <image :src="imgBase+'home/home_icon_db.png'"></image>
  48. <text>电表</text>
  49. </div>
  50. <div class="box" @tap="tuTurn('/pagesHome/energyConsumption/index')">
  51. <image :src="imgBase+'home/home_icon_nhfx.png'"></image>
  52. <text>能耗分析</text>
  53. </div>
  54. <div class="box" @tap="tuTurn('/pagesHome/employee/index')">
  55. <image :src="imgBase+'home/home_icon_yggl.png'"></image>
  56. <text>员工管理</text>
  57. </div>
  58. </div>
  59. <Tabbar :tabbarIndex="0"></Tabbar>
  60. </view>
  61. </template>
  62. <script>
  63. var amapFile = require('@/utils/amap-wx.130.js');
  64. var myAmapFun = new amapFile.AMapWX({key:'f83be04fc5f239edfa9f1201e4bc7c47'});
  65. import Tabbar from '@/components/CusTabbar/index.vue'
  66. export default {
  67. components:{
  68. Tabbar
  69. },
  70. data(){
  71. return {
  72. avatar:this.$imgBase+'home/home_avator.png',
  73. time:'早上好',
  74. deviceNum:0,
  75. weatherInfo:{}
  76. }
  77. },
  78. onShow() {
  79. this.avatar = JSON.parse(uni.getStorageSync('userInfo')||'{}')?.headUrl;
  80. },
  81. onLoad() {
  82. this.getTime();
  83. this.getWeather();
  84. },
  85. methods:{
  86. getTime(){
  87. let hours = new Date().getHours()+1;
  88. if(hours<=8) this.time = '早上好';
  89. else if(hours<=11) this.time = '上午好';
  90. else if(hours<=13) this.time = '中午好';
  91. else if(hours<=18) this.time = '下午好';
  92. else if(hours<=24) this.time = '晚上好';
  93. },
  94. getWeather(){
  95. myAmapFun.getWeather({
  96. success:res=>{
  97. this.weatherInfo = res.liveData;
  98. }
  99. })
  100. },
  101. tuTurn(url){
  102. if(!url) return
  103. uni.navigateTo({ url });
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="less">
  109. .tabPage{
  110. width: 100%;
  111. padding: 0 0 188rpx;
  112. box-sizing: border-box;
  113. background: #F4F8FB;
  114. .topbg{
  115. width: 100%;
  116. position: fixed;
  117. top: 0;
  118. left: 0;
  119. z-index: 0;
  120. }
  121. .header{
  122. width: 100%;
  123. position: relative;
  124. .top{
  125. width: 100%;
  126. padding: 26rpx 40rpx 0;
  127. box-sizing: border-box;
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. .left{
  132. .title{
  133. display: flex;
  134. align-items: center;
  135. text{
  136. font-family: PingFang-SC, PingFang-SC;
  137. font-weight: bold;
  138. font-size: 48rpx;
  139. color: #FFFFFF;
  140. line-height: 48rpx;
  141. text-align: left;
  142. letter-spacing: 2rpx;
  143. margin-right: 20rpx;
  144. }
  145. }
  146. .tip{
  147. font-family: PingFangSC, PingFang SC;
  148. font-weight: 400;
  149. font-size: 24rpx;
  150. color: #FFFFFF;
  151. line-height: 30rpx;
  152. text-align: left;
  153. margin-top: 20rpx;
  154. }
  155. }
  156. .right{
  157. width: 90rpx;
  158. height: 90rpx;
  159. background: #FFFFFF;
  160. padding: 2rpx;
  161. box-sizing: border-box;
  162. border-radius: 50%;
  163. image{
  164. width: 100%;
  165. height: 100%;
  166. border-radius: 50%;
  167. }
  168. }
  169. }
  170. .weather{
  171. width: 100%;
  172. margin-top: 50rpx;
  173. display: flex;
  174. .item{
  175. width: calc(100% / 3);
  176. display: flex;
  177. flex-direction: column;
  178. align-items: center;
  179. position: relative;
  180. &::after{
  181. content: '';
  182. width: 1rpx;
  183. height: 64rpx;
  184. background: #CCCCCC;
  185. position: absolute;
  186. top:10rpx;
  187. right: 0;
  188. }
  189. .text{
  190. font-family: PingFang-SC, PingFang-SC;
  191. font-weight: bold;
  192. font-size: 44rpx;
  193. color: #FFFFFF;
  194. line-height: 44rpx;
  195. span{
  196. font-weight: 400;
  197. font-size: 20rpx;
  198. }
  199. }
  200. p{
  201. font-family: PingFangSC, PingFang SC;
  202. font-weight: 400;
  203. font-size: 24rpx;
  204. color: #FFFFFF;
  205. line-height: 24rpx;
  206. text-align: center;
  207. margin-top: 16rpx;
  208. }
  209. }
  210. }
  211. }
  212. .boxs{
  213. width: calc(100% - 48rpx);
  214. margin: 38rpx 24rpx 0;
  215. display: flex;
  216. justify-content: space-between;
  217. flex-wrap: wrap;
  218. position: relative;
  219. .box{
  220. width: calc(50% - 11rpx);
  221. padding: 40rpx 22rpx;
  222. box-sizing: border-box;
  223. background: #FFFFFF;
  224. border-radius: 8rpx;
  225. display: flex;
  226. align-items: center;
  227. margin-top: 20rpx;
  228. image{
  229. width: 90rpx;
  230. height: 88rpx;
  231. }
  232. text{
  233. font-family: PingFang-SC, PingFang-SC;
  234. font-weight: bold;
  235. font-size: 30rpx;
  236. color: #333333;
  237. line-height: 30rpx;
  238. padding-left: 24rpx;
  239. }
  240. }
  241. }
  242. }
  243. </style>