mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-06-12 10:00:57 +08:00
优化bug
Signed-off-by: java110 <928255095@qq.com>
This commit is contained in:
parent
2ca31c8801
commit
ceaed2cfc5
@ -57,6 +57,7 @@ export function autoLogin(options) {
|
||||
if (hasLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//todo 如果是 h5 或者 微信小程序 ,检查是否做了配置,如果没有做配置不做自登陆
|
||||
// #ifdef H5 || MP-WEIXIN
|
||||
autoLoginWechat(options);
|
||||
@ -71,10 +72,13 @@ export function autoLogin(options) {
|
||||
export function autoLoginWechat(options) {
|
||||
let _openId = options.openId;
|
||||
if (_openId) { //h5 自登陆的情况
|
||||
let _time = uni.getStorageSync('refreshUserOpenId');
|
||||
if(_time){
|
||||
loginByOpenId(_openId);
|
||||
uni.removeStorageSync('refreshUserOpenId');
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
//todo 如果参数中带了wAppId
|
||||
let _wAppId = options.wAppId;
|
||||
|
||||
@ -83,6 +87,7 @@ export function autoLoginWechat(options) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let _objType = "1100"; // todo public
|
||||
// #ifdef MP-WEIXIN
|
||||
_objType = "1000";
|
||||
@ -121,6 +126,8 @@ export function _refreshWechatOpenId(options, appId) {
|
||||
wAppId: appId,
|
||||
}).then(_data => {
|
||||
if (_data.code == 0) {
|
||||
let _date = new Date();
|
||||
uni.setStorageSync("refreshUserOpenId", _data.getTime());
|
||||
window.location.href = _data.data.openUrl;
|
||||
return;
|
||||
}
|
||||
@ -177,7 +184,9 @@ export function loginByOpenId(openId){
|
||||
communityId: _json.data.communityId,
|
||||
communityName: _json.data.communityName,
|
||||
});
|
||||
uni.removeStorageSync("ownerInfo");
|
||||
saveUserLoginInfo(_json.data.userId, _json.data.token, _json.data.key);
|
||||
|
||||
},
|
||||
fail: function(e) {
|
||||
uni.hideLoading();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user