فهرست منبع

更改天津水务水查查的首页展示逻辑

Signed-off-by: wangfen <1225903233@qq.com>
wangfen 4 سال پیش
والد
کامیت
034a796294
2فایلهای تغییر یافته به همراه41 افزوده شده و 12 حذف شده
  1. 39 10
      shuichacha-for-TJ/pages/index/index.js
  2. 2 2
      shuichacha-for-TJ/pages/index/index.wxml

+ 39 - 10
shuichacha-for-TJ/pages/index/index.js

@@ -7,6 +7,7 @@ Page({
     userInfo: {},
     waterInfo: {},
     onQuery: true,
+    unAuth:false,
     items: [{
       id: 'realtimewater',
       label: '用水量',
@@ -72,8 +73,11 @@ Page({
                 duration: 2000
               })
               that.setData({
-                weixinLogin:true
+                weixinLogin:true,
+                onQuery:false
               })
+              console.log("weixinLogin:"+that.data.weixinLogin)
+              console.log("onQuery:"+that.data.onQuery)
               return;
             } 
             // 绑定成功未注册
@@ -89,6 +93,14 @@ Page({
         }
       })
     }
+    else{
+      wx.showToast({
+        title: '您尚未注册,请到平台端开通账号后重试',
+        icon: 'none',
+        duration: 2000
+      })
+      return;
+    }
   },
   gotopage(e) {
     const {
@@ -117,33 +129,38 @@ Page({
     })
   },
   getAccountInfo() {
+    let _self=this
     this.setData({
-      onQuery: true
-    })
+      onQuery:true,
+      unAuth:false
+    })  
     app.$util.selfUserInfo(app.globalData, true).then((data) => {
       if (data) {
         this.setData({
           userInfo: data,
           waterInfo: data.waterStages
+        })      
+        _self.setData({
+          onQuery:false
         })
+        console.log("_self.onQuery:" + _self.data.onQuery)
       } else {
         this.setData({
           userInfo: {},
           waterInfo: {}
         })
       }
-      this.setData({
-        onQuery: false
-      })
+   
     }).catch(() => {
-      this.setData({
-        onQuery: false
+      _self.setData({
+        onQuery:false
       })
     })
   },
   // 获取用户注册状态 /user/getUser 
   isRegister(){
     let that=this;
+    that.setData({unAuth:false})
     app.$http.postForm('/appletUser/getUser').then(({ status, msg, data }) => {
       // 已授权但客户不存在
       // 未授权
@@ -156,13 +173,25 @@ Page({
           weixinLogin:true
         })
       }
+      else if(status===-406)
+      {
+        that.setData({
+          weixinLogin:false,
+          unAuth:true
+        })
+        wx.showToast({
+          title: '您尚未注册认证,请到平台端开通账号后重试',
+          icon: 'none',
+          duration: 2000
+        })
+        return;
+      }
     })
   },
-  onShow() {
+  onShow() {   
     let _self=this
     this.getAccountInfo();
     this.isRegister()
-   
   },
   toLogin(msg) {
     this.popup && this.popup.setData({

+ 2 - 2
shuichacha-for-TJ/pages/index/index.wxml

@@ -1,8 +1,8 @@
 <!--index.wxml wx:if="{{ !weixinLogin }}"-->
 <view class="container home">
-	<view class="unbind-box" wx:if="{{(!userInfo.userNumber && !onQuery)||weixinLogin==false}}">
+	<view class="unbind-box" wx:if="{{onQuery||!weixinLogin}}">
 		<image class="unbind-img" src="/static/img/img_no_customer.png"></image>
-		<button  class="open-button" wx:if="{{weixinLogin==false}}"  open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">点击授权</button>
+		<button  class="open-button" wx:if="{{weixinLogin==false&&!unAuth}}"  open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">点击授权</button>
 	</view>
 	<view wx:else class="waterInfo waterheight">
 		<block>