1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657 |
- //index.js
- //获取应用实例
- import {
- getopenId,
- userCheck,
- powerCheck,
- queryRotation,
- queryChart,
- getfeedBack,
- getSpacedetail,
- followRoom,
- openSpace,
- getEquipmentAction
- } from "../../requests/api";
- import utils from "../../utils/util"
- import Toast from '../../vant-weapp/dist/toast/toast';
- var chartbox = null;
- const AUTH = require('../../utils/auth')
- const wxCharts = require('../../utils/wxcharts.js');
- const app = getApp();
- Page({
- data: {
- hasUserInfo: false,
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- swiperCurrent: 0, //首页轮播图
- popswiperCurrent: 0, //弹窗轮播图按钮
- statusList: [{
- id: 0,
- name: "缺数无法判断",
- 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":[]}
- },
- {
- id: 1,
- name: "恒温保持",
- imgSrc: "../../static/images/envtype1.png",
- 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":[]}
- },
- {
- id: 2,
- name: "正在为您快速降温",
- imgSrc: "../../static/images/envtype5.png",
- 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":[]}
- },
- {
- id: 3,
- name: "正在逐步调高温度",
- imgSrc: "../../static/images/envtype3.png",
- 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":[]}
- },
- {
- id: 4,
- name: "关机状态",
- imgSrc: "../../static/images/envtype4.png",
- 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":[]}
- }
- ],
- spacestatusList: [{
- id: 1,
- name: "加速升温",
- imgSrc: "../../static/images/envtype6.png",
- 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_6.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, 70, 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, 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": 31,
- "st": 0,
- "bm": 0
- }],
- "markers": []
- }
- },
- {
- id: 2,
- name: "逐步升温",
- imgSrc: "../../static/images/envtype3.png",
- 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": []
- }
- },
- {
- id: 3,
- name: "加速降温",
- imgSrc: "../../static/images/envtype5.png",
- 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": []
- }
- },
- {
- id: 4,
- name: "逐步降温",
- imgSrc: "../../static/images/envtype2.png",
- 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_2.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": []
- }
- },
- {
- id: 5,
- name: ".恒温保持",
- imgSrc: "../../static/images/envtype1.png",
- 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": []
- }
- },
- {
- id: 6,
- name: "正在开启环境调节",
- imgSrc: "../../static/images/envtype7.png",
- 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_7.png",
- "e": 0
- }],
- "layers": [{
- "ddd": 0,
- "ind": 1,
- "ty": 2,
- "nm": "开启环境调节.png",
- "cl": "png",
- "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": []
- }
- }
- ],
- popstatusList: [{
- id: 0,
- nowind: [{}],
- wind: []
- }],
- popShow: false, //下弹框显示问题
- meauList: [{
- id: 1,
- title: '扫码调节',
- des: '调节二维码对应空间的环境',
- imgSrc: "../../static/images/qrcode.png"
- },
- {
- id: 2,
- title: '关注列表',
- des: '对关注的房间进行调节',
- imgSrc: "../../static/images/adjust.png"
- },
- {
- id: 3,
- title: '关机',
- des: '下班了让环境节能控制',
- imgSrc: "../../static/images/lamp.png"
- },
- ],
- envList: [{
- name: "温度",
- value: "--",
- unit:"°C"
- },
- {
- name: "湿度",
- value: "--",
- unit:"%"
- },
- {
- name: "CO₂",
- value: "--",
- unit:"μg/m³",
- },
- {
- name: "PM2.5",
- value: "--",
- unit:"ppm",
- },
- ],
- tempType: [{
- id: 2,
- value: "太冷了",
- checked: false,
- imgSrc: "../../static/images/severityCold.png"
- },
- {
- id: 1,
- value: "有点冷",
- checked: false,
- imgSrc: "../../static/images/cold.png"
- },
- {
- id: 11,
- value: "赞",
- checked: false,
- imgSrc: "../../static/images/good.png"
- },
- {
- id: 3,
- value: "有点热",
- checked: false,
- imgSrc: "../../static/images/hot.png"
- },
- {
- id: 4,
- value: "太热了",
- checked: false,
- imgSrc: "../../static/images/severityHot.png"
- },
- ],
- tempTypeValue: -1,
- envType: [{
- id: 5,
- value: '风太大',
- checked: false,
- imgSrc: "../../static/images/severityWind.png"
- }, ],
- envTypeValue: -1,
- imageWidth: 0,
- feedBack: true,
- projectId: "",
- tenantName: "",
- tenantId: "",
- userId: "",
- imgbaseUrl: app.globalData.imgbaseUrl,
- swiperDate: [{
- "localName": "",
- id: "init",
- initPic:"../../static/images/room.png",
- // "pic": "../../static/images/room.png",
- isInit: true
- }],
- popswiperDate: {},
- chartDate: [],
- chartShow: false,
- spaceStatus: "",
- notice: "",
- equipmentStatus: "",
- equipmentStatustext: [],
- speedValue: 60,
- addFollow: '1',
- latitude: '',
- longitude: '',
- havePower: '',
- spaceStatusId: null,
- monthDay: '',
- tenants: [],
- fromFollowpage: false,
- secondpopValue: false,
- secondSpaceStatus: '',
- secondNotice: '',
- secondIcon: '',
- isEdit: false,
- wxqcode: '',
- formWxcode: false,
- formAuth: false,
- hideFlag: false,
- changeTenant:false, //是否通过调节改变项目
- formList:false, //是否改变项目
- imgShow:false,
- isRefresh:false
- },
- //事件处理函数
- bindViewTap: function () {},
- // 获取扫码结果
- getScancode: function () {
- if (!wx.getStorageSync('logined')) {
- wx.navigateTo({
- url: `../auth/index`,
- })
- return
- }
- // 只允许从相机扫码
- wx.scanCode({
- onlyFromCamera: true,
- complete: (res) => {
- if (res.errMsg === '"scanCode:fail cancel"') {
- Toast.fail('已取消扫描');
- }
- },
- success: (res) => {
- // console.log(res)
- this.checkCode(res.result);
- },
- fail: (res) => {
- Toast.fail('未扫描到结果');
- }
- })
- },
- // 检查是否位置授权
- isGetSetting() {
- wx.getSetting({
- success: async (res) => {
- var statu = res.authSetting;
- if (!statu['scope.userLocation']) {
- wx.showModal({
- title: '是否授权当前位置',
- content: '需要获取您的地理位置,请确认授权',
- confirmColor: '#f16765',
- success: res => {
- if (res.confirm) {
- wx.openSetting({
- success: async data => {
- if (data.authSetting["scope.userLocation"]) {
- await this.getUserLocation();
- } else {
- await this.getUserLocation();
- }
- },
- })
- } else {
- this.setData({
- havePower: {
- result: "fail",
- message: "未定位到您的位置"
- }
- })
- }
- }
- })
- } else {
- await this.getUserLocation();
- }
- }
- })
- },
- // 检查二维码
- async checkCode(value) {
- let scanArr = value.split("?");
- let domain = scanArr[0];
- if (domain === "http://meos.sagacloud.cn/scan" || domain === 'https://duoduoenv.sagacloud.cn/scan') {
- let md = scanArr[1].split('=');
- let md1 = md[1];
- let data = {
- "criteria": {
- "spaceId": md1,
- "userId": this.data.userId || wx.getStorageSync('userId'),
- "projectId": 'Pj' + md1.substring(2, 12)
- }
- }
- this.setData({
- "popswiperDate.id": md1
- });
- this.setData({
- "popswiperDate.projectId": 'Pj' + md1.substring(2, 12)
- });
- // this.setData({
- // projectId: 'Pj' + md1.substring(2, 12)
- // })
- let changeProjectid = wx.getStorageSync('projectId')
- if (changeProjectid && changeProjectid !== ('Pj' + md1.substring(2, 12))) {
- // this.setData()
- }
- let res = await getSpacedetail(data);
- this.setData({
- wxqcode: ''
- })
- wx.setStorageSync("wxqcode",'');
- this.setData({
- popswiperDate: res.content[0] || {}
- });
- this.initOpenTime();
- this.changePop()
- } else {
- Toast.fail('不支持的二维码');
- }
- },
- // 检查是否注册
- async check(data={}) {
- var that=this;
- async function cb(){
- data.latitude='';
- if(data.latitude==''){
- data.longitude=that.data.longitude || '';
- data.latitude=that.data.latitude || '';
- }
- let res = await userCheck(data);
- if (res.result === "fail" && !that.data.formAuth) {
- wx.setStorageSync('logined', false);
- wx.navigateTo({
- url: `../auth/index`,
- })
- } else {
- that.getTenant(res);
- }
- }
- if(wx.getStorageSync('logined') || !that.data.longitude){
- await this.getUserLocation(cb);
- }else{
- await cb();
- }
-
-
- },
- imageLoad(e){
- var index = e.currentTarget.dataset.index;
- // var item = this.data.swiperDate[index];
- var param = {};
- var str = "swiperDate["+index+"].imgShow"; //index为下标
- param[str] = true;
- // item.imgShow = true;
- // var str=`swiperDate[${index}]`;
- console.log(param,"str");
- this.setData(param);
- },
- changeImgshow(){
- setTimeout(function (){
- this.data.dataset
- },1000)
- },
- getTenant(res) {
- app.globalData.openId = res.content.openId || '';
- app.globalData.userId = res.content.id || '';
- app.globalData.tenants = res.content.tenants || [];
- // 检查定位哪个租户 优先定位再根据最近使用
- let currentTenant = this.checkTenant(app.globalData.tenants);
- app.globalData.projectId =currentTenant.projectId ||wx.getStorageSync('projectId') || '';
- app.globalData.projectName =currentTenant.projectName||wx.getStorageSync('projectName')|| '';
- app.globalData.tenantId = currentTenant.tenantId||wx.getStorageSync('tenantId')|| '';
- app.globalData.tenantName =currentTenant.tenantName|| wx.getStorageSync('tenantName') || '';
- wx.setStorageSync('logined', true);
- wx.setStorageSync('openId', res.content.openId);
- wx.setStorageSync('userId', res.content.id);
- wx.setStorageSync('projectId', app.globalData.projectId);
- wx.setStorageSync('projectName', app.globalData.projectName);
- wx.setStorageSync('tenantId', app.globalData.tenantId);
- wx.setStorageSync('tenantName', app.globalData.tenantName);
- this.setData({
- projectId: app.globalData.projectId
- });
- this.setData({
- tenantId: app.globalData.tenantId
- });
- this.setData({
- tenantName: app.globalData.tenantName
- });
- this.setData({
- tenants: app.globalData.tenants
- });
- this.setData({
- userId: app.globalData.userId
- });
- if (this.data.wxqcode) {
- this.checkCode(this.data.wxqcode);
- this.setData({
- formWxcode: false
- });
- }
- this.getswiperDate();
- },
- // 查询定位租户
- checkTenant(value = []) {
- var currntProjectId=wx.getStorageSync('projectId') || '';
- var currntProjectName=wx.getStorageSync('projectName') || '';
- var currntProjecttenantId=wx.getStorageSync('tenantId') || '';
- var currntProjecttenantName=wx.getStorageSync('tenantName') || '';
- var current = {};
- if (value.length) {
- // 定位到的租户id
- var currentTens=[];
- // 定位到的租户详情
- var currentTensArr=[];
- value.forEach(item => {
- if(item.current){
- currentTens.push(item.tenantId);
- currentTensArr.push(item);
- }
- })
-
- if(currentTens.length){
- if(!currentTens.includes(currntProjecttenantId)&&!this.data.changeTenant&&!this.data.formList){
- // 定位改变 但不是通过调节改变 切换改变
- current = currentTensArr[0];
- }else if(this.data.changeTenant){
- current.projectId = currntProjectId
- current.projectName = currntProjectName
- current.tenantId = currntProjecttenantId
- current.tenantName = currntProjecttenantName
- }
- }else{
- if(currntProjecttenantId!=''&&currntProjecttenantName!=''){
- current.projectId = currntProjectId
- current.projectName = currntProjectName
- current.tenantId = currntProjecttenantId
- current.tenantName = currntProjecttenantName
- }else{
- current = value[0]
- }
- }
- return current
- }else{
- current.projectId = currntProjectId
- current.projectName = currntProjectName
- current.tenantId = currntProjecttenantId
- current.tenantName = currntProjecttenantName
- return current
- }
-
- },
- // 查询租户名称
- changeTenantname(value){
- let tenarr=app.globalData.tenants;
- tenarr.forEach(item=>{
- if(item.tenantId == value){
- this.setData({changeTenant:true});
- this.setData({tenantName:item.tenantName})
- wx.setStorageSync('tenantName', item.tenantName)
- }
- })
- },
- onHide: function () {
- this.setData({
- formAuth: false
- })
- this.setData({
- hideFlag: true
- })
- this.setData({
- formList: false
- })
- },
- onLoad: async function (options) {
- // 是否从微信直接进来
- if (options.q !== undefined) {
- let q = decodeURIComponent(options.q);
- console.log(q);
- this.setData({
- wxqcode: q
- });
- wx.setStorageSync('wxqcode', q);
- //截取参数 options.q ='域名地址?bedcode=12345678';
- // this.checkCode(q,true);
- }
- this.setData({
- imageWidth: wx.getSystemInfoSync().windowWidth
- });
- var isLogined = await AUTH.checkHasLogined();
- if (!isLogined) {
- await AUTH.login().then(async result => {
- await getopenId(result.code).then(async res => {
- app.globalData.openId = res.openId;
- wx.setStorage({
- data: app.globalData.openId,
- key: 'openId',
- })
- await this.check({
- openid: res.openId
- });
- });
- });
- } else {
- await this.check();
- }
- },
- onShow: async function () {
- if (this.data.fromFollowpage) {
- this.setData({
- fromFollowpage: false
- });
- // this.setData({
- // popswiperDate: JSON.parse(options.data)
- // });
- this.initOpenTime();
- setTimeout(() => {
- this.changePop();
- }, 300)
- }
- if(this.data.formList || this.data.formWxcode){
- await this.check();
- }
- },
- // 阻止滚动穿透
- preventTouchMove: function () {
- return
- },
- swiperChange(e) {
- this.setData({
- swiperCurrent: e.detail.current
- })
- },
- popswiperChange(e) {
- this.setData({
- popswiperCurrent: e.detail.current
- })
- },
- // 图表数据
- async drawChart() {
- var windowW = this.data.imageWidth / 375;
- let chartValue = this.data.chartDate;
- this.setData({
- chartShow: false
- })
- if (!chartValue.length) {
- return;
- }
- let dataX = [];
- let dataY = [];
- chartValue.forEach(item => {
- if (item[1] === -9999) {
- dataY.push(null)
- } else {
- this.setData({
- chartShow: true
- })
- // 只显示9点后的
- dataY.push(item[1].toFixed(1))
- }
- dataX.push(utils.formatDate(item[0]))
- })
- if (!this.data.chartShow) {
- return
- }
- chartbox = null;
- chartbox = new wxCharts({
- canvasId: 'areaCanvas',
- type: 'line', // line area
- categories: dataX,
- dataLabel: false,
- dataPointShape: false,
- animation: false,
- extra: {
- lineStyle: 'curve' //线条的形状(弧形)
- },
- series: [{
- name: '当日温度',
- data: dataY,
- }],
- yAxis: {
- min: 20,
- max: 30, //max+max*0.2
- format: function (val) {
- return val;
- },
- },
- xAxis: {
- disableGrid: true,
- },
- width: (windowW * 330), //(windowW * 300)
- height: (windowW * 115)
- });
- },
- touchHandler: function (e) {
- console.log(chartbox.getCurrentDataIndex(e));
- chartbox.showToolTip(e, {
- // background: '#7cb5ec',
- format: function (item, category) {
- return category + '温度:' + item.data
- }
- });
- },
- getUserInfo() {
- if (app.globalData.userInfo) {
- this.setData({
- userInfo: app.globalData.userInfo,
- hasUserInfo: true
- })
- } else if (this.data.canIUse) {
- // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
- // 所以此处加入 callback 以防止这种情况
- app.userInfoReadyCallback = res => {
- this.setData({
- userInfo: res.userInfo,
- hasUserInfo: true
- })
- }
- } else {
- // 在没有 open-type=getUserInfo 版本的兼容处理
- wx.getUserInfo({
- success: res => {
- app.globalData.userInfo = res.userInfo
- this.setData({
- userInfo: res.userInfo,
- hasUserInfo: true
- })
- }
- })
- }
- },
- // 获取位置信息
- async getUserLocation(cb) {
- var that = this;
- await wx.getLocation({
- altitude: 'false',
- type: 'wgs84',
- complete: (res) => {},
- success: async res => {
- that.setData({
- latitude: res.latitude
- })
- that.setData({
- longitude: res.longitude
- })
- if(cb){
- await cb()
- }else{
- this.checkPower();
- }
-
- },
- fail() {
- if(cb){
- // console.log(cb);
- cb()
- }
- Toast.fail('未定位到您所在位置');
- // that.checkPower();
- that.setData({
- havePower: {
- result: "fail",
- message: "未定位到您的位置"
- }
- })
- }
- })
- },
- // 是否有操作权限
- async checkPower() {
- const data = {
- "criteria": {
- "projectId":this.data.popswiperDate.projectId,
- "spaceId": this.data.popswiperDate.id,
- "userId": app.globalData.userId,
- "tenantId": app.globalData.tenantId,
- "longitude": this.data.longitude,
- "latitude": this.data.latitude
- }
- };
- await powerCheck(data).then(res => {
- this.setData({
- havePower: res
- })
- })
- },
- // 获取轮播图数据
- async getswiperDate() {
- const data = {
- "criteria": {
- "userId": app.globalData.userId || wx.getStorageSync('userId'),
- "projectId": app.globalData.projectId || wx.getStorageSync('projectId'),
- "tenantId": app.globalData.tenantId || wx.getStorageSync('tenantId')
- }
- }
- console.log(data, "getswiperDate")
-
- let res = await queryRotation(data);
- console.log(res, "res.count")
- if (res.count) {
- this.setData({swiperCurrent:0})
- this.setData({
- swiperDate: [{
- "localName": "",
- id: "init",
- // "pic": "../../static/images/room.png",
- isInit: true,
- imgShow:true,
- initPic:"../../static/images/room.png",
- }]
- })
- let list = res.content;
- if (res.count > 5) {
- list = list.slice(0, 5);
- }
- list.map(item=>{
- item.imgShow=false;
- item.initPic=utils.picInit(item.roomFuncType);
- })
- this.setData({
- swiperDate: list
- })
- }else{
- this.setData({
- swiperDate: [{
- "localName": "",
- id: "init",
- // "pic": "../../static/images/room.png",
- isInit: true,
- imgShow:true,
- initPic:"../../static/images/room.png",
- }]
- })
- }
- },
- // 获取温度曲线
- async getChart() {
- // if(this.popswiperDate.isClose){
- // this.setData({
- // 'popShow': true
- // });
- // return
- // }
- let data = {
- projectId:this.data.popswiperDate.projectId,
- spaceId: this.data.popswiperDate.id
- }
- let res = await queryChart(data) || [];
- if (res.result == "success") {
- let date = res.data.slice(1);
- this.setData({
- chartDate: date
- });
- this.drawChart();
- }
- this.setData({
- 'popShow': true
- });
- },
- // 按钮点击
- itemClick: function (value) {
- var btnType = value.currentTarget.id;
- if (btnType === '2') {
- wx.navigateTo({
- url: '../search/index',
- })
- } else if (btnType === '3') {
- wx.navigateTo({
- url: '../efficient/index',
- })
- } else {
- this.getScancode();
- }
- },
- async changePop(e) {
- if (!wx.getStorageSync('logined') || (e && this.data.swiperDate[e.currentTarget.dataset.index].id == "init")) {
- return;
- }
- if (!this.data.formWxcode) {
- this.isGetSetting();
- }
- this.setData({
- addFollow: '1'
- });
- this.setData({
- isEdit: false
- });
- this.setData({
- feedBack: true
- });
- this.setData({
- tempTypeValue: -1
- });
- this.setData({
- envTypeValue: -1
- });
- if (e) {
- let index = e.currentTarget.dataset.index;
- this.setData({
- popswiperDate: this.data.swiperDate[index]
- });
- this.initOpenTime();
- }
- this.setData({
- "envList[0].value": this.data.popswiperDate.temperature || '--',
- "envList[1].value": this.data.popswiperDate.humidity || '--',
- "envList[2].value": this.data.popswiperDate.co2 || '--',
- "envList[3].value": this.data.popswiperDate.pm25 || '--'
- });
- this.getChart();
- },
- // 是否加入关注列表
- addonChange(e) {
- if (this.data.addFollow == "0") {
- this.setData({
- addFollow: '1'
- })
- } else {
- this.setData({
- addFollow: '0'
- })
- }
- },
- async colseFeedback() {
- // this.setData({isEdit:true});
- if (!this.data.popswiperDate.subscribe && this.data.addFollow == "1" && !this.data.feedBack) {
- let data = {
- "userId": app.globalData.userId || wx.getStorageSync('userId'), //用户id
- "projectId":this.data.popswiperDate.projectId , //项目id
- "spaceId": this.data.popswiperDate.id, //空间id
- flag: 1
- }
- // 关注空间
- await followRoom(data);
- await this.check();
- } else {
- this.getswiperDate();
- }
- this.setData({
- popShow: false
- })
- // this.setData({
- // feedBack: true
- // })
- },
- // 弹窗的显示隐藏
- popClose(e) {
- if (this.data.isEdit) {
- this.colseFeedback();
- }
- // this.colseFeedback();
- this.setData({
- 'popShow': false
- });
- // chartbox = null;
- // this.setData({popswiperCurrent:0})
- },
- // 提交反馈
- submitFeedback() {
- if (this.data.tempTypeValue != -1 || this.data.envTypeValue != -1) {
- this.setData({
- isEdit: true
- });
- this.setData({
- notice: []
- });
- this.setData({
- equipmentStatustext: []
- });
- let data = {
- "projectId": this.data.popswiperDate.projectId, //项目id
- "objectId": this.data.popswiperDate.id, //空间id
- "valueType": 1, //固定为1
- "itemIds": []
- }
- this.data.tempTypeValue != -1 ? data.itemIds.push(this.data.tempTypeValue) : '';
- this.data.envTypeValue != -1 ? data.itemIds.push(this.data.envTypeValue) : '';
- getEquipmentAction(data).then(res => {
- this.setData({
- equipmentStatus: res.equipmentStatus
- });
- let textMsg = "";
- let textMsgarr=[];
- this.data.equipmentStatus.forEach(item => {
-
- if (item.actions) {
- item.actions.forEach(items => {
- let textMsgobj={};
- textMsgobj.name=item.localName;
- textMsgobj.actions=items;
- textMsgarr.push(textMsgobj);
- textMsg = textMsg + item.localName + '--' + items + ' ';
- })
- }
- })
- this.setData({
- equipmentStatustext: textMsgarr
- });
- })
- getfeedBack(data).then(res => {
- this.setData({
- spaceStatus: res.spaceStatus
- });
- this.setData({
- spaceStatusId: res.icon - 1
- });
- let notice = res.notice ? res.notice.split('。') : [];
- this.setData({
- notice: notice
- });
- let currentTenantId=wx.getStorageSync('tenantId');
- if(currentTenantId!==res.tenantId){
- app.globalData.projectId = res.projectId;
- app.globalData.tenantId = res.tenantId;
- wx.setStorageSync('projectId', res.projectId);
- wx.setStorageSync('tenantId', res.tenantId);
- this.changeTenantname(res.tenantId);
- }
- })
- this.setData({
- feedBack: false
- });
- this.setData({
- popswiperCurrent: 0
- })
- }
- },
- // 反馈数据
- changeType(e) {
- if (this.data.havePower.result === 'fail' && wx.getStorageSync('logined')) {
- Toast.fail(this.data.havePower.message);
- return
- }
- var currentIndex = e.currentTarget.dataset.index;
- if (e.currentTarget.dataset.type === "temp") {
- currentIndex = currentIndex == this.data.tempTypeValue ? -1 : currentIndex;
- this.setData({
- "tempTypeValue": currentIndex
- });
- } else {
- currentIndex = currentIndex == this.data.envTypeValue ? -1 : currentIndex;
- this.setData({
- "envTypeValue": currentIndex
- });
- }
- },
- async openEnv() {
- // await this.checkPower();
- if (this.data.havePower.result === 'fail' && wx.getStorageSync('logined')) {
- Toast.fail(this.data.havePower.message);
- return
- }
- let data = {
- "projectId":this.data.popswiperDate.projectId, //项目id
- "objectId": this.data.popswiperDate.id //空间id
- }
- openSpace(data).then(res => {
- this.getswiperDate();
- this.setData({
- secondSpaceStatus: res.spaceStatus
- });
- this.setData({
- secondNotice: res.notice
- });
- this.setData({
- secondIcon: res.icon
- });
- this.setData({
- popShow: false
- });
- this.setData({
- secondpopValue: true
- })
- })
- },
- // 选择项目
- goProject(e) {
- wx.navigateTo({
- url: '../projectlist/index',
- })
- },
- fillZore(value) {
- if (value < 10) {
- value = 0 + value
- }
- return value
- },
- formatTimeall(value) {
- let stringValue;
- const date = new Date();
- var nowMonth = date.getMonth() + 1;
- let nowDay = date.getDate();
- let torrowDay = new Date(date);
- torrowDay.setDate(date.getDate() + 1);
- let torrowMonth = torrowDay.getMonth() + 1;
- nowDay = this.fillZore(nowDay);
- nowMonth = this.fillZore(nowMonth);
- torrowMonth = this.fillZore(torrowMonth);
- if (nowMonth == value.substring(4, 6) || torrowMonth == value.substring(4, 6)) {
- if (value.substring(6, 8) == nowDay) {
- stringValue = "今日"
- }
- let torrowVlue = torrowDay.getDate();
- torrowVlue = this.fillZore(torrowVlue);
- if (value.substring(6, 8) == torrowVlue) {
- stringValue = "明日"
- }
- }
- if (stringValue) {
- stringValue = stringValue + `${value.substring(8,10)}:${value.substring(10,12)}`
- } else {
- stringValue = `${value.substring(4,6)}月${value.substring(6,8)}日${value.substring(8,10)}:${value.substring(10,12)}`
- }
- return stringValue
- },
- initOpenTime() {
- // 是否为关闭状态
- if (this.data.popswiperDate.isClose) {
- this.setData({
- popswiperCurrent: 0
- })
- this.setData({
- monthDay: this.formatTimeall(this.data.popswiperDate.nextOpenTime)
- });
- }
- },
- commitClose() {
- this.setData({
- secondpopValue: false
- })
- }
- })
|