From 2ac338323833d519ffec3670b6d71de48cfefc1d Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Tue, 3 May 2022 11:20:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E4=BB=85=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E3=80=81=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95=E5=BC=BA=E5=88=B6=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E8=B4=A6=E5=8F=B7=E5=BE=AA=E7=8E=AF=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 9 ++++----- pages/index/index.vue | 2 +- pages/login/login.vue | 6 ++++-- pages/user/user.vue | 23 +++++++---------------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/App.vue b/App.vue index b5832fee..d431f49c 100644 --- a/App.vue +++ b/App.vue @@ -13,8 +13,6 @@ cache_user_login_key: "cache_user_login_key", // 用户信息缓存key cache_user_info_key: "cache_shop_user_info_key", - // 用户站点信息缓存key - cache_user_merchant_key: "cache_shop_user_merchant_key", // 设备信息缓存key cache_system_info_key: "cache_shop_system_info_key", // 用户地址选择缓存key @@ -1440,11 +1438,12 @@ // #ifdef H5 var user = this.get_user_cache_info() || null; if(user == null) { - var config = this.get_config('plugins_base.thirdpartylogin.data'); - var data = this.get_config('plugins_thirdpartylogin_data'); + var params = this.get_launch_cache_info() || {}; + var config = this.get_config('plugins_base.thirdpartylogin.data') || null; + var data = this.get_config('plugins_thirdpartylogin_data') || null; var url = null; // 是否微信环境 - if(this.is_weixin_env()) { + if((params.thirdpartylogin || null) == null && config != null && data != null && this.is_weixin_env()) { var is_auto = config.weixin_is_env_auto_login || 0; var weixin = data.weixin || null; if(is_auto != 0 && weixin != null) { diff --git a/pages/index/index.vue b/pages/index/index.vue index 8cd7fd71..13ab76d4 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -435,7 +435,7 @@ // 分享菜单处理、延时执行,确保基础数据已加载完成 setTimeout(function() { app.globalData.page_share_handle(); - }, 1000); + }, 3000); }, fail: () => { uni.stopPullDownRefresh(); diff --git a/pages/login/login.vue b/pages/login/login.vue index 55b85a4f..1c4d53f5 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -390,7 +390,7 @@ // 上一个页面记录 var page = app.globalData.prev_page(); - if(page != null) { + if(page != null && page != 'pages/login/login') { uni.setStorageSync(app.globalData.data.cache_prev_page_key, page); } @@ -835,7 +835,8 @@ confirm_phone_number_event(e) { var encrypted_data = e.detail.encryptedData || null; var iv = e.detail.iv || null; - if (encrypted_data != null && iv != null) { + var code = e.detail.code || null; + if ((encrypted_data != null && iv != null) || code != null) { // 系统参数、邀请人id var params = app.globalData.get_launch_cache_info(); var referrer = (params == null) ? ((this.user || null) == null ? 0 : this.user.referrer || 0) : params.referrer || 0; @@ -847,6 +848,7 @@ var data = { "encrypted_data": encrypted_data, "iv": iv, + "code": code, "openid": this.user[field_openid] || '', "nickname": this.user.nickname || '', "avatar": this.user.avatar || '', diff --git a/pages/user/user.vue b/pages/user/user.vue index 9509785c..d5a4c3a9 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -78,7 +78,7 @@ - + 退出登录 @@ -334,21 +334,12 @@ }); }, - // 退出/清除缓存 - clear_storage(e) { - // 获取uuid重新存储缓存,一定情况下确保用户的uuid不改变 - var uuid = uni.getStorageSync(app.globalData.data.cache_user_uuid_key) || null; - - // 清除所有缓存 - uni.clearStorage(); - - // 重新存储用户uuid缓存 - if (uuid != null) { - uni.setStorage({ - key: app.globalData.data.cache_user_uuid_key, - data: uuid - }); - } + // 退出 + logout_event(e) { + // 用户登录缓存 + uni.removeStorageSync(app.globalData.data.cache_user_login_key); + // 用户信息缓存 + uni.removeStorageSync(app.globalData.data.cache_user_info_key); // #ifdef MP // 小程序提示缓存清除成功