登出功能

wechat_user_type
Ge Hao 8 years ago
parent c1a87bc2ca
commit 56dd3eda87
  1. BIN
      images/icon-tihuo-close.png
  2. 19
      pages/mine/mine.js
  3. 9
      pages/mine/mine.wxml
  4. 29
      pages/mine/mine.wxss

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -96,6 +96,25 @@ Page({
profile.getCustomerInfo(data, this.infoCallback)
},
bindLogout: function() {
var that = this
app.request({
url: `${app.globalData.API_URL}/sessions/logout`,
data: {code: app.globalData.code},
method: 'POST',
success: function(res) {
if (res.statusCode === 200) {
wx.removeStorage({ key: 'token' })
app.globalData.currentCustomer = null
app.globalData.token = null
that.setData({needBindMobile: true})
}
},
fail: function() {},
complete: function() {}
})
},
infoCallback: function(currentCustomer) {
var that = this
var baye_rank = currentCustomer.baye_rank

@ -59,3 +59,12 @@
</view>-->
</view>
</view>
<view class="separate"></view>
<view wx:if="{{!needBindMobile}}" class="profile-button-container">
<view class="profile-button" bindtap="bindLogout">
<view><image src="../../images/icon-tihuo-close.png" mode='aspectFit'></image></view>
<view><text>登出</text></view>
</view>
</view>

@ -137,6 +137,7 @@
justify-content: flex-start;
font-size: 30rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.check text {
@ -161,20 +162,32 @@
font-size: 30rpx;
}
.check-code {
font-size: 30rpx;
display: flex;
}
.check input {
min-width: 230rpx;
width: 290rpx;
}
.check-code text {
.profile-button-container {
display: flex;
flex-wrap: wrap;
margin-top: 10rpx;
margin-bottom: 10rpx;
}
.check-code text {
.profile-button {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 188rpx;
height: 130rpx;
}
.check-code text {
}
.profile-button image {
width: 36rpx;
height: 36rpx;
}
.profile-button text {
font-size: 25rpx;
}

Loading…
Cancel
Save