From cd1f206ce93f4bd3908f690afb321daa9df89d10 Mon Sep 17 00:00:00 2001 From: initwithout Date: Thu, 20 Apr 2023 16:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/product/detail.wxml | 7 +++---- pages/set/set.js | 30 ++++++++++++++++++++++-------- utils/server.js | 3 +++ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/pages/product/detail.wxml b/pages/product/detail.wxml index b241c18..ff697f1 100644 --- a/pages/product/detail.wxml +++ b/pages/product/detail.wxml @@ -77,14 +77,14 @@ - @@ -126,7 +126,6 @@ - 购买数量 diff --git a/pages/set/set.js b/pages/set/set.js index 0c5a631..3267335 100644 --- a/pages/set/set.js +++ b/pages/set/set.js @@ -62,16 +62,30 @@ Page({ } }, logout: function() { - wx.clearStorage({ - success: (res) => { - wx.clearStorageSync('isLogin'); - wx.reLaunch({ - url: '/pages/login/login', + + WXAPI.logout({ + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + }).then(res => { + if (res.code == 200) { + wx.clearStorage({ + success: (res) => { + wx.clearStorageSync('isLogin'); + wx.reLaunch({ + url: '/pages/login/login', + }) + }, }) - }, - }) + } else { + wx.showToast({ + icon: 'loading', + title: res.message, + duration: 2000 + }); + } + }); }, - onShow: function () { }, diff --git a/utils/server.js b/utils/server.js index af0bdd0..f2ee927 100644 --- a/utils/server.js +++ b/utils/server.js @@ -62,6 +62,9 @@ module.exports = { wxLogin: (data) => { //微信一键登录 return requestServer('&action=login&app=user', 'post', data) }, + logout: (data) => { //退出登录 + return requestServer('&action=login&app=quit', 'post', data) + }, /* 首页 */ homeIndex: (data) => { //首页 return requestServer('&action=index&app=index', 'post', data)