From ce829538f6c9e5afd8b911166e90710dadaccb53 Mon Sep 17 00:00:00 2001
From: liaoanqi <1776106376@qq.com>
Date: Tue, 3 Jan 2023 09:26:53 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95=E6=8C=89=E9=92=AE=EF=BC=8C?=
=?UTF-8?q?=E5=B1=8F=E8=94=BD=E7=BB=91=E5=AE=9A=E5=85=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
mall4m/pages/user/user.js | 33 +++++++++++++++++++++++++++++++++
mall4m/pages/user/user.wxml | 10 ++++++++--
mall4m/pages/user/user.wxss | 22 ++++++++++++++++++++++
mall4m/utils/util.js | 12 +++++++++++-
4 files changed, 74 insertions(+), 3 deletions(-)
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
}