小程序增加退出登录按钮,屏蔽绑定入口

master
liaoanqi 3 years ago
parent 200812a789
commit ce829538f6

@ -1,6 +1,7 @@
// pages/user/user.js // pages/user/user.js
var http = require("../../utils/http.js"); var http = require("../../utils/http.js");
var util = require("../../utils/util.js");
Page({ Page({
/** /**
@ -119,6 +120,38 @@ Page({
}) })
}, },
/**
* 退出登录
*/
logout: function() {
// 请求退出登陆接口
http.request({
url: '/logOut',
method: 'post',
callBack: res => {
util.removeTabBadge()
wx.removeStorageSync('loginResult');
wx.removeStorageSync('token');
// this.$Router.pushTab('/pages/index/index')
wx.showToast({
title: "退出成功",
icon: "none"
})
this.setData({
orderAmount: ''
});
setTimeout(() => {
wx.switchTab({
url: "/pages/index/index"
})
}, 1000)
}
})
},
toOrderListPage: function(e) { toOrderListPage: function(e) {
var sts = e.currentTarget.dataset.sts; var sts = e.currentTarget.dataset.sts;
wx.navigateTo({ wx.navigateTo({

@ -9,10 +9,10 @@
<open-data type="userNickName"></open-data> <open-data type="userNickName"></open-data>
</view> </view>
</view> </view>
<view class='binding-phone'> <!-- <view class='binding-phone'>
<text class='show-tip'>绑定手机号后可查看订单和领取优惠券,</text> <text class='show-tip'>绑定手机号后可查看订单和领取优惠券,</text>
<text class='gotobinding' bindtap='toBindingPhone'>去绑定</text> <text class='gotobinding' bindtap='toBindingPhone'>去绑定</text>
</view> </view> -->
<!-- end 用户信息 --> <!-- end 用户信息 -->
<view class='list-cont'> <view class='list-cont'>
@ -98,4 +98,10 @@
<!--end 列表项 --> <!--end 列表项 -->
</view> </view>
<view class="log-out" bindtap="logout" wx:if="isAuthInfo">
<view class="log-out-n">
<text>退出登录</text>
</view>
</view>
</view> </view>

@ -200,3 +200,25 @@ page {
.prod-col .col-item .tit{ .prod-col .col-item .tit{
line-height: 34px; line-height: 34px;
} }
/* 退出登录 */
.log-out{
padding:20rpx;
text-align: center;
margin-top:20rpx;
}
.log-out-n{
font-size: 30rpx;
margin: auto;
width:200rpx;
padding:20rpx;
border-radius: 10rpx;
background: #e43130;
color:#ffffff;
}
button.memu-btn.memu-item {
background-color: #fff;
}
button.memu-btn.memu-item:after {
border: 0;
}

@ -23,7 +23,17 @@ const formatHtml = content => {
return content; return content;
} }
/**
* 移除购物车Tabbar的数字
*/
const removeTabBadge = () => {
wx.removeTabBarBadge({
index: 2
})
}
module.exports = { module.exports = {
formatTime: formatTime, formatTime: formatTime,
formatHtml: formatHtml formatHtml: formatHtml,
removeTabBadge: removeTabBadge
} }

Loading…
Cancel
Save