用户登录&退出

This commit is contained in:
骆超
2023-05-06 17:03:05 +08:00
parent fea1c29b96
commit 767f164e59
5 changed files with 98 additions and 76 deletions

View File

@@ -13,7 +13,7 @@
<view class="bg-white margin padding radius shadow-warp">
<view class="cu-form-group">
<view class="title mini-label text-black">手机号</view>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" @blur="bulrInput" />
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" />
</view>
<view class="cu-form-group padding-top-sm" v-if="showRandom">
<view class="title text-black mini-label">验证码</view>
@@ -75,11 +75,11 @@
</view>
</view>
<view class="cu-modal" :class="checkList">
<view class="cu-dialog">
<view class="cu-dialog">
<view class="cu-bar bg-red justify-end">
<view class="content " >
{{ titleText }}
</view>
</view>
<view class="action" @tap="hidecheckList">
<text class="cuIcon-close text-white"></text>
</view>
@@ -130,7 +130,7 @@
frozen: false, // 二维码冷却时间
oliList:[
{
}
]
}
@@ -146,7 +146,7 @@
icon:'none'
})
console.log('-------------')
return
return
}else{
console.log(this.auth.phone)
console.log('+++++++++++++')
@@ -155,15 +155,15 @@
uni.setStorageSync('oliList',res.data)
this.oliList = res.data
this.checkUser = true
// this.checkList = 'show'
// this.checkList = 'show'
this.titleText = '油站时间'
}else{
let _that= this
_that.auth.phone = ''
//console.log(this.auth.phone)
this.errMsg =res.msg
this.checkUser = false
this.checkList = 'show'
this.checkUser = false
this.checkList = 'show'
this.titleText = '提示'
}
})
@@ -179,35 +179,35 @@
}
})
if(this.checkType == 0 ){
}else{
}
}
},
checkOli(n){
// if(!this.checkUser){
// this.checkList = 'show'
// this.checkList = 'show'
// return
// }
this.checkType = n
if(n == 0 ){
this.loginRandom( )
//console.log('这里是验证码登录')
}else{
//console.log('这里是验证码登录')
}else{
if(!this.auth.phone){
uni.showToast({
title:'请输入手机号',
icon:"none"
})
})
return
}
if(!this.auth.password){
uni.showToast({
title:'请输入密码',
icon:"none"
})
})
return
}
}
this.loginPwd( )
}
},
@@ -221,7 +221,7 @@
},
// 根据用户手机查询油站
getByPhone(){
},
navToQr() {
uni.setClipboardData({
@@ -317,8 +317,8 @@
// //console.log(err)
// }
// });
// },
loginPwd(channelId) {
// },
loginPwd(channelId) {
uni.login({
provider: 'weixin',
success: loginRes => {
@@ -335,7 +335,7 @@
code: code,
unionId:res.data.unionId,
openId:res.data.openId
}
}
uni.setStorage({
key: 'device',
data: res.data.openId,
@@ -360,7 +360,7 @@
})
//console.log('oilSiteCode', this.oilSiteNo)
if (res.code === 20000) {
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
@@ -379,7 +379,7 @@
//console.log('Authorization成功', res.data.authTokenDTO.accessToken)
}
})
uni.setStorageSync('userMenu', res.data.authTokenDTO.loginUser.roleMenus)
//console.log( '这里是获取userMenu处',res.data.authTokenDTO.loginUser.roleMenus)
uni.setStorageSync('loginUser', {
@@ -403,7 +403,7 @@
const code = loginRes.code
//console.log(code)
oilIdentityApi.sendCode(code).then((res)=>{
oilIdentityApi.loginPersonal().then(res => {
if (res.code === 20000) {
uni.reLaunch({
@@ -456,7 +456,7 @@
})
})
},
fail: err => {
//console.log(err)
@@ -532,7 +532,7 @@
unionId:res.data.unionId, //根据code接收后台返回的值
channelId:channelId, //所选油站channelId
verifyCodeToken: this.auth.verifyCodeToken ,//验证码
openId:res.data.openId
openId:res.data.openId
}
//console.log('device')
//console.log(res.data.openId)
@@ -579,7 +579,7 @@
//console.log('Authorization成功', res.data.authTokenDTO.accessToken)
}
})
uni.setStorageSync('userMenu', res.data.authTokenDTO.loginUser.roleMenus)
uni.setStorageSync('loginUser', {
id: res.data.authTokenDTO.loginUser.id,
@@ -589,8 +589,8 @@
}
})
})
},
fail: err => {
//console.log(err)
@@ -658,7 +658,7 @@
}
.page-content {
min-height: 100%;
position: relative;
position: relative;
}
.logo {