index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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.wea||''}},共有{{deviceNum}}个设备正在运行</div> -->
  13. <div class="tip">{{time}},天气{{weatherInfo.wea||''}}</div>
  14. </div>
  15. <div class="right" @tap="tuTurn('/pages/my/info')">
  16. <image :src="avatar"></image>
  17. </div>
  18. </div>
  19. <div class="weather">
  20. <div class="item line">
  21. <div class="text">{{weatherInfo.air_level||''}}</div>
  22. <p>空气质量</p>
  23. </div>
  24. <div class="item line">
  25. <div class="text">{{weatherInfo.tem||''}}<span>℃</span></div>
  26. <p>温度</p>
  27. </div>
  28. <div class="item">
  29. <div class="text">{{weatherInfo.humidity||''}}<span>%</span></div>
  30. <p>湿度</p>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="boxs">
  35. <div class="box" @tap="tuTurn('/pagesHome/video/index')">
  36. <div class="left">
  37. <image :src="imgBase+'home/home_icon_spjk.png'"></image>
  38. <text>视频监控</text>
  39. </div>
  40. <div class="right">
  41. <!-- <div class="num">{{18}}</div>
  42. <div class="wz">设备</div> -->
  43. </div>
  44. </div>
  45. <div class="box" @tap="tuTurn('/pagesHome/airConditioner/index')">
  46. <div class="left">
  47. <image :src="imgBase+'home/home_icon_zhkt.png'"></image>
  48. <text>智慧空调</text>
  49. </div>
  50. <div class="right">
  51. <!-- <div class="num">{{18}}</div>
  52. <div class="wz">设备</div> -->
  53. </div>
  54. </div>
  55. <div class="box" @tap="tuTurn('/pagesHome/entranceGuard/index')">
  56. <div class="left">
  57. <image :src="imgBase+'home/home_icon_mjgl.png'"></image>
  58. <text>门禁管理</text>
  59. </div>
  60. <div class="right">
  61. <!-- <div class="num">{{18}}</div>
  62. <div class="wz">设备</div> -->
  63. </div>
  64. </div>
  65. <div class="box" @tap="tuTurn('/pagesHome/energyMeter/index')">
  66. <div class="left">
  67. <image :src="imgBase+'home/home_icon_db.png'"></image>
  68. <text>电表</text>
  69. </div>
  70. <div class="right">
  71. <!-- <div class="num">{{18}}</div>
  72. <div class="wz">设备</div> -->
  73. </div>
  74. </div>
  75. <div class="box" @tap="tuTurn('/pagesHome/energyConsumption/index')">
  76. <div class="left">
  77. <image :src="imgBase+'home/home_icon_nhfx.png'"></image>
  78. <text>能耗分析</text>
  79. </div>
  80. <div class="right">
  81. <!-- <div class="num">{{18}}</div>
  82. <div class="wz">设备</div> -->
  83. </div>
  84. </div>
  85. <div class="box" @tap="tuTurn('/pagesHome/employee/index')">
  86. <div class="left">
  87. <image :src="imgBase+'home/home_icon_yggl.png'"></image>
  88. <text>员工管理</text>
  89. </div>
  90. <div class="right">
  91. <!-- <div class="num">{{18}}</div>
  92. <div class="wz">设备</div> -->
  93. </div>
  94. </div>
  95. </div>
  96. <Tabbar :tabbarIndex="0"></Tabbar>
  97. </view>
  98. </template>
  99. <script>
  100. var amapFile = require('@/utils/amap-wx.130.js');
  101. import Tabbar from '@/components/CusTabbar/index.vue'
  102. export default {
  103. components:{
  104. Tabbar
  105. },
  106. data(){
  107. return {
  108. avatar:this.$imgBase+'home/home_avator.png',
  109. time:'早上好',
  110. deviceNum:0,
  111. weatherInfo:{}
  112. }
  113. },
  114. onShow() {
  115. this.avatar = JSON.parse(uni.getStorageSync('userInfo')||'{}')?.headUrl;
  116. },
  117. onLoad() {
  118. this.getTime();
  119. this.getWeather();
  120. },
  121. methods:{
  122. getTime(){
  123. let hours = new Date().getHours()+1;
  124. if(hours<=8) this.time = '早上好';
  125. else if(hours<=11) this.time = '上午好';
  126. else if(hours<=13) this.time = '中午好';
  127. else if(hours<=18) this.time = '下午好';
  128. else if(hours<=24) this.time = '晚上好';
  129. },
  130. getWeather(){
  131. // uni.request({
  132. // url:'http://gfeljm.tianqiapi.com/free/v2030?appid=31449887&appsecret=7F6JCrvB&adcode=340100000000',
  133. // success:res=>{
  134. // this.weatherInfo = res.data;
  135. // this.weatherInfo.humidity = this.weatherInfo.humidity.replace('%','')
  136. // }
  137. // })
  138. var myAmapFun = new amapFile.AMapWX({key:'f83be04fc5f239edfa9f1201e4bc7c47'});
  139. myAmapFun.getWeather({
  140. success: function(data) {
  141. console.log(data);
  142. }
  143. })
  144. },
  145. tuTurn(url){
  146. if(!url) return
  147. uni.navigateTo({ url });
  148. }
  149. }
  150. }
  151. </script>
  152. <style scoped lang="less">
  153. .tabPage{
  154. width: 100%;
  155. padding: 0 0 188rpx;
  156. box-sizing: border-box;
  157. background: #F4F8FB;
  158. .topbg{
  159. width: 100%;
  160. position: fixed;
  161. top: 0;
  162. left: 0;
  163. z-index: 0;
  164. }
  165. .header{
  166. width: 100%;
  167. position: relative;
  168. .top{
  169. width: 100%;
  170. padding: 26rpx 40rpx 0;
  171. box-sizing: border-box;
  172. display: flex;
  173. align-items: center;
  174. justify-content: space-between;
  175. .left{
  176. .title{
  177. display: flex;
  178. align-items: center;
  179. text{
  180. font-family: PingFang-SC, PingFang-SC;
  181. font-weight: bold;
  182. font-size: 48rpx;
  183. color: #FFFFFF;
  184. line-height: 48rpx;
  185. text-align: left;
  186. letter-spacing: 2rpx;
  187. margin-right: 20rpx;
  188. }
  189. }
  190. .tip{
  191. font-family: PingFangSC, PingFang SC;
  192. font-weight: 400;
  193. font-size: 24rpx;
  194. color: #FFFFFF;
  195. line-height: 30rpx;
  196. text-align: left;
  197. margin-top: 20rpx;
  198. }
  199. }
  200. .right{
  201. width: 90rpx;
  202. height: 90rpx;
  203. background: #FFFFFF;
  204. padding: 2rpx;
  205. box-sizing: border-box;
  206. border-radius: 50%;
  207. image{
  208. width: 100%;
  209. height: 100%;
  210. border-radius: 50%;
  211. }
  212. }
  213. }
  214. .weather{
  215. width: 100%;
  216. margin-top: 50rpx;
  217. display: flex;
  218. .item{
  219. width: calc(100% / 3);
  220. display: flex;
  221. flex-direction: column;
  222. align-items: center;
  223. position: relative;
  224. &::after{
  225. content: '';
  226. width: 1rpx;
  227. height: 64rpx;
  228. background: #CCCCCC;
  229. position: absolute;
  230. top:10rpx;
  231. right: 0;
  232. }
  233. .text{
  234. font-family: PingFang-SC, PingFang-SC;
  235. font-weight: bold;
  236. font-size: 44rpx;
  237. color: #FFFFFF;
  238. line-height: 44rpx;
  239. span{
  240. font-weight: 400;
  241. font-size: 20rpx;
  242. }
  243. }
  244. p{
  245. font-family: PingFangSC, PingFang SC;
  246. font-weight: 400;
  247. font-size: 24rpx;
  248. color: #FFFFFF;
  249. line-height: 24rpx;
  250. text-align: center;
  251. margin-top: 16rpx;
  252. }
  253. }
  254. }
  255. }
  256. .boxs{
  257. width: calc(100% - 48rpx);
  258. margin: 20rpx 24rpx 0;
  259. display: flex;
  260. justify-content: space-between;
  261. flex-wrap: wrap;
  262. position: relative;
  263. .box{
  264. width: calc(50% - 11rpx);
  265. padding: 36rpx 25rpx 40rpx 22rpx;
  266. box-sizing: border-box;
  267. background: #FFFFFF;
  268. border-radius: 8rpx;
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: flex-end;
  272. margin-top: 20rpx;
  273. .left{
  274. display: flex;
  275. flex-direction: column;
  276. image{
  277. width: 90rpx;
  278. height: 88rpx;
  279. }
  280. text{
  281. font-family: PingFang-SC, PingFang-SC;
  282. font-weight: bold;
  283. font-size: 28rpx;
  284. color: #333333;
  285. line-height: 28rpx;
  286. text-align: left;
  287. margin-top: 24rpx;
  288. padding-left: 2rpx;
  289. }
  290. }
  291. .right{
  292. display: flex;
  293. flex-direction: column;
  294. align-items: center;
  295. .num{
  296. font-family: PingFangSC, PingFang SC;
  297. font-weight: 400;
  298. font-size: 32rpx;
  299. color: #333333;
  300. line-height: 32rpx;
  301. text-align: center;
  302. }
  303. .wz{
  304. font-family: PingFangSC, PingFang SC;
  305. font-weight: 400;
  306. font-size: 24rpx;
  307. color: #999999;
  308. line-height: 24rpx;
  309. text-align: center;
  310. margin-top: 24rpx;
  311. }
  312. }
  313. }
  314. }
  315. }
  316. </style>