Quellcode durchsuchen

Merge branch 'master' of http://39.106.8.246:3003/sagacloud/sagacloud-sagacare-weChat

anxiaoxia vor 1 Jahr
Ursprung
Commit
eb85999cdd

+ 1 - 1
project.private.config.json

@@ -14,7 +14,7 @@
       "list": [
         {
           "name": "",
-          "pathName": "packagesEnv/pages/search/index",
+          "pathName": "pages/bindTenant/index",
           "query": "",
           "launchMode": "default",
           "scene": null

+ 13 - 10
src/packagesEnv/pages/intelligentControl/components/floor/floor.wpy

@@ -50,7 +50,7 @@
 
 .floor-item.selected,
 .building-item.selected {
-  background: #D4FAF4;
+  background: #d4faf4;
 }
 </style>
 
@@ -70,7 +70,6 @@
         </div>
      </div>
 
-     <!-- :class="{'selected' :selectedFloor == item.id}" -->
       <div class="floor-wrapper">
         <div
           class="floor-item"
@@ -93,14 +92,19 @@ let h5StaticPath = config.h5StaticPath + '/page-intelligent-control/';
 
 wepy.component({
   data: {
-    h5StaticPath
+    h5StaticPath,
   },
   props: {
     floors: Array,
     buildings: Array,
     status: 'fold',
     selectedBuilding: String, //选中的building id
-    selectedFloor: String //选中的floor id
+    selectedFloor: String, //选中的floor id
+  },
+  watch: {
+    selectedFloor: function() {
+      console.log("this.selectedFloor===",this.selectedFloor);
+    },
   },
   created() {},
   ready() {},
@@ -108,19 +112,18 @@ wepy.component({
   didUnmount() {},
   methods: {
     // 切换建筑
-    changeBuilding(id){
-      if(id!=this.selectedBuilding){
+    changeBuilding(id) {
+      if (id != this.selectedBuilding) {
         this.$emit('component-building-change', id);
-        
       }
     },
     // 切换楼层
     changeFloor(id) {
+      console.log(id);
       if (id !== this.selectedFloor) {
         this.$emit('component-floor-change', id);
       }
-     
-    }
-  }
+    },
+  },
 });
 </script>

+ 67 - 61
src/packagesEnv/pages/intelligentControl/home2.wpy

@@ -390,7 +390,7 @@ movable-view {
             </block>
             <div
                   class="selected-icon"
-                  v-if="selectArea"
+                  v-if="selectArea && selectArea.floorId==selectedFloor"
                   mode="scaleToFill"
                   :style="{top:(selectArea.top*mapScale-38)+'px',width:(selectArea.selectIconWidth)+'px',left:(selectArea.left*mapScale+(selectArea.width*mapScale/2)-selectArea.selectIconWidth/2)+'px',background:(selectArea.circleColor), transform: 'rotate('+(selectArea.rotate)+'deg)'}"
                 >
@@ -453,7 +453,7 @@ import store from '@/store';
 
 import {
   getSpaceBytoothHttp,
-  getMapDetailHttp
+  getMapDetailHttp,
 } from '@/packagesEnv/api/intelligentControl';
 import { checkHasUserInfo } from '@/service/user';
 import utils from '@/common/utils';
@@ -465,7 +465,7 @@ import { getCompanyMapData } from '@/api/home';
 import {
   getBuildingList,
   getFloorList,
-  getMapInfo
+  getMapInfo,
 } from '@/packagesEnv/api/mapApi.js';
 
 let h5StaticPath = config.h5StaticPath;
@@ -488,12 +488,12 @@ let pageSelectedAreaRecord = {
 let touchMapStartRecord = {
   timeStamp: 0,
   pageX: 0,
-  pageY: 0
+  pageY: 0,
 };
 let touchMapEndRecord = {
   timeStamp: 0,
   pageX: 0,
-  pageY: 0
+  pageY: 0,
 };
 let from = 'officehome';
 
@@ -504,8 +504,8 @@ wepy.component({
   props: {
     space: {
       type: Object,
-      default: {}
-    }
+      default: {},
+    },
   },
   store,
   data: {
@@ -536,12 +536,12 @@ wepy.component({
     companyId: '',
     buildingData: [],
     buildingItem: {},
-    floorItem: {}
+    floorItem: {},
   },
   computed: {
     ...mapState({
-      userInfo: state => state.user.userInfo
-    })
+      userInfo: (state) => state.user.userInfo,
+    }),
   },
   ready() {
     // 获取地图数据
@@ -562,7 +562,7 @@ wepy.component({
           this.init();
         }
       }
-    }
+    },
   },
   methods: {
     // 收起
@@ -585,7 +585,7 @@ wepy.component({
     },
     //设置建筑名称
     setBuidingItem() {
-      this.buildingData.map(item => {
+      this.buildingData.map((item) => {
         if (item.id == this.space.buildingId) {
           this.selectedBuilding = item.id;
           this.buildingItem = item;
@@ -596,10 +596,10 @@ wepy.component({
     getPageBuildingList() {
       let params = {
         criteria: {
-          projectId: this.projectId
-        }
+          projectId: this.projectId,
+        },
       };
-      getBuildingList(params).then(res => {
+      getBuildingList(params).then((res) => {
         this.buildingData = res.content || [];
         this.setBuidingItem();
         if (this.selectedBuilding) {
@@ -609,7 +609,7 @@ wepy.component({
     },
     // 设置楼层
     setFlorrItem() {
-      this.floors.map(item => {
+      this.floors.map((item) => {
         if (item.id == this.space.floorId) {
           this.selectedFloor = item.id;
           this.floorItem = item;
@@ -623,10 +623,10 @@ wepy.component({
       let params = {
         criteria: {
           projectId: this.projectId,
-          buildingId: this.selectedBuilding
-        }
+          buildingId: this.selectedBuilding,
+        },
       };
-      getFloorList(params).then(res => {
+      getFloorList(params).then((res) => {
         this.floors = res.content || [];
         this.setFlorrItem();
         // console.log('this.selectedFloor==', this.selectedFloor);
@@ -638,26 +638,31 @@ wepy.component({
     /**
      * 获取地图信息
      */
-    getPageMapInfo() {
+    getPageMapInfo(type) {
       let params = {
         projectId: this.projectId,
         floorId: this.selectedFloor,
         userCode: this.userInfo.userId,
-        companyId: this.userInfo.companyId
+        companyId: this.userInfo.companyId,
       };
       getMapInfo(params)
-        .then(res => {
+        .then((res) => {
           let data = res.data || {};
           this.mapAreasInfo = data.spaceList || [];
           CompanyMapData.mapWidth = data.width;
           this.setMapIcon();
           this.getMapSize();
           console.log('this.selectArea===', this.selectArea);
-          if (this.selectArea) {
-            if (this.space.from) {
+          if (this.selectArea && type != 1) {
+            if (this.space.from == 'FindIt') {
               this.doSelectArea(this.selectArea);
             } else {
-              this.doSelectArea(this.selectArea, true);
+              console.log('type==', type);
+              if (type == 1) {
+                this.doSelectArea(this.selectArea, false);
+              } else {
+                this.doSelectArea(this.selectArea, true);
+              }
             }
           }
         })
@@ -665,7 +670,7 @@ wepy.component({
     },
     // 设置地图的图标
     setMapIcon() {
-      this.mapAreasInfo.map(item => {
+      this.mapAreasInfo.map((item) => {
         if (item.spaceId == this.space.spaceId) {
           console.log(this.selectArea);
           this.selectArea = item;
@@ -705,7 +710,7 @@ wepy.component({
         }
       });
       if (this.space.from == 'FindIt') {
-        this.selectArea;
+        // this.selectArea;
       }
     },
     // 切换建筑
@@ -716,18 +721,18 @@ wepy.component({
     },
     // 切换楼层
     changeFloorFun(floor) {
-      console.log('切换楼层');
+      console.log('切换楼层', floor);
       this.selectedFloor = floor;
       // this.floorItem = floor;
-      this.getPageMapInfo();
+      this.getPageMapInfo(1);
     },
     // 获取地图的缩放比例
     getMapSize() {
-      getScreenInfo().then(res => {
+      getScreenInfo().then((res) => {
         this.screenScale = res.screenScale;
       });
 
-      this.getMapScale().then(res => {
+      this.getMapScale().then((res) => {
         this.mapScale = res.mapScale;
         this.mapWidth = Math.ceil(res.mapScale * CompanyMapData.mapWidth); // 因为有小数点的误差,故增加一部分
         this.mapHeight = res.mapHeight;
@@ -739,18 +744,18 @@ wepy.component({
       return new Promise((resolve, reject) => {
         wx.getStorage({
           key: 'SelectedASpace',
-          success: res => {
+          success: (res) => {
             if (res.data && res.data.spaceId) {
               pageSelectedAreaRecord = {
                 ...CompanyMapData.defalutSelectedId,
-                [res.data.floorId]: res.data.spaceId // 如果有历史记录选中,覆盖值
+                [res.data.floorId]: res.data.spaceId, // 如果有历史记录选中,覆盖值
               };
               resolve(res.data);
             } else {
               pageSelectedAreaRecord = CompanyMapData.defalutSelectedId;
               resolve({
                 spaceId: CompanyMapData.defalutSelectedId[this.selectedFloor],
-                floorId: this.selectedFloor
+                floorId: this.selectedFloor,
               });
             }
           },
@@ -758,14 +763,15 @@ wepy.component({
             pageSelectedAreaRecord = CompanyMapData.defalutSelectedId;
             resolve({
               spaceId: CompanyMapData.defalutSelectedId[this.selectedFloor],
-              floorId: this.selectedFloor
+              floorId: this.selectedFloor,
             });
-          }
+          },
         });
       });
     },
     // 设置选中的路径
     doSelectArea(area, sign) {
+      debugger;
       if (!area) {
         return;
       }
@@ -784,7 +790,7 @@ wepy.component({
         wx.showToast({
           title: '不可选区域',
           duration: 1000,
-          icon: 'none'
+          icon: 'none',
         });
         return;
       }
@@ -799,25 +805,25 @@ wepy.component({
         return;
       }
       getExpandPXHeight()
-        .then(res => {
+        .then((res) => {
           const { expandPXHeight, screenHeight, screenWidth } = res;
-          return this.getMapScale().then(res => {
+          return this.getMapScale().then((res) => {
             return {
               ...res,
               expandPXHeight,
               screenHeight,
-              screenWidth
+              screenWidth,
             };
           });
         })
-        .then(res => {
+        .then((res) => {
           const { foldStatus } = this;
           const {
             screenHeight,
             screenWidth,
             expandPXHeight,
             mapScale,
-            mapHeight
+            mapHeight,
           } = res;
           let viewHeight = screenHeight - tarBarHeight - expandPXHeight;
           let viewCenterX = screenWidth / 2,
@@ -854,7 +860,7 @@ wepy.component({
     },
     // 下面面板折叠起来的逻辑
     foldPanelFun() {
-      this.getMapHeight().then(res => {
+      this.getMapHeight().then((res) => {
         this.mapHeight = res.mapHeight;
         this.y = 0;
       });
@@ -865,12 +871,12 @@ wepy.component({
     toSearchPage() {
       console.log('被点击了');
       wx.navigateTo({
-        url: `/packagesEnv/pages/search/index`
+        url: `/packagesEnv/pages/search/index`,
       });
     },
     goBack() {
       wx.navigateBack({
-        delta: 1 // 返回的页面数,如果 delta 大于现有页面数,则返回到首页,
+        delta: 1, // 返回的页面数,如果 delta 大于现有页面数,则返回到首页,
       });
     },
     getfoldPanelPXHeight() {
@@ -883,10 +889,10 @@ wepy.component({
         return Promise.resolve({
           foldPanelPXHeight,
           screenWidth: screenInfo.screenWidth,
-          screenHeight: screenInfo.screenHeight
+          screenHeight: screenInfo.screenHeight,
         });
       }
-      return getScreenInfo().then(res => {
+      return getScreenInfo().then((res) => {
         let foldHeight =
           from == 'officehome' ? switchPanelHeight : panelFoldHeight;
         // foldPanelPXHeight = parseInt(res.screenScale * foldHeight);
@@ -894,30 +900,30 @@ wepy.component({
         return {
           screenWidth: res.screenWidth,
           screenHeight: res.screenHeight,
-          foldPanelPXHeight
+          foldPanelPXHeight,
         };
       });
     },
     getMapHeight() {
-      return this.getfoldPanelPXHeight().then(res => {
+      return this.getfoldPanelPXHeight().then((res) => {
         let mapHeight = res.screenHeight - tarBarHeight - res.foldPanelPXHeight;
 
         return {
           ...res,
-          mapHeight
+          mapHeight,
         };
       });
     },
     getMapScale() {
-      return this.getMapHeight().then(res => {
+      return this.getMapHeight().then((res) => {
         mapScale = Math.floor((res.mapHeight / standerMapHeight) * 10) / 10;
         return {
           ...res,
-          mapScale
+          mapScale,
         };
       });
-    }
-  }
+    },
+  },
 });
 function getScreenInfo() {
   if (
@@ -928,21 +934,21 @@ function getScreenInfo() {
   ) {
     return Promise.resolve({
       ...screenInfo,
-      screenScale
+      screenScale,
     });
   }
   return new Promise((resolve, reject) => {
     wx.getSystemInfo({
-      success: res => {
+      success: (res) => {
         screenInfo.screenHeight = res.screenHeight;
         screenInfo.screenWidth = res.screenWidth;
         screenScale = res.screenWidth / standerScreenWidth;
         resolve({
           screenWidth: res.screenWidth,
           screenHeight: res.screenHeight,
-          screenScale
+          screenScale,
         });
-      }
+      },
     });
   });
 }
@@ -956,15 +962,15 @@ function getExpandPXHeight() {
     return Promise.resolve({
       expandPXHeight,
       screenWidth: screenInfo.screenWidth,
-      screenHeight: screenInfo.screenHeight
+      screenHeight: screenInfo.screenHeight,
     });
   }
-  return getScreenInfo().then(res => {
+  return getScreenInfo().then((res) => {
     expandPXHeight = parseInt(res.screenScale * panelExpandHeight);
     return {
       screenWidth: res.screenWidth,
       screenHeight: res.screenHeight,
-      expandPXHeight
+      expandPXHeight,
     };
   });
 }

+ 22 - 26
src/pages/bindTenant/index.wpy

@@ -101,7 +101,7 @@ page {
       v-for="(item,index) in tenantData">
       <div class="tenant-name">{{ item.name }}</div>
       <div class="tenant-identity">
-        <div class="info">正式员工</div>
+        <div class="info">{{item.manageUserType==1?'正式成员':(item.manageUserType==2?'临时成员':'管理员') }}</div>
         <image class="logo-icon" v-if="item.logo" src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
       </div>
       <image class="checked-icon" 
@@ -126,30 +126,26 @@ import {
   getAvatar,
   wxLogin,
   checkLoginNew,
-  checkTokenIsValid
+  checkTokenIsValid,
 } from '@/service/user';
 import { register } from '@/api/user';
 
 wepy.page({
   store,
   config: {
-    navigationBarTitleText: 'test'
+    navigationBarTitleText: 'test',
   },
   data: {
     pageTopBarHeight: 48,
-    tenantData: [
-      {
-        name: '科技公司1'
-      }
-    ],
+    tenantData: [],
     selecItem: {},
-    h5StaticPath: config.h5StaticPath
+    h5StaticPath: config.h5StaticPath,
   },
   computed: {
     ...mapState({
-      userPhone: state => state.user.userPhone,
-      token: state => state.user.token
-    })
+      userPhone: (state) => state.user.userPhone,
+      token: (state) => state.user.token,
+    }),
   },
   onLoad() {
     this.getPageCompanyByPhone();
@@ -168,16 +164,16 @@ wepy.page({
     // 直接注册
     registerTent(params) {
       register(params)
-        .then(res => {
+        .then((res) => {
           if (res.result == 'success') {
-            wxLogin().then(res => {
+            wxLogin().then((res) => {
               this.goHome();
             });
           } else {
             this.returnLogin();
           }
         })
-        .catch(error => {
+        .catch((error) => {
           this.returnLogin();
         });
     },
@@ -186,19 +182,19 @@ wepy.page({
       let params = {
         phone: this.userPhone,
         defaultCompanyId: this.selecItem.id,
-        headImage: getAvatar()
+        headImage: getAvatar(),
       };
       if (checkTokenIsValid() == 3) {
         // 未过期直接注册
         this.registerTent(params);
       } else {
         // token过期续约后-注册
-        checkLoginNew().then(res => {
+        checkLoginNew().then((res) => {
           if (res.data && res.data.isActivated == 1) {
             this.registerTent(params);
           } else {
             wx.navigateTo({
-              url: '/pages/index'
+              url: '/pages/index',
             });
           }
         });
@@ -206,13 +202,13 @@ wepy.page({
     },
     // 初始化租户
     initTentData() {
-      this.tenantData.map(item => {
+      this.tenantData.map((item) => {
         item.isChecked = false;
       });
     },
     // 获取租户数据
     getPageCompanyByPhone() {
-      getCompanyDataByPhone().then(res => {
+      getCompanyDataByPhone().then((res) => {
         console.log(res);
         let data = res;
         if (data && data.length) {
@@ -223,7 +219,7 @@ wepy.page({
           wx.showToast({
             title: '未获得公司服务权限!',
             duration: 5000,
-            icon: 'none'
+            icon: 'none',
           });
           this.goHome();
         }
@@ -235,22 +231,22 @@ wepy.page({
     },
     goHome() {
       wx.navigateTo({
-        url: '/packagesEnv/pages/home/index'
+        url: '/packagesEnv/pages/home/index',
       });
     },
     returnLogin() {
       wx.navigateTo({
-        url: 'pages/index'
+        url: 'pages/index',
       });
     },
     goEnv() {
       wx.navigateTo({
         url:
-          '/packagesEnv/pages/officehome/index?spaceId=Sp1101080259b3510e26e7dd4dd9bf9784f06f3feb68'
+          '/packagesEnv/pages/officehome/index?spaceId=Sp1101080259b3510e26e7dd4dd9bf9784f06f3feb68',
       });
-    }
+    },
   },
-  created() {}
+  created() {},
 });
 </script>
 <config>

+ 14 - 11
src/pages/index.wpy

@@ -62,13 +62,13 @@ wepy.page({
   store,
   data: {
     h5StaticPath: config.h5StaticPath,
-    isActivated: 0
+    isActivated: 0,
   },
   computed: {
     ...mapState({
-      token: state => state.user.token,
-      isActivated: state => state.user.isActivated
-    })
+      token: (state) => state.user.token,
+      isActivated: (state) => state.user.isActivated,
+    }),
   },
   onLoad() {
     if (this.isActivated && this.isActivated == 1) {
@@ -81,18 +81,21 @@ wepy.page({
   onShow() {},
   methods: {
     goBindTenant() {
+      // wx.navigateTo({
+      //   url: '/pages/bindTenant/index',
+      // });
       this.goAuth();
     },
     // 判断用户是否认证过
     checkTenantRegist() {
       wxLogin(1)
-        .then(res => {
+        .then((res) => {
           this.isActivated = res.isActivated;
           let tokenInfo = {
             expireTime: res.expireTime,
             startTime: res.startTime,
             refreshTokenExpireTime: res.refreshTokenExpireTime,
-            refreshToken: res.refreshToken
+            refreshToken: res.refreshToken,
           };
           store.commit('setToken', res.token);
           store.commit('setActivated', res.isActivated);
@@ -108,22 +111,22 @@ wepy.page({
             // 作废
           }
         })
-        .catch(error => {});
+        .catch((error) => {});
     },
     goHome() {
       // console.log("gohome");
       wx.navigateTo({
-        url: '/packagesEnv/pages/home/index'
+        url: '/packagesEnv/pages/home/index',
       });
     },
     goAuth() {
       console.log('被点击了');
       wx.navigateTo({
-        url: '/pages/auth/index'
+        url: '/pages/auth/index',
       });
-    }
+    },
   },
-  created() {}
+  created() {},
 });
 </script>
 <config>