This commit is contained in:
xiaozhiyong
2023-03-20 13:08:21 +08:00
parent da9ffdb20d
commit 604e9b3bb6
4 changed files with 51 additions and 40 deletions

View File

@@ -152,22 +152,24 @@
loginRes: {},
sessionKey: '',
nickName: '',
loginOut: uni.getStorageSync('loginOut') ? true : false
loginOut: uni.getStorageSync('loginOut') ? true : false,
scanningParams:null
}
},
onLoad() {
onLoad(options) {
uni.clearStorageSync()
this.refreshLocation()
uni.login({
provider: 'weixin',
success: (loginRes) => {
console.log(loginRes,'loginRes')
const code = loginRes.code
this.onceCode = code
console.log(this.onceCode,'----------')
oilIdentityApi.sendCode(this.onceCode).then(res => {
console.log(res,'sendCode')
if (res.code === 20000) {
if(options.scanningParams) {
// 用于扫码进入油站详情页面
this.scanningParams = options.scanningParams
}
this.sessionKey = res.data.sessionKey
uni.setStorageSync('openid', res.data.openId)
uni.setStorageSync('unionid', res.data.unionId)
@@ -184,7 +186,6 @@
}
}).catch(err => {
console.log(err)
uni.reLaunch({
url: '/BagAuth/pages/login/boforeLogin/boforeLogin',
fail: (err) => {
@@ -231,7 +232,6 @@
decryptPhoneNumber(e) {
// console.log(e.detail)
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const data1 = {
...e.detail,
@@ -251,7 +251,6 @@
bindLoginByPhone(data, url) {
if (this.count < 1) {
oilIdentityApi.bindLoginByPhone(data, url).then(res => {
console.log(res)
if (res.code == 20000) {
this.loginSuccess(res)
@@ -278,11 +277,16 @@
title: res.msg,
icon: 'none',
complete: (err) => {
// console.log(err)
}
})
}, 1000);
// 这里有问题
if(this.scanningParams) {
uni.redirectTo({
url: `/BagStation/pages/stationDetail/stationDetail?q=${this.scanningParams}`
})
return
}
uni.switchTab({
url: '/pages/tabbar/home/home'
})