1
This commit is contained in:
@@ -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