index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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="this.ktInfo.temperature" @changeTemperature="changeTemperature" ref="tcRef"></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. this.$refs.tcRef.sjTemperature = item.temperature;
  204. this.$refs.tcRef.init();
  205. },
  206. changeType(type){
  207. if(this.ktInfo.status==2) return
  208. this.ktInfo.type = type;
  209. },
  210. changeWindSpeend(type){
  211. if(this.ktInfo.status==2) return
  212. if(type==1){
  213. if(this.speend<=20) return
  214. this.speend-=20;
  215. }else if(type==2){
  216. if(this.speend==100) return
  217. this.speend+=20;
  218. }
  219. },
  220. changeWindFx(type){
  221. if(this.ktInfo.status==2) return
  222. this.wtype = type;
  223. },
  224. control(type){
  225. this.show = false;
  226. },
  227. ktClose(){
  228. this.setShow = false;
  229. this.show = false;
  230. },
  231. confirmSet(){
  232. this.setShow = false;
  233. },
  234. changeTemperature(temperature){
  235. console.log(temperature,'temperature');
  236. }
  237. }
  238. }
  239. </script>
  240. <style scoped lang="less">
  241. .page{
  242. width: 100%;
  243. padding: 0 24rpx 20rpx;
  244. box-sizing: border-box;
  245. background: #F4F8FB;
  246. .bg{
  247. width: 100%;
  248. position: fixed;
  249. top: 0;
  250. left: 0;
  251. z-index: 0;
  252. }
  253. .nums{
  254. width: 100%;
  255. background: #FFFFFF;
  256. border-radius: 16rpx;
  257. padding: 37rpx 24rpx;
  258. box-sizing: border-box;
  259. display: flex;
  260. margin-top: 20rpx;
  261. position: relative;
  262. .pre{
  263. width: calc(100% / 3);
  264. font-family: PingFangSC, PingFang SC;
  265. font-weight: 400;
  266. font-size: 30rpx;
  267. color: #4E5969;
  268. line-height: 36rpx;
  269. text-align: left;
  270. span{
  271. font-family: PingFang-SC, PingFang-SC;
  272. font-weight: bold;
  273. font-size: 32rpx;
  274. line-height: 36rpx;
  275. text-align: left;
  276. &.mr{
  277. color: #1D2129;
  278. }
  279. &.zc{
  280. color: #14CC8C;
  281. }
  282. &.lx{
  283. color: #F95050;
  284. }
  285. }
  286. }
  287. }
  288. .boxs{
  289. position: relative;
  290. display: flex;
  291. flex-wrap: wrap;
  292. justify-content: space-between;
  293. margin-top: 4rpx;
  294. .box{
  295. width: calc(50% - 11rpx);
  296. box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(35,130,255,0.1), inset 0rpx 3rpx 3rpx 0rpx #FFFFFF;
  297. border-radius: 16rpx;
  298. margin-top: 20rpx;
  299. padding: 32rpx 21rpx 42rpx 29rpx;
  300. box-sizing: border-box;
  301. position: relative;
  302. &.cold{
  303. background: linear-gradient( 180deg, #D7EBFF 0%, #FFFFFF 100%);
  304. }
  305. &.hot{
  306. background: linear-gradient( 180deg, #FFE7E4 0%, #FFFFFF 100%);
  307. }
  308. &.water{
  309. background: linear-gradient( 180deg, #ECF2F7 0%, #FFFFFF 100%);
  310. }
  311. &.wind{
  312. background: linear-gradient( 180deg, #ECF2F7 0%, #FFFFFF 100%);
  313. }
  314. .type{
  315. width: 164rpx;
  316. height: 164rpx;
  317. position: absolute;
  318. top: 0;
  319. right: 0;
  320. z-index: 9;
  321. }
  322. .place{
  323. font-family: PingFang-SC, PingFang-SC;
  324. font-weight: bold;
  325. font-size: 30rpx;
  326. color: #1D2129;
  327. line-height: 42rpx;
  328. white-space: nowrap;
  329. overflow: hidden;
  330. text-overflow: ellipsis;
  331. }
  332. .position{
  333. font-family: PingFangSC, PingFang SC;
  334. font-weight: 400;
  335. font-size: 24rpx;
  336. color: #86909C;
  337. line-height: 33rpx;
  338. white-space: nowrap;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. margin-top: 16rpx;
  342. }
  343. .temperature{
  344. font-family: PingFang-SC, PingFang-SC;
  345. font-weight: bold;
  346. font-size: 54rpx;
  347. color: #198CFF;
  348. line-height: 64rpx;
  349. margin-top: 33rpx;
  350. &.off{
  351. color: #4E5969;
  352. }
  353. }
  354. .text{
  355. font-family: PingFangSC, PingFang SC;
  356. font-weight: 400;
  357. font-size: 24rpx;
  358. color: #86909C;
  359. line-height: 33rpx;
  360. margin-top: 9rpx;
  361. }
  362. .btn{
  363. width: 98rpx;
  364. height: 54rpx;
  365. background: #FFFFFF;
  366. box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.06), inset 0rpx 2rpx 4rpx 0rpx #FFFFFF, inset 0rpx -1rpx 1rpx 0rpx #FFFFFF;
  367. border-radius: 27rpx;
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. position: absolute;
  372. right: 21rpx;
  373. bottom: 40rpx;
  374. .circle{
  375. width: 24rpx;
  376. height: 24rpx;
  377. background: #6FDD93;
  378. border-radius: 50%;
  379. &.off{
  380. background: #CCCCCC;
  381. }
  382. }
  383. text{
  384. font-family: PingFang-SC, PingFang-SC;
  385. font-weight: bold;
  386. font-size: 24rpx;
  387. color: #1D2129;
  388. line-height: 33rpx;
  389. }
  390. }
  391. }
  392. }
  393. .kt_info{
  394. width: 100%;
  395. padding: 40rpx 30rpx 65rpx;
  396. box-sizing: border-box;
  397. background: #FFFFFF;
  398. position: relative;
  399. border-radius: 40rpx 40rpx 0 0;
  400. .top{
  401. display: flex;
  402. justify-content: space-between;
  403. .left{
  404. display: flex;
  405. image{
  406. width: 72rpx;
  407. height: 72rpx;
  408. }
  409. .addr{
  410. display: flex;
  411. flex-direction: column;
  412. margin-left: 20rpx;
  413. text{
  414. font-family: PingFang-SC, PingFang-SC;
  415. font-weight: bold;
  416. font-size: 30rpx;
  417. color: #1D2129;
  418. line-height: 42rpx;
  419. text-align: left;
  420. &.ts{
  421. font-weight: 400;
  422. font-size: 24rpx;
  423. color: #86909C;
  424. margin-top: 16rpx;
  425. }
  426. }
  427. }
  428. }
  429. }
  430. .setting{
  431. width: 48rpx;
  432. height: 48rpx;
  433. position: absolute;
  434. right: 30rpx;
  435. top: 165rpx;
  436. z-index: 9;
  437. }
  438. .wendu{
  439. width: 484rpx;
  440. height: 484rpx;
  441. margin: 69rpx auto 0;
  442. }
  443. .type{
  444. display: flex;
  445. justify-content: space-around;
  446. margin-top: 20rpx;
  447. .pre{
  448. width: calc(25% - 20rpx);
  449. margin: 0 10rpx;
  450. padding: 36rpx 0;
  451. display: flex;
  452. flex-direction: column;
  453. align-items: center;
  454. background: linear-gradient( 180deg, #ECF2F7 0%, #FFFFFF 100%);
  455. box-shadow: 0rpx 4rpx 16rpx 0rpx #EDF4FF, inset 0rpx 3rpx 3rpx 0rpx #FFFFFF;
  456. border-radius: 16rpx;
  457. border: 2rpx solid #FFFFFF;
  458. image{
  459. width: 48rpx;
  460. height: 48rpx;
  461. }
  462. text{
  463. font-family: PingFangSC, PingFang SC;
  464. font-weight: 400;
  465. font-size: 28rpx;
  466. color: #1D2129;
  467. line-height: 40rpx;
  468. text-align: center;
  469. margin-top: 16rpx;
  470. }
  471. &.active{
  472. background: #198CFF;
  473. box-shadow: 0rpx 4rpx 16rpx 4rpx #EDF4FF;
  474. text{
  475. font-weight: bold;
  476. color: #FFFFFF;
  477. }
  478. }
  479. }
  480. }
  481. .speend{
  482. width: 100%;
  483. padding-left: 20rpx;
  484. box-sizing: border-box;
  485. display: flex;
  486. align-items: center;
  487. margin-top: 80rpx;
  488. text{
  489. font-family: PingFangSC, PingFang SC;
  490. font-weight: 400;
  491. font-size: 28rpx;
  492. color: #1D2129;
  493. line-height: 40rpx;
  494. }
  495. image{
  496. width: 32rpx;
  497. height: 32rpx;
  498. margin: 0 20rpx;
  499. }
  500. .area{
  501. width: calc(100% - 200rpx);
  502. height: 20rpx;
  503. background: #EDF4FF;
  504. border-radius: 16rpx;
  505. position: relative;
  506. .jd{
  507. height: 100%;
  508. border-radius: 16rpx;
  509. background: linear-gradient( 90deg, #3A8DFF 0%, #0BC6FF 100%);
  510. box-shadow: 0rpx 4rpx 16rpx 4rpx #EFEFEF;
  511. position: absolute;
  512. left: 0;
  513. top: 0;
  514. }
  515. }
  516. }
  517. .btns{
  518. display: flex;
  519. align-items: center;
  520. justify-content: space-between;
  521. margin-top: 28rpx;
  522. .btn{
  523. width: 210rpx;
  524. height: 88rpx;
  525. background: #FFFFFF;
  526. box-shadow: 0rpx 4rpx 12rpx 4rpx #EDF4FF;
  527. border-radius: 16rpx;
  528. font-family: PingFangSC, PingFang SC;
  529. font-weight: 400;
  530. font-size: 28rpx;
  531. color: #1D2129;
  532. line-height: 88rpx;
  533. text-align: center;
  534. &.blue{
  535. background: #198CFF;
  536. color: #FFFFFF;
  537. }
  538. }
  539. image{
  540. width: 170rpx;
  541. height: 170rpx;
  542. }
  543. }
  544. .form{
  545. margin-top: 72rpx;
  546. .item{
  547. width: 100%;
  548. padding: 28rpx 30rpx;
  549. box-sizing: border-box;
  550. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EDF4FF;
  551. display: flex;
  552. align-items: center;
  553. justify-content: space-between;
  554. .left{
  555. font-family: PingFangSC, PingFang SC;
  556. font-weight: 400;
  557. font-size: 30rpx;
  558. color: #1D2129;
  559. line-height: 42rpx;
  560. letter-spacing: 2rpx;
  561. }
  562. .right{
  563. input{
  564. outline: none;
  565. border: none;
  566. font-family: PingFangSC, PingFang SC;
  567. font-weight: 400;
  568. font-size: 30rpx;
  569. color: #4E5969;
  570. line-height: 42rpx;
  571. text-align: right;
  572. }
  573. }
  574. }
  575. }
  576. .confirm{
  577. width: calc(100% - 48rpx);
  578. height: 88rpx;
  579. background: #198CFF;
  580. border-radius: 16rpx;
  581. margin: 234rpx 24rpx 0;
  582. font-family: PingFang-SC, PingFang-SC;
  583. font-weight: bold;
  584. font-size: 32rpx;
  585. color: #FFFFFF;
  586. line-height: 88rpx;
  587. text-align: center;
  588. letter-spacing: 2rpx;
  589. }
  590. }
  591. }
  592. </style>