用户登录&退出
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="margin text-center">
|
||||
<button class="cu-btn round bg-main-oil lg text-lg" open-type="getPhoneNumber"
|
||||
@@ -84,11 +84,11 @@
|
||||
if (res.code === 20000) {
|
||||
this.sessionKey = res.data.sessionKey
|
||||
uni.setStorageSync('openid', res.data.openId)
|
||||
uni.setStorageSync('unionid', res.data.unionId)
|
||||
uni.setStorageSync('unionid', res.data.unionId)
|
||||
if(_that.outType !== '1'){
|
||||
this.autoLogin()
|
||||
return
|
||||
}
|
||||
}
|
||||
} else if (res.code == 1002) {
|
||||
uni.showModal({
|
||||
title: '微信登录失败提醒',
|
||||
@@ -96,7 +96,7 @@
|
||||
})
|
||||
} else {
|
||||
// console.log('res', res.code)
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.reLaunch({
|
||||
url: '/BagAuth/pages/login/boforeLogin/boforeLogin',
|
||||
@@ -126,7 +126,7 @@
|
||||
title: '您已拒绝授权手机号'
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
bindLoginByPhone(data, url) { //绑定用户手机号
|
||||
if (this.count < 1) {
|
||||
oilIdentityApi.bindLoginByPhonePersonal(data, url).then(res => {
|
||||
@@ -134,10 +134,10 @@
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
loginSuccess(res) {//这里是绑定登录
|
||||
if (res.data.authTokenDTO.loginFlag) {
|
||||
loginSuccess(res) {//这里是绑定登录
|
||||
if (res.data.authTokenDTO.loginFlag) {
|
||||
this.setStored(res)
|
||||
}
|
||||
},
|
||||
@@ -158,17 +158,22 @@
|
||||
let data={
|
||||
unionId:uni.getStorageSync('unionid'),
|
||||
openId:uni.getStorageSync('openid')
|
||||
}
|
||||
}
|
||||
console.log(data,'这里是自动登录data')
|
||||
oilIdentityApi.loginPersonal(data).then(res => { //微信自动登录
|
||||
console.log(res,'这里是自动登录res')
|
||||
if (res.data.authTokenDTO.loginFlag == true) {
|
||||
if (res.data.authTokenDTO.loginFlag == true) {
|
||||
this.setStored(res)
|
||||
}
|
||||
}else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.data.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 存值本地 根据手机号获取其下的油站并且存储本地
|
||||
setStored(res){
|
||||
setStored(res){
|
||||
let user = res.data.authTokenDTO.loginUser,
|
||||
unionId = uni.getStorageSync('unionid'),
|
||||
openId = uni.getStorageSync('openid'),
|
||||
@@ -182,7 +187,7 @@
|
||||
}
|
||||
})
|
||||
}, 1000);
|
||||
uni.setStorageSync('user', user)
|
||||
uni.setStorageSync('user', user)
|
||||
uni.setStorage({
|
||||
key: 'Authorization',
|
||||
data: res.data.authTokenDTO.accessToken,
|
||||
@@ -229,20 +234,20 @@
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '未绑定油站请联系客服',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
nextStep() {
|
||||
if (this.oilSiteNo) {
|
||||
cloudSiteApi.verifyOilSite({
|
||||
oilSiteCode: this.oilSiteNo
|
||||
}).then(res => {
|
||||
}).then(res => {
|
||||
if (res.code === 20000) {
|
||||
//历史遗留代码---------------------------------
|
||||
// address: "安徽省合肥市庐阳区大杨镇"
|
||||
@@ -320,7 +325,7 @@
|
||||
this.toMain(nickName);
|
||||
},
|
||||
toMain(userName) {
|
||||
// this.login(userName)
|
||||
// this.login(userName)
|
||||
/**
|
||||
* 强制登录时使用reLaunch方式跳转过来
|
||||
* 返回首页也使用reLaunch方式
|
||||
|
||||
Reference in New Issue
Block a user