Переглянути джерело

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

anxiaoxia 1 рік тому
батько
коміт
94e8251170

+ 6 - 6
src/common/request.js

@@ -37,7 +37,7 @@ function commonParams() {
     url = url + `&userId=${storeUser().userId}`
   }
   if (storeToken()) {
-    // url = url + `&saga-token=${storeToken()}`
+    url = url + `&saga-token=${storeToken()}`
   }
   return url;
 }
@@ -65,9 +65,9 @@ export default function (info) {
 
   const token = store.state.user.token;
   if (token) {
-    // info.header = Object.assign(
-    //   { 'saga-token': token }
-    //   , info.header)
+    info.header = Object.assign(
+      { 'saga-token': token }
+      , info.header)
   }
 
   info.timeout = info.timeout || 10 * 1000; // 默认超时为10s
@@ -95,8 +95,8 @@ export default function (info) {
         }
         if (res.statusCode === 401) {
           if (checkTokenIsValid() == 2) { // 登录过期后重新从首页刷新进入
-            // store.commit('clearToken','');
-            // wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
+            store.commit('clearToken', '');
+            wx.redirectTo({ url: '/pages/index' });
           }
         } else if (res.statusCode >= 400) {
           reject(res.errMsg);

+ 1 - 4
src/packagesEnv/pages/intelligentControl/components/floor/floor.wpy

@@ -113,12 +113,9 @@
           class="floor-item"
           :key="index+'map'"
           v-for="(item,index) in floors"
-          v-on:click.stop="changeFloor(item.id)"
-          v-if="status=='expand' || (status=='fold' && selectedFloor == item.id)"
-        >
+          v-on:click.stop="changeFloor(item.id)">
         {{item.localName}}
        </div>
-
       </div>
     </div>
   </div>

+ 12 - 6
src/packagesEnv/pages/intelligentControl/home2.wpy

@@ -257,12 +257,12 @@ movable-view {
   .icon-arrow-box {
     margin-top: 8rpx;
     box-sizing: border-box;
-    padding: 22rpx;
-    border-radius: 8px;
+    border-radius: 16rpx;
     display: inline-block;
-    height: 44px;
-    line-height: 44px;
-    width: 60px;
+    height: 88rpx;
+    line-height: 88rpx;
+    text-align: center;
+    width: 152rpx;
     background: #fff;
     box-shadow: 0px 4px 12px 0px #00000008;
     label {
@@ -385,7 +385,7 @@ movable-view {
 
          <!--查看更多 -->
         <div class="icon-arrow">
-         <div class="icon-arrow-box">
+         <div class="icon-arrow-box" @click="closeExpend">
           <label>收起</label>
           <image
             mode="scaleToFill"
@@ -517,6 +517,12 @@ wepy.component({
     }
   },
   methods: {
+    // 收起
+    closeExpend() {
+      console.log('点击了收起--');
+      this.floorStatus = 'fold';
+      console.log(this.foldStatus);
+    },
     init() {
       this.projectId = 'Pj1101080259';
       this.getPageBuildingList();

+ 19 - 4
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, setUserInfoByAuth } from '@/service/user';
+import { setAvatar, checkLoginNew, setUserInfoByAuth } from '@/service/user';
 import { getHttpPhoneNumber } from '@/api/user';
 let defaultAvatarUrl =
   config.h5StaticPath + '/page-bind-tenant/default_avatar.svg';
@@ -110,7 +110,18 @@ wepy.page({
       this.canIUseGetUserProfile = true;
     }
   },
-  onShow() {},
+  onShow() {
+    // 过期重定向处理
+    // checkLoginNew().then(res => {
+    //   if (res.data && res.data.isActivated == 1) {
+    //     this.goHome();
+    //   } else {
+    //     wx.navigateTo({
+    //       url: '/pages/index'
+    //     });
+    //   }
+    // });
+  },
   methods: {
     // 绑定租户
     bindTenant() {},
@@ -138,6 +149,8 @@ wepy.page({
     phonenumberAuth(e) {
       let detail = e.$wx.detail;
       let code = detail.code;
+      // store.commit('setUserPhone', 13810794283);
+      // this.goBindTenant();
       this.getHttpPhoneNumber(code);
     },
     // code 换取手机号
@@ -145,8 +158,10 @@ wepy.page({
       getHttpPhoneNumber(code).then(res => {
         let data = res.data || {};
         let phoneNumber = data.purePhoneNumber;
-        store.commit('setUserPhone', phoneNumber);
-        this.goBindTenant();
+        if (phoneNumber) {
+          store.commit('setUserPhone', phoneNumber);
+          this.goBindTenant();
+        }
       });
     },
     goBindTenant() {

+ 10 - 1
src/pages/bindTenant/index.wpy

@@ -193,7 +193,16 @@ wepy.page({
         // 未过期直接注册
         this.registerTent(params);
       } else {
-        checkLoginNew();
+        // token过期续约后-注册
+        checkLoginNew().then(res => {
+          if (res.data && res.data.isActivated == 1) {
+            this.registerTent(params);
+          } else {
+            wx.navigateTo({
+              url: '/pages/index'
+            });
+          }
+        });
       }
     },
     // 初始化租户

+ 12 - 3
src/pages/index.wpy

@@ -57,7 +57,7 @@ import wepy from '@wepy/core';
 import { mapState } from '@wepy/x';
 import store from '@/store';
 import config from '@/config';
-import { wxLogin } from '@/service/user';
+import { wxLogin,checkLoginNew } from '@/service/user';
 wepy.page({
   store,
   data: {
@@ -70,9 +70,18 @@ wepy.page({
   },
   onLoad() {},
   onShow() {
-    // this.checkTenantRegist();
     if (this.isActivated && this.isActivated == 1) {
-      this.goHome();
+      // this.goHome();
+      checkLoginNew().then(res => {
+        console.log(res);
+        if (res.data && res.data.isActivated == 1) {
+          this.goHome();
+        } else {
+          // wx.navigateTo({
+          //   url: '/pages/index'
+          // });
+        }
+      });
     } else {
       this.checkTenantRegist();
     }

+ 17 - 12
src/service/user.js

@@ -211,20 +211,25 @@ function refreshTokenPage() {
 }
 // 检查是否登录过以及过期
 function checkLoginNew() {
-  let token = store.state.user.token;
-  if (!token) {
-    return wxLogin();
-  } else {
-    let flag = checkTokenIsValid()
-    if (flag == 1) {
-      return refreshTokenPage(); // 续约
-    } else if (flag == 2) { // 重新登录
+  return new Promise((resolve, reject) => {
+    let token = store.state.user.token;
+    if (!token) {
       return wxLogin();
-    } else if (flag == 3) {  // 后续补定时器定时续约逻辑
-
+    } else {
+      let flag = checkTokenIsValid()
+      if (flag == 1) {
+        return refreshTokenPage(); // 续约
+      } else if (flag == 2) { // 重新登录
+        return wxLogin();
+      } else if (flag == 3) {  // 后续补定时器定时续约逻辑
+        resolve({
+          data: {
+            isActivated: 1
+          }
+        })
+      }
     }
-    return Promise.resolve();
-  }
+  })
 }
 
 // 判断token是否过期