This commit is contained in:
caolc
2023-05-11 09:02:10 +08:00
parent 3c8c985cce
commit ffd45a79c2
15 changed files with 71 additions and 67 deletions

View File

@@ -3,21 +3,18 @@
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil">
<block slot="content">星油云站</block>
</cu-custom>
<view class="bg-img margin flex padding-lg radius align-center text-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
<view class=" header_card bg-img margin flex padding-lg radius align-center text-center" >
<view class="padding-lg margin text-center text-lg text-white w100">
<text class="">
油站工作人员绑定油站
</text>
</view>
</view>
</view>
<view class="pannel">
<view class="bg-white margin padding radius ">
<view class="cu-form-group radius " @tap="routerTo('/pages/login/posLogin/posLogin')">
<view class="title mini-label text-black">已有账号登录</view>
<view class="cuIcon-right">
</view>
<view class="cuIcon-right"></view>
</view>
<!-- <view class="cu-form-group padding-top" @tap="routerTo('/pages/login/login')">
<view class="title mini-label text-black">首次认证登录</view>
@@ -25,7 +22,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 +81,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 +93,7 @@
})
} else {
// console.log('res', res.code)
}
}
}).catch(err => {
uni.reLaunch({
url: '/BagAuth/pages/login/boforeLogin/boforeLogin',
@@ -126,7 +123,7 @@
title: '您已拒绝授权手机号'
})
}
},
},
bindLoginByPhone(data, url) { //绑定用户手机号
if (this.count < 1) {
oilIdentityApi.bindLoginByPhonePersonal(data, url).then(res => {
@@ -134,10 +131,10 @@
this.loginSuccess(res)
}
})
}
}
},
loginSuccess(res) {//这里是绑定登录
if (res.data.authTokenDTO.loginFlag) {
loginSuccess(res) {//这里是绑定登录
if (res.data.authTokenDTO.loginFlag) {
this.setStored(res)
}
},
@@ -158,22 +155,17 @@
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'),
@@ -187,7 +179,7 @@
}
})
}, 1000);
uni.setStorageSync('user', user)
uni.setStorageSync('user', user)
uni.setStorage({
key: 'Authorization',
data: res.data.authTokenDTO.accessToken,
@@ -234,20 +226,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: "安徽省合肥市庐阳区大杨镇"
@@ -325,7 +317,7 @@
this.toMain(nickName);
},
toMain(userName) {
// this.login(userName)
// this.login(userName)
/**
* 强制登录时使用reLaunch方式跳转过来
* 返回首页也使用reLaunch方式
@@ -350,6 +342,10 @@
</script>
<style scoped>
.header_card{
background-image: url('../../../static/img/header_card.png') !important;
background-size: 100% 100%;
}
.btnSize{
font-size:60rpx;
}