Browse Source

注释写死一些变量页面跑起来

anxiaoxia 1 year ago
parent
commit
42291d75e5

+ 8 - 9
src/app.wpy

@@ -10,20 +10,19 @@
 </style>
 
 <script>
-import wepy from '@wepy/core';
-import eventHub from './common/eventHub';
-import vuex from '@wepy/x';
-
-wepy.use(vuex);
+import wepy from '@wepy/core'
+import eventHub from './common/eventHub'
+import vuex from '@wepy/x'
 
+wepy.use(vuex)
 
 wepy.app({
   hooks: {
     // App 级别 hook,对整个 App 生效
     // 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
     'before-setData': function (dirty) {
-      console.log('setData dirty: ', dirty);
-      return dirty;
+    //   console.log('setData dirty: ', dirty);
+      return dirty
     }
   },
   globalData: {
@@ -31,7 +30,7 @@ wepy.app({
   },
 
   onLaunch() {
-    //this.testAsync();
+    // this.testAsync();
    // eventHub.$on('app-launch', (...args) => {
     //  console.log('app-launch event emitted, the params are:');
     //  console.log(args);
@@ -40,7 +39,7 @@ wepy.app({
 
   methods: {
   }
-});
+})
 </script>
 <config>
 {

+ 19 - 20
src/config/index.js

@@ -1,34 +1,33 @@
 
 // featuresVersion属于哪个功能版本: experience-体验版, building-写字楼版, enterprise-企业版
 // npm run server-test-building 通过增加node_env 参数来判断test-building, test 是环境是test 还是prod ,building参数即是featuresVersion参数值
-let envValus = NODE_ENV.split('-');
-let env = envValus[0];
-let featuresVersion = envValus[1];
-let projectName = envValus[2] || '';
+let envValus = NODE_ENV.split('-')
+let env = envValus[0]
+let featuresVersion = envValus[1]
+let projectName = envValus[2] || ''
 // 根据在package.json中配置的不同编译命令,引用/config下不同的配置文件
-import base from './base';
-import demo from './demo';
-import dev from './dev';
-import test from './test';
-import prod from './prod';
-let config;
+import base from './base'
+import demo from './demo'
+import dev from './dev'
+import test from './test'
+import prod from './prod'
+let config
 if (env == 'dev') {
-  config = dev;
+  config = dev
 }
 
 if (env === 'prod') {
-  config = prod;
+  config = prod
 }
 
-
- const setupService = '/duoduo-service/setup-service/'
- const objectService = '/duoduo-service/object-service/'
- const duoduoenvService = '/duoduo-service/duoduoenv-service/'
+const setupService = '/duoduo-service/setup-service/'
+const objectService = '/duoduo-service/object-service/'
+const duoduoenvService = '/duoduo-service/duoduoenv-service/'
 
 config = Object.assign(base, config, {
   // h5PagePath: config.h5Origin + '/#',
-  h5PagePath: "http://localhost:8081/" + '/#',
-  h5StaticPath: "http://localhost:8081/" + '/static/WeChat',
+  h5PagePath: 'http://localhost:8081/' + '/#',
+  h5StaticPath: '/static',
   // h5StaticPath: config.h5Origin + '/static/WeChat',
   featuresVersion,
   projectName,
@@ -36,6 +35,6 @@ config = Object.assign(base, config, {
   objectService,
   duoduoenvService,
   env
-});
+})
 
-export default Object.freeze(config)
+export default Object.freeze(config)

+ 70 - 68
src/packagesEnv/api/officehome.js

@@ -1,16 +1,18 @@
-import $http from '@/common/request.js';
-import config from '@/config';
-import store from '@/store/index.js';
+import $http from '@/common/request.js'
+import config from '@/config'
+import store from '@/store/index.js'
 
 function storeUser() {
-  return store.state.user.userInfo;
+  return {
+    tag: '20247ac1b24e82760a733485969ef7ee',
+    userId: '9a1ecfbacb6b4f249bf2dd3ec7793ead',
+    phone: '17611228068',
+    userName: '安小霞'
+  }
 }
 
 function getProjectId() {
-  return (
-    store.state.company.companyConfig &&
-    store.state.company.companyConfig.sagacareProjectId
-  );
+  return 'Pj1101080259'
 }
 
 function commonParams() {
@@ -18,7 +20,7 @@ function commonParams() {
     config.brsgServer.pubname
   }&projectId=${getProjectId()}&userName=${storeUser().userName}&userPhone=${
     storeUser().phone
-  }&userId=${storeUser().userId}`;
+  }&userId=${storeUser().userId}`
 }
 
 // 获取地暖
@@ -29,7 +31,7 @@ function querySapceFloorHeating(params) {
     url: `/duoduo-service/duoduoenv-service/ctrl/querySapceFloorHeating?${commonParams()}&spaceId=${params.spaceId}`,
     errorSave: true,
     method: 'get'
-  });
+  })
 }
 
 //  设置设备
@@ -41,7 +43,7 @@ function setEquipeHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 
 // 获取设备
@@ -53,7 +55,7 @@ function getObjectDataEqpGroupHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify({ ...params })
-  });
+  })
 }
 
 // 改变场景
@@ -65,7 +67,7 @@ function switchoverSceneHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify({ ...params, projectId: getProjectId() })
-  });
+  })
 }
 // 获得空间当前会议室场景
 function getMeetingSceneHttp(params) {
@@ -77,7 +79,7 @@ function getMeetingSceneHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'get'
-  });
+  })
 }
 // 获得空间场景
 function querySpaceSceneConfigHttp(params) {
@@ -89,7 +91,7 @@ function querySpaceSceneConfigHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'get'
-  });
+  })
 }
 
 // 设备
@@ -102,7 +104,7 @@ function getEquipmentListHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'POST'
-  });
+  })
 }
 // set 设备
 function setEquipmentHttp(params) {
@@ -113,7 +115,7 @@ function setEquipmentHttp(params) {
     errorSave: true,
     method: 'POST',
     data: JSON.stringify({ ...params, projectId: getProjectId() })
-  });
+  })
 }
 
 // 详情页 面积图
@@ -126,7 +128,7 @@ function getChartListHTTP(params) {
       params.spaceId
     }&funcid=${params.funcid}`,
     method: 'get'
-  });
+  })
 }
 // 办公空间
 function getSpaceAdjustList(params) {
@@ -141,7 +143,7 @@ function getSpaceAdjustList(params) {
       ...params,
       criteria: { ...params.criteria, projectId: getProjectId() }
     })
-  });
+  })
 }
 
 //  温度上下限
@@ -152,7 +154,7 @@ function getTempRangeHttp() {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'get'
-  });
+  })
 }
 
 // 天气预报
@@ -163,7 +165,7 @@ function getWeather() {
     url: `/duoduo-service/object-service/weather/getCurrentWeather?${commonParams()}`,
     errorSave: true,
     method: 'get'
-  });
+  })
 }
 //  空调 - 调节文案/空调信息
 function getFeedbackDocumentsHttp(params) {
@@ -174,7 +176,7 @@ function getFeedbackDocumentsHttp(params) {
     errorSave: true,
     method: 'POST',
     data: JSON.stringify(params)
-  });
+  })
 }
 
 //  空调 调节
@@ -186,7 +188,7 @@ function changeTempHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify({ ...params, projectId: getProjectId() })
-  });
+  })
 }
 
 //  手动控制 下发指令
@@ -198,7 +200,7 @@ function changeManualTempHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 
 // 查询空间空调信息
@@ -212,7 +214,7 @@ function querySpaceConditioners(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'GET'
-  });
+  })
 }
 
 // // 空调 调节
@@ -236,12 +238,12 @@ function getSetTimeHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'GET'
-  });
+  })
 }
 
 // 更改 定制时间
 function changeSetTimeHttp(params) {
-  params = { ...params, projectId: getProjectId() };
+  params = { ...params, projectId: getProjectId() }
   return $http({
     serverSp: config.brsgServer.duoduoUrl,
     url: `/server/customScene/create?${commonParams()}`,
@@ -249,7 +251,7 @@ function changeSetTimeHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 
 // 灯的状态
@@ -262,7 +264,7 @@ function getLampHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'GET'
-  });
+  })
 }
 
 // 批量 开关灯
@@ -274,7 +276,7 @@ function setallLampHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 
 // 全部关闭 关灯 走廊的灯 晚关
@@ -286,7 +288,7 @@ function specialLightSetHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 // 开关失败时 定时查询灯状态
 function getStatusHttp(params) {
@@ -297,7 +299,7 @@ function getStatusHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 // 插座-列表
 function getSocketHttp(params) {
@@ -309,7 +311,7 @@ function getSocketHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'GET'
-  });
+  })
 }
 // 插座-控制
 function setSocketHttp(params) {
@@ -320,7 +322,7 @@ function setSocketHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 // 查询是否是过渡季
 function getSeasonType(params) {
@@ -330,7 +332,7 @@ function getSeasonType(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'GET'
-  });
+  })
 }
 // 查询所有空间设备
 function queryEquipStatistics(params) {
@@ -340,7 +342,7 @@ function queryEquipStatistics(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     method: 'GET'
-  });
+  })
 }
 //  批量空调 调节
 function changeAllAirHttp(params) {
@@ -352,50 +354,50 @@ function changeAllAirHttp(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 
 // 批量取消和申请加班
 function saveBatchCustomScene(params) {
-  let paramsArr = JSON.parse(JSON.stringify(params.historyBookList));
+  let paramsArr = JSON.parse(JSON.stringify(params.historyBookList))
   paramsArr.find((item) => {
-    item.customSceneEqType = 'ALL';
-    if (!item.sceneEquipList) item.sceneEquipList = [];
-  });
+    item.customSceneEqType = 'ALL'
+    if (!item.sceneEquipList) item.sceneEquipList = []
+  })
   if (params.type !== 'workOff' && params.type !== 'delete') {
     if (
       params.newBooklist &&
       params.newBooklist.startTime &&
       params.newBooklist.startTime !== ''
     ) {
-      params.newBooklist.projectId = getProjectId();
-      params.newBooklist.sourceType = config.brsgServer.pubname;
-      params.newBooklist.userId = storeUser().userId;
-      params.newBooklist.userPhone = storeUser().phone;
-      params.newBooklist.userName = storeUser().userName;
+      params.newBooklist.projectId = getProjectId()
+      params.newBooklist.sourceType = config.brsgServer.pubname
+      params.newBooklist.userId = storeUser().userId
+      params.newBooklist.userPhone = storeUser().phone
+      params.newBooklist.userName = storeUser().userName
     }
     if (paramsArr.length > 0) {
       paramsArr.find((item) => {
-        item.startDate = item.startDate.replace(/-/g, '');
-        item.endDate = item.startDate;
-      });
+        item.startDate = item.startDate.replace(/-/g, '')
+        item.endDate = item.startDate
+      })
     }
-    params.newBooklist && paramsArr.push(params.newBooklist);
+    params.newBooklist && paramsArr.push(params.newBooklist)
   }
   if (params.type === 'delete') {
     paramsArr.find((item) => {
-      item.startDate = item.startDate.replace(/-/g, '');
-      item.endDate = item.startDate;
-      item.customSceneEqType = 'ALL';
-      item.projectId = getProjectId();
-      item.sourceType = config.brsgServer.pubname;
-      item.userId = storeUser().userId;
-      item.userPhone = storeUser().phone;
-      item.userName = storeUser().userName;
-    });
+      item.startDate = item.startDate.replace(/-/g, '')
+      item.endDate = item.startDate
+      item.customSceneEqType = 'ALL'
+      item.projectId = getProjectId()
+      item.sourceType = config.brsgServer.pubname
+      item.userId = storeUser().userId
+      item.userPhone = storeUser().phone
+      item.userName = storeUser().userName
+    })
   }
 
-  console.log(paramsArr, 'paramsArrparamsArr');
+  console.log(paramsArr, 'paramsArrparamsArr')
   return $http({
     serverSp: config.brsgServer.duoduoUrl,
     url: `/server/customScene/saveBatchCustomScene?${commonParams()}`,
@@ -403,7 +405,7 @@ function saveBatchCustomScene(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(paramsArr)
-  });
+  })
 }
 // 查询加班记录
 function queryCustomAndScence(params) {
@@ -415,7 +417,7 @@ function queryCustomAndScence(params) {
     method: 'GET',
     isNotShowErrorToast: true,
     errorSave: true
-  });
+  })
 }
 
 function changeDefaultSpace(params) {
@@ -424,7 +426,7 @@ function changeDefaultSpace(params) {
     method: 'POST',
     isNotShowErrorToast: true,
     errorSave: true
-  });
+  })
 }
 // 设备运行配置
 function queryEquipmentRunConfig(params) {
@@ -434,7 +436,7 @@ function queryEquipmentRunConfig(params) {
     method: 'GET',
     isNotShowErrorToast: true,
     errorSave: true
-  });
+  })
 }
 
 // ---权限控制---
@@ -446,7 +448,7 @@ function queryProjectConfig() {
     method: 'GET',
     isNotShowErrorToast: true,
     errorSave: true
-  });
+  })
 }
 // 空间控制权限
 function queryUserControlInfo() {
@@ -456,7 +458,7 @@ function queryUserControlInfo() {
     method: 'GET',
     isNotShowErrorToast: true,
     errorSave: true
-  });
+  })
 }
 // 会议室控制权限
 function querySpaceMeetingInfo(params) {
@@ -467,7 +469,7 @@ function querySpaceMeetingInfo(params) {
     isNotShowErrorToast: true,
     errorSave: true,
     data: JSON.stringify(params)
-  });
+  })
 }
 
 export {
@@ -505,4 +507,4 @@ export {
   querySpaceConditioners,
   changeManualTempHttp,
   changeDefaultSpace
-};
+}

+ 78 - 78
src/packagesEnv/pages/officehome/components/air-adjust.wpy

@@ -119,17 +119,17 @@
 </template>
 
 <script>
-import wepy from '@wepy/core';
+import wepy from '@wepy/core'
 import { changeTempHttp, getFeedbackDocumentsHttp, getTempRangeHttp, getSeasonType } from '@/packagesEnv/api/officehome.js'
-import config from '@/config';
-import { isWithinLocation } from '@/service/location';
-import moment from 'moment';
-import store from '@/store';
-import { mapState } from '@wepy/x';
+import config from '@/config'
+import { isWithinLocation } from '@/service/location'
+import moment from 'moment'
+import store from '@/store'
+import { mapState } from '@wepy/x'
 import { checkSpaceControl } from '@/packagesEnv/pages/common.js'
 
-let infoTimer;
-let feedbackTimer;
+let infoTimer
+let feedbackTimer
 
 wepy.component({
   props: {
@@ -175,28 +175,28 @@ wepy.component({
   watch: {
     airVisible(val) {
       if (!val) {
-        console.log('---关闭定时器');
-        clearInterval(feedbackTimer);
+        console.log('---关闭定时器')
+        clearInterval(feedbackTimer)
       }
     },
     hasAir(val) {
       if (!val) {
-        clearInterval(infoTimer);
-        this.airData.isOpen = false;
-        this.airImg = 'air_close.png';
+        clearInterval(infoTimer)
+        this.airData.isOpen = false
+        this.airImg = 'air_close.png'
       }
     },
     objectId(val) {
             //   this.glistenAirTemHttp();
 
       if (val) {
-        clearInterval(infoTimer); // 定时器先清理 再设定
+        clearInterval(infoTimer) // 定时器先清理 再设定
         infoTimer = setInterval(() => {
-          this.getInfo();
-        }, 1000);
+          this.getInfo()
+        }, 1000)
       } else {
-        this.airData.isOpen = false;
-        this.airImg = 'air_close.png';
+        this.airData.isOpen = false
+        this.airImg = 'air_close.png'
       }
     }
 
@@ -205,33 +205,33 @@ wepy.component({
     ...mapState({isNowTime: state => state.officehome.isNowTime}),
 
     airRunImg() {
-      let imgStr = '';
+      let imgStr = ''
       switch (this.airData.icon) {
         case 1:
-          imgStr = 'temp-keep.png';
-          break;
+          imgStr = 'temp-keep.png'
+          break
         case 2:
-          imgStr = 'temp_cold.svg';
-          break;
+          imgStr = 'temp_cold.svg'
+          break
         case 3:
-          imgStr = 'temp_sun.png';
-          break;
+          imgStr = 'temp_sun.png'
+          break
         default:
-          imgStr = '';
-          break;
+          imgStr = ''
+          break
       }
       return imgStr
     }
   },
   ready() {
-    this.querySeasonType();
+    this.querySeasonType()
   },
   detached() {
-    this.airData.isOpen = false;
-    this.airData.icon = 1;
+    this.airData.isOpen = false
+    this.airData.icon = 1
 
-    clearInterval(feedbackTimer);
-    clearInterval(infoTimer);
+    clearInterval(feedbackTimer)
+    clearInterval(infoTimer)
   },
   methods: {
     querySeasonType() {
@@ -241,17 +241,17 @@ wepy.component({
       }
       if (!this.seasonType) {
         getSeasonType(params).then(res => {
-          this.seasonType = res.data || '';
+          this.seasonType = res.data || ''
         }).catch(() => {
         })
       }
     },
     showDetail(funcid) {
-      this.$emit('showDetail', { funcid: funcid });
-      wx.uma.trackEvent('officeHome_changeAir_temperature', { key: 'roomTemperature' });
+      this.$emit('showDetail', { funcid: funcid })
+      wx.uma.trackEvent('officeHome_changeAir_temperature', { key: 'roomTemperature' })
     },
     async getInfo() {
-      await this.getAirInfo('info');
+      await this.getAirInfo('info')
             //   this.judgeAirLevel();
             //   this.glistenAirTem();
     },
@@ -259,36 +259,36 @@ wepy.component({
         // 空调信息airTemp
     getAirInfo(type, btnType, feedbackId) {
       const paramObj = {
-        projectId: this.projectId, // 项目id
+        projectId: 'Pj1101080259', // 项目id
         objectId: this.objectId // 空间id
       }
       if (type === 'feedback') {
-        paramObj.id = feedbackId;
+        paramObj.id = feedbackId
       }
       getFeedbackDocumentsHttp(paramObj).then(res => {
         if (type !== 'feedback') {
-          res.isOpen = false;
-          this.airData = res;
+          res.isOpen = false
+          this.airData = res
           this.airData.designTemperature = res.designTemperature ? res.designTemperature.toFixed(1) : '--'
 
           if (this.airData.icon === 7) {
-            this.airData.isOpen = false;
-            this.airImg = 'air_close.png';
+            this.airData.isOpen = false
+            this.airImg = 'air_close.png'
                         // 如果是过渡季 并且 是ATVA 空调 开启时则显示 过渡季节运行中...
           } else if (this.airData.icon != 6) {
-            this.airData.isOpen = true;
-            this.airImg = 'openair.png';
+            this.airData.isOpen = true
+            this.airImg = 'openair.png'
 
             if (this.isACATVA && this.seasonType == 'Transition') {
-              this.airData.spaceStatus = '过渡季节运行中...';
-              this.airData.icon = 1;
+              this.airData.spaceStatus = '过渡季节运行中...'
+              this.airData.icon = 1
             }
           }
         }
                 //   弹窗
         if (type === 'feedback' && res.notice && btnType != 'sw') {
-          clearInterval(feedbackTimer); // 拿到反馈文案清除定时器
-          this.$emit('airTemp', {notice: res.notice, remark: res.remark});
+          clearInterval(feedbackTimer) // 拿到反馈文案清除定时器
+          this.$emit('airTemp', {notice: res.notice, remark: res.remark})
         }
       })
     },
@@ -296,8 +296,8 @@ wepy.component({
         // 空调温度 闪烁
     glistenAirTemHttp() {
       getTempRangeHttp().then(res => {
-        this.tempMax = res.tempMax;
-        this.tempMin = res.tempMin;
+        this.tempMax = res.tempMax
+        this.tempMin = res.tempMin
       })
     },
         // glistenAirTem() {
@@ -350,24 +350,24 @@ wepy.component({
 
     vibrateLong() {
       if (wx.canIUse('vibrateLong')) {
-        wx.vibrateLong();
+        wx.vibrateLong()
       } else {
-        wx.vibrateShort();
+        wx.vibrateShort()
       }
     },
     vibrateShort() {
       if (wx.canIUse('vibrateShort')) {
-        wx.vibrateShort();
+        wx.vibrateShort()
       } else {
-        wx.vibrateLong();
+        wx.vibrateLong()
       }
     },
 
     airChange(value) {
-      if (!checkSpaceControl(this.isControl)) return;
-      const itemId = value ? 12 : 10; // 10关闭 12开启
-      console.log('itemId', itemId, value);
-      let btnTypeDetail = '';
+      if (!checkSpaceControl(this.isControl)) return
+      const itemId = value ? 12 : 10 // 10关闭 12开启
+      console.log('itemId', itemId, value)
+      let btnTypeDetail = ''
       if (itemId == 12) {
         btnTypeDetail = 'openAir'
       } else {
@@ -376,10 +376,10 @@ wepy.component({
       this.changeAir(itemId, 'sw', btnTypeDetail)
     },
     onClose() {
-      this.visible = false;
+      this.visible = false
     },
     popShow() {
-      this.visible = true;
+      this.visible = true
     },
 
     checkAirCanOpen(itemId) { // 判断空调是否能开启
@@ -389,19 +389,19 @@ wepy.component({
           icon: 'info',
           duration: 1000
         })
-        return false;
+        return false
       }
       if (itemId === 12) { // 12表示开空调
-        console.log(this.isNowTime, 'this.isNowTime');
+        console.log(this.isNowTime, 'this.isNowTime')
         if (this.roomHasScene && !this.isNowTime) {
-          this.$emit('component-open-workTimePop', true);
-          return false;
+          this.$emit('component-open-workTimePop', true)
+          return false
         }
       }
-      return true;
+      return true
     },
     changeAir(itemId, btnType, btnTypeDetail) {
-      if (!checkSpaceControl(this.isControl)) return;
+      if (!checkSpaceControl(this.isControl)) return
             // 如果是过渡季 并且ACATVA 空调  则不能调节温度 不能开
     //   console.log('btnType,this.isACATVA,this.seasonType', btnType, this.isACATVA, this.isACATFC, this.seasonType);
       if (btnType == 'temp' && this.isACATVA && this.seasonType == 'Transition') {
@@ -411,16 +411,16 @@ wepy.component({
             duration: 2600,
             icon: 'none'
           })
-        }, 0);
-        return;
+        }, 0)
+        return
       }
       isWithinLocation().then(() => {
         if (this.roomType === '开放') {
-          this.showWorkTime = this.checkAirCanOpen(itemId);
-          if (!this.showWorkTime) return;
+          this.showWorkTime = this.checkAirCanOpen(itemId)
+          if (!this.showWorkTime) return
         }
-        wx.uma.trackEvent(`officeHome_changeAir_${btnTypeDetail}`, { key: btnTypeDetail });
-        this.vibrateShort();
+        wx.uma.trackEvent(`officeHome_changeAir_${btnTypeDetail}`, { key: btnTypeDetail })
+        this.vibrateShort()
         const paramObj = {
           objectId: this.objectId, // 空间id
           valueType: 1, // 固定为1
@@ -431,22 +431,22 @@ wepy.component({
           this.$emit('airShowVisible', {
             'toWhere': btnTypeDetail,
             'designTemperature': 0 }
-                    );
+                    )
         }
-        console.log('空调下发指令');
+        console.log('空调下发指令')
                 //  下达指令
         changeTempHttp(paramObj).then(res => {
           if (btnType != 'sw') {
             this.$emit('airShowVisible', {
               'toWhere': btnTypeDetail,
               'designTemperature': res.designTemperature }
-                        );
+                        )
             if (res.notice) {
-              this.$emit('airTemp', {notice: res.notice, remark: res.remark});
+              this.$emit('airTemp', {notice: res.notice, remark: res.remark})
             } else {
               feedbackTimer = setInterval(() => {
-                this.getAirInfo('feedback', btnType, res.id); // 调节反馈文案
-              }, 1000);
+                this.getAirInfo('feedback', btnType, res.id) // 调节反馈文案
+              }, 1000)
             }
           }
         }).catch(() => {

+ 103 - 106
src/packagesEnv/pages/officehome/components/all-close.wpy

@@ -40,7 +40,7 @@
     >
         <div class="cont">办公室已经没人了,我是最后一个走的</div>
         <div class="check">
-            <image src="{{h5StaticPath}}icon_done_btn.svg" />
+            <!-- <image src="{{h5StaticPath}}icon_done_btn.svg" /> -->
         </div>
 
     </div>
@@ -48,121 +48,118 @@
 </template>
 
 <script>
-import wepy from '@wepy/core';
+import wepy from '@wepy/core'
 import { specialLightSetHttp, queryEquipStatistics, changeAllAirHttp } from '@/packagesEnv/api/officehome.js'
-import config from '@/config';
+import config from '@/config'
 wepy.component({
-    data: {
-        h5StaticPath: config.h5StaticPath + '/',
-        allSpaceList: [],
-        lightSpaceList: [],
-        airSpaceList: [],
-    },
-    props: {
-        floorInfo: Array,
-        projectId: String,
-    },
-    computed: {
+  data: {
+    h5StaticPath: config.h5StaticPath + '/',
+    allSpaceList: [],
+    lightSpaceList: [],
+    airSpaceList: []
+  },
+  props: {
+    floorInfo: Array,
+    projectId: String
+  },
+  computed: {
 
-    },
-    watch: {
+  },
+  watch: {
 
+  },
+  ready() {
+    this.getEquipStatistics()
+  },
+  methods: {
+    changeLight(status) {
+      const setType = status === '打开' // 10关闭 12开启
+      var paramsArr = []
+      this.allSpaceList.forEach((citem) => {
+        (citem.equipList || []).forEach((item) => {
+          if (item.equipType == 'light') {
+            paramsArr.push({
+              id: item.id,
+              switch: setType
+            })
+          }
+        })
+      })
+      specialLightSetHttp(paramsArr).then((res) => {
+
+      })
     },
-    ready() {
-        this.getEquipStatistics();
+        // 开关全部空调
+    changeAllAir(status) {
+      let paramsArr = []
+      this.allSpaceList.forEach((sitem) => {
+        const itemId = status === '打开' ? 12 : 10 // 10关闭 12开启
+        paramsArr.push({
+          projectId: this.projectId,
+          objectId: sitem.id, // 空间id
+          valueType: 1, // 固定为1 1
+          itemId: itemId
+        })
+      })
+            // console.log("paramsArr2", paramsArr);
+      changeAllAirHttp(paramsArr).then((res) => {
+        if (res.result == 'success') {
+        } else {
+        }
+      })
     },
-    methods: {
-        changeLight(status) {
-            const setType = status === '打开' ? true : false; // 10关闭 12开启
-            var paramsArr = [];
-            this.allSpaceList.forEach((citem) => {
-                (citem.equipList || []).forEach((item) => {
-                    if (item.equipType == 'light') {
-                        paramsArr.push({
-                            id: item.id,
-                            switch: setType,
-                        });
-                    }
-                });
-            });
-            specialLightSetHttp(paramsArr).then((res) => {
-
-            });
-        },
-        //开关全部空调 
-        changeAllAir(status) {
-            let paramsArr = [];
-            this.allSpaceList.forEach((sitem) => {
-                const itemId = status === '打开' ? 12 : 10; // 10关闭 12开启
-                paramsArr.push({
-                    projectId: this.projectId,
-                    objectId: sitem.id, // 空间id
-                    valueType: 1, // 固定为1 1
-                    itemId: itemId,
-                });
-            });
-            //console.log("paramsArr2", paramsArr);
-            changeAllAirHttp(paramsArr).then((res) => {
-                if (res.result == 'success') {
-                } else {
-                }
-            });
-        },
-        getEquipStatistics() {
-            var params1 = {
-                floorId: this.floorInfo[0] && this.floorInfo[0].floorId,
-                projectId: this.projectId
-            };
-            var params2 = {
-                floorId: this.floorInfo[1] && this.floorInfo[1].floorId,
-                projectId: this.projectId
-            };
-            Promise.all([queryEquipStatistics(params1), queryEquipStatistics(params2)]).then((res) => {
+    getEquipStatistics() {
+      var params1 = {
+        floorId: this.floorInfo[0] && this.floorInfo[0].floorId,
+        projectId: this.projectId
+      }
+      var params2 = {
+        floorId: this.floorInfo[1] && this.floorInfo[1].floorId,
+        projectId: this.projectId
+      }
+      Promise.all([queryEquipStatistics(params1), queryEquipStatistics(params2)]).then((res) => {
+        var allSpaceList = [];
+        (res || []).forEach((ritem) => {
+          var spaceList = (ritem.data && ritem.data.spaceList) || []
+          allSpaceList.push(...spaceList)
+        })
+                // || item.localName == '上格云休闲区'
+        var filterSpaceArr = allSpaceList.filter((item) => {
+          return item.localName == '图书休闲区'
+        })
+                // 没用
+        this.airSpaceList = allSpaceList.filter((item) => {
+          var airStatus = (item.equipStatusList || []).filter((eitem) => {
+            return eitem.equipType == 'airConditioner'
+          })
 
-                var allSpaceList = [];
-                (res || []).forEach((ritem) => {
-                    var spaceList = (ritem.data && ritem.data.spaceList) || [];
-                    allSpaceList.push(...spaceList)
-                });
-                //|| item.localName == '上格云休闲区'
-                var filterSpaceArr = allSpaceList.filter((item) => {
-                    return item.localName == '图书休闲区';
-                });
-                //没用
-                this.airSpaceList = allSpaceList.filter((item) => {
-                    var airStatus = (item.equipStatusList || []).filter((eitem) => {
-                        return eitem.equipType == 'airConditioner'
-                    })
+          var status = airStatus[0] && airStatus[0].status
+                    // if(status !== 0){ console.log('this.airSpaceList-name', item.localName,status);}
+          return status !== 0
+        })
+                // 没用
+        this.lightSpaceList = allSpaceList.filter((item) => {
+          var lightStatus = (item.equipStatusList || []).filter((eitem) => {
+            return eitem.equipType == 'light'
+          })
 
-                    var status = airStatus[0] && airStatus[0].status;
-                    //if(status !== 0){ console.log('this.airSpaceList-name', item.localName,status);}
-                    return status !== 0;
-                });
-                //没用
-                this.lightSpaceList = allSpaceList.filter((item) => {
-                    var lightStatus = (item.equipStatusList || []).filter((eitem) => {
-                        return eitem.equipType == 'light'
-                    })
-
-                    var status = lightStatus[0] && lightStatus[0].status;
+          var status = lightStatus[0] && lightStatus[0].status
                     // if(status !== 0){ console.log('this.lightSpaceList-name', item.localName,status);}
-                    return status !== 0;
-                });
-                //console.log('this.lightSpaceList', this.lightSpaceList);
-                this.allSpaceList = allSpaceList;
-
-            });
-        },
-        controlEquipStatistics() {
-            this.changeLight('关闭');
-            this.changeAllAir('关闭');
-        },
-        showPopup() {
-            this.$emit("showAllClose");
-
-        }
+          return status !== 0
+        })
+                // console.log('this.lightSpaceList', this.lightSpaceList);
+        this.allSpaceList = allSpaceList
+      })
+    },
+    controlEquipStatistics() {
+      this.changeLight('关闭')
+      this.changeAllAir('关闭')
+    },
+    showPopup() {
+      this.$emit('showAllClose')
     }
-});
+  }
+})
 </script>
 
 <config>

File diff suppressed because it is too large
+ 2273 - 2272
src/packagesEnv/pages/officehome/index.wpy


+ 6 - 6
src/store/company.js

@@ -1,26 +1,26 @@
 export default {
   state: {
     companyConfig: {
-      sagacareProjectId: 'Pj1101080255'  // 测试阶段先给一个默认值
+      sagacareProjectId: 'Pj1101080259'  // 测试阶段先给一个默认值
     }
   },
   mutations: {
     setCompanyConfig(state, configInfo) {
-      state.companyConfig = configInfo;
+      state.companyConfig = configInfo
     },
     clearCompanyConfig(state) {
       // state.companyConfig = null;
       state.companyConfig = {
-        sagacareProjectId: 'Pj1101080255'  // 测试阶段先给一个默认值
+        sagacareProjectId: 'Pj1101080259'  // 测试阶段先给一个默认值
       }
     }
   },
   actions: {
     setCompanyConfig({ commit }, data) {
-      commit('setCompanyConfig', data);
+      commit('setCompanyConfig', data)
     },
     clearCompanyConfig({ commit }) {
-      commit('clearCompanyConfig');
+      commit('clearCompanyConfig')
     }
   }
-}
+}