Browse Source

merge master

zhaojing 1 year ago
parent
commit
24c8216721

+ 1 - 2
src/common/request.js

@@ -100,14 +100,13 @@ export default function (info) {
             wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
           } else { // 续约
             if (!store.state.user.refreshUse) {
-              console.log("开始续约--");
               store.commit('setRefreshUse', true);
               refreshTokenPage().then(res => {
                 store.commit('setRefreshUse', false);
               }).catch((err) => {
+                store.commit('setRefreshUse', false);
                 store.commit('clearToken', '');
                 wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
-                store.commit('setRefreshUse', false);
               })
             }
           }

+ 40 - 0
src/packagesEnv/api/personalCenter.js

@@ -0,0 +1,40 @@
+import $http from '@/common/request.js'
+import config from '@/config'
+import store from '@/store/index.js'
+function getProjectId() {
+  const userInfo = store.state.user.userInfo
+  return userInfo
+}
+//  客服
+function customerservice() {
+  let params = {
+    'criteria': {
+      'projectId': getProjectId().projectId,
+      'state': 1
+    }
+  }
+  return $http({
+    serverSp: config.brsgServer.duoduoUrl,
+    url: `/server/duoduoenv/customerservice/query`,
+    method: 'POST',
+    isNotShowErrorToast: true,
+    errorSave: true,
+    data: JSON.stringify(params)
+  })
+}
+//  个人信心
+function queryUserById() {
+  return $http({
+    serverSp: 'http://192.168.4.29:52015',
+    // serverSp: config.brsgServer.duoduoUrl,
+    url: `/user/queryUserById?userId=${getProjectId().userId}`,
+    method: 'GET',
+    isNotShowErrorToast: true,
+    errorSave: true
+  })
+}
+
+export {
+    customerservice,
+    queryUserById
+}

+ 6 - 10
src/packagesEnv/api/portrait.js

@@ -3,21 +3,17 @@ import config from '@/config'
 import store from '@/store/index.js'
 /* 使用统计 */
 function storeUser() {
-//   return store.state.user.userInfo;
+  const userInfo = store.state.user.userInfo
   return {
-    tag: '20247ac1b24e82760a733485969ef7ee',
-    userId: '9a1ecfbacb6b4f249bf2dd3ec7793ead',
-    phone: '17611228068',
-    userName: '安小霞'
+    userId: userInfo.userId,
+    phone: userInfo.phone,
+    userName: userInfo.name
   }
 }
 
 function getProjectId() {
-//   return (
-//     store.state.company.companyConfig &&
-//     store.state.company.companyConfig.sagacareProjectId
-//   )
-  return 'Pj1101080259'
+  const projectId = store.state.user.userInfo.projectId
+  return projectId
 }
 
 function commonParams() {

+ 82 - 85
src/packagesEnv/pages/common.js

@@ -1,5 +1,5 @@
-import config from '@/config';
-import uma from 'umtrack-wx';
+import config from '@/config'
+import uma from 'umtrack-wx'
 
 function umaInit() {
   config.appKey &&
@@ -13,66 +13,66 @@ function umaInit() {
       autoGetOpenid: false
       // debug: true, // 是否打开调试模式
       // uploadUserInfo: true // 自动上传用户信息,设为false取消上传,默认为false
-    });
+    })
 }
 
-const SliderUnit = 0.5; // 一个色块代表0.5个小时
-const TimeStart = 0;
-const TimeEnd = 24;
+const SliderUnit = 0.5 // 一个色块代表0.5个小时
+const TimeStart = 0
+const TimeEnd = 24
 
 function generateTimeSliders(openStartTime, openEndTime, disabledPast = true) {
   let start = TimeStart,
-    end = TimeEnd;
-  let duration = end - start;
-  let times = [];
-  let { juggeValue } = getNowTime();
+    end = TimeEnd
+  let duration = end - start
+  let times = []
+  let { juggeValue } = getNowTime()
   for (let i = 0; i < duration / SliderUnit; i++) {
-    let value = start + i * SliderUnit;
-    let values = value.toString().split('.');
-    let status = '';
-    let label = '';
+    let value = start + i * SliderUnit
+    let values = value.toString().split('.')
+    let status = ''
+    let label = ''
     if (values.length == 1) {
       // 代表是整数
       label =
-        parseInt(values[0]) < 10 ? '0' + values[0] + ':00' : values[0] + ':00';
+        parseInt(values[0]) < 10 ? '0' + values[0] + ':00' : values[0] + ':00'
     } else {
       // 代表是有分钟
-      let mniuts = SliderUnit * 60; // 转化分钟;
+      let mniuts = SliderUnit * 60 // 转化分钟;
       label =
         parseInt(values[0]) < 10
           ? '0' + values[0] + ':' + mniuts
-          : values[0] + ':' + mniuts;
+          : values[0] + ':' + mniuts
     }
     if (disabledPast && value < juggeValue) {
-      status = 'past'; // 过去时间
+      status = 'past' // 过去时间
     }
 
     if (openEndTime && value >= openStartTime && value <= openEndTime) {
-      status = 'unOpened'; // 不在开放时间内
+      status = 'unOpened' // 不在开放时间内
     }
 
     times.push({
       value,
       label,
       status
-    });
+    })
   }
-  return times;
+  return times
 }
 function getNowTime() {
-  let now = new Date();
-  let hour = now.getHours();
-  let minuts = now.getMinutes();
+  let now = new Date()
+  let hour = now.getHours()
+  let minuts = now.getMinutes()
   // let hour = 16;
   // let minuts = 30;
-  let minutsValue = 0;
+  let minutsValue = 0
   if (minuts < 30) {
     // 在30分钟内,都可以预约当前小时,故取0
-    minutsValue = 0;
+    minutsValue = 0
   } else {
-    minutsValue = 0.5; // 在30分钟-59分钟内,都可以预约当前小时+半小时之后,故取0.5
+    minutsValue = 0.5 // 在30分钟-59分钟内,都可以预约当前小时+半小时之后,故取0.5
   }
-  let juggeValue = hour + minutsValue;
+  let juggeValue = hour + minutsValue
 
   return {
     juggeValue,
@@ -80,110 +80,110 @@ function getNowTime() {
       hour,
       minuts
     }
-  };
+  }
 }
 
 function getNowDate(date) {
-  let now = new Date();
-  return getDate(now);
+  let now = new Date()
+  return getDate(now)
 }
 
 function getDate(now) {
-  let year = now.getFullYear();
-  let month = now.getMonth() + 1;
-  let date = now.getDate();
-  return [year, getTowNum(month), getTowNum(date)].join('');
+  let year = now.getFullYear()
+  let month = now.getMonth() + 1
+  let date = now.getDate()
+  return [year, getTowNum(month), getTowNum(date)].join('')
 }
 
 function getTowNum(num) {
-  num = parseInt(num);
-  return num < 10 ? '0' + num : num;
+  num = parseInt(num)
+  return num < 10 ? '0' + num : num
 }
 
 function formateTimeValue(timeValue) {
-  let value = parseFloat(timeValue);
-  let hour = parseInt(timeValue);
-  let minits = (value - hour) * 60;
-  return `${getTowNum(hour)}${getTowNum(minits)}00`;
+  let value = parseFloat(timeValue)
+  let hour = parseInt(timeValue)
+  let minits = (value - hour) * 60
+  return `${getTowNum(hour)}${getTowNum(minits)}00`
 }
 
 function formateDateValue(dateValue) {
-  return dateValue.replace(/-/g, '');
+  return dateValue.replace(/-/g, '')
 }
 
 function formateTimeToValue(time) {
-  if (time === '') return 0;
-  let hours = time.substring(0, 2);
-  let mins = time.substring(2, 4);
-  let hoursValue = parseInt(hours);
-  let mintusValue = parseInt(mins) / 60;
-  return hoursValue + mintusValue;
+  if (time === '') return 0
+  let hours = time.substring(0, 2)
+  let mins = time.substring(2, 4)
+  let hoursValue = parseInt(hours)
+  let mintusValue = parseInt(mins) / 60
+  return hoursValue + mintusValue
 }
 
 function formateTimeToColon(time) {
-  let hours = time.substring(0, 2);
-  let mins = time.substring(2, 4);
-  return `${hours}:${mins}`;
+  let hours = time.substring(0, 2)
+  let mins = time.substring(2, 4)
+  return `${hours}:${mins}`
 }
 
 function endtimeToUnitTime(time) {
-  let hours = time.substring(0, 2);
-  let mins = time.substring(2, 4);
+  let hours = time.substring(0, 2)
+  let mins = time.substring(2, 4)
   if (mins < 30) {
-    mins = '00';
+    mins = '00'
   } else {
-    mins = '30';
+    mins = '30'
   }
-  return `${hours}${mins}00`;
+  return `${hours}${mins}00`
 }
 function startimeToUnitTime(time) {
-  let hours = time.substring(0, 2);
-  let mins = time.substring(2, 4);
+  let hours = time.substring(0, 2)
+  let mins = time.substring(2, 4)
   if (mins < 30 && mins !== '00') {
-    mins = '30';
+    mins = '30'
   } else if (mins > 30) {
-    mins = '00';
-    hours = parseInt(hours) + 1;
+    mins = '00'
+    hours = parseInt(hours) + 1
     hours = hours < 10 ? `0${hours}` : hours
   } else {
   }
-  return `${hours}${mins}00`;
+  return `${hours}${mins}00`
 }
 
 function formateBookedList(bookedList) {
-  let list = {};
+  let list = {}
   if (!bookedList || (bookedList && bookedList.length == 0)) {
-    return list;
+    return list
   }
 
   bookedList.forEach((item) => {
-    let { startTime, endTime, startDate } = item;
-    let key = startDate;
+    let { startTime, endTime, startDate } = item
+    let key = startDate
     let data = {
       start: formateTimeToValue(endtimeToUnitTime(startTime)),
       end: formateTimeToValue(startimeToUnitTime(endTime)),
       ...item
-    };
+    }
     if (!list[key]) {
-      list[key] = [data];
+      list[key] = [data]
     } else {
-      list[key].push(data);
+      list[key].push(data)
     }
-  });
-  return list;
+  })
+  return list
 }
 
 function dateToDate(val) {
-  const year = val.slice(0, 4);
-  const month = val.slice(4, 6);
-  const day = val.slice(6, 8);
-  return `${year}-${month}-${day}`;
+  const year = val.slice(0, 4)
+  const month = val.slice(4, 6)
+  const day = val.slice(6, 8)
+  return `${year}-${month}-${day}`
 }
 
 function getWeekDay(date) {
-  let week = date.getDay();
-  let weekday = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
-  return weekday[week];
+  let week = date.getDay()
+  let weekday = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
+  return weekday[week]
 }
 function checkSpaceControl(val) {
   if (!val) {
@@ -191,18 +191,15 @@ function checkSpaceControl(val) {
       title: '您没有权限!',
       icon: 'none',
       duration: 1500
-    });
-    return false;
+    })
+    return false
   } else {
     return true
   }
 }
 
 function carbonCredit(projectId) {
-  if (projectId === 'Pj1101020007') {
-    return '碳积分';
-  }
-  return '节能分';
+  return '碳积分'
 }
 
 function carbonCreditExplain(params) {
@@ -298,4 +295,4 @@ export {
   TimeEnd,
   TimeStart,
   SliderUnit
-};
+}

+ 3 - 2
src/packagesEnv/pages/home/index.wpy

@@ -467,8 +467,8 @@ wepy.page({
     console.log("home----onLoad");
     checkLoginNew()
       .then(() => {
-        checkHasUserInfo(); //续约token
-
+    
+        checkHasUserInfo();
         //获取项目list
         getCompanyDataByPhone()
           .then((res) => {
@@ -509,6 +509,7 @@ wepy.page({
   onShow() {
     console.log("home----onShow");
     this.loadData();
+
   },
 });
 </script>

+ 3 - 1
src/packagesEnv/pages/officehome/Header/space-basic.wpy

@@ -24,7 +24,8 @@
     <div class="room-bg">
         <div class="space-name">
             <div class="g-fl room-name">
-                <span class="name_text">{{officeData.localName || '该空间不可调节'}}</span>
+                <span class="name_text" v-if="isSpaceCanControl">{{officeData.localName}}</span>
+                <span class="name_text" v-else>该空间不可调节</span>
                 <has-person
                     v-if="officeData.isPassengerPass !== undefined && IsShowPerson"
                     :isPassengerPass="officeData.isPassengerPass"
@@ -52,6 +53,7 @@ wepy.component({
     officeData: Object,
     options: Object,
     fromMapInfo: Object,
+    isSpaceCanControl: Boolean,
     userControlSpace: Object,
     userInfo: Object
   },

+ 188 - 197
src/packagesEnv/pages/officehome/demo.wpy

@@ -263,214 +263,205 @@ page {
 </template>
 
 <script>
-import wepy from '@wepy/core';
-import store from '@/store';
-import config from '@/config';
-import moment from 'moment';
-import { mapState } from '@wepy/x';
-import { checkHasUserInfo } from '@/service/user';
-import { saveCompanyConfig } from '@/service/companyConfig';
-
+import wepy from '@wepy/core'
+import store from '@/store'
+import config from '@/config'
+import moment from 'moment'
+import { mapState } from '@wepy/x'
+import { checkHasUserInfo } from '@/service/user'
+import { saveCompanyConfig } from '@/service/companyConfig'
 
 wepy.page({
-    store,
-    data: {
-        imgpath: config.h5StaticPath + '/page-officehome-demo/',
-        img: config.h5StaticPath + '/page-officehome-demo/tiyan.png',//allopen.png
-        isHome: false,//是否是主页面
-        showChart: false,
-        serviceTime: false,
-        airOpen: true,
-        lampOpen: true,
-        curtainOpen: true,
-        waterOpen: true,
-        fanOpen: true,
-        wetOpen: true,
+  store,
+  data: {
+    imgpath: config.h5StaticPath + '/page-officehome-demo/',
+    img: config.h5StaticPath + '/page-officehome-demo/tiyan.png', // allopen.png
+    isHome: false, // 是否是主页面
+    showChart: false,
+    serviceTime: false,
+    airOpen: true,
+    lampOpen: true,
+    curtainOpen: true,
+    waterOpen: true,
+    fanOpen: true,
+    wetOpen: true
+  },
+  computed: {
+    ...mapState({ token: state => state.user.token, energyHeadData: state => state.portrait.energyHeadData })
+  },
+  onLoad() {
+    checkHasUserInfo()
+    setTimeout(() => {
+      this.img = this.imgpath + 'allopen.png'
+      this.isHome = true
+    }, 2000)
+  },
+  onReady() { },
+  methods: {
+    chartShowClick() {
+      this.img = this.imgpath + 'chart.png'
+      this.isHome = false
+      this.showChart = true
     },
-    computed: {
-        ...mapState({ token: state => state.user.token, energyHeadData: state => state.portrait.energyHeadData })
+    serviceTimeClick() {
+      this.img = this.imgpath + 'serviceTime.png'
+      this.isHome = false
+            // this.serviceTime = true;
     },
-    onLoad() {
-        var _this = this;
-        checkHasUserInfo().then(function (userInfo) {
-            console.log('checkHasUserInfo', userInfo);
-            var companyId = userInfo.companyId;
-            // saveCompanyConfig(companyId).then(() => 
-            // })
-        });
-        setTimeout(() => {
-            this.img = this.imgpath + 'allopen.png';
-            this.isHome = true;
-        }, 2000);
-
+    airClick() {
+      console.log('this.airOpen', this.airOpen)
+      if (this.airOpen) {
+        this.airOpen = false
+        this.img = this.imgpath + 'airclose.png'
+      } else {
+        this.airOpen = true
+        this.img = this.imgpath + 'allopen.png'
+      }
+      this.lampOpen = true
+      this.curtainOpen = true
+      this.waterOpen = true
+      this.fanOpen = true
+      this.wetOpen = true
     },
-    onReady() { },
-    methods: {
-        chartShowClick() {
-            this.img = this.imgpath + 'chart.png';
-            this.isHome = false;
-            this.showChart = true;
-        },
-        serviceTimeClick() {
-            this.img = this.imgpath + 'serviceTime.png';
-            this.isHome = false;
-            // this.serviceTime = true;
-        },
-        airClick() {
-            console.log('this.airOpen', this.airOpen);
-            if (this.airOpen) {
-                this.airOpen = false;
-                this.img = this.imgpath + 'airclose.png';
-            } else {
-                this.airOpen = true;
-                this.img = this.imgpath + 'allopen.png';
-            }
-            this.lampOpen = true;
-            this.curtainOpen = true;
-            this.waterOpen = true;
-            this.fanOpen = true;
-            this.wetOpen = true;
-        },
-        downCold() {
-            this.img = this.imgpath + 'downcold.png';
-            this.isHome = false;
-        },
-        upHot() {
-            this.img = this.imgpath + 'uphot.png';
-            this.isHome = false;
-        },
-        xiaoWind() {
-            this.img = this.imgpath + 'windxiao.png';
-            this.isHome = false;
-        },
-        daWind() {
-            this.img = this.imgpath + 'windda.png';
-            this.isHome = false;
-        },
-        lampOpenClick() {
-            if (!this.lampOpen) {
-                this.lampOpen = true;
-
-                this.airOpen = true;
-                this.curtainOpen = true;
-                this.waterOpen = true;
-                this.fanOpen = true;
-                this.wetOpen = true;
-                this.img = this.imgpath + 'allopen.png';
-            }
-        },
-        lampCloseClick() {
-            console.log('this.lampOpen', this.lampOpen);
-            if (this.lampOpen) {
-                this.lampOpen = false;
+    downCold() {
+      this.img = this.imgpath + 'downcold.png'
+      this.isHome = false
+    },
+    upHot() {
+      this.img = this.imgpath + 'uphot.png'
+      this.isHome = false
+    },
+    xiaoWind() {
+      this.img = this.imgpath + 'windxiao.png'
+      this.isHome = false
+    },
+    daWind() {
+      this.img = this.imgpath + 'windda.png'
+      this.isHome = false
+    },
+    lampOpenClick() {
+      if (!this.lampOpen) {
+        this.lampOpen = true
 
-                this.airOpen = true;
-                this.curtainOpen = true;
-                this.waterOpen = true;
-                this.fanOpen = true;
-                this.wetOpen = true;
-                this.img = this.imgpath + 'lampclose.png';
-            }
-        },
-        fanClick() {
-            if (this.fanOpen) {
-                this.fanOpen = false;
-                this.img = this.imgpath + 'fanclose.png';
-            } else {
-                this.fanOpen = true;
-                this.img = this.imgpath + 'allopen.png';
-            }
-            this.airOpen = true;
-            this.lampOpen = true;
-            this.curtainOpen = true;
-            this.waterOpen = true;
-            this.wetOpen = true;
-        },
-        waterClick() {
-            if (this.waterOpen) {
-                this.waterOpen = false;
-                this.img = this.imgpath + 'waterclose.png';
-            } else {
-                this.waterOpen = true;
-                this.img = this.imgpath + 'allopen.png';
-            }
-            this.airOpen = true;
-            this.lampOpen = true;
-            this.curtainOpen = true;
-            this.fanOpen = true;
-            this.wetOpen = true;
-        },
-        wetClick() {
-            if (this.wetOpen) {
-                this.wetOpen = false;
-                this.img = this.imgpath + 'wetclose.png';
-            } else {
+        this.airOpen = true
+        this.curtainOpen = true
+        this.waterOpen = true
+        this.fanOpen = true
+        this.wetOpen = true
+        this.img = this.imgpath + 'allopen.png'
+      }
+    },
+    lampCloseClick() {
+      console.log('this.lampOpen', this.lampOpen)
+      if (this.lampOpen) {
+        this.lampOpen = false
 
-                this.wetOpen = true;
-                this.img = this.imgpath + 'allopen.png';
-            }
-            this.airOpen = true;
-            this.lampOpen = true;
-            this.curtainOpen = true;
-            this.waterOpen = true;
-            this.fanOpen = true;
-        },
-        curtainOpenClick() {
-            if (!this.curtainOpen) {
-                this.airOpen = true;
-                this.lampOpen = true;
-                this.curtainOpen = true;
-                this.waterOpen = true;
-                this.fanOpen = true;
-                this.wetOpen = true;
-                this.img = this.imgpath + 'allopen.png';
-            }
-        },
-        curtainCloseClick() {
-            if (this.curtainOpen) {
-                this.curtainOpen = false;
+        this.airOpen = true
+        this.curtainOpen = true
+        this.waterOpen = true
+        this.fanOpen = true
+        this.wetOpen = true
+        this.img = this.imgpath + 'lampclose.png'
+      }
+    },
+    fanClick() {
+      if (this.fanOpen) {
+        this.fanOpen = false
+        this.img = this.imgpath + 'fanclose.png'
+      } else {
+        this.fanOpen = true
+        this.img = this.imgpath + 'allopen.png'
+      }
+      this.airOpen = true
+      this.lampOpen = true
+      this.curtainOpen = true
+      this.waterOpen = true
+      this.wetOpen = true
+    },
+    waterClick() {
+      if (this.waterOpen) {
+        this.waterOpen = false
+        this.img = this.imgpath + 'waterclose.png'
+      } else {
+        this.waterOpen = true
+        this.img = this.imgpath + 'allopen.png'
+      }
+      this.airOpen = true
+      this.lampOpen = true
+      this.curtainOpen = true
+      this.fanOpen = true
+      this.wetOpen = true
+    },
+    wetClick() {
+      if (this.wetOpen) {
+        this.wetOpen = false
+        this.img = this.imgpath + 'wetclose.png'
+      } else {
+        this.wetOpen = true
+        this.img = this.imgpath + 'allopen.png'
+      }
+      this.airOpen = true
+      this.lampOpen = true
+      this.curtainOpen = true
+      this.waterOpen = true
+      this.fanOpen = true
+    },
+    curtainOpenClick() {
+      if (!this.curtainOpen) {
+        this.airOpen = true
+        this.lampOpen = true
+        this.curtainOpen = true
+        this.waterOpen = true
+        this.fanOpen = true
+        this.wetOpen = true
+        this.img = this.imgpath + 'allopen.png'
+      }
+    },
+    curtainCloseClick() {
+      if (this.curtainOpen) {
+        this.curtainOpen = false
 
-                this.airOpen = true;
-                this.lampOpen = true;
-                this.waterOpen = true;
-                this.fanOpen = true;
-                this.wetOpen = true;
-                this.img = this.imgpath + 'curtainclose.png';
-            }
-        },
-        mainBack() {
-            if (this.isHome) {
-                wx.navigateBack();
-            } else {
-                this.img = this.imgpath + 'allopen.png';
-                this.isHome = true;
-                this.showChart = false;
+        this.airOpen = true
+        this.lampOpen = true
+        this.waterOpen = true
+        this.fanOpen = true
+        this.wetOpen = true
+        this.img = this.imgpath + 'curtainclose.png'
+      }
+    },
+    mainBack() {
+      if (this.isHome) {
+        wx.navigateBack()
+      } else {
+        this.img = this.imgpath + 'allopen.png'
+        this.isHome = true
+        this.showChart = false
 
-                this.airOpen = true;
-                this.lampOpen = true;
-                this.curtainOpen = true;
-                this.waterOpen = true;
-                this.fanOpen = true;
-                this.wetOpen = true;
-            }
-        },
-        mainImgShow() {
-            //如果是参数chart页面 则只能通过back按钮
-            //如果是其他非主页面 一点击则 显示主页面图片
-            if (!this.isHome && !this.showChart) {
-                this.img = this.imgpath + 'allopen.png';
-                this.isHome = true;
+        this.airOpen = true
+        this.lampOpen = true
+        this.curtainOpen = true
+        this.waterOpen = true
+        this.fanOpen = true
+        this.wetOpen = true
+      }
+    },
+    mainImgShow() {
+            // 如果是参数chart页面 则只能通过back按钮
+            // 如果是其他非主页面 一点击则 显示主页面图片
+      if (!this.isHome && !this.showChart) {
+        this.img = this.imgpath + 'allopen.png'
+        this.isHome = true
 
-                this.airOpen = true;
-                this.lampOpen = true;
-                this.curtainOpen = true;
-                this.waterOpen = true;
-                this.fanOpen = true;
-                this.wetOpen = true;
-            }
-        }
+        this.airOpen = true
+        this.lampOpen = true
+        this.curtainOpen = true
+        this.waterOpen = true
+        this.fanOpen = true
+        this.wetOpen = true
+      }
     }
-});
+  }
+})
 </script>
 
 <config>

+ 20 - 16
src/packagesEnv/pages/officehome/index.wpy

@@ -563,7 +563,7 @@ page {
                         v-show="moveToBottom"
                     >
                         <div class="upToSpace" 
-                        v-if="officeData.localName">
+                        v-if="isSpaceCanControl">
                             <image
                                 class="imgSt"
                                 src="{{h5StaticPath}}icon-double-arrow.svg"
@@ -571,6 +571,7 @@ page {
                             <span class="text">上滑进入空间</span>
                         </div>
                         <space-basic
+                            :isSpaceCanControl="isSpaceCanControl"
                             :IsShowPerson="false"
                             :officeData="officeData"
                             :options="options"
@@ -1009,20 +1010,10 @@ import {
     queryCustomAndScence,
     queryEquipmentRunConfig
 } from '../../api/officehome.js'
-
-import { getMeetingList } from '@/api/meetingroom'
+import { checkHasUserInfo } from '@/service/user'
 import { isWithinLocation } from '@/service/location'
 import config from '@/config'
-import loadFont from '@/common/loadFont'
-import { getCompanyMapData } from '@/api/home'
-import { checkHasUserInfo } from '@/service/user'
-import { getNowDate, getTowNum } from '@/service/meetingTimes'
-
 let spaceInfoStatusTimer = null
-let pageSelectedAreaRecord = {
-    // key为楼层ID,value 为spceId
-}
-
 const switchPanelHeight = 125 // 145是下面块的高
 const roomPicTop = 185 // 135是建筑图片的高度 单位都是px
 var moveY
@@ -1076,6 +1067,7 @@ wepy.page({
   data: {
     sceneShow: false,
     isShowPermanent: false,
+    isUserControlFromMap: true,
     userControlSpace: {}, // 用户控制空间
     cardWidth: 0, // 动态获取卡片的宽度
     floorFeatItem: {}, // 地暖弹窗数据
@@ -1234,6 +1226,14 @@ wepy.page({
                 this.options.roomType === '会议室' &&
                 this.spaceEqFlagObj.hasLamp
       return meetingScene
+    },
+    isSpaceCanControl() {
+      let flag = true
+      if (this.userControlSpace.isControlSpace === 1 || this.userControlSpace.isControlSpace === 2 || !this.isUserControlFromMap) {
+        flag = false
+      }
+      console.log(flag, '----flag')
+      return flag
     }
   },
   watch: {
@@ -1256,6 +1256,7 @@ wepy.page({
   },
     // 加载字体
   onLoad(routeParams) {
+    checkHasUserInfo()
     this.getCardWidth()
     this.getWeatherInfo()// 天气预报
     var nowTimeStr = moment().format('YYYY-MM-DD')
@@ -1306,6 +1307,7 @@ wepy.page({
 
       if (this.routeParams.from === 'FindIt') {
         this.getCurrentSpace('FindIt')
+        this.isUserControlFromMap = this.routeParams.isUserControl
         this.options.spaceId = this.routeParams.spaceId
         this.moveToBottom = true  // 来自找一找, 页面在底部
         this.getData() // 获取数据
@@ -1331,7 +1333,6 @@ wepy.page({
             break
           case 'openLamp':
             this.selectCrad('', 'lamp')
-            console.log(this.$refs, '----this.$refs.lampAdjust')
             this.$refs.lampAdjust.eqChange(true, 'allLamp')
             break
           case 'airAddOne':
@@ -1357,7 +1358,7 @@ wepy.page({
     },
     getCurrentSpace(from) {
       return checkUserControl().then(res => {
-        // 1-租户下无可控;2-租户有可控;3-用户有可控 4-当前空间为常驻空间
+        // isControlSpace 1-租户下无可控;2-租户有可控;3-用户有可控 4-当前空间为常驻空间
         this.userControlSpace = res
         // 从首页进入 才给空间重新赋值
         if (from === 'home') {
@@ -1599,10 +1600,10 @@ wepy.page({
     },
     // 地图数据切换空间
     mapChangeSpaceInfo(obj) {
-      console.log(obj, '----来自地图')
-      // isCompanyControl: true 为常驻工区
+      // isUserControl-Boolean 用户空间是否可以控
       const mapItem = JSON.parse(JSON.stringify(obj))
       this.options.spaceId = mapItem.spaceId
+      this.isUserControlFromMap = mapItem.isUserControl
       this.getData()
     },
     getSpaceInfo() {
@@ -1891,6 +1892,8 @@ wepy.page({
       this.scrollTop = targetNav.top // 实现点击导航 滚动
     },
     async scrollEvent(event) {
+        // 空间不可控不能滑动
+      if (!this.isSpaceCanControl) return
             // 滚动 选中导航条相应的
       await this.getCardPosition()
       var scrollTop = (event.detail || event.$wx.detail || {}).scrollTop || 0
@@ -1931,6 +1934,7 @@ wepy.page({
     toRoom() {
       this.scrollTop = null
       this.scrollTop = 0
+      console.log('----滑下来----')
       this.transY = this.transYCopy
     },
     handleWorkOff(val) {

+ 132 - 0
src/packagesEnv/pages/personalCenter/component/custome-service-panel.wpy

@@ -0,0 +1,132 @@
+<style lang="less">
+.custome-service-panel {
+    position: fixed;
+    top: 0;
+    bottom: 0;
+    right: 0;
+    left: 0;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    z-index: 2;
+    &.show {
+        display: flex;
+    }
+    &.hide {
+        display: none;
+    }
+    .panel-mask {
+        position: absolute;
+        top: 0;
+        right: 0;
+        left: 0;
+        bottom: 0;
+        background: rgba(0, 0, 0, 0.2);
+    }
+    .content {
+        position: absolute;
+        bottom: 0px;
+        text-align: center;
+        border-radius: 16px 16px 0px 0px;
+        background: #ffffff;
+        width: 100%;
+        height: 296rpx;
+
+        .sp-text {
+            height: 100rpx;
+            color: #1db1b2;
+            font-family: PingFang SC;
+            font-size: 32rpx;
+            font-weight: 400;
+            line-height: 100rpx;
+        }
+        .dir {
+            height: 16rpx;
+            background: #f1f4f6;
+        }
+        .text {
+            color: #8b949e;
+            font-family: PingFang SC;
+            font-size: 32rpx;
+            font-weight: 400;
+            line-height: 100rpx;
+        }
+    }
+}
+</style>
+
+<template>
+    <cover-view
+        class="{{'custome-service-panel '+(show?'show':'hide')}}"
+        v-on:touchmove.stop="stopProgration"
+    >
+        <cover-view
+            class="panel-mask"
+            v-on:click="closePanel"
+        ></cover-view>
+        <cover-view class="content">
+            <cover-view>
+                <cover-view
+                    class="sp-text"
+                    @click="callPhone"
+                >
+                    呼叫 {{ phone }}
+                </cover-view>
+                <cover-view class="dir"></cover-view>
+                <cover-view
+                    class="text"
+                    v-on:click="closePanel"
+                >取消</cover-view>
+            </cover-view>
+        </cover-view>
+    </cover-view>
+</template>
+
+<script>
+import wepy from '@wepy/core'
+import config from '@config'
+import { mapState } from '@wepy/x'
+import store from '@/store'
+
+wepy.component({
+  store,
+  data: {
+    h5StaticPath: config.h5StaticPath,
+    h5Origin: config.h5Origin,
+    showLink: `${config.h5Origin}/#/wx-external-link`
+  },
+  props: {
+    show: Boolean,
+    phone: String
+
+  },
+  computed: {
+    ...mapState({ userInfo: state => state.user.userInfo })
+  },
+  created() {
+
+  },
+  methods: {
+    callPhone() {
+      let _this = this
+      wx.makePhoneCall({
+        phoneNumber: this.phone,
+        complete() {
+          _this.$emit('custome-service-close', false)
+        }
+      })
+    },
+    closePanel() {
+      this.$emit('custome-service-close', false)
+    },
+    stopProgration() { }
+  }
+})
+</script>
+
+
+<config>
+{
+  
+}
+</config>

+ 24 - 13
src/packagesEnv/pages/personalCenter/footer.wpy

@@ -29,10 +29,10 @@
         justify-content: center;
         width: 272rpx;
         height: 88rpx;
-        padding: 20rpx 48rpx 20rpx 48rpx;
         border-radius: 40px;
         background: #ffffff;
         .text {
+            margin-left: 16rpx;
             font-family: PingFang SC;
             font-size: 28rpx;
             font-weight: 400;
@@ -52,10 +52,11 @@
         <div
             class="btn-box"
             v-if="IsShowPhone"
+            @click="callPhone"
         >
             <image
                 class="imgSt"
-                src="/static/icon-phone.svg"
+                src="{{ h5StaticPath }}/icon-phone.svg"
             />
             <span class="text">客服电话</span>
         </div>
@@ -74,26 +75,36 @@
 <script>
 
 import wepy from '@wepy/core'
-// import config from '@/config';
+import config from '@/config'
+import { customerservice } from '../../api/personalCenter.js'
 wepy.component({
   name: 'Footer',
   props: {
-    IsShowPhone: Boolean
   },
   data: {
+    h5StaticPath: config.h5StaticPath + '/page-personalCenter',
+    IsShowPhone: true,
+    phone: null
 
   },
   computed: {},
-  methods: {
-
+  ready() {
+    this.getPhone()
   },
-    // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-
-  },
-    // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-
+  methods: {
+    callPhone() {
+      this.$emit('callPhone', this.phone)
+    },
+    getPhone() {
+      customerservice().then(res => {
+        let phone = null
+        if (res.count) {
+          phone = res.content[0].phone
+        }
+        this.phone = phone
+      })
+    }
   }
+
 })
 </script>

+ 37 - 17
src/packagesEnv/pages/personalCenter/index.wpy

@@ -18,7 +18,6 @@ page {
         top: 0;
         left: 0;
         z-index: 0;
-
     }
     .contain {
         padding-top: 240rpx;
@@ -120,9 +119,10 @@ page {
 <template>
     <div class="percsonal-center">
         <page-top-bar
-        iconClickedEmitId="toPage"
-        @toPage="toPage('/packagesEnv/pages/home/index')"
-          icon="{{h5Static+'/page-top-bar/return-icon.svg'}}"></page-top-bar>
+            iconClickedEmitId="toPage"
+            @toPage="toPage('/packagesEnv/pages/home/index')"
+            icon="{{h5Static+'/page-top-bar/return-icon.svg'}}"
+        ></page-top-bar>
         <image
             class="imgst"
             src="{{h5StaticPath}}/bg-personal.png"
@@ -133,17 +133,17 @@ page {
             <div class="head">
                 <image
                     class="imgHead"
-                    src="{{h5StaticPath}}/no-person.png"
+                    src="{{userInfo.headImgUrl}}"
                 />
                 <div @click="goToPersonalInfo">
                     <div>
-                        <span class="p-name">纳兰词</span>
+                        <span class="p-name">{{userInfo.name}}</span>
                         <image
                             style="width: 24rpx;height: 24rpx;"
                             src="{{h5StaticPath}}/icon-arrow-right.svg"
                         />
                     </div>
-                    <div class="p-comp">上格云智能技术有限公司</div>
+                    <div class="p-comp">{{ userInfo.companyName }}</div>
                 </div>
             </div>
             <div class="content">
@@ -192,7 +192,13 @@ page {
 
             </div>
         </div>
-        <footer :IsShowPhone="IsShowPhone"></footer>
+        <footer @callPhone="openPhonePanel"></footer>
+        <custome-service-panel
+            :show="visiblePhone"
+            :phone="phone"
+            @custome-service-close="closePhonePanel"
+        >
+        </custome-service-panel>
         <add-miniprogram-to-desk-panel
             :show="isShowAddminiProgramToDesk"
             @component-add-miniprogram-to-desk-panel-close="handleAdd(false)"
@@ -204,22 +210,42 @@ page {
 <script>
 import wepy from '@wepy/core'
 import config from '@/config'
+import { queryUserById } from '../../api/personalCenter'
 wepy.page({
   components: {},
   props: {},
   data: {
+    visiblePhone: false,
+    phone: '',
+    userInfo: null,
     h5StaticPath: config.h5StaticPath + '/page-personalCenter',
     h5Static: config.h5StaticPath,
     isShowAddminiProgramToDesk: false,
-    IsShowPhone: true,
     arr: [
             // { name: '问题反馈', icon: 'icon-message.svg', url: '' },
             { name: '操作指引', icon: 'icon-guid.svg', url: '/packagesEnv/pages/personalCenter/operating' },
             { name: '关于小飒指控', icon: 'icon-tip.svg', url: '/packagesEnv/pages/personalCenter/xiaosa' }
     ]
   },
+  onLoad() {
+    this.getUserInfo()
+  },
+
   computed: {},
   methods: {
+    getUserInfo() {
+      queryUserById().then(res => {
+        this.userInfo = res.data
+        this.userInfo.headImgUrl = res.data.headImgUrl || `${this.h5StaticPath}/no-person.png`
+      })
+    },
+    openPhonePanel(val) {
+      this.phone = val
+      this.visiblePhone = true
+    },
+    closePhonePanel(val) {
+      this.visiblePhone = val
+    },
     handleAdd(val) {
       this.isShowAddminiProgramToDesk = val
     },
@@ -234,15 +260,8 @@ wepy.page({
       })
     }
 
-  },
-    // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-
-  },
-    // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-
   }
+
 })
 </script>
 <config>
@@ -253,6 +272,7 @@ wepy.page({
     usingComponents: {
         'page-top-bar': '~@/components/common/page-top-bar', 
         'add-miniprogram-to-desk-panel': './component/add-miniprogram-to-desk-panel', 
+        'custome-service-panel': './component/custome-service-panel', 
         'footer':'./footer'     
     },
     "componentPlaceholder": {

+ 18 - 12
src/packagesEnv/pages/personalCenter/personalInfo.wpy

@@ -80,14 +80,15 @@ page{
 
 import wepy from '@wepy/core'
 import config from '@/config'
+import { queryUserById } from '../../api/personalCenter'
 wepy.page({
   props: {},
   data: {
     h5StaticPath: config.h5StaticPath + '/page-personalCenter',
     topArr: [
-        {name: '头像', text: '', url: 'no-person.png'},
-        {name: '姓名', text: '尹亚琼', url: ''},
-        {name: '手机号', text: '186909090', url: ''}
+        {name: '头像', text: '', url: ''},
+        {name: '姓名', text: '', url: ''},
+        {name: '手机号', text: '', url: ''}
     ],
     nextArr: [
         {name: '岗位', text: 'UX设计师'},
@@ -95,17 +96,22 @@ wepy.page({
     ]
   },
   computed: {},
-  methods: {
-
-  },
-    // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-
+  onLoad() {
+    this.getUserInfo()
   },
-    // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-
+  methods: {
+    getUserInfo() {
+      queryUserById().then(res => {
+        const userInfo = res.data
+        this.topArr[0].url = userInfo.headImgUrl || 'no-person.png'
+        this.topArr[1].text = userInfo.name
+        this.topArr[2].text = userInfo.phone
+        this.nextArr[0].text = userInfo.job
+        this.nextArr[1].text = userInfo.companyName
+      })
+    }
   }
+
 })
 </script>
 <config>

+ 2 - 8
src/packagesEnv/pages/portrait/home.wpy

@@ -221,14 +221,8 @@ wepy.page({
   },
   onLoad() {
     umaInit()
-    var _this = this
-    checkHasUserInfo().then(function (userInfo) {
-      console.log('checkHasUserInfo', userInfo)
-      var companyId = userInfo.companyId
-            //   saveCompanyConfig(companyId).then(() => {
-      _this.getData()
-            //   }).catch((err) => {})
-    })
+    checkHasUserInfo()
+    this.getData()
     this.carbonCreditText = carbonCredit(this.projectId)
   },
   onReady() { },

+ 1 - 31
src/packagesEnv/pages/portrait/pointExplain.wpy

@@ -63,7 +63,7 @@ page {
 <template>
     <div>
         <page-top-bar
-            icon="{{h5StaticPath+'/topBar/return-icon.svg'}}"
+            icon="{{h5StaticPath+'/page-top-bar/return-icon.svg'}}"
         ></page-top-bar>
         <div class="page-container">
             <div class="energyHead">
@@ -71,7 +71,6 @@ page {
             </div>
             <div
                 class="pointExplain"
-                v-if="projectId === 'Pj1101020007'"
             >
                 <div :class="{'item':true,'carbonItem':true}" 
                 style="{{ item.sty }}"
@@ -80,35 +79,6 @@ page {
                     <div class="cont" style="line-height: 48rpx;">{{item.text}}</div>
                 </div>
             </div>
-            <div
-                class="pointExplain"
-                v-else
-            >
-                <div class="item">
-                    <div class="order">1、</div>
-                    <div class="cont">加班的时候设置加班时间,积分1</div>
-                </div>
-                <div class="item">
-                    <div class="order">2、</div>
-                    <div class="cont">办公中暂时不需要<span v-if="portraitModule.light">照明&</span><span v-if="portraitModule.airConditioner">空调</span>,持续时间大于等<br>于0.5,小于1小时无任何开启,积分0.5</div>
-                </div>
-                <div class="item">
-                    <div class="order">3、</div>
-                    <div class="cont">办公中暂时不需要<span v-if="portraitModule.light">照明&</span><span v-if="portraitModule.airConditioner">空调</span>,持续时间大于等<br>于1,小于2小时无任何开启,积分1</div>
-                </div>
-                <div class="item">
-                    <div class="order">4、</div>
-                    <div class="cont">办公中暂时不需要<span v-if="portraitModule.light">照明&</span><span v-if="portraitModule.airConditioner">空调</span>,持续时间大于等<br>于2小时无任何开启,积分2</div>
-                </div>
-                <div class="item">
-                    <div class="order">5、</div>
-                    <div class="cont">供冷季,调节至室内温度大于等于26℃,积分1</div>
-                </div>
-                <div class="item">
-                    <div class="order">6、</div>
-                    <div class="cont">供暖季,调节至室内温度小于等于20℃,积分1</div>
-                </div>
-            </div>
 
         </div>
     </div>

+ 57 - 58
src/packagesEnv/pages/portrait/visitor.wpy

@@ -292,24 +292,24 @@ page {
 </template>
 
 <script>
-import wepy from '@wepy/core';
-import store from '@/store';
-import config from '@/config';
-import moment from 'moment';
-import { mapState } from '@wepy/x';
-import { checkLogin, checkHasUserInfo } from '@/service/user';
-import { queryInvitationStatisticsHttp, queeyBuriedEventLogHttp } from '@/packagesEnv/api/portrait';
+import wepy from '@wepy/core'
+import store from '@/store'
+import config from '@/config'
+import moment from 'moment'
+import { mapState } from '@wepy/x'
+import { checkLogin, checkHasUserInfo } from '@/service/user'
+import { queryInvitationStatisticsHttp, queeyBuriedEventLogHttp } from '@/packagesEnv/api/portrait'
 
-let numChart = null;
+let numChart = null
 let resultData = {
   data: [
 
   ]
 }
 function numChartData(F2, config) {
-  let data = resultData.data;
-  numChart = new F2.Chart({ ...config, appendPadding: [30, 30, 15, 5] });
-  numChart.clear();
+  let data = resultData.data
+  numChart = new F2.Chart({ ...config, appendPadding: [30, 30, 15, 5] })
+  numChart.clear()
   numChart.source(data, {
     'x': {
       type: 'linear',
@@ -319,7 +319,7 @@ function numChartData(F2, config) {
 
     }
 
-  });
+  })
 
   numChart.guide().text({
     top: false,
@@ -332,7 +332,7 @@ function numChartData(F2, config) {
     }, // 文本的图形样式属性
     offsetX: 20, // x 方向的偏移量
     offsetY: 12 // y 方向偏移量
-  });
+  })
   numChart.guide().text({
     position: ['min', 'max'], // 文本的起始位置,值为原始数据值,支持 callback
     content: '时长', // 显示的文本内容
@@ -342,8 +342,8 @@ function numChartData(F2, config) {
     }, // 文本的图形样式属性
     offsetX: -4, // x 方向的偏移量
     offsetY: -20 // y 方向偏移量
-  });
-  numChart.tooltip(false);
+  })
+  numChart.tooltip(false)
   numChart.point().position('x*y')
         .size('r', [0, 30])
         .shape('circle')
@@ -351,8 +351,8 @@ function numChartData(F2, config) {
           opacity: 0.6
         })
 
-  numChart.render();
-  return numChart;
+  numChart.render()
+  return numChart
 }
 wepy.page({
   store,
@@ -379,9 +379,8 @@ wepy.page({
     ...mapState({ userInfo: state => state.user.userInfo, token: state => state.user.token })
   },
   onLoad() {
-    checkHasUserInfo().then(() => {
-      this.getData();
-    })
+    checkHasUserInfo()
+    this.getData()
   },
   onReady() { },
   methods: {
@@ -398,14 +397,14 @@ wepy.page({
           this.imgSrc = res.tempFilePath
         },
         fail: res => {
-          console.log('转图片失败', res);
+          console.log('转图片失败', res)
         }
       }, this)
     },
     async  getData() {
-      let res = await this.getInvitationStatistics();
+      let res = await this.getInvitationStatistics()
       if (res && res.visitorTotal) { // 有访客,显示界面,再请求
-        await this.getBuriedEventLog();
+        await this.getBuriedEventLog()
         this.isPageShow = true
       }
     },
@@ -421,29 +420,29 @@ wepy.page({
         endDate: endDate
       }
       return queryInvitationStatisticsHttp(paramObj).then(res => {
-        this.isPageShow = false;
+        this.isPageShow = false
         if (JSON.stringify(res.data) === '{}') { return };
-        let resData = JSON.parse(JSON.stringify(res.data));
-        this.infoArr[0].value = resData.visitorTotal;
-        this.infoArr[1].value = resData.invitationTimeTotal;
-        this.infoArr[2].value = Number.isInteger(resData.avgTimePerDay) ? resData.avgTimePerDay : resData.avgTimePerDay.toFixed(2);
+        let resData = JSON.parse(JSON.stringify(res.data))
+        this.infoArr[0].value = resData.visitorTotal
+        this.infoArr[1].value = resData.invitationTimeTotal
+        this.infoArr[2].value = Number.isInteger(resData.avgTimePerDay) ? resData.avgTimePerDay : resData.avgTimePerDay.toFixed(2)
 
-        let charArr = [];
-        let resCharArr = resData.detailList;
+        let charArr = []
+        let resCharArr = resData.detailList
 
-        let startMonthday = this.yearMonth + '01';
-        let endMonthday = moment(this.yearMonth).endOf('month').format('YYYYMMDD');
+        let startMonthday = this.yearMonth + '01'
+        let endMonthday = moment(this.yearMonth).endOf('month').format('YYYYMMDD')
                 // 补齐坐标轴
         for (let i = Number(startMonthday); i <= Number(endMonthday); i++) {
-          let flag = true;
-          let jItem = {};
+          let flag = true
+          let jItem = {}
           resCharArr.forEach(j => {
-            let JMs = j.date; // 时间戳
+            let JMs = j.date // 时间戳
             if (i == JMs) {
-              flag = false;
-              jItem = j;
+              flag = false
+              jItem = j
             }
-          });
+          })
           if (flag) {
             charArr.push({
               date: i,
@@ -454,15 +453,15 @@ wepy.page({
             charArr.push(jItem)
           }
         }
-        let visitorNumArr = []; // 人数
-        let invitationTimeArr = []; // 时长
+        let visitorNumArr = [] // 人数
+        let invitationTimeArr = [] // 时长
         charArr.forEach(item => {
-          let dateItem = String(item.date);
-          item.date = moment(dateItem).format('DD');
-          visitorNumArr.push({ x: item.date, y: item.invitationTime, r: item.visitorNum, color: '#5E8BCF' });
-          invitationTimeArr.push({ x: item.date, y: item.invitationTime, r: item.invitationTime, color: '#D0DBED' });
+          let dateItem = String(item.date)
+          item.date = moment(dateItem).format('DD')
+          visitorNumArr.push({ x: item.date, y: item.invitationTime, r: item.visitorNum, color: '#5E8BCF' })
+          invitationTimeArr.push({ x: item.date, y: item.invitationTime, r: item.invitationTime, color: '#D0DBED' })
         })
-        resultData.data = invitationTimeArr.concat(visitorNumArr);
+        resultData.data = invitationTimeArr.concat(visitorNumArr)
         // return new Promise((res, reject) => {
         //   this.canvasToImg();
         // })
@@ -471,7 +470,7 @@ wepy.page({
       })
     },
     getBuriedEventLog() { // 访客使用的功能
-      let funArr = ['connect_wifi', 'navigation'];
+      let funArr = ['connect_wifi', 'navigation']
       let $lt = ''
       if (moment().format('YYYYMM') === this.yearMonth) {
         $lt = moment().add(1, 'days').format('YYYYMMDD')
@@ -490,36 +489,36 @@ wepy.page({
         return queeyBuriedEventLogHttp(paramObj).then(res => {
           if (res.count) {
             if (res.content[0].name === 'connect_wifi') {
-              this.functionArr[0].value = res.count;
+              this.functionArr[0].value = res.count
             } else {
-              this.functionArr[1].value = res.count;
+              this.functionArr[1].value = res.count
             }
-            let maxValue = Math.max.apply(Math, this.functionArr.map(item => { return item.value }));
+            let maxValue = Math.max.apply(Math, this.functionArr.map(item => { return item.value }))
             this.functionArr.forEach(item => {
               item.wth = item.value / maxValue * 220 // 220 为最大宽度
             })
           } else {
             this.functionArr.forEach(item => {
               item.value = 0
-              item.wth = 0;
+              item.wth = 0
             })
           }
         })
       })
     },
     checkTime(val) {
-      wx.uma.trackEvent('portrait_visitor_card', { key: '访客-月份切换' });
-      this.visible = !this.visible;
-      this.chartFlag = false;
-      this.yearMonth = val;
-      this.yearMonthText = moment(this.yearMonth).format('YYYY.MM');
-      this.getData();
+      wx.uma.trackEvent('portrait_visitor_card', { key: '访客-月份切换' })
+      this.visible = !this.visible
+      this.chartFlag = false
+      this.yearMonth = val
+      this.yearMonthText = moment(this.yearMonth).format('YYYY.MM')
+      this.getData()
     },
     changeMonth() {
-      this.visible = !this.visible;
+      this.visible = !this.visible
     }
   }
-});
+})
 </script>
 
 <config>

+ 1 - 1
src/pages/auth/index.wpy

@@ -89,7 +89,7 @@ import wepy from '@wepy/core';
 import { mapState } from '@wepy/x';
 import store from '@/store';
 import config from '@/config';
-import { setAvatar, checkLoginNew } from '@/service/user';
+import { setAvatar } from '@/service/user';
 import { getHttpPhoneNumber } from '@/api/user';
 let defaultAvatarUrl =
   config.h5StaticPath + '/page-bind-tenant/default_avatar.svg';

+ 10 - 9
src/pages/index.wpy

@@ -47,7 +47,7 @@ page {
    <div class="login">
        <image src="{{h5StaticPath +'/page-bind-tenant/logo_title.png'}}" alt=""/>
        <button class="bind-btn"
-        @click="goBindTenant">登录</button>
+        @click.stop="goBindTenant">登录</button>
    </div>
   </div>
 </template>
@@ -57,7 +57,7 @@ import wepy from '@wepy/core';
 import { mapState } from '@wepy/x';
 import store from '@/store';
 import config from '@/config';
-import { wxLogin, checkLoginNew } from '@/service/user';
+import { wxLogin } from '@/service/user';
 wepy.page({
   store,
   data: {
@@ -65,17 +65,20 @@ wepy.page({
     isActivated: 0
   },
   computed: {
-    ...mapState({ token: state => state.user.token }),
-    ...mapState({ isActivated: state => state.user.isActivated })
+    ...mapState({
+      token: state => state.user.token,
+      isActivated: state => state.user.isActivated
+    })
   },
-  onLoad() {},
-  onShow() {
+  onLoad() {
     if (this.isActivated && this.isActivated == 1) {
       this.goHome();
     } else {
+      console.log('this.isActivated===45', this.isActivated);
       this.checkTenantRegist();
     }
   },
+  onShow() {},
   methods: {
     goBindTenant() {
       this.goAuth();
@@ -108,12 +111,10 @@ wepy.page({
         .catch(error => {});
     },
     goHome() {
+      // console.log("gohome");
       wx.navigateTo({
         url: '/packagesEnv/pages/home/index'
       });
-      // wx.navigateTo({
-      //   url: '/pages/auth/index'
-      // });
     },
     goAuth() {
       console.log('被点击了');

+ 40 - 15
src/service/user.js

@@ -3,26 +3,39 @@ import store from '@/store';
 import config from '@/config';
 import { login, getCompanyByPhone, refreshToken, getUserControlSpace } from '@/api/user.js';
 import utils from '@/common/utils.js';
-//  定时检查用户信息并且续约
+//  定时检查用户信息并且续约-进入页面默认传0
 function checkHasUserInfo() {
   let timer = setTimeout(() => {
+    let token = store.state.user.token
     let tokenInfo = store.state.user.tokenInfo;
     let expireTime = tokenInfo.expireTime;
     let refreshTokenExpireTime = tokenInfo.refreshTokenExpireTime;
     let nowtime = utils.getTimeStamp();
-    if (expireTime && refreshTokenExpireTime >= nowtime && expireTime - nowtime <= 1800000) {  // 过期可续约
-      refreshTokenPage()
+    let refreshTokenValue = tokenInfo && tokenInfo.refreshToken ? tokenInfo.refreshToken : '';
+    if (token && refreshTokenValue && expireTime && refreshTokenExpireTime >= nowtime) {  // 过期可续约
+      let minute = (parseInt(expireTime - nowtime) / 1000 / 60);
+      console.log(minute);
+      if (minute < 20) {
+        refreshTokenPage().then(() => {
+          clearTimeout(timer);
+          checkHasUserInfo(600000);
+        });
+      } else {
+        clearTimeout(timer);
+        checkHasUserInfo(600000);
+      }
+    } else {
+      clearTimeout(timer);
+      checkHasUserInfo(600000);
     }
-    clearTimeout(timer);
-    checkHasUserInfo();
   }, 600000)
-
 }
 
 
 
 // 登录
 function wxLogin(type) {
+  console.log("执行了登录")
   // type=1 如果type未激活和作废不需要跳转到登录页面
   return new Promise((resolve, reject) => {
     wx.login({
@@ -52,7 +65,7 @@ function wxLogin(type) {
                 // store.commit('setProjectId', data.tokenUser.projectId);
               } else {
                 if (!type) {
-                  wx.redirectTo({ url: '/pages/index' });
+                  refreshLogin()
                 }
                 store.commit('setUserInfo', {});
               }
@@ -125,6 +138,7 @@ function refreshTokenPage() {
           refreshTokenExpireTime: data.refreshTokenExpireTime,
           refreshToken: data.refreshToken
         };
+        console.log(data);
         store.commit('setToken', data.token);
         store.commit('setActivated', data.isActivated);
         store.commit('setTokenInfo', tokenInfo);
@@ -133,18 +147,19 @@ function refreshTokenPage() {
           resolve(data)
         } else {
           store.commit('clearToken', '');
-          refreshHome()
+          // 去登录页面
+          refreshLogin()
           resolve(data)
         }
-      } else { 
+      } else {
         store.commit('clearToken', '');
         refreshHome();
-        reject("续约失败")
+        reject("续约失败!")
       }
     }).catch(() => {
       store.commit('clearToken', '');
       refreshHome();
-      reject("续约失败")
+      reject("续约失败!")
     })
   })
 }
@@ -154,6 +169,10 @@ function refreshHome() {
   // wx.redirectTo({ url: '/pages/index' });
   wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
 }
+function refreshLogin() {
+  wx.redirectTo({ url: '/pages/index' });
+  // wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
+}
 // 检查用户是否有空间控制权限
 function checkUserControl() {
   return new Promise((resolve, reject) => {
@@ -198,11 +217,12 @@ function checkUserControl() {
 }
 
 // 登录续约逻辑-待处理
-function checkLoginNew(type) {
+function checkLoginNew() {
   return new Promise((resolve, reject) => {
     let token = store.state.user.token;
     let storeTokenInfo = store.state.user.tokenInfo
     let refreshToken = storeTokenInfo && storeTokenInfo.refreshToken ? storeTokenInfo.refreshToken : '';
+    console.log("执行checkLoginNew--", token, refreshToken);
     console.log("执行checkLoginNew--");
     if (!token || !refreshToken) {
       wxLogin().then((res) => {
@@ -218,13 +238,13 @@ function checkLoginNew(type) {
           resolve(res)
         }).catch((error) => {
           reject("续约失败!");
-        });;
+        });
       } else if (flag == 2) { // 重新登录
         wxLogin().then((res) => {
           resolve(res)
         }).catch((error) => {
           reject("登录失败!");
-        });;
+        });
       } else if (flag == 3) {  // 未过期
         resolve({
           isActivated: store.state.user.isActivated
@@ -244,7 +264,12 @@ function checkTokenIsValid() {
   if (expireTime && expireTime <= nowtime && refreshTokenExpireTime >= nowtime) {  // 过期可续约
     flag = 1
   } else if (expireTime && expireTime >= nowtime) { //未过期
-    flag = 3
+    let minute = (parseInt(expireTime - nowtime) / 1000 / 60)
+    if (minute <= 20) {
+      flag = 1
+    } else {
+      flag = 3
+    }
   }
   else { // 需要重新登录
     flag = 2

+ 1 - 0
src/store/user.js

@@ -24,6 +24,7 @@ export default {
     // 设置token
     setToken(state, token) {
       wx.setStorageSync('token', token);
+      console.log("设置token--")
       state.token = token;
     },
     //设置租户状态