demo.wpy 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <style lang="less">
  2. page {
  3. height: 100%;
  4. background-color: #eceff4;
  5. }
  6. .pagedemo {
  7. position: relative;
  8. width: 100%;
  9. image {
  10. width: 100%;
  11. }
  12. .backDiv {
  13. position: absolute;
  14. top: 50px;
  15. left: 10px;
  16. height: 36px;
  17. width: 40px;
  18. z-index: 2;
  19. }
  20. .mainWrap {
  21. position: absolute;
  22. top: 0;
  23. left: 0;
  24. width: 100%;
  25. box-sizing: border-box;
  26. bottom: 0;
  27. z-index: 1;
  28. padding: 592rpx 44rpx 0 44rpx;
  29. .top {
  30. height: 226rpx;
  31. margin-bottom: 15px;
  32. position: relative;
  33. .chartDiv {
  34. position: absolute;
  35. height: 80px;
  36. bottom: 0;
  37. left: 0;
  38. width: 100%;
  39. }
  40. .serviceDiv {
  41. position: absolute;
  42. height: 20px;
  43. top: 9px;
  44. right: 20px;
  45. width: 110px;
  46. }
  47. }
  48. .air {
  49. height: 520rpx;
  50. margin-bottom: 15px;
  51. position: relative;
  52. .openButton {
  53. position: absolute;
  54. top: 93px;
  55. right: 15px;
  56. width: 50px;
  57. height: 44px;
  58. }
  59. .downCold {
  60. position: absolute;
  61. top: 149px;
  62. right: 76px;
  63. width: 40px;
  64. height: 40px;
  65. }
  66. .upHot {
  67. position: absolute;
  68. top: 149px;
  69. right: 15px;
  70. width: 40px;
  71. height: 40px;
  72. }
  73. .xiaoWind {
  74. position: absolute;
  75. bottom: 9px;
  76. right: 76px;
  77. width: 40px;
  78. height: 40px;
  79. }
  80. .daWind {
  81. position: absolute;
  82. bottom: 9px;
  83. right: 15px;
  84. width: 40px;
  85. height: 40px;
  86. }
  87. }
  88. .lamp {
  89. height: 456rpx;
  90. margin-bottom: 15px;
  91. position: relative;
  92. .openButton {
  93. position: absolute;
  94. top: 91px;
  95. right: 15px;
  96. width: 50px;
  97. height: 42px;
  98. }
  99. .closeButton {
  100. position: absolute;
  101. top: 140px;
  102. right: 15px;
  103. width: 50px;
  104. height: 66px;
  105. }
  106. }
  107. .curtain {
  108. height: 280rpx;
  109. margin-bottom: 15px;
  110. position: relative;
  111. .openButton {
  112. position: absolute;
  113. top: 86px;
  114. right: 14px;
  115. width: 40px;
  116. height: 40px;
  117. }
  118. .closeButton {
  119. position: absolute;
  120. top: 86px;
  121. right: 74px;
  122. width: 40px;
  123. height: 40px;
  124. }
  125. }
  126. .water {
  127. height: 280rpx;
  128. margin-bottom: 15px;
  129. position: relative;
  130. .openButton {
  131. position: absolute;
  132. bottom: 10px;
  133. right: 8px;
  134. width: 55px;
  135. height: 36px;
  136. }
  137. }
  138. .fan {
  139. height: 280rpx;
  140. margin-bottom: 15px;
  141. position: relative;
  142. .openButton {
  143. position: absolute;
  144. bottom: 8px;
  145. right: 15px;
  146. width: 55px;
  147. height: 36px;
  148. }
  149. }
  150. .wet {
  151. height: 280rpx;
  152. margin-bottom: 15px;
  153. position: relative;
  154. .openButton {
  155. position: absolute;
  156. bottom: 8px;
  157. right: 15px;
  158. width: 55px;
  159. height: 36px;
  160. }
  161. }
  162. }
  163. }
  164. </style>
  165. <template>
  166. <div
  167. class="pagedemo"
  168. :style="{'height':isHome?'1905px':'500px'}"
  169. >
  170. <div
  171. class="backDiv"
  172. @click="mainBack"
  173. ></div>
  174. <image
  175. class="mainImg"
  176. :src="img"
  177. mode="widthFix"
  178. @click="mainImgShow"
  179. />
  180. <div
  181. class="mainWrap"
  182. v-show="isHome"
  183. >
  184. <div class="top">
  185. <div
  186. class="serviceDiv"
  187. @click="serviceTimeClick"
  188. ></div>
  189. <div
  190. class="chartDiv"
  191. @click="chartShowClick"
  192. ></div>
  193. </div>
  194. <div class="air">
  195. <div
  196. class="openButton"
  197. @click="airClick"
  198. ></div>
  199. <div
  200. class="downCold"
  201. @click="downCold"
  202. v-show="airOpen"
  203. ></div>
  204. <div
  205. class="upHot"
  206. @click="upHot"
  207. v-show="airOpen"
  208. ></div>
  209. <div
  210. class="xiaoWind"
  211. @click="xiaoWind"
  212. v-show="airOpen"
  213. ></div>
  214. <div
  215. class="daWind"
  216. @click="daWind"
  217. v-show="airOpen"
  218. ></div>
  219. </div>
  220. <div class="lamp">
  221. <div
  222. class="openButton"
  223. v-show="!lampOpen"
  224. @click="lampOpenClick"
  225. ></div>
  226. <div
  227. class="closeButton"
  228. v-show="lampOpen"
  229. @click="lampCloseClick"
  230. ></div>
  231. </div>
  232. <div class="curtain">
  233. <div
  234. class="openButton"
  235. @click="curtainOpenClick"
  236. ></div>
  237. <div
  238. class="closeButton"
  239. @click="curtainCloseClick"
  240. ></div>
  241. </div>
  242. <div class="water">
  243. <div
  244. class="openButton"
  245. @click="waterClick"
  246. ></div>
  247. </div>
  248. <div class="fan">
  249. <div
  250. class="openButton"
  251. @click="fanClick"
  252. ></div>
  253. </div>
  254. <div class="wet">
  255. <div
  256. class="openButton"
  257. @click="wetClick"
  258. ></div>
  259. </div>
  260. </div>
  261. </div>
  262. </template>
  263. <script>
  264. import wepy from '@wepy/core'
  265. import store from '@/store'
  266. import config from '@/config'
  267. import moment from 'moment'
  268. import { mapState } from '@wepy/x'
  269. import { checkHasUserInfo } from '@/service/user'
  270. import { saveCompanyConfig } from '@/service/companyConfig'
  271. wepy.page({
  272. store,
  273. data: {
  274. imgpath: config.h5StaticPath + '/page-officehome-demo/',
  275. img: config.h5StaticPath + '/page-officehome-demo/tiyan.png', // allopen.png
  276. isHome: false, // 是否是主页面
  277. showChart: false,
  278. serviceTime: false,
  279. airOpen: true,
  280. lampOpen: true,
  281. curtainOpen: true,
  282. waterOpen: true,
  283. fanOpen: true,
  284. wetOpen: true
  285. },
  286. computed: {
  287. ...mapState({ token: state => state.user.token, energyHeadData: state => state.portrait.energyHeadData })
  288. },
  289. onLoad() {
  290. checkHasUserInfo()
  291. setTimeout(() => {
  292. this.img = this.imgpath + 'allopen.png'
  293. this.isHome = true
  294. }, 2000)
  295. },
  296. onReady() { },
  297. methods: {
  298. chartShowClick() {
  299. this.img = this.imgpath + 'chart.png'
  300. this.isHome = false
  301. this.showChart = true
  302. },
  303. serviceTimeClick() {
  304. this.img = this.imgpath + 'serviceTime.png'
  305. this.isHome = false
  306. // this.serviceTime = true;
  307. },
  308. airClick() {
  309. console.log('this.airOpen', this.airOpen)
  310. if (this.airOpen) {
  311. this.airOpen = false
  312. this.img = this.imgpath + 'airclose.png'
  313. } else {
  314. this.airOpen = true
  315. this.img = this.imgpath + 'allopen.png'
  316. }
  317. this.lampOpen = true
  318. this.curtainOpen = true
  319. this.waterOpen = true
  320. this.fanOpen = true
  321. this.wetOpen = true
  322. },
  323. downCold() {
  324. this.img = this.imgpath + 'downcold.png'
  325. this.isHome = false
  326. },
  327. upHot() {
  328. this.img = this.imgpath + 'uphot.png'
  329. this.isHome = false
  330. },
  331. xiaoWind() {
  332. this.img = this.imgpath + 'windxiao.png'
  333. this.isHome = false
  334. },
  335. daWind() {
  336. this.img = this.imgpath + 'windda.png'
  337. this.isHome = false
  338. },
  339. lampOpenClick() {
  340. if (!this.lampOpen) {
  341. this.lampOpen = true
  342. this.airOpen = true
  343. this.curtainOpen = true
  344. this.waterOpen = true
  345. this.fanOpen = true
  346. this.wetOpen = true
  347. this.img = this.imgpath + 'allopen.png'
  348. }
  349. },
  350. lampCloseClick() {
  351. console.log('this.lampOpen', this.lampOpen)
  352. if (this.lampOpen) {
  353. this.lampOpen = false
  354. this.airOpen = true
  355. this.curtainOpen = true
  356. this.waterOpen = true
  357. this.fanOpen = true
  358. this.wetOpen = true
  359. this.img = this.imgpath + 'lampclose.png'
  360. }
  361. },
  362. fanClick() {
  363. if (this.fanOpen) {
  364. this.fanOpen = false
  365. this.img = this.imgpath + 'fanclose.png'
  366. } else {
  367. this.fanOpen = true
  368. this.img = this.imgpath + 'allopen.png'
  369. }
  370. this.airOpen = true
  371. this.lampOpen = true
  372. this.curtainOpen = true
  373. this.waterOpen = true
  374. this.wetOpen = true
  375. },
  376. waterClick() {
  377. if (this.waterOpen) {
  378. this.waterOpen = false
  379. this.img = this.imgpath + 'waterclose.png'
  380. } else {
  381. this.waterOpen = true
  382. this.img = this.imgpath + 'allopen.png'
  383. }
  384. this.airOpen = true
  385. this.lampOpen = true
  386. this.curtainOpen = true
  387. this.fanOpen = true
  388. this.wetOpen = true
  389. },
  390. wetClick() {
  391. if (this.wetOpen) {
  392. this.wetOpen = false
  393. this.img = this.imgpath + 'wetclose.png'
  394. } else {
  395. this.wetOpen = true
  396. this.img = this.imgpath + 'allopen.png'
  397. }
  398. this.airOpen = true
  399. this.lampOpen = true
  400. this.curtainOpen = true
  401. this.waterOpen = true
  402. this.fanOpen = true
  403. },
  404. curtainOpenClick() {
  405. if (!this.curtainOpen) {
  406. this.airOpen = true
  407. this.lampOpen = true
  408. this.curtainOpen = true
  409. this.waterOpen = true
  410. this.fanOpen = true
  411. this.wetOpen = true
  412. this.img = this.imgpath + 'allopen.png'
  413. }
  414. },
  415. curtainCloseClick() {
  416. if (this.curtainOpen) {
  417. this.curtainOpen = false
  418. this.airOpen = true
  419. this.lampOpen = true
  420. this.waterOpen = true
  421. this.fanOpen = true
  422. this.wetOpen = true
  423. this.img = this.imgpath + 'curtainclose.png'
  424. }
  425. },
  426. mainBack() {
  427. if (this.isHome) {
  428. wx.navigateBack()
  429. } else {
  430. this.img = this.imgpath + 'allopen.png'
  431. this.isHome = true
  432. this.showChart = false
  433. this.airOpen = true
  434. this.lampOpen = true
  435. this.curtainOpen = true
  436. this.waterOpen = true
  437. this.fanOpen = true
  438. this.wetOpen = true
  439. }
  440. },
  441. mainImgShow() {
  442. // 如果是参数chart页面 则只能通过back按钮
  443. // 如果是其他非主页面 一点击则 显示主页面图片
  444. if (!this.isHome && !this.showChart) {
  445. this.img = this.imgpath + 'allopen.png'
  446. this.isHome = true
  447. this.airOpen = true
  448. this.lampOpen = true
  449. this.curtainOpen = true
  450. this.waterOpen = true
  451. this.fanOpen = true
  452. this.wetOpen = true
  453. }
  454. }
  455. }
  456. })
  457. </script>
  458. <config>
  459. {
  460. "navigationStyle": "custom",
  461. backgroundColor: '#f7f8fa',
  462. backgroundColorTop:'#FFE823',
  463. backgroundColorBottom:"#eceff4"
  464. }
  465. </config>