zhaojing преди 1 година
родител
ревизия
69f1cd2f58

+ 15 - 6
src/api/home.js

@@ -17,9 +17,9 @@ export function queryControlSpaceCompany(params) {
   return $http({
     url: `/controlSpaceUser/getControlSpaceCompany`,
     method: 'POST',
-    serverSp:'http://192.168.4.29:52015',
-    data: JSON.stringify(params)
-  })
+    serverSp: 'http://192.168.4.29:52015',
+    data: JSON.stringify(params),
+  });
 }
 
 //常驻空间快速调节卡片
@@ -27,14 +27,14 @@ export function querySpaceFunctionCard(params) {
   return $http({
     url: `/controlSpaceUser/queryPermanentSpaceFunctionCard?userId=${params.userId}&companyId=${params.companyId}`,
     method: 'GET',
-    serverSp:'http://192.168.4.29:52015'
+    serverSp: 'http://192.168.4.29:52015',
   });
 }
 //常驻空间参数属性
 export function getSpaceProperty(params) {
   return $http({
     url: `/duoduo-service/duoduoenv-service/custom/spaceProperty?projectId=${params.projectId}&spaceId=${params.spaceId}`,
-    method: 'GET'
+    method: 'GET',
   });
 }
 //切换公司
@@ -50,7 +50,16 @@ export function getWeather(projectId) {
   return $http({
     isNotShowErrorToast: true,
     url: `/duoduo-service/object-service/weather/getCurrentWeather?projectId=${projectId}`,
-    method: 'get'
+    method: 'get',
+  });
+}
+//扫码确认登录接 行政端
+export function confirmLogin({ qrCodeId }) {
+  // /duoduo-service/duoduoenv-service/userNew/confirmLogin
+  return $http({
+    url: `/userNew/confirmLogin/${qrCodeId}`,
+    method: 'GET',
+    serverSp: 'http://192.168.16.181:52009',
   });
 }
 

+ 25 - 53
src/packagesEnv/pages/administration/chooseIdentity.wpy

@@ -1,7 +1,7 @@
 <style lang="less">
 .overflow-wrap {
   box-sizing: border-box;
-  position:relative;
+  position: relative;
   width: 100%;
   height: 100%;
   background-color: #ebf5fa;
@@ -94,63 +94,16 @@
   <div class="overflow-wrap"  :style="{'background-image': 'url('+h5StaticPath+'/page-home/adminBack.png)'}">
     <navigationbar :ntitle="'选择登录身份'"></navigationbar>
    <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" >
-      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-name">{{ companyName }}</div>
       <div class="tenant-identity">
         <div class="info">正式员工</div>
         <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
       </div>
       <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
    </div>
+
    <div class="bind-btn-box">
-    <button @click.stop="bindTent">确认</button>
+    <button @click.stop="loginAdmin">确认</button>
    </div>
  </div>
 </template>
@@ -161,22 +114,41 @@ import eventHub from '@/common/eventHub';
 import { mapState } from '@wepy/x';
 import store from '@/store';
 import config from '@/config';
+import { confirmLogin } from '@/api/home.js';
 
 wepy.page({
   store,
   config: {},
   data: {
     h5StaticPath: config.h5StaticPath,
+    qrCodeId: '',
   },
   computed: {
     ...mapState({
       userInfo: (state) => state.user.userInfo,
       projctId: (state) => state.user?.userInfo?.projctId,
       companyId: (state) => state.user?.userInfo?.companyId,
+      companyName: (state) => {
+        return state.user?.companyName;
+      },
     }),
   },
-  methods: {},
-  onLoad() {},
+  methods: {
+    loginAdmin() {
+      confirmLogin({ qrCodeId: '1792589efd114af5a1493f1b05a22378' })
+        .then((res) => {
+          if (res.result == 'success') {
+            wx.navigateTo({
+              url: `/packagesEnv/pages/administration/asuccess`,
+            });
+          }
+        })
+        .catch((err) => {});
+    },
+  },
+  onLoad(options) {
+    this.qrCodeId = options.qrCodeId;
+  },
   onShow() {},
 });
 </script>

+ 15 - 3
src/packagesEnv/pages/administration/index.wpy

@@ -78,7 +78,7 @@
     <div class="aLink">用电脑打开上方行政端网址<span class="copy">复制网址</span></div>
   </div>
   <div class="bottom">
-    <div class="aButton">
+    <div class="aButton" @click="scanQrcode">
       <van-icon name="scan" style="margin-right:8px;"/>扫码登录
     </div>
   <div class="aInfo">扫一扫行政端二维码,登录行政端</div>
@@ -106,8 +106,20 @@ wepy.page({
       companyId: (state) => state.user?.userInfo?.companyId,
     }),
   },
-  methods: {},
-  onLoad() {},
+  methods: {
+    scanQrcode: function() {
+      wx.scanCode({
+        success: (res) => {
+          console.log('scanQrcodescanQrcode', res);
+          var qrCodeId = res.result;
+          wx.navigateTo({
+            url: `/packagesEnv/pages/administration/chooseIdentity?qrCodeId=${qrCodeId}`,
+          });
+        },
+      });
+    },
+  },
+  onLoad(options) {},
   onShow() {},
 });
 </script>

+ 6 - 4
src/packagesEnv/pages/home/index.wpy

@@ -272,10 +272,10 @@
     <div class="menuItem" @click="goPortrait"><div class="menuImg"><image class="image" :src="h5StaticPath+'myhabits.png'"/></div><div class="menuTitle">我的习惯</div></div>
     <div class="menuItem" @click="goPersonCenter"><div class="menuImg"><image class="image" :src="h5StaticPath+'myself.png'"/></div><div class="menuTitle">个人中心</div></div>
   </div>
-  <div class="menuHeader">管理</div>
-  <div class="menuList">
+  <div class="menuHeader" v-if="userInfo.manageUserType==3">管理</div>
+  <div class="menuList" v-if="userInfo.manageUserType==3">
     <div class="menuItem"><div class="menuImg"  @click="goAdministration"><image class="image" :src="h5StaticPath+'control.png'"/></div><div class="menuTitle">行政端管理</div></div>
-</div>
+  </div>
 </div>
 <van-popup :show="show" position="bottom"  @close="hideProject" round>
   <div class="projectPop">
@@ -329,6 +329,7 @@ wepy.page({
       var filter = this.companyList.filter((item) => {
         return item.id == this.companyId;
       });
+      store.commit('setCompanyName', filter[0]?.name);
       return filter[0]?.name;
     },
   },
@@ -434,6 +435,7 @@ wepy.page({
       });
     },
     goToIntroduce(id) {
+      //有没有可控空间
       var hasControlSpaces = this.controlSpaces.length == 0 ? 'no' : 'has';
       wx.navigateTo({
         url: `/packagesEnv/pages/home/${id}?hasControlSpaces=${hasControlSpaces}`,
@@ -451,7 +453,7 @@ wepy.page({
     },
     goAdministration() {
       wx.navigateTo({
-        url: '/packagesEnv/pages/administration/index',
+        url: `/packagesEnv/pages/administration/index`,
       });
     },
   },

+ 6 - 3
src/store/user.js

@@ -11,7 +11,8 @@ export default {
     tokenInfo: wx.getStorageSync('tokenInfo'),
     hasClearToken: false,
     tokenIsValid: true,
-    isActivated: wx.getStorageSync('isActivated')
+    isActivated: wx.getStorageSync('isActivated'),
+    companyName: '',
   },
   mutations: {
     setToken(state, token) {
@@ -58,8 +59,10 @@ export default {
     setUserPhone(state, data) {
       wx.setStorageSync('userPhone', data);
       state.userPhone = data
-    }
-
+    },
+    setCompanyName(state, value) {
+      state.companyName = value;
+    },
   },
   actions: {
     setToken({ commit }, data) {