diff --git a/mall4m/pages/user/user.js b/mall4m/pages/user/user.js
index 72688e9..0518cd1 100644
--- a/mall4m/pages/user/user.js
+++ b/mall4m/pages/user/user.js
@@ -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({
diff --git a/mall4m/pages/user/user.wxml b/mall4m/pages/user/user.wxml
index 6b6494a..9e77a35 100644
--- a/mall4m/pages/user/user.wxml
+++ b/mall4m/pages/user/user.wxml
@@ -9,10 +9,10 @@
-
+
@@ -98,4 +98,10 @@
+
+
+ 退出登录
+
+
+
\ No newline at end of file
diff --git a/mall4m/pages/user/user.wxss b/mall4m/pages/user/user.wxss
index 6bf959d..ea16d30 100644
--- a/mall4m/pages/user/user.wxss
+++ b/mall4m/pages/user/user.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/mall4m/utils/util.js b/mall4m/utils/util.js
index 0b25ed6..1829c55 100644
--- a/mall4m/utils/util.js
+++ b/mall4m/utils/util.js
@@ -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
}