1
This commit is contained in:
@@ -1,36 +1,12 @@
|
||||
<template>
|
||||
<view class="login-page bg-white">
|
||||
|
||||
|
||||
|
||||
<view class="image login-bg">
|
||||
|
||||
|
||||
|
||||
<image :src="yellowURL+'login-bg.png'" mode="widthFix"></image>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<scroll-view scroll-x class=" bg-white nav padding">
|
||||
|
||||
|
||||
|
||||
<view class="flex text-center padding-bottom">
|
||||
|
||||
|
||||
|
||||
<!-- <view class="cu-item flex-sub" :class="0==TabCur?'text-red cur':''" @tap="tabSelect(0)">
|
||||
|
||||
|
||||
|
||||
个人账号
|
||||
|
||||
|
||||
|
||||
<view class="login-page bg-white">
|
||||
<view class="image login-bg">
|
||||
<image :src="yellowURL+'login-bg.png'" mode="widthFix"></image>
|
||||
</view>
|
||||
<scroll-view scroll-x class=" bg-white nav padding">
|
||||
<view class="flex text-center padding-bottom">
|
||||
<!-- <view class="cu-item flex-sub" :class="0==TabCur?'text-red cur':''" @tap="tabSelect(0)">
|
||||
个人账号
|
||||
</view>
|
||||
-->
|
||||
<view class="cu-item text-bold text-lg flex-sub">
|
||||
@@ -59,26 +35,30 @@
|
||||
<button class="cu-btn margin-top round lg" @tap="refuseEmpower">
|
||||
输入手机号码登录
|
||||
</button>
|
||||
<button v-if="isShow" class="cu-btn margin-top bg-0 round lg" @tap="refuseLogin">
|
||||
<button class="cu-btn margin-top bg-0 round lg" @tap="refuseLogin">
|
||||
跳过
|
||||
</button>
|
||||
</view>
|
||||
<view class="isKLUser" v-if='otherUser'>
|
||||
<view class="isKLUser">卡力用户仅支持跳转登录</view>
|
||||
</view>
|
||||
<SwitchEnterprises @logout='logout' @submit='goHome' :is-show.sync="isSwitchEnterprises"></SwitchEnterprises>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SwitchEnterprises from '@/components/SwitchEnterprises.vue'
|
||||
import loginBottom from './components/loginBottom.vue'
|
||||
import oilIdentityApi from '@/api/oil-identity'
|
||||
|
||||
import accountApi from '@/api/account.js'
|
||||
export default {
|
||||
components: {
|
||||
loginBottom
|
||||
loginBottom,
|
||||
SwitchEnterprises
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isSwitchEnterprises:false,
|
||||
value:'123',
|
||||
userHandle: false,
|
||||
TabCur: 1,
|
||||
@@ -95,49 +75,66 @@
|
||||
loginRes: {},
|
||||
sessionKey: '',
|
||||
nickName: '',
|
||||
loginOut: uni.getStorageSync('loginOut') ? true : false,
|
||||
isShow:true
|
||||
loginOut: uni.getStorageSync('loginOut') ? true : false
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
if(option.companyId === '1460872936910831616'){
|
||||
this.otherUser = true
|
||||
uni.clearStorageSync()
|
||||
this.weChatLogin(option)
|
||||
// console.log('当前为卡力用户')
|
||||
return
|
||||
}
|
||||
|
||||
let IsOtherUser = uni.getStorageSync('isOther')
|
||||
// console.log('这里是onload',IsOtherUser)
|
||||
if(IsOtherUser){
|
||||
uni.showToast({
|
||||
title:'卡力用户仅支持跳转登录',
|
||||
icon:'none'
|
||||
})
|
||||
this.otherUser = true
|
||||
return
|
||||
} else{
|
||||
|
||||
this.weChatLogin()
|
||||
}
|
||||
// console.log('小程序跳转参数接收onLoad----')
|
||||
// console.log('姓名:',option.driverName)
|
||||
// console.log('公司ID:',option.companyId)
|
||||
// console.log('车牌号:',option.plateNumber)
|
||||
// console.log('油站Id:',option.siteId)
|
||||
// console.log('--------------------------')
|
||||
// console.log('这里是登录')
|
||||
this.init(option);
|
||||
console.log('onLoad')
|
||||
},
|
||||
methods: {
|
||||
onShow() {
|
||||
console.log('show');
|
||||
|
||||
},
|
||||
watch:{
|
||||
isSwitchEnterprises(n,o){ }
|
||||
},
|
||||
methods: {
|
||||
init(option){
|
||||
if(option){
|
||||
if(option.companyId === '1460872936910831616'){
|
||||
this.otherUser = true
|
||||
uni.clearStorageSync()
|
||||
this.weChatLogin(option)
|
||||
console.log('当前为卡力用户')
|
||||
return
|
||||
}
|
||||
}
|
||||
let IsOtherUser = uni.getStorageSync('isOther')
|
||||
if(IsOtherUser){
|
||||
uni.showToast({
|
||||
title:'卡力用户仅支持跳转登录',
|
||||
icon:'none'
|
||||
})
|
||||
this.otherUser = true
|
||||
return
|
||||
} else{
|
||||
this.weChatLogin()
|
||||
}
|
||||
},
|
||||
logout(){
|
||||
let that = this
|
||||
accountApi.logout('authSystem').then(res => {
|
||||
if (res.code == '20000') {
|
||||
uni.showToast({
|
||||
title: res.msg
|
||||
})
|
||||
uni.clearStorageSync();
|
||||
this.isSwitchEnterprises = false;
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
},
|
||||
goHome(){
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
},
|
||||
weChatLogin(option){
|
||||
let isJump = uni.getStorageSync('isJump');
|
||||
let siteId = uni.getStorageSync('siteId')
|
||||
uni.clearStorageSync();
|
||||
if(isJump) uni.setStorageSync('isJump',isJump)
|
||||
if(siteId) {
|
||||
this.isShow = false
|
||||
uni.setStorageSync('siteId',siteId)
|
||||
if(isJump){
|
||||
uni.setStorageSync('isJump',isJump)
|
||||
}
|
||||
this.refreshLocation()
|
||||
let _that = this
|
||||
@@ -146,15 +143,14 @@
|
||||
success: (loginRes) => {
|
||||
const code = loginRes.code
|
||||
this.onceCode = code
|
||||
// console.log('这里是code')
|
||||
// console.log(this.onceCode)
|
||||
console.log('这里是code')
|
||||
console.log(this.onceCode)
|
||||
oilIdentityApi.sendCode(this.onceCode).then(res => {
|
||||
if (res.code === 20000) {
|
||||
// console.log('这里是sendCode',res)
|
||||
console.log('这里是sendCode',res)
|
||||
this.sessionKey = res.data.sessionKey
|
||||
uni.setStorageSync('openid', res.data.openId)
|
||||
uni.setStorageSync('unionid', res.data.unionId)
|
||||
// console.log('这里是213','++++++')
|
||||
uni.setStorageSync('unionid', res.data.unionId)
|
||||
if(option){
|
||||
if(option.companyId == '1460872936910831616'){
|
||||
let sysCustomerInfos = {
|
||||
@@ -171,17 +167,17 @@
|
||||
}
|
||||
uni.setStorageSync('isOther',_that.otherUser)
|
||||
uni.setStorageSync('otherUserInfo',sysCustomerInfos)
|
||||
// console.log('此处为data参数:',data)
|
||||
// console.log('当前为卡利用户:companyId 为',sysCustomerInfos.companyId)
|
||||
console.log('此处为data参数:',data)
|
||||
console.log('当前为卡利用户:companyId 为',sysCustomerInfos.companyId)
|
||||
oilIdentityApi.wechatLogin(data).then(res=>{
|
||||
// console.log('这里是wechatLogin',res)
|
||||
console.log('这里是wechatLogin',res)
|
||||
this.OtherloginSuccess(res)
|
||||
// console.log(res)
|
||||
console.log(res)
|
||||
})
|
||||
return
|
||||
}
|
||||
}else{
|
||||
// console.log('这里是213','----')
|
||||
console.log('这里是213','----')
|
||||
this.autoLogin()
|
||||
}
|
||||
// uni.setStorageSync('isOther',_that.otherUser)
|
||||
@@ -209,7 +205,7 @@
|
||||
})
|
||||
},
|
||||
refuseLogin(){
|
||||
uni.setStorageSync('refuseLogin',true)
|
||||
uni.clearStorageSync()
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
@@ -228,7 +224,7 @@
|
||||
// let url = 'loginPersonal'
|
||||
oilIdentityApi.autoLogin({
|
||||
unionId: uni.getStorageSync('unionid')
|
||||
}, url).then(res => {
|
||||
}, url,{closePrompt:true}).then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
@@ -262,9 +258,8 @@
|
||||
},
|
||||
bindLoginByPhone(data, url) {
|
||||
if (this.count < 1) {
|
||||
oilIdentityApi.bindLoginByPhone(data, url).then(res => {
|
||||
if (res.code == 20000) {
|
||||
|
||||
oilIdentityApi.bindLoginByPhone(data,url,{closePrompt:true}).then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
})
|
||||
@@ -283,14 +278,7 @@
|
||||
uni.setStorageSync('accountStatus', resData.isCompanyAccount)
|
||||
let user = resData.authTokenDTO.loginUser
|
||||
uni.setStorageSync('user', user)
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
complete: (err) => {
|
||||
// console.log(err)
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
}, 1000);
|
||||
// 这里有问题
|
||||
uni.redirectTo({
|
||||
@@ -305,26 +293,11 @@
|
||||
uni.setStorageSync('accountStatus', resData.isCompanyAccount)
|
||||
let user = resData.authTokenDTO.loginUser
|
||||
uni.setStorageSync('user', user)
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
complete: (err) => {
|
||||
// console.log(err)
|
||||
}
|
||||
})
|
||||
}, 1000);
|
||||
let siteId = uni.getStorageSync('siteId')
|
||||
if(siteId) {
|
||||
uni.redirectTo({
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?siteId=${siteId}`
|
||||
})
|
||||
return
|
||||
}
|
||||
// 这里有问题
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
this.isSwitchEnterprises = true
|
||||
// // 这里有问题
|
||||
// uni.switchTab({
|
||||
// url: '/pages/tabbar/home/home'
|
||||
// })
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<!-- 验证码登录 账密登录 -->
|
||||
<template>
|
||||
<view class="login-page bg-white">
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-white">
|
||||
<cu-custom :callBack='backPage' class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-white">
|
||||
</cu-custom>
|
||||
<view class="bg-img bg-mask flex align-center" :style="'background-image: url('+imgURL+'login-bg-top.png);height: 480upx;'">
|
||||
<view class="bg-img bg-mask flex align-center"
|
||||
:style="'background-image: url('+imgURL+'login-bg-top.png);height: 480upx;'">
|
||||
<view class="padding-xl ">
|
||||
<view class="image login-bg">
|
||||
<image :src="imgURL+'new-logo.png'" mode="widthFix"></image>
|
||||
@@ -19,19 +20,15 @@
|
||||
<scroll-view class="bg-white nav padding login-shadow">
|
||||
<view class="flex text-center padding-bottom">
|
||||
<view class="cu-item text-bold text-lg flex-sub">
|
||||
|
||||
</view>
|
||||
<view class="cu-item text-bold text-lg flex-sub " :class="[1==TabCur?'text-red cur':'',(animation=='animation-fades'&&1==TabCur)?'animation-fade':'']"
|
||||
@tap="tabSelect(1)">
|
||||
<view class="cu-item text-bold text-lg flex-sub "
|
||||
:class="[1==TabCur?'text-red cur':'',(animation=='animation-fades'&&1==TabCur)?'animation-fade':'']"
|
||||
@tap="tabSelect(1)">
|
||||
企业账号
|
||||
</view>
|
||||
|
||||
<view class="cu-item text-bold text-lg flex-sub">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<form v-if="1==TabCur">
|
||||
<view class="cu-form-group yu-input padding-top" v-if="!next">
|
||||
<input name="手机号" label="手机号" type="number" placeholder="请输入企业下绑定手机号" v-model="driver.username" />
|
||||
@@ -77,20 +74,24 @@
|
||||
<view class="cu-load load-modal" v-if="loadModal">
|
||||
</view>
|
||||
<loginBottom @onCheck="checkAgree" />
|
||||
|
||||
<SwitchEnterprises @submit='goHome' @logout='logout' :is-show.sync="isSwitchEnterprises"></SwitchEnterprises>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SwitchEnterprises from '@/components/SwitchEnterprises.vue'
|
||||
import loginBottom from './components/loginBottom.vue'
|
||||
import authApi from '@/api/auth.js'
|
||||
import md5 from 'js-md5'
|
||||
import accountApi from '@/api/account.js'
|
||||
export default {
|
||||
components: {
|
||||
loginBottom
|
||||
loginBottom,
|
||||
SwitchEnterprises
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isSwitchEnterprises: false,
|
||||
showRandom: true,
|
||||
animation: '',
|
||||
hasPhone: false,
|
||||
@@ -130,8 +131,44 @@
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
moreLogin(){
|
||||
uni.redirectTo({url:'/BagAuth/pages/login/login'})
|
||||
backPage() {
|
||||
uni.reLaunch({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
},
|
||||
logout() {
|
||||
let that = this
|
||||
accountApi.logout('authSystem').then(res => {
|
||||
if (res.code == '20000') {
|
||||
uni.showToast({
|
||||
title: res.msg
|
||||
});
|
||||
uni.clearStorageSync();
|
||||
this.isSwitchEnterprises = false;
|
||||
uni.reLaunch({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
goHome() {
|
||||
let siteId = uni.getStorageSync('siteId');
|
||||
if (siteId) {
|
||||
uni.reLaunch({
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?siteId=${siteId}`
|
||||
})
|
||||
return
|
||||
}
|
||||
// 这里有问题
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
},
|
||||
moreLogin() {
|
||||
uni.reLaunch({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
},
|
||||
checkAgree(val) {
|
||||
this.checked = val
|
||||
@@ -290,9 +327,11 @@
|
||||
password: this.TabCur == 0 ? md5(this.person.password) : md5(this.company.password),
|
||||
unionId: uni.getStorageSync('unionid')
|
||||
}
|
||||
let type = this.TabCur == 0 ? 'Personal' : 'Company'
|
||||
let type = this.TabCur == 0 ? 'Personal' : 'Company';
|
||||
authApi.loginPwd(data, type).then(res => {
|
||||
this.loginSuccess(res)
|
||||
}).catch(err => {
|
||||
this.logout()
|
||||
})
|
||||
},
|
||||
loginRandom() {
|
||||
@@ -314,6 +353,8 @@
|
||||
if (res.code == 20000) {
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
}).catch(err => {
|
||||
this.logout()
|
||||
})
|
||||
},
|
||||
checkPersonal() {
|
||||
@@ -338,30 +379,14 @@
|
||||
uni.setStorageSync('Authorization', resData.authTokenDTO.accessToken)
|
||||
uni.setStorageSync('accountStatus', resData.isCompanyAccount)
|
||||
uni.getUserProfile({
|
||||
desc: '登录',
|
||||
success: (res) => {
|
||||
uni.setStorageSync('wxInfo', JSON.parse(res.rawData))
|
||||
}
|
||||
})
|
||||
let user = resData.authTokenDTO.loginUser
|
||||
uni.setStorageSync('user', user)
|
||||
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}, 1000);
|
||||
let siteId = uni.getStorageSync('siteId')
|
||||
if(siteId) {
|
||||
uni.redirectTo({
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?siteId=${siteId}`
|
||||
})
|
||||
return
|
||||
}
|
||||
// 这里有问题
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
this.isSwitchEnterprises = true
|
||||
}
|
||||
},
|
||||
checkCompany() {
|
||||
@@ -514,12 +539,13 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.moreLogin{
|
||||
.moreLogin {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.login-bg {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -553,4 +579,4 @@
|
||||
.yu-input {
|
||||
background: #FAFAFA
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user