index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 class="box" @tap="tuTurn('/pagesInspection/index')">
  59. <image :src="imgBase+'/img_home_znxj.png'"></image>
  60. <text>智能巡检</text>
  61. </div>
  62. </div>
  63. <Tabbar :tabbarIndex="0"></Tabbar>
  64. </view>
  65. </template>
  66. <script>
  67. var amapFile = require('@/utils/amap-wx.130.js');
  68. var myAmapFun = new amapFile.AMapWX({key:'f83be04fc5f239edfa9f1201e4bc7c47'});
  69. import Tabbar from '@/components/CusTabbar/index.vue'
  70. export default {
  71. components:{
  72. Tabbar
  73. },
  74. data(){
  75. return {
  76. avatar:this.$imgBase+'home/home_avator.png',
  77. time:'早上好',
  78. deviceNum:0,
  79. weatherInfo:{}
  80. }
  81. },
  82. onShow() {
  83. this.avatar = JSON.parse(uni.getStorageSync('userInfo')||'{}')?.headUrl;
  84. },
  85. onLoad() {
  86. this.getTime();
  87. this.getWeather();
  88. },
  89. methods:{
  90. getTime(){
  91. let hours = new Date().getHours()+1;
  92. if(hours<=8) this.time = '早上好';
  93. else if(hours<=11) this.time = '上午好';
  94. else if(hours<=13) this.time = '中午好';
  95. else if(hours<=18) this.time = '下午好';
  96. else if(hours<=24) this.time = '晚上好';
  97. },
  98. getWeather(){
  99. myAmapFun.getWeather({
  100. success:res=>{
  101. this.weatherInfo = res.liveData;
  102. }
  103. })
  104. },
  105. tuTurn(url){
  106. if(!url) return
  107. uni.navigateTo({ url });
  108. }
  109. }
  110. }
  111. </script>
  112. <style scoped lang="less">
  113. .tabPage{
  114. width: 100%;
  115. padding: 0 0 188rpx;
  116. box-sizing: border-box;
  117. background: #F4F8FB;
  118. .topbg{
  119. width: 100%;
  120. position: fixed;
  121. top: 0;
  122. left: 0;
  123. z-index: 0;
  124. }
  125. .header{
  126. width: 100%;
  127. position: relative;
  128. .top{
  129. width: 100%;
  130. padding: 26rpx 40rpx 0;
  131. box-sizing: border-box;
  132. display: flex;
  133. align-items: center;
  134. justify-content: space-between;
  135. .left{
  136. .title{
  137. display: flex;
  138. align-items: center;
  139. text{
  140. font-family: PingFang-SC, PingFang-SC;
  141. font-weight: bold;
  142. font-size: 48rpx;
  143. color: #FFFFFF;
  144. line-height: 48rpx;
  145. text-align: left;
  146. letter-spacing: 2rpx;
  147. margin-right: 20rpx;
  148. }
  149. }
  150. .tip{
  151. font-family: PingFangSC, PingFang SC;
  152. font-weight: 400;
  153. font-size: 24rpx;
  154. color: #FFFFFF;
  155. line-height: 30rpx;
  156. text-align: left;
  157. margin-top: 20rpx;
  158. }
  159. }
  160. .right{
  161. width: 90rpx;
  162. height: 90rpx;
  163. background: #FFFFFF;
  164. padding: 2rpx;
  165. box-sizing: border-box;
  166. border-radius: 50%;
  167. image{
  168. width: 100%;
  169. height: 100%;
  170. border-radius: 50%;
  171. }
  172. }
  173. }
  174. .weather{
  175. width: 100%;
  176. margin-top: 50rpx;
  177. display: flex;
  178. .item{
  179. width: calc(100% / 3);
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. position: relative;
  184. &::after{
  185. content: '';
  186. width: 1rpx;
  187. height: 64rpx;
  188. background: #CCCCCC;
  189. position: absolute;
  190. top:10rpx;
  191. right: 0;
  192. }
  193. .text{
  194. font-family: PingFang-SC, PingFang-SC;
  195. font-weight: bold;
  196. font-size: 44rpx;
  197. color: #FFFFFF;
  198. line-height: 44rpx;
  199. span{
  200. font-weight: 400;
  201. font-size: 20rpx;
  202. }
  203. }
  204. p{
  205. font-family: PingFangSC, PingFang SC;
  206. font-weight: 400;
  207. font-size: 24rpx;
  208. color: #FFFFFF;
  209. line-height: 24rpx;
  210. text-align: center;
  211. margin-top: 16rpx;
  212. }
  213. }
  214. }
  215. }
  216. .boxs{
  217. width: calc(100% - 48rpx);
  218. margin: 38rpx 24rpx 0;
  219. display: flex;
  220. justify-content: space-between;
  221. flex-wrap: wrap;
  222. position: relative;
  223. .box{
  224. width: calc(50% - 11rpx);
  225. padding: 40rpx 22rpx;
  226. box-sizing: border-box;
  227. background: #FFFFFF;
  228. border-radius: 8rpx;
  229. display: flex;
  230. align-items: center;
  231. margin-top: 20rpx;
  232. image{
  233. width: 90rpx;
  234. height: 88rpx;
  235. }
  236. text{
  237. font-family: PingFang-SC, PingFang-SC;
  238. font-weight: bold;
  239. font-size: 30rpx;
  240. color: #333333;
  241. line-height: 30rpx;
  242. padding-left: 24rpx;
  243. }
  244. }
  245. }
  246. }
  247. </style>