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

This commit is contained in:
liaoanqi 2023-01-03 09:26:53 +08:00
parent 200812a789
commit ce829538f6
4 changed files with 74 additions and 3 deletions

View File

@ -1,6 +1,7 @@
// pages/user/user.js
var http = require("../../utils/http.js");
var util = require("../../utils/util.js");
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) {
var sts = e.currentTarget.dataset.sts;
wx.navigateTo({

View File

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

View File

@ -200,3 +200,25 @@ page {
.prod-col .col-item .tit{
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;
}

View File

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