浏览代码

Merge branch 'master' of https://dkb.xmyuedian.com/18016688350/agent-vending-machine

# Conflicts:
#	pages/vendingMachine/settledStore.wxml
18016688350 4 年之前
父节点
当前提交
b098e36cf0

+ 2 - 2
pages/accountBind/index.js

@@ -83,7 +83,7 @@ Page({
       console.log(1111111111)
       this.data.wechatVo.realName = that.data.userInfo.realname
       this.data.wechatVo.avatarUrl = res.userInfo.avatarUrl
-      this.data.wechatVo.nickName =  res.userInfo.nickName 
+      this.data.wechatVo.nickName =  res.userInfo.nickName
       // this.data
       wx.login({
         success: res => {
@@ -96,7 +96,7 @@ Page({
                 util.toast('绑定成功')
                 this.setData({
                   userInfo: res.result,
-                  isLogin: 1, 
+                  isLogin: true, 
                 })
                  app.globalData.userInfo = res.result   
                 //存入缓存

+ 24 - 15
pages/index/index.js

@@ -16,7 +16,8 @@ Page({
    
     searchParams: {
       timeType:"oldDay",
-    }
+    },
+    isLogin:false
   },
   onShow:function(){
     if (typeof this.getTabBar === 'function' &&
@@ -36,7 +37,8 @@ Page({
     this.getStatis();
 
     this.setData({
-      userInfo: app.globalData.userInfo
+      userInfo: app.globalData.userInfo,
+      isLogin:app.globalData.isLogin 
     })
 
     setTimeout(()=>{
@@ -59,25 +61,32 @@ Page({
     this.getStatis()
   },
   toRouter(e){
-    console.log(e)
-    wx.navigateTo({
-      url: e.currentTarget.dataset.url,
-    })
+    if(app.globalData.isLogin){
+      wx.navigateTo({
+        url: e.currentTarget.dataset.url,
+      })
+    }else{
+      wx.reLaunch({
+        url: '/pages/login/index',
+      })
+    }
   },
   tip(){
     utils.toast('功能暂未开放')
   },
   getStatis(){
     let that = this;
-    utils.request(utils.api.indexSalesOrderApp, this.data.searchParams, "GET", false, true,app.globalData.token).then((res)=>{
-     if (res.code == 200) {
-      that.setData({
-        statisData:res.result
-      })
-     }else{
-       util.toast(res.message);
-     }
-   }).catch((res) => {})
+    if(app.globalData.isLogin){
+      utils.request(utils.api.indexSalesOrderApp, this.data.searchParams, "GET", false, true,app.globalData.token).then((res)=>{
+        if (res.code == 200) {
+          that.setData({
+            statisData:res.result
+          })
+        }else{
+          util.toast(res.message);
+        }
+      }).catch((res) => {})
+    }
   }
 
 })

+ 2 - 2
pages/index/index.wxml

@@ -81,7 +81,7 @@
     </view>
 
 
-    <view>
+    <view wx:if="{{isLogin}}">
     <!-- <view  wx:if="{{userInfo.mgvmRole==3||userInfo.mgvmRole==4}}"> -->
       <view class="margin-xs padding radius shadow-warp common-list-row" bindtap="toRouter" data-url="/pages/store/index">
         <view style="width:100%;">
@@ -131,7 +131,7 @@
     </view>
 
    
-    <view>
+    <view wx:if="{{isLogin}}">
     <!-- <view wx:if="{{userInfo.mgvmRole==0||userInfo.mgvmRole==3}}"> -->
       <view class="margin-xs padding radius shadow-warp common-list-row" bindtap="toRouter" data-url="/pages/agent/index">
         <view style="width:100%;">

+ 15 - 2
pages/mine/index.js

@@ -14,14 +14,16 @@ Page({
       text: "确定",
       type: '#5677fc'
     }],
+    isLogin:false
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {  
+  onLoad: function (options) {
     this.setData({
-      userInfo: app.globalData.userInfo
+      userInfo: app.globalData.userInfo,
+      isLogin:app.globalData.isLogin 
     })
   },
 
@@ -147,4 +149,15 @@ Page({
       url: '/pages/accountRecord/index',
     })
   },
+  toRouter(e){
+    if(app.globalData.isLogin){
+      wx.navigateTo({
+        url: e.currentTarget.dataset.url,
+      })
+    }else{
+      wx.reLaunch({
+        url: '/pages/login/index',
+      })
+    }
+  },
 })

+ 12 - 19
pages/mine/index.wxml

@@ -15,10 +15,7 @@
     <view hidden='{{!isLogin}}' class='user'>
       <image class='avatar-img' src='../../static/images/my/mine_def_touxiang_3x.png'></image>
       <view class='user-info-mobile'>
-        <text>{{memberName}}</text>
-        <view class='edit-img' hover-class="opcity" hover-stay-time="150" bindtap="edit">
-          <image src='../../static/images/my/mine_icon_bianji_3x.png'></image>
-        </view>
+        <text>{{userInfo.username}}</text>
       </view>
     </view>
   </view>
@@ -29,10 +26,6 @@
         <image style="vertical-align:middle"  bindtap="showToast" src="https://mg-vm.oss-cn-beijing.aliyuncs.com/mg-vm/2011617337666_.pic_hd.jpg" class="tui-bg-img" ></image>
       </view>
       <view class="tui-money-explain" bindtap="toInvite">
-			<tui-tag type="warning" tui-tag-class="tui-tag-share tui-size" shape="circleLeft" size="small">
-				<tui-icon name="order" color="#fff" size="15"></tui-icon>
-				<text class="tui-share-text tui-gray-txt">账户记录</text>
-			</tui-tag>
 		</view>
     </view>
     
@@ -55,26 +48,26 @@
   </tui-modal>
 
 
-  <view class='bottom-container' >
-    <navigator wx:if="{{userInfo.mgvmRole!=1||userInfo.mgvmRole==0}}" url="/pages/divide/index" hover-class="navigator-hover">
+  <view wx:if='{{isLogin}}' class='bottom-container' >
+    <view wx:if="{{userInfo.mgvmRole!=1||userInfo.mgvmRole==0}}" bindtap="toRouter" data-url="/pages/divide/index" hover-class="navigator-hover">
       <tui-cell arrow="{{true}}" tui-cell-class="tui-list">
         <tui-icon name="pie" size="20" color="blue" tui-icon-class="margin-right-xs"></tui-icon>
         <text class="tui-cell-name">分成记录</text>
       </tui-cell>
-    </navigator>
-    <navigator wx:if="{{userInfo.mgvmRole!=1&&userInfo.mgvmRole!=2}}" url="/pages/billing/index" hover-class="navigator-hover">
+    </view>
+    <view wx:if="{{userInfo.mgvmRole!=1&&userInfo.mgvmRole!=2}}" bindtap="toRouter" data-url="/pages/billing/index" hover-class="navigator-hover">
       <tui-cell arrow="{{true}}" tui-cell-class="tui-list">
         <tui-icon name="order" size="20" color="blue" tui-icon-class="margin-right-xs"></tui-icon>
         <text class="tui-cell-name">账单明细</text>
       </tui-cell>
-    </navigator>
+    </view>
 
-    <navigator wx:if="{{userInfo.mgvmRole!=1}}" url="/pages/accountBind/index" hover-class="navigator-hover">
+    <view wx:if="{{userInfo.mgvmRole!=1}}" bindtap="toRouter" data-url="/pages/accountBind/index" hover-class="navigator-hover">
       <tui-cell arrow="{{true}}" tui-cell-class="tui-list">
         <tui-icon name="wealth" size="20" color="blue" tui-icon-class="margin-right-xs"></tui-icon>
         <text class="tui-cell-name">账户绑定</text>
       </tui-cell>
-    </navigator>
+    </view>
     <!-- 
     <tui-cell arrow="{{true}}" tui-cell-class="tui-list" bindtap="toReward">
       <text class="tui-cell-name">奖励设置</text>
@@ -88,19 +81,19 @@
     </navigator> -->
 
 
-    <navigator wx:if="{{userInfo.mgvmRole!=1&&userInfo.mgvmRole!=3}}" url="/pages/role/index" hover-class="navigator-hover">
+    <view wx:if="{{userInfo.mgvmRole!=1&&userInfo.mgvmRole!=3}}" bindtap="toRouter" data-url="/pages/role/index" hover-class="navigator-hover">
     <tui-cell arrow="{{true}}" tui-cell-class="tui-list">
         <tui-icon name="friendadd" size="20" color="blue" tui-icon-class="margin-right-xs"></tui-icon>
       <text class="tui-cell-name">运维创建</text>
     </tui-cell>
-    </navigator>
+    </view>
 
-    <navigator url="/pages/pwdSet/index" hover-class="navigator-hover">
+    <view bindtap="toRouter" data-url="/pages/pwdSet/index" hover-class="navigator-hover">
       <tui-cell arrow="{{true}}" tui-cell-class="tui-list">
         <tui-icon name="pwd" size="20" color="red" tui-icon-class="margin-right-xs"></tui-icon>
         <text class="tui-cell-name">修改密码</text>
       </tui-cell>
-    </navigator>
+    </view>
 
     <tui-cell arrow="{{true}}" tui-cell-class="tui-list" bindtap="logout">
         <tui-icon name="deletekey" size="20" color="red" tui-icon-class="margin-right-xs"></tui-icon>

+ 5 - 5
pages/mine/index.wxss

@@ -65,14 +65,14 @@
 }
 .edit-img{
   position: absolute;
-  width: 42rpx;
-  height: 42rpx;
+  width: 50rpx;
+  height: 50rpx;
   right: 0;
-  bottom: -4rpx;
+  bottom: -8rpx;
 }
 .edit-img>image{
-  width: 42rpx;
-  height: 42rpx;
+  width: 50rpx;
+  height: 50rpx;
   padding-left: 25rpx;
 }
 

+ 3 - 1
pages/total/index.js

@@ -87,7 +87,6 @@ Page({
     })
   },
   bindData() {
-
     var option = {
       color: ["#37A2DA"],
       grid: {
@@ -169,6 +168,9 @@ Page({
     })
   },
   getStatis(){
+    if(!app.globalData.isLogin){
+      return
+    }
     let that = this;
    if(this.data.userInfo.mgvmRole==1){
       return;

+ 0 - 3
pages/vendingMachine/settledStore.wxml

@@ -94,9 +94,6 @@
   </view>
 
 
-
-
-
   <view wx:if="{{isTabs}}" class="tui-goods-item" wx:for="{{selectGridProductList}}">
     <image wx:if="{{!item.productImg==''}}" bindtap="toSelect" src="{{item.productImg}}" class="tui-goods-img"  data-index="{{index}}"></image>      
     <view wx:else class="tui-goods-grid" bindtap="toSelect" data-index="{{index}}"><text>{{index+1}}号柜</text></view>

+ 1 - 33
project.config.json

@@ -4,39 +4,7 @@
     "ignore": []
   },
   "setting": {
-    "urlCheck": false,
-    "es6": true,
-    "enhance": false,
-    "postcss": true,
-    "preloadBackgroundData": false,
-    "minified": true,
-    "newFeature": false,
-    "coverView": true,
-    "nodeModules": false,
-    "autoAudits": false,
-    "showShadowRootInWxmlPanel": true,
-    "scopeDataCheck": false,
-    "uglifyFileName": false,
-    "checkInvalidKey": true,
-    "checkSiteMap": true,
-    "uploadWithSourceMap": true,
-    "compileHotReLoad": false,
-    "useMultiFrameRuntime": false,
-    "useApiHook": true,
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
-    },
-    "useIsolateContext": true,
-    "useCompilerModule": true,
-    "userConfirmedUseCompilerModuleSwitch": false,
-    "packNpmManually": false,
-    "packNpmRelationList": [],
-    "useApiHostProcess": false,
-    "userConfirmedBundleSwitch": false,
-    "minifyWXSS": true,
-    "showES6CompileOption": false
+    "useApiHostProcess": true
   },
   "compileType": "miniprogram",
   "libVersion": "2.14.4",

+ 6 - 1
utils/util.js

@@ -73,11 +73,16 @@ const utils = {
         dataType: 'json',
         success: (res) => {
           !hideLoading && wx.hideLoading()
-          if(res.statusCode && res.statusCode == 500){
+          if((res.statusCode && res.statusCode == 500) || (res.statusCode && res.statusCode == 401)){
             wx.reLaunch({
               url: '/pages/login/index',
             })
           }
+          // if(res.statusCode && res.statusCode == 200 && res.data.message.indexOf('未获取到用户')>-1){
+          //   wx.reLaunch({
+          //     url: '/pages/login/index',
+          //   })
+          // }
           resolve(res.data)
         },
         fail: (res) => {