Ver Fonte

feat(天津津南定制版本):增加预警图片

zouwenying há 4 anos atrás
pai
commit
7a58cd3d34

+ 94 - 38
shuichacha-for-TJ/pages/index/index.js

@@ -8,34 +8,36 @@ Page({
     waterInfo: {},
     onQuery: true,
     items: [{
-        id: 'realtimewater',
-        label: '用水量',
-        icon: '/static/img/icon-water.png',
-        url: '?period=7'
-      }, {
-        id: 'waterprice',
-        label: '水价查询',
-        icon: '/static/img/icon_water_price.png'
-      }, {
-        id: 'payment',
-        label: '缴费',
-        icon: '/static/img/icon-payment.png'
-      }, {
-        id: 'wateranalysis',
-        label: '用水趋势',
-        icon: '/static/img/icon_water_analysis.png'
-      }, {
-        id: 'waterabnormal',
-        label: '异常预警',
-        icon: '/static/img/icon_water_abnormal.png'
-      }, {
-        id: 'customermanage',
-        label: '户号管理',
-        icon: '/static/img/icon_customer_manage.png'
-      }
-    ]
+      id: 'realtimewater',
+      label: '用水量',
+      icon: '/static/img/icon-water.png',
+      url: '?period=7'
+    }, {
+      id: 'waterprice',
+      label: '水价查询',
+      icon: '/static/img/icon_water_price.png'
+    }, {
+      id: 'payment',
+      label: '缴费',
+      icon: '/static/img/icon-payment.png'
+    }, {
+      id: 'wateranalysis',
+      label: '用水趋势',
+      icon: '/static/img/icon_water_analysis.png'
+    }, {
+      id: 'waterabnormal',
+      label: '异常预警',
+      icon: '/static/img/icon_water_abnormal.png'
+    }, {
+      id: 'customermanage',
+      label: '户号管理',
+      icon: '/static/img/icon_customer_manage.png'
+    }],
+    weixinLogin: false,
+    // showTips: false
   },
   getPhoneNumber(e) {
+    let that = this;
     if (e.detail.encryptedData) {
       const {
         iv,
@@ -59,16 +61,43 @@ Page({
             data = {}
           }) => {
             if (status === 0) {
+              // 绑定成功
               if (this.data.userInfo.deviceId) {
                 wx.navigateTo({
                   url: `/pages/${item.id || param}/${item.id || param}${item.url ? item.url : ''}`
                 })
-              } else {
-                wx.navigateTo({
-                  url: "/pages/customermanage/customermanage"
-                })
               }
+              // that.setData({
+              //   showTips: false,
+              //   weixinLogin:true
+              // })
+              wx.showToast({
+                title: '授权成功',
+                icon: 'none',
+                duration: 2000
+              })
+              that.setData({
+                weixinLogin:true
+              })
+              return;
+            } 
+            // 绑定成功未注册
+            else {
+              wx.showToast({
+                title: '您尚未注册,请到平台端开通账号后重试',
+                icon: 'none',
+                duration: 2000
+              })
+              return;
+              // that.setData({
+              //   showTips: true,
+              //   weixinLogin:true
+              // })
             }
+            // wx.setStorage({
+            //   key: 'isLogin',
+            //   data: true
+            // })
           })
         }
       })
@@ -79,9 +108,19 @@ Page({
       param,
       item = {}
     } = e.currentTarget.dataset;
+
+    if (!this.data.weixinLogin) {
+      wx.showToast({
+        title: '请您先进行授权',
+        icon: 'none',
+        duration: 2000
+      })
+      return;
+    }
+    console.log("app的值",app)
     if (!this.data.userInfo.userNumber && param != 'customermanage' && item.id != 'customermanage') {
       wx.showToast({
-        title: '请先绑定您的户号',
+        title: '请先绑定的户号',
         icon: 'none',
         duration: 2000
       })
@@ -95,14 +134,13 @@ Page({
     this.setData({
       onQuery: true
     })
-    //app.showLoading()
     app.$util.selfUserInfo(app.globalData, true).then((data) => {
       if (data) {
         this.setData({
           userInfo: data,
           waterInfo: data.waterStages
         })
-      }else {
+      } else {
         this.setData({
           userInfo: {},
           waterInfo: {}
@@ -111,16 +149,34 @@ Page({
       this.setData({
         onQuery: false
       })
-      //app.hideLoading();
     }).catch(() => {
-      //app.hideLoading();
       this.setData({
         onQuery: false
       })
     })
   },
+  // 获取用户注册状态 /user/getUser 
+  isRegister(){
+    let that=this;
+    app.$http.postForm('/user/getUser').then(({ status, msg, data }) => {
+      // 已授权但客户不存在
+      // 未授权
+      if(status===-602){
+        that.setData({
+          // showTips: true,
+          weixinLogin:false
+        })
+      }else{
+        that.setData({
+          showTips: false,
+          weixinLogin:true
+        })
+      }
+    })
+  },
   onShow() {
     this.getAccountInfo();
+    this.isRegister()
   },
   toLogin(msg) {
     this.popup && this.popup.setData({
@@ -131,16 +187,16 @@ Page({
     });
     this.popup.show();
   },
-  cancelEvent: function() {
+  cancelEvent: function () {
     this.popup.close();
   },
-  confirmEvent: function() {
+  confirmEvent: function () {
     this.getAccountInfo(true);
   },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
     //获得popup组件
     this.popup = this.selectComponent("#popup");
   },

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

@@ -2,8 +2,9 @@
 <view class="container home">
 	<view class="unbind-box" wx:if="{{!userInfo.userNumber && !onQuery}}">
 		<image class="unbind-img" src="/static/img/img_no_customer.png"></image>
-		<text>您还没绑定您的户号</text>
-		<button class="open-button" data-param="customermanage" bindtap="gotopage">去绑定</button>
+		<!-- <text>您还没绑定您的户号</text> -->
+		<!-- <text wx:if="{{ showTips }}" data-param="customermanage">您尚未注册,请到平台端开通账号后重试</text> -->
+		<button  class="open-button"  wx:if="{{ !weixinLogin }}"open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">点击授权</button>
 	</view>
 	<view wx:else class="waterInfo">
 		<block>

+ 1 - 1
shuichacha-for-TJ/project.config.json

@@ -40,7 +40,7 @@
   },
   "compileType": "miniprogram",
   "libVersion": "2.12.0",
-  "appid": "wx759db34b9c2e1491",
+  "appid": "wx27f831675081e293",
   "projectname": "%E6%B0%B4%E6%9F%A5%E6%9F%A5",
   "debugOptions": {
     "hidedInDevtools": []

BIN
shuichacha-for-TJ/static/img/img_abnormal3.png


BIN
shuichacha-for-TJ/static/img/img_abnormal4.png


+ 1 - 1
shuichacha-for-TJ/utils/http.js

@@ -2,7 +2,7 @@
 // const $perfix = 'http://localhost:8090';
 
 // 测试环境
-const $perfix = 'http://114.135.61.188:58082';
+const $perfix = 'http://192.168.0.113:8111';
 
 // 演示环境
 // const $perfix = 'https://water.zoniot.com'; 

+ 1 - 1
shuichacha-for-TJ/utils/util.js

@@ -83,6 +83,6 @@ module.exports = {
   selfUserInfo,
   uuid,
   numberFormat,
-  customerId: 33, //47
+  customerId: 47, //47
   throttle: throttle
 }