index.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657
  1. //index.js
  2. //获取应用实例
  3. import {
  4. getopenId,
  5. userCheck,
  6. powerCheck,
  7. queryRotation,
  8. queryChart,
  9. getfeedBack,
  10. getSpacedetail,
  11. followRoom,
  12. openSpace,
  13. getEquipmentAction
  14. } from "../../requests/api";
  15. import utils from "../../utils/util"
  16. import Toast from '../../vant-weapp/dist/toast/toast';
  17. var chartbox = null;
  18. const AUTH = require('../../utils/auth')
  19. const wxCharts = require('../../utils/wxcharts.js');
  20. const app = getApp();
  21. Page({
  22. data: {
  23. hasUserInfo: false,
  24. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  25. swiperCurrent: 0, //首页轮播图
  26. popswiperCurrent: 0, //弹窗轮播图按钮
  27. statusList: [{
  28. id: 0,
  29. name: "缺数无法判断",
  30. canvasDate:{"v":"5.6.6","fr":25,"ip":0,"op":50,"w":100,"h":100,"nm":"恒温","ddd":0,"assets":[{"id":"image_0","w":60,"h":60,"u":"images/","p":"img_1.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"恒温.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":50,"s":[-360]}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2},"a":{"a":0,"k":[30,30,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":50,"st":0,"bm":0}],"markers":[]}
  31. },
  32. {
  33. id: 1,
  34. name: "恒温保持",
  35. imgSrc: "../../static/images/envtype1.png",
  36. canvasDate:{"v":"5.6.6","fr":25,"ip":0,"op":50,"w":100,"h":100,"nm":"恒温","ddd":0,"assets":[{"id":"image_0","w":60,"h":60,"u":"images/","p":"img_1.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"恒温.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":50,"s":[-360]}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2},"a":{"a":0,"k":[30,30,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":50,"st":0,"bm":0}],"markers":[]}
  37. },
  38. {
  39. id: 2,
  40. name: "正在为您快速降温",
  41. imgSrc: "../../static/images/envtype5.png",
  42. canvasDate:{"v":"5.6.6","fr":25,"ip":0,"op":31,"w":100,"h":100,"nm":"高数降低","ddd":0,"assets":[{"id":"image_0","w":60,"h":60,"u":"images/","p":"img_5.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"高速降低.eps","cl":"eps","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":15,"s":[100]},{"t":31,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[50,30,0],"to":[0,3.333,0],"ti":[0,-6.667,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":15,"s":[50,50,0],"to":[0,6.667,0],"ti":[0,-3.333,0]},{"t":31,"s":[50,70,0]}],"ix":2},"a":{"a":0,"k":[30,30,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":31,"st":0,"bm":0}],"markers":[]}
  43. },
  44. {
  45. id: 3,
  46. name: "正在逐步调高温度",
  47. imgSrc: "../../static/images/envtype3.png",
  48. canvasDate:{"v":"5.6.6","fr":25,"ip":0,"op":50,"w":100,"h":100,"nm":"逐步提升","ddd":0,"assets":[{"id":"image_0","w":60,"h":60,"u":"images/","p":"img_3.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"逐步提升.eps","cl":"eps","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":25,"s":[100]},{"t":50,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[30,70,0],"to":[3.333,-3.333,0],"ti":[-6.667,6.667,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":25,"s":[50,50,0],"to":[6.667,-6.667,0],"ti":[-3.333,3.333,0]},{"t":50,"s":[70,30,0]}],"ix":2},"a":{"a":0,"k":[30,30,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":50,"st":0,"bm":0}],"markers":[]}
  49. },
  50. {
  51. id: 4,
  52. name: "关机状态",
  53. imgSrc: "../../static/images/envtype4.png",
  54. canvasDate:{"v":"5.6.6","fr":25,"ip":0,"op":50,"w":100,"h":100,"nm":"节能运行","ddd":0,"assets":[{"id":"image_0","w":60,"h":60,"u":"images/","p":"img_4.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"节能运行.eps","cl":"eps","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":25,"s":[100]},{"t":50,"s":[20]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2},"a":{"a":0,"k":[30,30,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":50,"st":0,"bm":0}],"markers":[]}
  55. }
  56. ],
  57. spacestatusList: [{
  58. id: 1,
  59. name: "加速升温",
  60. imgSrc: "../../static/images/envtype6.png",
  61. canvasDate: {
  62. "v": "5.6.6",
  63. "fr": 25,
  64. "ip": 0,
  65. "op": 31,
  66. "w": 100,
  67. "h": 100,
  68. "nm": "高速提升",
  69. "ddd": 0,
  70. "assets": [{
  71. "id": "image_0",
  72. "w": 60,
  73. "h": 60,
  74. "u": "images/",
  75. "p": "img_6.png",
  76. "e": 0
  77. }],
  78. "layers": [{
  79. "ddd": 0,
  80. "ind": 1,
  81. "ty": 2,
  82. "nm": "高速提升.eps",
  83. "cl": "eps",
  84. "refId": "image_0",
  85. "sr": 1,
  86. "ks": {
  87. "o": {
  88. "a": 1,
  89. "k": [{
  90. "i": {
  91. "x": [0.833],
  92. "y": [0.833]
  93. },
  94. "o": {
  95. "x": [0.167],
  96. "y": [0.167]
  97. },
  98. "t": 0,
  99. "s": [0]
  100. }, {
  101. "i": {
  102. "x": [0.833],
  103. "y": [0.833]
  104. },
  105. "o": {
  106. "x": [0.167],
  107. "y": [0.167]
  108. },
  109. "t": 15,
  110. "s": [100]
  111. }, {
  112. "t": 31,
  113. "s": [0]
  114. }],
  115. "ix": 11
  116. },
  117. "r": {
  118. "a": 0,
  119. "k": 0,
  120. "ix": 10
  121. },
  122. "p": {
  123. "a": 1,
  124. "k": [{
  125. "i": {
  126. "x": 0.833,
  127. "y": 0.833
  128. },
  129. "o": {
  130. "x": 0.167,
  131. "y": 0.167
  132. },
  133. "t": 0,
  134. "s": [50, 70, 0],
  135. "to": [0, -3.333, 0],
  136. "ti": [0, 6.667, 0]
  137. }, {
  138. "i": {
  139. "x": 0.833,
  140. "y": 0.833
  141. },
  142. "o": {
  143. "x": 0.167,
  144. "y": 0.167
  145. },
  146. "t": 15,
  147. "s": [50, 50, 0],
  148. "to": [0, -6.667, 0],
  149. "ti": [0, 3.333, 0]
  150. }, {
  151. "t": 31,
  152. "s": [50, 30, 0]
  153. }],
  154. "ix": 2
  155. },
  156. "a": {
  157. "a": 0,
  158. "k": [30, 30, 0],
  159. "ix": 1
  160. },
  161. "s": {
  162. "a": 0,
  163. "k": [100, 100, 100],
  164. "ix": 6
  165. }
  166. },
  167. "ao": 0,
  168. "ip": 0,
  169. "op": 31,
  170. "st": 0,
  171. "bm": 0
  172. }],
  173. "markers": []
  174. }
  175. },
  176. {
  177. id: 2,
  178. name: "逐步升温",
  179. imgSrc: "../../static/images/envtype3.png",
  180. canvasDate: {
  181. "v": "5.6.6",
  182. "fr": 25,
  183. "ip": 0,
  184. "op": 50,
  185. "w": 100,
  186. "h": 100,
  187. "nm": "逐步提升",
  188. "ddd": 0,
  189. "assets": [{
  190. "id": "image_0",
  191. "w": 60,
  192. "h": 60,
  193. "u": "images/",
  194. "p": "img_3.png",
  195. "e": 0
  196. }],
  197. "layers": [{
  198. "ddd": 0,
  199. "ind": 1,
  200. "ty": 2,
  201. "nm": "逐步提升.eps",
  202. "cl": "eps",
  203. "refId": "image_0",
  204. "sr": 1,
  205. "ks": {
  206. "o": {
  207. "a": 1,
  208. "k": [{
  209. "i": {
  210. "x": [0.833],
  211. "y": [0.833]
  212. },
  213. "o": {
  214. "x": [0.167],
  215. "y": [0.167]
  216. },
  217. "t": 0,
  218. "s": [0]
  219. }, {
  220. "i": {
  221. "x": [0.833],
  222. "y": [0.833]
  223. },
  224. "o": {
  225. "x": [0.167],
  226. "y": [0.167]
  227. },
  228. "t": 25,
  229. "s": [100]
  230. }, {
  231. "t": 50,
  232. "s": [0]
  233. }],
  234. "ix": 11
  235. },
  236. "r": {
  237. "a": 0,
  238. "k": 0,
  239. "ix": 10
  240. },
  241. "p": {
  242. "a": 1,
  243. "k": [{
  244. "i": {
  245. "x": 0.833,
  246. "y": 0.833
  247. },
  248. "o": {
  249. "x": 0.167,
  250. "y": 0.167
  251. },
  252. "t": 0,
  253. "s": [30, 70, 0],
  254. "to": [3.333, -3.333, 0],
  255. "ti": [-6.667, 6.667, 0]
  256. }, {
  257. "i": {
  258. "x": 0.833,
  259. "y": 0.833
  260. },
  261. "o": {
  262. "x": 0.167,
  263. "y": 0.167
  264. },
  265. "t": 25,
  266. "s": [50, 50, 0],
  267. "to": [6.667, -6.667, 0],
  268. "ti": [-3.333, 3.333, 0]
  269. }, {
  270. "t": 50,
  271. "s": [70, 30, 0]
  272. }],
  273. "ix": 2
  274. },
  275. "a": {
  276. "a": 0,
  277. "k": [30, 30, 0],
  278. "ix": 1
  279. },
  280. "s": {
  281. "a": 0,
  282. "k": [100, 100, 100],
  283. "ix": 6
  284. }
  285. },
  286. "ao": 0,
  287. "ip": 0,
  288. "op": 50,
  289. "st": 0,
  290. "bm": 0
  291. }],
  292. "markers": []
  293. }
  294. },
  295. {
  296. id: 3,
  297. name: "加速降温",
  298. imgSrc: "../../static/images/envtype5.png",
  299. canvasDate: {
  300. "v": "5.6.6",
  301. "fr": 25,
  302. "ip": 0,
  303. "op": 31,
  304. "w": 100,
  305. "h": 100,
  306. "nm": "高数降低",
  307. "ddd": 0,
  308. "assets": [{
  309. "id": "image_0",
  310. "w": 60,
  311. "h": 60,
  312. "u": "images/",
  313. "p": "img_5.png",
  314. "e": 0
  315. }],
  316. "layers": [{
  317. "ddd": 0,
  318. "ind": 1,
  319. "ty": 2,
  320. "nm": "高速降低.eps",
  321. "cl": "eps",
  322. "refId": "image_0",
  323. "sr": 1,
  324. "ks": {
  325. "o": {
  326. "a": 1,
  327. "k": [{
  328. "i": {
  329. "x": [0.833],
  330. "y": [0.833]
  331. },
  332. "o": {
  333. "x": [0.167],
  334. "y": [0.167]
  335. },
  336. "t": 0,
  337. "s": [0]
  338. }, {
  339. "i": {
  340. "x": [0.833],
  341. "y": [0.833]
  342. },
  343. "o": {
  344. "x": [0.167],
  345. "y": [0.167]
  346. },
  347. "t": 15,
  348. "s": [100]
  349. }, {
  350. "t": 31,
  351. "s": [0]
  352. }],
  353. "ix": 11
  354. },
  355. "r": {
  356. "a": 0,
  357. "k": 0,
  358. "ix": 10
  359. },
  360. "p": {
  361. "a": 1,
  362. "k": [{
  363. "i": {
  364. "x": 0.833,
  365. "y": 0.833
  366. },
  367. "o": {
  368. "x": 0.167,
  369. "y": 0.167
  370. },
  371. "t": 0,
  372. "s": [50, 30, 0],
  373. "to": [0, 3.333, 0],
  374. "ti": [0, -6.667, 0]
  375. }, {
  376. "i": {
  377. "x": 0.833,
  378. "y": 0.833
  379. },
  380. "o": {
  381. "x": 0.167,
  382. "y": 0.167
  383. },
  384. "t": 15,
  385. "s": [50, 50, 0],
  386. "to": [0, 6.667, 0],
  387. "ti": [0, -3.333, 0]
  388. }, {
  389. "t": 31,
  390. "s": [50, 70, 0]
  391. }],
  392. "ix": 2
  393. },
  394. "a": {
  395. "a": 0,
  396. "k": [30, 30, 0],
  397. "ix": 1
  398. },
  399. "s": {
  400. "a": 0,
  401. "k": [100, 100, 100],
  402. "ix": 6
  403. }
  404. },
  405. "ao": 0,
  406. "ip": 0,
  407. "op": 31,
  408. "st": 0,
  409. "bm": 0
  410. }],
  411. "markers": []
  412. }
  413. },
  414. {
  415. id: 4,
  416. name: "逐步降温",
  417. imgSrc: "../../static/images/envtype2.png",
  418. canvasDate: {
  419. "v": "5.6.6",
  420. "fr": 25,
  421. "ip": 0,
  422. "op": 50,
  423. "w": 100,
  424. "h": 100,
  425. "nm": "逐步提升",
  426. "ddd": 0,
  427. "assets": [{
  428. "id": "image_0",
  429. "w": 60,
  430. "h": 60,
  431. "u": "images/",
  432. "p": "img_2.png",
  433. "e": 0
  434. }],
  435. "layers": [{
  436. "ddd": 0,
  437. "ind": 1,
  438. "ty": 2,
  439. "nm": "逐步提升.eps",
  440. "cl": "eps",
  441. "refId": "image_0",
  442. "sr": 1,
  443. "ks": {
  444. "o": {
  445. "a": 1,
  446. "k": [{
  447. "i": {
  448. "x": [0.833],
  449. "y": [0.833]
  450. },
  451. "o": {
  452. "x": [0.167],
  453. "y": [0.167]
  454. },
  455. "t": 0,
  456. "s": [0]
  457. }, {
  458. "i": {
  459. "x": [0.833],
  460. "y": [0.833]
  461. },
  462. "o": {
  463. "x": [0.167],
  464. "y": [0.167]
  465. },
  466. "t": 25,
  467. "s": [100]
  468. }, {
  469. "t": 50,
  470. "s": [0]
  471. }],
  472. "ix": 11
  473. },
  474. "r": {
  475. "a": 0,
  476. "k": 0,
  477. "ix": 10
  478. },
  479. "p": {
  480. "a": 1,
  481. "k": [{
  482. "i": {
  483. "x": 0.833,
  484. "y": 0.833
  485. },
  486. "o": {
  487. "x": 0.167,
  488. "y": 0.167
  489. },
  490. "t": 0,
  491. "s": [30, 70, 0],
  492. "to": [3.333, -3.333, 0],
  493. "ti": [-6.667, 6.667, 0]
  494. }, {
  495. "i": {
  496. "x": 0.833,
  497. "y": 0.833
  498. },
  499. "o": {
  500. "x": 0.167,
  501. "y": 0.167
  502. },
  503. "t": 25,
  504. "s": [50, 50, 0],
  505. "to": [6.667, -6.667, 0],
  506. "ti": [-3.333, 3.333, 0]
  507. }, {
  508. "t": 50,
  509. "s": [70, 30, 0]
  510. }],
  511. "ix": 2
  512. },
  513. "a": {
  514. "a": 0,
  515. "k": [30, 30, 0],
  516. "ix": 1
  517. },
  518. "s": {
  519. "a": 0,
  520. "k": [100, 100, 100],
  521. "ix": 6
  522. }
  523. },
  524. "ao": 0,
  525. "ip": 0,
  526. "op": 50,
  527. "st": 0,
  528. "bm": 0
  529. }],
  530. "markers": []
  531. }
  532. },
  533. {
  534. id: 5,
  535. name: ".恒温保持",
  536. imgSrc: "../../static/images/envtype1.png",
  537. canvasDate: {
  538. "v": "5.6.6",
  539. "fr": 25,
  540. "ip": 0,
  541. "op": 50,
  542. "w": 100,
  543. "h": 100,
  544. "nm": "恒温",
  545. "ddd": 0,
  546. "assets": [{
  547. "id": "image_0",
  548. "w": 60,
  549. "h": 60,
  550. "u": "images/",
  551. "p": "img_1.png",
  552. "e": 0
  553. }],
  554. "layers": [{
  555. "ddd": 0,
  556. "ind": 1,
  557. "ty": 2,
  558. "nm": "恒温.png",
  559. "cl": "png",
  560. "refId": "image_0",
  561. "sr": 1,
  562. "ks": {
  563. "o": {
  564. "a": 0,
  565. "k": 100,
  566. "ix": 11
  567. },
  568. "r": {
  569. "a": 1,
  570. "k": [{
  571. "i": {
  572. "x": [0.833],
  573. "y": [0.833]
  574. },
  575. "o": {
  576. "x": [0.167],
  577. "y": [0.167]
  578. },
  579. "t": 0,
  580. "s": [0]
  581. }, {
  582. "t": 50,
  583. "s": [-360]
  584. }],
  585. "ix": 10
  586. },
  587. "p": {
  588. "a": 0,
  589. "k": [50, 50, 0],
  590. "ix": 2
  591. },
  592. "a": {
  593. "a": 0,
  594. "k": [30, 30, 0],
  595. "ix": 1
  596. },
  597. "s": {
  598. "a": 0,
  599. "k": [100, 100, 100],
  600. "ix": 6
  601. }
  602. },
  603. "ao": 0,
  604. "ip": 0,
  605. "op": 50,
  606. "st": 0,
  607. "bm": 0
  608. }],
  609. "markers": []
  610. }
  611. },
  612. {
  613. id: 6,
  614. name: "正在开启环境调节",
  615. imgSrc: "../../static/images/envtype7.png",
  616. canvasDate: {
  617. "v": "5.6.6",
  618. "fr": 25,
  619. "ip": 0,
  620. "op": 50,
  621. "w": 100,
  622. "h": 100,
  623. "nm": "开启环境调节",
  624. "ddd": 0,
  625. "assets": [{
  626. "id": "image_0",
  627. "w": 60,
  628. "h": 60,
  629. "u": "images/",
  630. "p": "img_7.png",
  631. "e": 0
  632. }],
  633. "layers": [{
  634. "ddd": 0,
  635. "ind": 1,
  636. "ty": 2,
  637. "nm": "开启环境调节.png",
  638. "cl": "png",
  639. "refId": "image_0",
  640. "sr": 1,
  641. "ks": {
  642. "o": {
  643. "a": 1,
  644. "k": [{
  645. "i": {
  646. "x": [0.833],
  647. "y": [0.833]
  648. },
  649. "o": {
  650. "x": [0.167],
  651. "y": [0.167]
  652. },
  653. "t": 0,
  654. "s": [20]
  655. }, {
  656. "i": {
  657. "x": [0.833],
  658. "y": [0.833]
  659. },
  660. "o": {
  661. "x": [0.167],
  662. "y": [0.167]
  663. },
  664. "t": 25,
  665. "s": [100]
  666. }, {
  667. "t": 50,
  668. "s": [20]
  669. }],
  670. "ix": 11
  671. },
  672. "r": {
  673. "a": 0,
  674. "k": 0,
  675. "ix": 10
  676. },
  677. "p": {
  678. "a": 0,
  679. "k": [50, 50, 0],
  680. "ix": 2
  681. },
  682. "a": {
  683. "a": 0,
  684. "k": [30, 30, 0],
  685. "ix": 1
  686. },
  687. "s": {
  688. "a": 0,
  689. "k": [100, 100, 100],
  690. "ix": 6
  691. }
  692. },
  693. "ao": 0,
  694. "ip": 0,
  695. "op": 50,
  696. "st": 0,
  697. "bm": 0
  698. }],
  699. "markers": []
  700. }
  701. }
  702. ],
  703. popstatusList: [{
  704. id: 0,
  705. nowind: [{}],
  706. wind: []
  707. }],
  708. popShow: false, //下弹框显示问题
  709. meauList: [{
  710. id: 1,
  711. title: '扫码调节',
  712. des: '调节二维码对应空间的环境',
  713. imgSrc: "../../static/images/qrcode.png"
  714. },
  715. {
  716. id: 2,
  717. title: '关注列表',
  718. des: '对关注的房间进行调节',
  719. imgSrc: "../../static/images/adjust.png"
  720. },
  721. {
  722. id: 3,
  723. title: '关机',
  724. des: '下班了让环境节能控制',
  725. imgSrc: "../../static/images/lamp.png"
  726. },
  727. ],
  728. envList: [{
  729. name: "温度",
  730. value: "--",
  731. unit:"°C"
  732. },
  733. {
  734. name: "湿度",
  735. value: "--",
  736. unit:"%"
  737. },
  738. {
  739. name: "CO₂",
  740. value: "--",
  741. unit:"μg/m³",
  742. },
  743. {
  744. name: "PM2.5",
  745. value: "--",
  746. unit:"ppm",
  747. },
  748. ],
  749. tempType: [{
  750. id: 2,
  751. value: "太冷了",
  752. checked: false,
  753. imgSrc: "../../static/images/severityCold.png"
  754. },
  755. {
  756. id: 1,
  757. value: "有点冷",
  758. checked: false,
  759. imgSrc: "../../static/images/cold.png"
  760. },
  761. {
  762. id: 11,
  763. value: "赞",
  764. checked: false,
  765. imgSrc: "../../static/images/good.png"
  766. },
  767. {
  768. id: 3,
  769. value: "有点热",
  770. checked: false,
  771. imgSrc: "../../static/images/hot.png"
  772. },
  773. {
  774. id: 4,
  775. value: "太热了",
  776. checked: false,
  777. imgSrc: "../../static/images/severityHot.png"
  778. },
  779. ],
  780. tempTypeValue: -1,
  781. envType: [{
  782. id: 5,
  783. value: '风太大',
  784. checked: false,
  785. imgSrc: "../../static/images/severityWind.png"
  786. }, ],
  787. envTypeValue: -1,
  788. imageWidth: 0,
  789. feedBack: true,
  790. projectId: "",
  791. tenantName: "",
  792. tenantId: "",
  793. userId: "",
  794. imgbaseUrl: app.globalData.imgbaseUrl,
  795. swiperDate: [{
  796. "localName": "",
  797. id: "init",
  798. initPic:"../../static/images/room.png",
  799. // "pic": "../../static/images/room.png",
  800. isInit: true
  801. }],
  802. popswiperDate: {},
  803. chartDate: [],
  804. chartShow: false,
  805. spaceStatus: "",
  806. notice: "",
  807. equipmentStatus: "",
  808. equipmentStatustext: [],
  809. speedValue: 60,
  810. addFollow: '1',
  811. latitude: '',
  812. longitude: '',
  813. havePower: '',
  814. spaceStatusId: null,
  815. monthDay: '',
  816. tenants: [],
  817. fromFollowpage: false,
  818. secondpopValue: false,
  819. secondSpaceStatus: '',
  820. secondNotice: '',
  821. secondIcon: '',
  822. isEdit: false,
  823. wxqcode: '',
  824. formWxcode: false,
  825. formAuth: false,
  826. hideFlag: false,
  827. changeTenant:false, //是否通过调节改变项目
  828. formList:false, //是否改变项目
  829. imgShow:false,
  830. isRefresh:false
  831. },
  832. //事件处理函数
  833. bindViewTap: function () {},
  834. // 获取扫码结果
  835. getScancode: function () {
  836. if (!wx.getStorageSync('logined')) {
  837. wx.navigateTo({
  838. url: `../auth/index`,
  839. })
  840. return
  841. }
  842. // 只允许从相机扫码
  843. wx.scanCode({
  844. onlyFromCamera: true,
  845. complete: (res) => {
  846. if (res.errMsg === '"scanCode:fail cancel"') {
  847. Toast.fail('已取消扫描');
  848. }
  849. },
  850. success: (res) => {
  851. // console.log(res)
  852. this.checkCode(res.result);
  853. },
  854. fail: (res) => {
  855. Toast.fail('未扫描到结果');
  856. }
  857. })
  858. },
  859. // 检查是否位置授权
  860. isGetSetting() {
  861. wx.getSetting({
  862. success: async (res) => {
  863. var statu = res.authSetting;
  864. if (!statu['scope.userLocation']) {
  865. wx.showModal({
  866. title: '是否授权当前位置',
  867. content: '需要获取您的地理位置,请确认授权',
  868. confirmColor: '#f16765',
  869. success: res => {
  870. if (res.confirm) {
  871. wx.openSetting({
  872. success: async data => {
  873. if (data.authSetting["scope.userLocation"]) {
  874. await this.getUserLocation();
  875. } else {
  876. await this.getUserLocation();
  877. }
  878. },
  879. })
  880. } else {
  881. this.setData({
  882. havePower: {
  883. result: "fail",
  884. message: "未定位到您的位置"
  885. }
  886. })
  887. }
  888. }
  889. })
  890. } else {
  891. await this.getUserLocation();
  892. }
  893. }
  894. })
  895. },
  896. // 检查二维码
  897. async checkCode(value) {
  898. let scanArr = value.split("?");
  899. let domain = scanArr[0];
  900. if (domain === "http://meos.sagacloud.cn/scan" || domain === 'https://duoduoenv.sagacloud.cn/scan') {
  901. let md = scanArr[1].split('=');
  902. let md1 = md[1];
  903. let data = {
  904. "criteria": {
  905. "spaceId": md1,
  906. "userId": this.data.userId || wx.getStorageSync('userId'),
  907. "projectId": 'Pj' + md1.substring(2, 12)
  908. }
  909. }
  910. this.setData({
  911. "popswiperDate.id": md1
  912. });
  913. this.setData({
  914. "popswiperDate.projectId": 'Pj' + md1.substring(2, 12)
  915. });
  916. // this.setData({
  917. // projectId: 'Pj' + md1.substring(2, 12)
  918. // })
  919. let changeProjectid = wx.getStorageSync('projectId')
  920. if (changeProjectid && changeProjectid !== ('Pj' + md1.substring(2, 12))) {
  921. // this.setData()
  922. }
  923. let res = await getSpacedetail(data);
  924. this.setData({
  925. wxqcode: ''
  926. })
  927. wx.setStorageSync("wxqcode",'');
  928. this.setData({
  929. popswiperDate: res.content[0] || {}
  930. });
  931. this.initOpenTime();
  932. this.changePop()
  933. } else {
  934. Toast.fail('不支持的二维码');
  935. }
  936. },
  937. // 检查是否注册
  938. async check(data={}) {
  939. var that=this;
  940. async function cb(){
  941. data.latitude='';
  942. if(data.latitude==''){
  943. data.longitude=that.data.longitude || '';
  944. data.latitude=that.data.latitude || '';
  945. }
  946. let res = await userCheck(data);
  947. if (res.result === "fail" && !that.data.formAuth) {
  948. wx.setStorageSync('logined', false);
  949. wx.navigateTo({
  950. url: `../auth/index`,
  951. })
  952. } else {
  953. that.getTenant(res);
  954. }
  955. }
  956. if(wx.getStorageSync('logined') || !that.data.longitude){
  957. await this.getUserLocation(cb);
  958. }else{
  959. await cb();
  960. }
  961. },
  962. imageLoad(e){
  963. var index = e.currentTarget.dataset.index;
  964. // var item = this.data.swiperDate[index];
  965. var param = {};
  966. var str = "swiperDate["+index+"].imgShow"; //index为下标
  967. param[str] = true;
  968. // item.imgShow = true;
  969. // var str=`swiperDate[${index}]`;
  970. console.log(param,"str");
  971. this.setData(param);
  972. },
  973. changeImgshow(){
  974. setTimeout(function (){
  975. this.data.dataset
  976. },1000)
  977. },
  978. getTenant(res) {
  979. app.globalData.openId = res.content.openId || '';
  980. app.globalData.userId = res.content.id || '';
  981. app.globalData.tenants = res.content.tenants || [];
  982. // 检查定位哪个租户 优先定位再根据最近使用
  983. let currentTenant = this.checkTenant(app.globalData.tenants);
  984. app.globalData.projectId =currentTenant.projectId ||wx.getStorageSync('projectId') || '';
  985. app.globalData.projectName =currentTenant.projectName||wx.getStorageSync('projectName')|| '';
  986. app.globalData.tenantId = currentTenant.tenantId||wx.getStorageSync('tenantId')|| '';
  987. app.globalData.tenantName =currentTenant.tenantName|| wx.getStorageSync('tenantName') || '';
  988. wx.setStorageSync('logined', true);
  989. wx.setStorageSync('openId', res.content.openId);
  990. wx.setStorageSync('userId', res.content.id);
  991. wx.setStorageSync('projectId', app.globalData.projectId);
  992. wx.setStorageSync('projectName', app.globalData.projectName);
  993. wx.setStorageSync('tenantId', app.globalData.tenantId);
  994. wx.setStorageSync('tenantName', app.globalData.tenantName);
  995. this.setData({
  996. projectId: app.globalData.projectId
  997. });
  998. this.setData({
  999. tenantId: app.globalData.tenantId
  1000. });
  1001. this.setData({
  1002. tenantName: app.globalData.tenantName
  1003. });
  1004. this.setData({
  1005. tenants: app.globalData.tenants
  1006. });
  1007. this.setData({
  1008. userId: app.globalData.userId
  1009. });
  1010. if (this.data.wxqcode) {
  1011. this.checkCode(this.data.wxqcode);
  1012. this.setData({
  1013. formWxcode: false
  1014. });
  1015. }
  1016. this.getswiperDate();
  1017. },
  1018. // 查询定位租户
  1019. checkTenant(value = []) {
  1020. var currntProjectId=wx.getStorageSync('projectId') || '';
  1021. var currntProjectName=wx.getStorageSync('projectName') || '';
  1022. var currntProjecttenantId=wx.getStorageSync('tenantId') || '';
  1023. var currntProjecttenantName=wx.getStorageSync('tenantName') || '';
  1024. var current = {};
  1025. if (value.length) {
  1026. // 定位到的租户id
  1027. var currentTens=[];
  1028. // 定位到的租户详情
  1029. var currentTensArr=[];
  1030. value.forEach(item => {
  1031. if(item.current){
  1032. currentTens.push(item.tenantId);
  1033. currentTensArr.push(item);
  1034. }
  1035. })
  1036. if(currentTens.length){
  1037. if(!currentTens.includes(currntProjecttenantId)&&!this.data.changeTenant&&!this.data.formList){
  1038. // 定位改变 但不是通过调节改变 切换改变
  1039. current = currentTensArr[0];
  1040. }else if(this.data.changeTenant){
  1041. current.projectId = currntProjectId
  1042. current.projectName = currntProjectName
  1043. current.tenantId = currntProjecttenantId
  1044. current.tenantName = currntProjecttenantName
  1045. }
  1046. }else{
  1047. if(currntProjecttenantId!=''&&currntProjecttenantName!=''){
  1048. current.projectId = currntProjectId
  1049. current.projectName = currntProjectName
  1050. current.tenantId = currntProjecttenantId
  1051. current.tenantName = currntProjecttenantName
  1052. }else{
  1053. current = value[0]
  1054. }
  1055. }
  1056. return current
  1057. }else{
  1058. current.projectId = currntProjectId
  1059. current.projectName = currntProjectName
  1060. current.tenantId = currntProjecttenantId
  1061. current.tenantName = currntProjecttenantName
  1062. return current
  1063. }
  1064. },
  1065. // 查询租户名称
  1066. changeTenantname(value){
  1067. let tenarr=app.globalData.tenants;
  1068. tenarr.forEach(item=>{
  1069. if(item.tenantId == value){
  1070. this.setData({changeTenant:true});
  1071. this.setData({tenantName:item.tenantName})
  1072. wx.setStorageSync('tenantName', item.tenantName)
  1073. }
  1074. })
  1075. },
  1076. onHide: function () {
  1077. this.setData({
  1078. formAuth: false
  1079. })
  1080. this.setData({
  1081. hideFlag: true
  1082. })
  1083. this.setData({
  1084. formList: false
  1085. })
  1086. },
  1087. onLoad: async function (options) {
  1088. // 是否从微信直接进来
  1089. if (options.q !== undefined) {
  1090. let q = decodeURIComponent(options.q);
  1091. console.log(q);
  1092. this.setData({
  1093. wxqcode: q
  1094. });
  1095. wx.setStorageSync('wxqcode', q);
  1096. //截取参数 options.q ='域名地址?bedcode=12345678';
  1097. // this.checkCode(q,true);
  1098. }
  1099. this.setData({
  1100. imageWidth: wx.getSystemInfoSync().windowWidth
  1101. });
  1102. var isLogined = await AUTH.checkHasLogined();
  1103. if (!isLogined) {
  1104. await AUTH.login().then(async result => {
  1105. await getopenId(result.code).then(async res => {
  1106. app.globalData.openId = res.openId;
  1107. wx.setStorage({
  1108. data: app.globalData.openId,
  1109. key: 'openId',
  1110. })
  1111. await this.check({
  1112. openid: res.openId
  1113. });
  1114. });
  1115. });
  1116. } else {
  1117. await this.check();
  1118. }
  1119. },
  1120. onShow: async function () {
  1121. if (this.data.fromFollowpage) {
  1122. this.setData({
  1123. fromFollowpage: false
  1124. });
  1125. // this.setData({
  1126. // popswiperDate: JSON.parse(options.data)
  1127. // });
  1128. this.initOpenTime();
  1129. setTimeout(() => {
  1130. this.changePop();
  1131. }, 300)
  1132. }
  1133. if(this.data.formList || this.data.formWxcode){
  1134. await this.check();
  1135. }
  1136. },
  1137. // 阻止滚动穿透
  1138. preventTouchMove: function () {
  1139. return
  1140. },
  1141. swiperChange(e) {
  1142. this.setData({
  1143. swiperCurrent: e.detail.current
  1144. })
  1145. },
  1146. popswiperChange(e) {
  1147. this.setData({
  1148. popswiperCurrent: e.detail.current
  1149. })
  1150. },
  1151. // 图表数据
  1152. async drawChart() {
  1153. var windowW = this.data.imageWidth / 375;
  1154. let chartValue = this.data.chartDate;
  1155. this.setData({
  1156. chartShow: false
  1157. })
  1158. if (!chartValue.length) {
  1159. return;
  1160. }
  1161. let dataX = [];
  1162. let dataY = [];
  1163. chartValue.forEach(item => {
  1164. if (item[1] === -9999) {
  1165. dataY.push(null)
  1166. } else {
  1167. this.setData({
  1168. chartShow: true
  1169. })
  1170. // 只显示9点后的
  1171. dataY.push(item[1].toFixed(1))
  1172. }
  1173. dataX.push(utils.formatDate(item[0]))
  1174. })
  1175. if (!this.data.chartShow) {
  1176. return
  1177. }
  1178. chartbox = null;
  1179. chartbox = new wxCharts({
  1180. canvasId: 'areaCanvas',
  1181. type: 'line', // line area
  1182. categories: dataX,
  1183. dataLabel: false,
  1184. dataPointShape: false,
  1185. animation: false,
  1186. extra: {
  1187. lineStyle: 'curve' //线条的形状(弧形)
  1188. },
  1189. series: [{
  1190. name: '当日温度',
  1191. data: dataY,
  1192. }],
  1193. yAxis: {
  1194. min: 20,
  1195. max: 30, //max+max*0.2
  1196. format: function (val) {
  1197. return val;
  1198. },
  1199. },
  1200. xAxis: {
  1201. disableGrid: true,
  1202. },
  1203. width: (windowW * 330), //(windowW * 300)
  1204. height: (windowW * 115)
  1205. });
  1206. },
  1207. touchHandler: function (e) {
  1208. console.log(chartbox.getCurrentDataIndex(e));
  1209. chartbox.showToolTip(e, {
  1210. // background: '#7cb5ec',
  1211. format: function (item, category) {
  1212. return category + '温度:' + item.data
  1213. }
  1214. });
  1215. },
  1216. getUserInfo() {
  1217. if (app.globalData.userInfo) {
  1218. this.setData({
  1219. userInfo: app.globalData.userInfo,
  1220. hasUserInfo: true
  1221. })
  1222. } else if (this.data.canIUse) {
  1223. // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  1224. // 所以此处加入 callback 以防止这种情况
  1225. app.userInfoReadyCallback = res => {
  1226. this.setData({
  1227. userInfo: res.userInfo,
  1228. hasUserInfo: true
  1229. })
  1230. }
  1231. } else {
  1232. // 在没有 open-type=getUserInfo 版本的兼容处理
  1233. wx.getUserInfo({
  1234. success: res => {
  1235. app.globalData.userInfo = res.userInfo
  1236. this.setData({
  1237. userInfo: res.userInfo,
  1238. hasUserInfo: true
  1239. })
  1240. }
  1241. })
  1242. }
  1243. },
  1244. // 获取位置信息
  1245. async getUserLocation(cb) {
  1246. var that = this;
  1247. await wx.getLocation({
  1248. altitude: 'false',
  1249. type: 'wgs84',
  1250. complete: (res) => {},
  1251. success: async res => {
  1252. that.setData({
  1253. latitude: res.latitude
  1254. })
  1255. that.setData({
  1256. longitude: res.longitude
  1257. })
  1258. if(cb){
  1259. await cb()
  1260. }else{
  1261. this.checkPower();
  1262. }
  1263. },
  1264. fail() {
  1265. if(cb){
  1266. // console.log(cb);
  1267. cb()
  1268. }
  1269. Toast.fail('未定位到您所在位置');
  1270. // that.checkPower();
  1271. that.setData({
  1272. havePower: {
  1273. result: "fail",
  1274. message: "未定位到您的位置"
  1275. }
  1276. })
  1277. }
  1278. })
  1279. },
  1280. // 是否有操作权限
  1281. async checkPower() {
  1282. const data = {
  1283. "criteria": {
  1284. "projectId":this.data.popswiperDate.projectId,
  1285. "spaceId": this.data.popswiperDate.id,
  1286. "userId": app.globalData.userId,
  1287. "tenantId": app.globalData.tenantId,
  1288. "longitude": this.data.longitude,
  1289. "latitude": this.data.latitude
  1290. }
  1291. };
  1292. await powerCheck(data).then(res => {
  1293. this.setData({
  1294. havePower: res
  1295. })
  1296. })
  1297. },
  1298. // 获取轮播图数据
  1299. async getswiperDate() {
  1300. const data = {
  1301. "criteria": {
  1302. "userId": app.globalData.userId || wx.getStorageSync('userId'),
  1303. "projectId": app.globalData.projectId || wx.getStorageSync('projectId'),
  1304. "tenantId": app.globalData.tenantId || wx.getStorageSync('tenantId')
  1305. }
  1306. }
  1307. console.log(data, "getswiperDate")
  1308. let res = await queryRotation(data);
  1309. console.log(res, "res.count")
  1310. if (res.count) {
  1311. this.setData({swiperCurrent:0})
  1312. this.setData({
  1313. swiperDate: [{
  1314. "localName": "",
  1315. id: "init",
  1316. // "pic": "../../static/images/room.png",
  1317. isInit: true,
  1318. imgShow:true,
  1319. initPic:"../../static/images/room.png",
  1320. }]
  1321. })
  1322. let list = res.content;
  1323. if (res.count > 5) {
  1324. list = list.slice(0, 5);
  1325. }
  1326. list.map(item=>{
  1327. item.imgShow=false;
  1328. item.initPic=utils.picInit(item.roomFuncType);
  1329. })
  1330. this.setData({
  1331. swiperDate: list
  1332. })
  1333. }else{
  1334. this.setData({
  1335. swiperDate: [{
  1336. "localName": "",
  1337. id: "init",
  1338. // "pic": "../../static/images/room.png",
  1339. isInit: true,
  1340. imgShow:true,
  1341. initPic:"../../static/images/room.png",
  1342. }]
  1343. })
  1344. }
  1345. },
  1346. // 获取温度曲线
  1347. async getChart() {
  1348. // if(this.popswiperDate.isClose){
  1349. // this.setData({
  1350. // 'popShow': true
  1351. // });
  1352. // return
  1353. // }
  1354. let data = {
  1355. projectId:this.data.popswiperDate.projectId,
  1356. spaceId: this.data.popswiperDate.id
  1357. }
  1358. let res = await queryChart(data) || [];
  1359. if (res.result == "success") {
  1360. let date = res.data.slice(1);
  1361. this.setData({
  1362. chartDate: date
  1363. });
  1364. this.drawChart();
  1365. }
  1366. this.setData({
  1367. 'popShow': true
  1368. });
  1369. },
  1370. // 按钮点击
  1371. itemClick: function (value) {
  1372. var btnType = value.currentTarget.id;
  1373. if (btnType === '2') {
  1374. wx.navigateTo({
  1375. url: '../search/index',
  1376. })
  1377. } else if (btnType === '3') {
  1378. wx.navigateTo({
  1379. url: '../efficient/index',
  1380. })
  1381. } else {
  1382. this.getScancode();
  1383. }
  1384. },
  1385. async changePop(e) {
  1386. if (!wx.getStorageSync('logined') || (e && this.data.swiperDate[e.currentTarget.dataset.index].id == "init")) {
  1387. return;
  1388. }
  1389. if (!this.data.formWxcode) {
  1390. this.isGetSetting();
  1391. }
  1392. this.setData({
  1393. addFollow: '1'
  1394. });
  1395. this.setData({
  1396. isEdit: false
  1397. });
  1398. this.setData({
  1399. feedBack: true
  1400. });
  1401. this.setData({
  1402. tempTypeValue: -1
  1403. });
  1404. this.setData({
  1405. envTypeValue: -1
  1406. });
  1407. if (e) {
  1408. let index = e.currentTarget.dataset.index;
  1409. this.setData({
  1410. popswiperDate: this.data.swiperDate[index]
  1411. });
  1412. this.initOpenTime();
  1413. }
  1414. this.setData({
  1415. "envList[0].value": this.data.popswiperDate.temperature || '--',
  1416. "envList[1].value": this.data.popswiperDate.humidity || '--',
  1417. "envList[2].value": this.data.popswiperDate.co2 || '--',
  1418. "envList[3].value": this.data.popswiperDate.pm25 || '--'
  1419. });
  1420. this.getChart();
  1421. },
  1422. // 是否加入关注列表
  1423. addonChange(e) {
  1424. if (this.data.addFollow == "0") {
  1425. this.setData({
  1426. addFollow: '1'
  1427. })
  1428. } else {
  1429. this.setData({
  1430. addFollow: '0'
  1431. })
  1432. }
  1433. },
  1434. async colseFeedback() {
  1435. // this.setData({isEdit:true});
  1436. if (!this.data.popswiperDate.subscribe && this.data.addFollow == "1" && !this.data.feedBack) {
  1437. let data = {
  1438. "userId": app.globalData.userId || wx.getStorageSync('userId'), //用户id
  1439. "projectId":this.data.popswiperDate.projectId , //项目id
  1440. "spaceId": this.data.popswiperDate.id, //空间id
  1441. flag: 1
  1442. }
  1443. // 关注空间
  1444. await followRoom(data);
  1445. await this.check();
  1446. } else {
  1447. this.getswiperDate();
  1448. }
  1449. this.setData({
  1450. popShow: false
  1451. })
  1452. // this.setData({
  1453. // feedBack: true
  1454. // })
  1455. },
  1456. // 弹窗的显示隐藏
  1457. popClose(e) {
  1458. if (this.data.isEdit) {
  1459. this.colseFeedback();
  1460. }
  1461. // this.colseFeedback();
  1462. this.setData({
  1463. 'popShow': false
  1464. });
  1465. // chartbox = null;
  1466. // this.setData({popswiperCurrent:0})
  1467. },
  1468. // 提交反馈
  1469. submitFeedback() {
  1470. if (this.data.tempTypeValue != -1 || this.data.envTypeValue != -1) {
  1471. this.setData({
  1472. isEdit: true
  1473. });
  1474. this.setData({
  1475. notice: []
  1476. });
  1477. this.setData({
  1478. equipmentStatustext: []
  1479. });
  1480. let data = {
  1481. "projectId": this.data.popswiperDate.projectId, //项目id
  1482. "objectId": this.data.popswiperDate.id, //空间id
  1483. "valueType": 1, //固定为1
  1484. "itemIds": []
  1485. }
  1486. this.data.tempTypeValue != -1 ? data.itemIds.push(this.data.tempTypeValue) : '';
  1487. this.data.envTypeValue != -1 ? data.itemIds.push(this.data.envTypeValue) : '';
  1488. getEquipmentAction(data).then(res => {
  1489. this.setData({
  1490. equipmentStatus: res.equipmentStatus
  1491. });
  1492. let textMsg = "";
  1493. let textMsgarr=[];
  1494. this.data.equipmentStatus.forEach(item => {
  1495. if (item.actions) {
  1496. item.actions.forEach(items => {
  1497. let textMsgobj={};
  1498. textMsgobj.name=item.localName;
  1499. textMsgobj.actions=items;
  1500. textMsgarr.push(textMsgobj);
  1501. textMsg = textMsg + item.localName + '--' + items + ' ';
  1502. })
  1503. }
  1504. })
  1505. this.setData({
  1506. equipmentStatustext: textMsgarr
  1507. });
  1508. })
  1509. getfeedBack(data).then(res => {
  1510. this.setData({
  1511. spaceStatus: res.spaceStatus
  1512. });
  1513. this.setData({
  1514. spaceStatusId: res.icon - 1
  1515. });
  1516. let notice = res.notice ? res.notice.split('。') : [];
  1517. this.setData({
  1518. notice: notice
  1519. });
  1520. let currentTenantId=wx.getStorageSync('tenantId');
  1521. if(currentTenantId!==res.tenantId){
  1522. app.globalData.projectId = res.projectId;
  1523. app.globalData.tenantId = res.tenantId;
  1524. wx.setStorageSync('projectId', res.projectId);
  1525. wx.setStorageSync('tenantId', res.tenantId);
  1526. this.changeTenantname(res.tenantId);
  1527. }
  1528. })
  1529. this.setData({
  1530. feedBack: false
  1531. });
  1532. this.setData({
  1533. popswiperCurrent: 0
  1534. })
  1535. }
  1536. },
  1537. // 反馈数据
  1538. changeType(e) {
  1539. if (this.data.havePower.result === 'fail' && wx.getStorageSync('logined')) {
  1540. Toast.fail(this.data.havePower.message);
  1541. return
  1542. }
  1543. var currentIndex = e.currentTarget.dataset.index;
  1544. if (e.currentTarget.dataset.type === "temp") {
  1545. currentIndex = currentIndex == this.data.tempTypeValue ? -1 : currentIndex;
  1546. this.setData({
  1547. "tempTypeValue": currentIndex
  1548. });
  1549. } else {
  1550. currentIndex = currentIndex == this.data.envTypeValue ? -1 : currentIndex;
  1551. this.setData({
  1552. "envTypeValue": currentIndex
  1553. });
  1554. }
  1555. },
  1556. async openEnv() {
  1557. // await this.checkPower();
  1558. if (this.data.havePower.result === 'fail' && wx.getStorageSync('logined')) {
  1559. Toast.fail(this.data.havePower.message);
  1560. return
  1561. }
  1562. let data = {
  1563. "projectId":this.data.popswiperDate.projectId, //项目id
  1564. "objectId": this.data.popswiperDate.id //空间id
  1565. }
  1566. openSpace(data).then(res => {
  1567. this.getswiperDate();
  1568. this.setData({
  1569. secondSpaceStatus: res.spaceStatus
  1570. });
  1571. this.setData({
  1572. secondNotice: res.notice
  1573. });
  1574. this.setData({
  1575. secondIcon: res.icon
  1576. });
  1577. this.setData({
  1578. popShow: false
  1579. });
  1580. this.setData({
  1581. secondpopValue: true
  1582. })
  1583. })
  1584. },
  1585. // 选择项目
  1586. goProject(e) {
  1587. wx.navigateTo({
  1588. url: '../projectlist/index',
  1589. })
  1590. },
  1591. fillZore(value) {
  1592. if (value < 10) {
  1593. value = 0 + value
  1594. }
  1595. return value
  1596. },
  1597. formatTimeall(value) {
  1598. let stringValue;
  1599. const date = new Date();
  1600. var nowMonth = date.getMonth() + 1;
  1601. let nowDay = date.getDate();
  1602. let torrowDay = new Date(date);
  1603. torrowDay.setDate(date.getDate() + 1);
  1604. let torrowMonth = torrowDay.getMonth() + 1;
  1605. nowDay = this.fillZore(nowDay);
  1606. nowMonth = this.fillZore(nowMonth);
  1607. torrowMonth = this.fillZore(torrowMonth);
  1608. if (nowMonth == value.substring(4, 6) || torrowMonth == value.substring(4, 6)) {
  1609. if (value.substring(6, 8) == nowDay) {
  1610. stringValue = "今日"
  1611. }
  1612. let torrowVlue = torrowDay.getDate();
  1613. torrowVlue = this.fillZore(torrowVlue);
  1614. if (value.substring(6, 8) == torrowVlue) {
  1615. stringValue = "明日"
  1616. }
  1617. }
  1618. if (stringValue) {
  1619. stringValue = stringValue + `${value.substring(8,10)}:${value.substring(10,12)}`
  1620. } else {
  1621. stringValue = `${value.substring(4,6)}月${value.substring(6,8)}日${value.substring(8,10)}:${value.substring(10,12)}`
  1622. }
  1623. return stringValue
  1624. },
  1625. initOpenTime() {
  1626. // 是否为关闭状态
  1627. if (this.data.popswiperDate.isClose) {
  1628. this.setData({
  1629. popswiperCurrent: 0
  1630. })
  1631. this.setData({
  1632. monthDay: this.formatTimeall(this.data.popswiperDate.nextOpenTime)
  1633. });
  1634. }
  1635. },
  1636. commitClose() {
  1637. this.setData({
  1638. secondpopValue: false
  1639. })
  1640. }
  1641. })