tanyanfei 2 年 前
コミット
4b778f0150
3 ファイル変更23 行追加4 行削除
  1. 3 1
      pages/user/user.wxml
  2. 17 0
      pages/user/user.wxss
  3. 3 3
      utils/api.js

+ 3 - 1
pages/user/user.wxml

@@ -1,4 +1,4 @@
-<view class="bg">
+<view class="bg" wx:if="{{userinfo.id}}">
       <view class="info">
         <view class='avatar'>
             <image style="width:100%;height:100%;"  src="{{userinfo.avatar}}"></image>
@@ -65,3 +65,5 @@
   
 </view>
 
+<navigator url="../login/user" class="not_login" wx:else>去登录</navigator>
+

+ 17 - 0
pages/user/user.wxss

@@ -224,3 +224,20 @@ page{
 }
 
 
+
+
+.not_login{
+  background: #D94B24;
+  border: 1px solid #D94B24;
+  color: #fff;
+  width: 60%;
+  margin: 50% auto;
+  height: 88rpx;
+  line-height: 88rpx;
+  padding: 0;
+  font-size: 32rpx;
+  border-radius: 8rpx;
+  position: relative;
+  display: block;
+  text-align: center;
+}

+ 3 - 3
utils/api.js

@@ -30,19 +30,19 @@ function request(method, url, data) {
           success(res) {
             //请求成功
             //判断状态码---errCode状态根据后端定义来判断
-
+            wx.hideNavigationBarLoading()
             if (res.data.code == 0) {
               resolve(res);
             } else if (res.data.code == 403) {
               //未登录
               reject(403)
-              if(url.indexOf('authinfo')>=0){
+              if(url.indexOf('/player/record')>=0){
                 wx.navigateTo({
                   url: '../login/user',
                 })
               }
             }else{
-              wx.hideNavigationBarLoading()
+              
               wx.hideLoading()
               wx.showToast({
                 title: res.data.message,