mirror of
https://gitee.com/zongzhige/shopxo-uniapp.git
synced 2026-07-06 21:45:42 +08:00
退出仅清除用户信息、微信自动登录强制绑定账号循环修复
This commit is contained in:
9
App.vue
9
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) {
|
||||
|
||||
@ -435,7 +435,7 @@
|
||||
// 分享菜单处理、延时执行,确保基础数据已加载完成
|
||||
setTimeout(function() {
|
||||
app.globalData.page_share_handle();
|
||||
}, 1000);
|
||||
}, 3000);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
@ -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 || '',
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
</block>
|
||||
|
||||
<!-- 清除缓存 -->
|
||||
<view class="nav-item padding-main fl tc cp" @tap="clear_storage">
|
||||
<view class="nav-item padding-main fl tc cp" @tap="logout_event">
|
||||
<!-- #ifndef MP -->
|
||||
<image :src="common_static_url+'logout-icon.png'" class="item-icon" mode="widthFix"></image>
|
||||
<view class="item-name single-text cr-base">退出登录</view>
|
||||
@ -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
|
||||
// 小程序提示缓存清除成功
|
||||
|
||||
Reference in New Issue
Block a user