index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='智慧空调' bgColor='transparent'></cus-header>
  4. <image class="bg" :src="imgBase+'home/kongtiao_bg.png'" mode="widthFix"></image>
  5. <div class="nums">
  6. <div class="pre">空调:<span class="mr">{{8}}</span></div>
  7. <div class="pre">正常:<span class="zc">{{20}}</span></div>
  8. <div class="pre">离线:<span class="lx">{{1}}</span></div>
  9. </div>
  10. <div class="boxs" v-if="list.length">
  11. <div class="box" v-for="(item,index) in list" :key="index" :class="bgcolorCfg[item.type]" @tap="showDetail(item)">
  12. <image :src="imgCfg[item.type]" class="type" mode="widthFix"></image>
  13. <div class="place">{{item.place}}</div>
  14. <div class="position">{{item.position}}</div>
  15. <div class="temperature" :class="{'off':item.status==2}">{{item.temperature}}℃</div>
  16. <div class="text">温度</div>
  17. <div class="btn" v-if="item.status==1">
  18. <div class="circle"></div>
  19. <text style="margin-left: 4rpx;">ON</text>
  20. </div>
  21. <div class="btn" v-else-if="item.status==2">
  22. <text style="margin-right: 4rpx;">OFF</text>
  23. <div class="circle off"></div>
  24. </div>
  25. </div>
  26. </div>
  27. <template v-else>
  28. <page-empty :height="'calc(100vh - '+(mt+65)+'px)'" marginTop="65px"></page-empty>
  29. </template>
  30. <u-popup :show="show" mode="bottom" :round="40" @close="ktClose">
  31. <div class="kt_info">
  32. <div class="top">
  33. <div class="left">
  34. <image :src="imgBase+'home/kongtiao_kt.png'"></image>
  35. <div class="addr">
  36. <text>{{ktInfo.place}}</text>
  37. <text class="ts">{{ktInfo.position}}</text>
  38. </div>
  39. </div>
  40. <div class="right" @tap="ktClose">
  41. <u-icon name="close" color="#333333" size="48"></u-icon>
  42. </div>
  43. </div>
  44. <template v-if="!setShow">
  45. <image class="setting" :src="imgBase+'home/kongtiao_set.png'" @tap="setShow = true"></image>
  46. <div class="wendu">
  47. <TemperatureControl :temperature="27" @changeTemperature="changeTemperature"></TemperatureControl>
  48. </div>
  49. <div class="type">
  50. <div class="pre" :class="{'active':ktInfo.type==1}" @tap="changeType(1)">
  51. <image :src="imgBase+'home/kongtiao_zl_bai.png'" v-if="ktInfo.type==1"></image>
  52. <image :src="imgBase+'home/kongtiao_zl_hui.png'" v-else></image>
  53. <text>制冷</text>
  54. </div>
  55. <div class="pre" :class="{'active':ktInfo.type==2}" @tap="changeType(2)">
  56. <image :src="imgBase+'home/kongtiao_zr_bai.png'" v-if="ktInfo.type==2"></image>
  57. <image :src="imgBase+'home/kongtiao_zr_hui.png'" v-else></image>
  58. <text>制热</text>
  59. </div>
  60. <div class="pre" :class="{'active':ktInfo.type==3}" @tap="changeType(3)">
  61. <image :src="imgBase+'home/kongtiao_cs_bai.png'" v-if="ktInfo.type==3"></image>
  62. <image :src="imgBase+'home/kongtiao_cs_hui.png'" v-else></image>
  63. <text>除湿</text>
  64. </div>
  65. <div class="pre" :class="{'active':ktInfo.type==4}" @tap="changeType(4)">
  66. <image :src="imgBase+'home/kongtiao_sf_bai.png'" v-if="ktInfo.type==4"></image>
  67. <image :src="imgBase+'home/kongtiao_sf_hui.png'" v-else></image>
  68. <text>送风</text>
  69. </div>
  70. </div>
  71. <div class="speend">
  72. <text>风速</text>
  73. <image class="jian" :src="imgBase+'home/kongtiao_jian.png'" @tap="changeWindSpeend(1)"></image>
  74. <div class="area">
  75. <div class="jd" :style="{'width':speend+'%'}"></div>
  76. </div>
  77. <image class="jia" :src="imgBase+'home/kongtiao_jia.png'" @tap="changeWindSpeend(2)"></image>
  78. </div>
  79. <div class="btns">
  80. <div class="btn" :class="{'blue':wtype==1}" @tap="changeWindFx(1)">左右扫风</div>
  81. <image :src="imgBase+'home/kongtiao_open1.png'" v-if="ktInfo.status==1" @tap="control(1)"></image>
  82. <image :src="imgBase+'home/kongtiao_open2.png'" v-else-if="ktInfo.status==2" @tap="control(2)"></image>
  83. <div class="btn" :class="{'blue':wtype==2}" @tap="changeWindFx(2)">上下扫风</div>
  84. </div>
  85. </template>
  86. <template v-else>
  87. <div class="form">
  88. <div class="item">
  89. <div class="left">所属楼栋</div>
  90. <div class="right">
  91. <input type="text" placeholder="请输入楼栋">
  92. </div>
  93. </div>
  94. <div class="item">
  95. <div class="left">所属楼层</div>
  96. <div class="right">
  97. <input type="text" placeholder="请输入楼层">
  98. </div>
  99. </div>
  100. <div class="item">
  101. <div class="left">房间号</div>
  102. <div class="right">
  103. <input type="text" placeholder="请输入房间号">
  104. </div>
  105. </div>
  106. <div class="item">
  107. <div class="left">设备序列号</div>
  108. <div class="right">
  109. <input type="text" placeholder="请输入设备序列号">
  110. </div>
  111. </div>
  112. <div class="item">
  113. <div class="left">空调名称</div>
  114. <div class="right">
  115. <input type="text" placeholder="请输入空调名称">
  116. </div>
  117. </div>
  118. <div class="item">
  119. <div class="left">空调编号</div>
  120. <div class="right">
  121. <input type="text" placeholder="请输入空调编号">
  122. </div>
  123. </div>
  124. <div class="item">
  125. <div class="left">是否为公共区域</div>
  126. <div class="right">
  127. <u-switch></u-switch>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="confirm" @tap="confirmSet">确定</div>
  132. </template>
  133. </div>
  134. </u-popup>
  135. </view>
  136. </template>
  137. <script>
  138. import TemperatureControl from '@/pagesHome/components/TemperatureControl/index.vue'
  139. export default {
  140. components:{
  141. TemperatureControl
  142. },
  143. data(){
  144. return {
  145. imgCfg:{
  146. 1:this.$imgBase+'home/kongtiao_cold.png',
  147. 2:this.$imgBase+'home/kongtiao_sun.png',
  148. 3:this.$imgBase+'home/kongtiao_water.png',
  149. 4:this.$imgBase+'home/kongtiao_wind.png'
  150. },
  151. bgcolorCfg:{
  152. 1:'cold',
  153. 2:'hot',
  154. 3:'water',
  155. 4:'wind'
  156. },
  157. list:[
  158. {
  159. place:'B#/13F1301',
  160. position:'传秀-指挥中心东',
  161. temperature:18,
  162. status:1,//1开启 2关闭
  163. type:1//1制冷 2制热 3除湿 4送风
  164. },
  165. {
  166. place:'B#/13F1302',
  167. position:'传秀-指挥中心南',
  168. temperature:20.5,
  169. status:2,//1开启 2关闭
  170. type:3//1制冷 2制热 3除湿 4送风
  171. },
  172. {
  173. place:'B#/13F1303',
  174. position:'传秀-指挥中心西',
  175. temperature:28,
  176. status:1,//1开启 2关闭
  177. type:4//1制冷 2制热 3除湿 4送风
  178. },
  179. {
  180. place:'B#/13F1304',
  181. position:'传秀-指挥中心北',
  182. temperature:28,
  183. status:1,//1开启 2关闭
  184. type:2//1制冷 2制热 3除湿 4送风
  185. }
  186. ],
  187. show:false,
  188. setShow:false,
  189. ktInfo:{},
  190. speend:20,
  191. wtype:1
  192. }
  193. },
  194. methods:{
  195. showDetail(item){
  196. this.ktInfo = JSON.parse(JSON.stringify(item));
  197. if(item.status==2){
  198. this.speend = 0;
  199. this.wtype = '';
  200. this.ktInfo.type = '';
  201. }
  202. this.show = true;
  203. },
  204. changeType(type){
  205. if(this.ktInfo.status==2) return
  206. this.ktInfo.type = type;
  207. },
  208. changeWindSpeend(type){
  209. if(this.ktInfo.status==2) return
  210. if(type==1){
  211. if(this.speend<=20) return
  212. this.speend-=20;
  213. }else if(type==2){
  214. if(this.speend==100) return
  215. this.speend+=20;
  216. }
  217. },
  218. changeWindFx(type){
  219. if(this.ktInfo.status==2) return
  220. this.wtype = type;
  221. },
  222. control(type){
  223. this.show = false;
  224. },
  225. ktClose(){
  226. this.setShow = false;
  227. this.show = false;
  228. },
  229. confirmSet(){
  230. this.setShow = false;
  231. },
  232. changeTemperature(temperature){
  233. console.log(temperature,'temperature');
  234. }
  235. }
  236. }
  237. </script>
  238. <style scoped lang="less">
  239. .page{
  240. width: 100%;
  241. padding: 0 24rpx 20rpx;
  242. box-sizing: border-box;
  243. background: #F4F8FB;
  244. .bg{
  245. width: 100%;
  246. position: fixed;
  247. top: 0;
  248. left: 0;
  249. z-index: 0;
  250. }
  251. .nums{
  252. width: 100%;
  253. background: #FFFFFF;
  254. border-radius: 16rpx;
  255. padding: 37rpx 24rpx;
  256. box-sizing: border-box;
  257. display: flex;
  258. margin-top: 20rpx;
  259. position: relative;
  260. .pre{
  261. width: calc(100% / 3);
  262. font-family: PingFangSC, PingFang SC;
  263. font-weight: 400;
  264. font-size: 30rpx;
  265. color: #4E5969;
  266. line-height: 36rpx;
  267. text-align: left;
  268. span{
  269. font-family: PingFang-SC, PingFang-SC;
  270. font-weight: bold;
  271. font-size: 32rpx;
  272. line-height: 36rpx;
  273. text-align: left;
  274. &.mr{
  275. color: #1D2129;
  276. }
  277. &.zc{
  278. color: #14CC8C;
  279. }
  280. &.lx{
  281. color: #F95050;
  282. }
  283. }
  284. }
  285. }
  286. .boxs{
  287. position: relative;
  288. display: flex;
  289. flex-wrap: wrap;
  290. justify-content: space-between;
  291. margin-top: 4rpx;
  292. .box{
  293. width: calc(50% - 11rpx);
  294. box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(35,130,255,0.1), inset 0rpx 3rpx 3rpx 0rpx #FFFFFF;
  295. border-radius: 16rpx;
  296. margin-top: 20rpx;
  297. padding: 32rpx 21rpx 42rpx 29rpx;
  298. box-sizing: border-box;
  299. position: relative;
  300. &.cold{
  301. background: linear-gradient( 180deg, #D7EBFF 0%, #FFFFFF 100%);
  302. }
  303. &.hot{
  304. background: linear-gradient( 180deg, #FFE7E4 0%, #FFFFFF 100%);
  305. }
  306. &.water{
  307. background: linear-gradient( 180deg, #ECF2F7 0%, #FFFFFF 100%);
  308. }
  309. &.wind{
  310. background: linear-gradient( 180deg, #ECF2F7 0%, #FFFFFF 100%);
  311. }
  312. .type{
  313. width: 164rpx;
  314. height: 164rpx;
  315. position: absolute;
  316. top: 0;
  317. right: 0;
  318. z-index: 9;
  319. }
  320. .place{
  321. font-family: PingFang-SC, PingFang-SC;
  322. font-weight: bold;
  323. font-size: 30rpx;
  324. color: #1D2129;
  325. line-height: 42rpx;
  326. white-space: nowrap;
  327. overflow: hidden;
  328. text-overflow: ellipsis;
  329. }
  330. .position{
  331. font-family: PingFangSC, PingFang SC;
  332. font-weight: 400;
  333. font-size: 24rpx;
  334. color: #86909C;
  335. line-height: 33rpx;
  336. white-space: nowrap;
  337. overflow: hidden;
  338. text-overflow: ellipsis;
  339. margin-top: 16rpx;
  340. }
  341. .temperature{
  342. font-family: PingFang-SC, PingFang-SC;
  343. font-weight: bold;
  344. font-size: 54rpx;
  345. color: #198CFF;
  346. line-height: 64rpx;
  347. margin-top: 33rpx;
  348. &.off{
  349. color: #4E5969;
  350. }
  351. }
  352. .text{
  353. font-family: PingFangSC, PingFang SC;
  354. font-weight: 400;
  355. font-size: 24rpx;
  356. color: #86909C;
  357. line-height: 33rpx;
  358. margin-top: 9rpx;
  359. }
  360. .btn{
  361. width: 98rpx;
  362. height: 54rpx;
  363. background: #FFFFFF;
  364. box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.06), inset 0rpx 2rpx 4rpx 0rpx #FFFFFF, inset 0rpx -1rpx 1rpx 0rpx #FFFFFF;
  365. border-radius: 27rpx;
  366. display: flex;
  367. align-items: center;
  368. justify-content: center;
  369. position: absolute;
  370. right: 21rpx;
  371. bottom: 40rpx;
  372. .circle{
  373. width: 24rpx;
  374. height: 24rpx;
  375. background: #6FDD93;
  376. border-radius: 50%;
  377. &.off{
  378. background: #CCCCCC;
  379. }
  380. }
  381. text{
  382. font-family: PingFang-SC, PingFang-SC;
  383. font-weight: bold;
  384. font-size: 24rpx;
  385. color: #1D2129;
  386. line-height: 33rpx;
  387. }
  388. }
  389. }
  390. }
  391. .kt_info{
  392. width: 100%;
  393. padding: 40rpx 30rpx 65rpx;
  394. box-sizing: border-box;
  395. background: #FFFFFF;
  396. position: relative;
  397. border-radius: 40rpx 40rpx 0 0;
  398. .top{
  399. display: flex;
  400. justify-content: space-between;
  401. .left{
  402. display: flex;
  403. image{
  404. width: 72rpx;
  405. height: 72rpx;
  406. }
  407. .addr{
  408. display: flex;
  409. flex-direction: column;
  410. margin-left: 20rpx;
  411. text{
  412. font-family: PingFang-SC, PingFang-SC;
  413. font-weight: bold;
  414. font-size: 30rpx;
  415. color: #1D2129;
  416. line-height: 42rpx;
  417. text-align: left;
  418. &.ts{
  419. font-weight: 400;
  420. font-size: 24rpx;
  421. color: #86909C;
  422. margin-top: 16rpx;
  423. }
  424. }
  425. }
  426. }
  427. }
  428. .setting{
  429. width: 48rpx;
  430. height: 48rpx;
  431. position: absolute;
  432. right: 30rpx;
  433. top: 165rpx;
  434. z-index: 9;
  435. }
  436. .wendu{
  437. width: 484rpx;
  438. height: 484rpx;
  439. margin: 69rpx auto 0;
  440. }
  441. .type{
  442. display: flex;
  443. justify-content: space-around;
  444. margin-top: 20rpx;
  445. .pre{
  446. width: calc(25% - 20rpx);
  447. margin: 0 10rpx;
  448. padding: 36rpx 0;
  449. display: flex;
  450. flex-direction: column;
  451. align-items: center;
  452. background: linear-gradient( 180deg, #ECF2F7 0%, #FFFFFF 100%);
  453. box-shadow: 0rpx 4rpx 16rpx 0rpx #EDF4FF, inset 0rpx 3rpx 3rpx 0rpx #FFFFFF;
  454. border-radius: 16rpx;
  455. border: 2rpx solid #FFFFFF;
  456. image{
  457. width: 48rpx;
  458. height: 48rpx;
  459. }
  460. text{
  461. font-family: PingFangSC, PingFang SC;
  462. font-weight: 400;
  463. font-size: 28rpx;
  464. color: #1D2129;
  465. line-height: 40rpx;
  466. text-align: center;
  467. margin-top: 16rpx;
  468. }
  469. &.active{
  470. background: #198CFF;
  471. box-shadow: 0rpx 4rpx 16rpx 4rpx #EDF4FF;
  472. text{
  473. font-weight: bold;
  474. color: #FFFFFF;
  475. }
  476. }
  477. }
  478. }
  479. .speend{
  480. width: 100%;
  481. padding-left: 20rpx;
  482. box-sizing: border-box;
  483. display: flex;
  484. align-items: center;
  485. margin-top: 80rpx;
  486. text{
  487. font-family: PingFangSC, PingFang SC;
  488. font-weight: 400;
  489. font-size: 28rpx;
  490. color: #1D2129;
  491. line-height: 40rpx;
  492. }
  493. image{
  494. width: 32rpx;
  495. height: 32rpx;
  496. margin: 0 20rpx;
  497. }
  498. .area{
  499. width: calc(100% - 200rpx);
  500. height: 20rpx;
  501. background: #EDF4FF;
  502. border-radius: 16rpx;
  503. position: relative;
  504. .jd{
  505. height: 100%;
  506. border-radius: 16rpx;
  507. background: linear-gradient( 90deg, #3A8DFF 0%, #0BC6FF 100%);
  508. box-shadow: 0rpx 4rpx 16rpx 4rpx #EFEFEF;
  509. position: absolute;
  510. left: 0;
  511. top: 0;
  512. }
  513. }
  514. }
  515. .btns{
  516. display: flex;
  517. align-items: center;
  518. justify-content: space-between;
  519. margin-top: 28rpx;
  520. .btn{
  521. width: 210rpx;
  522. height: 88rpx;
  523. background: #FFFFFF;
  524. box-shadow: 0rpx 4rpx 12rpx 4rpx #EDF4FF;
  525. border-radius: 16rpx;
  526. font-family: PingFangSC, PingFang SC;
  527. font-weight: 400;
  528. font-size: 28rpx;
  529. color: #1D2129;
  530. line-height: 88rpx;
  531. text-align: center;
  532. &.blue{
  533. background: #198CFF;
  534. color: #FFFFFF;
  535. }
  536. }
  537. image{
  538. width: 170rpx;
  539. height: 170rpx;
  540. }
  541. }
  542. .form{
  543. margin-top: 72rpx;
  544. .item{
  545. width: 100%;
  546. padding: 28rpx 30rpx;
  547. box-sizing: border-box;
  548. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EDF4FF;
  549. display: flex;
  550. align-items: center;
  551. justify-content: space-between;
  552. .left{
  553. font-family: PingFangSC, PingFang SC;
  554. font-weight: 400;
  555. font-size: 30rpx;
  556. color: #1D2129;
  557. line-height: 42rpx;
  558. letter-spacing: 2rpx;
  559. }
  560. .right{
  561. input{
  562. outline: none;
  563. border: none;
  564. font-family: PingFangSC, PingFang SC;
  565. font-weight: 400;
  566. font-size: 30rpx;
  567. color: #4E5969;
  568. line-height: 42rpx;
  569. text-align: right;
  570. }
  571. }
  572. }
  573. }
  574. .confirm{
  575. width: calc(100% - 48rpx);
  576. height: 88rpx;
  577. background: #198CFF;
  578. border-radius: 16rpx;
  579. margin: 234rpx 24rpx 0;
  580. font-family: PingFang-SC, PingFang-SC;
  581. font-weight: bold;
  582. font-size: 32rpx;
  583. color: #FFFFFF;
  584. line-height: 88rpx;
  585. text-align: center;
  586. letter-spacing: 2rpx;
  587. }
  588. }
  589. }
  590. </style>