This commit is contained in:
xiaozhiyong
2023-04-17 09:54:24 +08:00
parent 0f72d67b2e
commit 91895c9265
3 changed files with 37 additions and 25 deletions

View File

@@ -99,7 +99,6 @@
} }
}, },
onLoad(option) { onLoad(option) {
if(option){
if(option.companyId === '1460872936910831616'){ if(option.companyId === '1460872936910831616'){
this.otherUser = true this.otherUser = true
uni.clearStorageSync() uni.clearStorageSync()
@@ -108,7 +107,6 @@
return return
} }
}
let IsOtherUser = uni.getStorageSync('isOther') let IsOtherUser = uni.getStorageSync('isOther')
// console.log('这里是onload',IsOtherUser) // console.log('这里是onload',IsOtherUser)
if(IsOtherUser){ if(IsOtherUser){
@@ -119,6 +117,7 @@
this.otherUser = true this.otherUser = true
return return
} else{ } else{
this.weChatLogin() this.weChatLogin()
} }
// console.log('小程序跳转参数接收onLoad----') // console.log('小程序跳转参数接收onLoad----')
@@ -132,11 +131,10 @@
methods: { methods: {
weChatLogin(option){ weChatLogin(option){
let isJump = uni.getStorageSync('isJump'); let isJump = uni.getStorageSync('isJump');
let siteId = uni.getStorageSync('siteId')
uni.clearStorageSync(); uni.clearStorageSync();
if(isJump){ if(isJump) uni.setStorageSync('isJump',isJump)
uni.setStorageSync('isJump',isJump) if(siteId) uni.setStorageSync('siteId',siteId)
}
this.refreshLocation() this.refreshLocation()
let _that = this let _that = this
uni.login({ uni.login({
@@ -144,15 +142,15 @@
success: (loginRes) => { success: (loginRes) => {
const code = loginRes.code const code = loginRes.code
this.onceCode = code this.onceCode = code
console.log('这里是code') // console.log('这里是code')
console.log(this.onceCode) // console.log(this.onceCode)
oilIdentityApi.sendCode(this.onceCode).then(res => { oilIdentityApi.sendCode(this.onceCode).then(res => {
if (res.code === 20000) { if (res.code === 20000) {
console.log('这里是sendCode',res) // console.log('这里是sendCode',res)
this.sessionKey = res.data.sessionKey this.sessionKey = res.data.sessionKey
uni.setStorageSync('openid', res.data.openId) uni.setStorageSync('openid', res.data.openId)
uni.setStorageSync('unionid', res.data.unionId) uni.setStorageSync('unionid', res.data.unionId)
console.log('这里是213','++++++') // console.log('这里是213','++++++')
if(option){ if(option){
if(option.companyId == '1460872936910831616'){ if(option.companyId == '1460872936910831616'){
let sysCustomerInfos = { let sysCustomerInfos = {
@@ -169,17 +167,17 @@
} }
uni.setStorageSync('isOther',_that.otherUser) uni.setStorageSync('isOther',_that.otherUser)
uni.setStorageSync('otherUserInfo',sysCustomerInfos) uni.setStorageSync('otherUserInfo',sysCustomerInfos)
console.log('此处为data参数',data) // console.log('此处为data参数',data)
console.log('当前为卡利用户companyId 为',sysCustomerInfos.companyId) // console.log('当前为卡利用户companyId 为',sysCustomerInfos.companyId)
oilIdentityApi.wechatLogin(data).then(res=>{ oilIdentityApi.wechatLogin(data).then(res=>{
console.log('这里是wechatLogin',res) // console.log('这里是wechatLogin',res)
this.OtherloginSuccess(res) this.OtherloginSuccess(res)
console.log(res) // console.log(res)
}) })
return return
} }
}else{ }else{
console.log('这里是213','----') // console.log('这里是213','----')
this.autoLogin() this.autoLogin()
} }
// uni.setStorageSync('isOther',_that.otherUser) // uni.setStorageSync('isOther',_that.otherUser)
@@ -312,6 +310,13 @@
} }
}) })
}, 1000); }, 1000);
let siteId = uni.getStorageSync('siteId')
if(siteId) {
uni.redirectTo({
url: `/BagStation/pages/stationDetail/stationDetail?siteId=${siteId}`
})
return
}
// 这里有问题 // 这里有问题
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: '/pages/tabbar/home/home'

View File

@@ -351,6 +351,13 @@
icon: 'none' icon: 'none'
}) })
}, 1000); }, 1000);
let siteId = uni.getStorageSync('siteId')
if(siteId) {
uni.redirectTo({
url: `/BagStation/pages/stationDetail/stationDetail?siteId=${siteId}`
})
return
}
// 这里有问题 // 这里有问题
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: '/pages/tabbar/home/home'

View File

@@ -217,8 +217,8 @@
this.innerAudioContext?.stop() this.innerAudioContext?.stop()
}, },
onLoad(option) { onLoad(option) {
let siteId = uni.getStorageSync('siteId') || option.siteId // let siteId = uni.getStorageSync('siteId') ||
if(siteId) { if(option.siteId) {
uni.setStorageSync('siteId',siteId) uni.setStorageSync('siteId',siteId)
this.siteId = siteId this.siteId = siteId
this.getSiteInfo(siteId) this.getSiteInfo(siteId)