星油企业版
This commit is contained in:
26
BagAuth/pages/agreeMent/OperationGuide.vue
Normal file
26
BagAuth/pages/agreeMent/OperationGuide.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<view>
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">星油云操作指南</block>
|
||||
</cu-custom>
|
||||
<web-view src="https://mp.weixin.qq.com/s/h1O_dFO1d3J0j4AjMuefHQ"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
26
BagAuth/pages/agreeMent/agreeMent.vue
Normal file
26
BagAuth/pages/agreeMent/agreeMent.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<view>
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">星卡互联平台用户服务协议</block>
|
||||
</cu-custom>
|
||||
<web-view src="https://www.51xingka.net/LSMOIL/#/Agreement"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
120
BagAuth/pages/authentication/facial/facial.vue
Normal file
120
BagAuth/pages/authentication/facial/facial.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<view>
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">人脸识别</block>
|
||||
</cu-custom>
|
||||
<button type="primary" @click="checkIsSupportSoterAuthentication">检查支持的认证方式</button>
|
||||
<button type="primary" @click="checkIsSoterEnrolledInDeviceFingerPrint">检查是否录入指纹</button>
|
||||
<button type="primary" @click="checkIsSoterEnrolledInDeviceFaceID">检查是否录入FaceID</button>
|
||||
<button type="primary" @click="startSoterAuthenticationFingerPrint">开始指纹认证</button>
|
||||
<button type="primary" @click="startSoterAuthenticationFaceID">开始FaceID认证</button>
|
||||
<button type="primary" @tap="startAuth">start</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkIsSupportSoterAuthentication() {
|
||||
uni.checkIsSupportSoterAuthentication({
|
||||
success(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
},
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
checkIsSoterEnrolledInDeviceFingerPrint() {
|
||||
uni.checkIsSoterEnrolledInDevice({
|
||||
checkAuthMode: 'fingerPrint',
|
||||
success(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
},
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
checkIsSoterEnrolledInDeviceFaceID() {
|
||||
uni.checkIsSoterEnrolledInDevice({
|
||||
checkAuthMode: 'facial',
|
||||
success(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
},
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
startSoterAuthenticationFingerPrint() {
|
||||
uni.startSoterAuthentication({
|
||||
requestAuthModes: ['fingerPrint'],
|
||||
challenge: '123456',
|
||||
authContent: '请用指纹解锁',
|
||||
success(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
},
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
startSoterAuthenticationFaceID() {
|
||||
uni.startSoterAuthentication({
|
||||
requestAuthModes: ['facial'],
|
||||
challenge: '123456',
|
||||
authContent: '请用FaceID解锁',
|
||||
success(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
},
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
startAuth() {
|
||||
|
||||
uni.startSoterAuthentication({
|
||||
requestAuthModes: ['facial', 'fingerPrint'],
|
||||
challenge: '挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 resultJSON 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。,',
|
||||
authContent: '啦啦啦',
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
},
|
||||
complete: () => {
|
||||
console.log('触发了')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
25
BagAuth/pages/authentication/fingerPrint/fingerPrint.vue
Normal file
25
BagAuth/pages/authentication/fingerPrint/fingerPrint.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<view>
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">指纹识别</block>
|
||||
</cu-custom>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
49
BagAuth/pages/login/components/loginBottom.vue
Normal file
49
BagAuth/pages/login/components/loginBottom.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<view class="bg-white bottom-part bg-white">
|
||||
<view class=" text-center text-sm">
|
||||
<view class="padding-xxs">
|
||||
全国统一客服/投诉热线:
|
||||
<text class="oil-main-color" :href="'tel:4008-56-5355'">4008-56-5355</text>
|
||||
</view>
|
||||
<view class="padding-xs">
|
||||
<checkbox @tap="onChange" class='round red chagesize' :class="checked?'checked':''"
|
||||
:checked="checked?true:false" value="C"></checkbox> 我已阅读并同意
|
||||
<text @tap="toAgree" class="oil-main-color">《星卡互联平台注册服务协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'loginBottom',
|
||||
data() {
|
||||
return {
|
||||
count: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange() {
|
||||
this.count++
|
||||
this.$emit('onCheck', this.count % 2 != 0)
|
||||
},
|
||||
toAgree() {
|
||||
uni.navigateTo({
|
||||
url:'/BagAuth/pages/agreeMent/agreeMent'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.bottom-part {
|
||||
width: 750upx;
|
||||
position: absolute;
|
||||
bottom: 60rpx;
|
||||
}
|
||||
|
||||
.chagesize {
|
||||
transform: scale(0.6, 0.6);
|
||||
}
|
||||
</style>
|
||||
344
BagAuth/pages/login/login.vue
Normal file
344
BagAuth/pages/login/login.vue
Normal file
@@ -0,0 +1,344 @@
|
||||
<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>
|
||||
-->
|
||||
<view class="cu-item text-bold text-lg flex-sub">
|
||||
|
||||
</view>
|
||||
|
||||
<view class="cu-item flex-sub" :class="1==TabCur?'text-red cur':''" @tap="tabSelect(1)">
|
||||
企业账号
|
||||
</view>
|
||||
<view class="cu-item text-bold text-lg flex-sub">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="cu-load load-modal" v-if="loadModal">
|
||||
<view class="gray-text">加载中...</view>
|
||||
</view>
|
||||
<view class="margin-lg flex flex-direction text-center" v-if="!otherUser">
|
||||
<button class="cu-btn round bg-main-oil lg text-lg" open-type="getPhoneNumber"
|
||||
@getphonenumber="decryptPhoneNumber">
|
||||
<text class="cuIcon-weixin padding-right-xs"> </text>
|
||||
<text>
|
||||
微信用户一键登录
|
||||
</text>
|
||||
</button>
|
||||
<button class="cu-btn margin-top round lg" @tap="refuseEmpower">
|
||||
输入手机号码登录
|
||||
</button>
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import loginBottom from './components/loginBottom.vue'
|
||||
import oilIdentityApi from '@/api/oil-identity'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
loginBottom
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value:'123',
|
||||
userHandle: false,
|
||||
TabCur: 1,
|
||||
otherUser:false,
|
||||
accuntSource: false,
|
||||
imgURL: this.global.imgURL,
|
||||
yellowURL: this.global.yellowURL,
|
||||
loadModal: false,
|
||||
active: 0,
|
||||
password: "",
|
||||
random: '',
|
||||
driver: {},
|
||||
count: 0,
|
||||
loginRes: {},
|
||||
sessionKey: '',
|
||||
nickName: '',
|
||||
loginOut: uni.getStorageSync('loginOut') ? true : false
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
if(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('这里是登录')
|
||||
},
|
||||
methods: {
|
||||
weChatLogin(option){
|
||||
uni.clearStorageSync()
|
||||
this.refreshLocation()
|
||||
let _that = this
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (loginRes) => {
|
||||
const code = loginRes.code
|
||||
this.onceCode = code
|
||||
console.log('这里是code')
|
||||
console.log(this.onceCode)
|
||||
oilIdentityApi.sendCode(this.onceCode).then(res => {
|
||||
if (res.code === 20000) {
|
||||
console.log('这里是sendCode',res)
|
||||
this.sessionKey = res.data.sessionKey
|
||||
uni.setStorageSync('openid', res.data.openId)
|
||||
uni.setStorageSync('unionid', res.data.unionId)
|
||||
console.log('这里是213','++++++')
|
||||
if(option){
|
||||
if(option.companyId == '1460872936910831616'){
|
||||
let sysCustomerInfos = {
|
||||
userName :option.driverName,
|
||||
companyId:option.companyId,
|
||||
plateNumber:option.plateNumber,
|
||||
siteId:option.siteId,
|
||||
phone:option.phone
|
||||
} ,data = {
|
||||
tokenInfoDTO:{
|
||||
sysCustomerInfo:sysCustomerInfos
|
||||
},
|
||||
unionId:res.data.unionId
|
||||
}
|
||||
uni.setStorageSync('isOther',_that.otherUser)
|
||||
uni.setStorageSync('otherUserInfo',sysCustomerInfos)
|
||||
console.log('此处为data参数:',data)
|
||||
console.log('当前为卡利用户:companyId 为',sysCustomerInfos.companyId)
|
||||
oilIdentityApi.wechatLogin(data).then(res=>{
|
||||
console.log('这里是wechatLogin',res)
|
||||
this.OtherloginSuccess(res)
|
||||
console.log(res)
|
||||
})
|
||||
return
|
||||
}
|
||||
}else{
|
||||
console.log('这里是213','----')
|
||||
this.autoLogin()
|
||||
}
|
||||
// uni.setStorageSync('isOther',_that.otherUser)
|
||||
|
||||
|
||||
} else if (res.code == 1002) {
|
||||
uni.showModal({
|
||||
title: '微信登录失败提醒',
|
||||
content: `${res.msg}如有疑问,请联系客服处理`
|
||||
})
|
||||
} else {
|
||||
// console.log('res', res.code)
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.reLaunch({
|
||||
url: '/BagAuth/pages/login/boforeLogin/boforeLogin',
|
||||
fail: (err) => {
|
||||
// console.log(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
fail: err => {},
|
||||
})
|
||||
},
|
||||
refuseLogin(){
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
},
|
||||
refreshLocation() {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function(res) {
|
||||
uni.setStorageSync('location', res)
|
||||
}
|
||||
});
|
||||
},
|
||||
autoLogin() {
|
||||
let url = 'loginCompany'
|
||||
console.log('这里是自动登录')
|
||||
// let url = 'loginPersonal'
|
||||
oilIdentityApi.autoLogin({
|
||||
unionId: uni.getStorageSync('unionid')
|
||||
}, url).then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
})
|
||||
},
|
||||
refuseEmpower() {
|
||||
uni.navigateTo({
|
||||
url: '/BagAuth/pages/login/oldLogin'
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
decryptPhoneNumber(e) {
|
||||
// console.log(e.detail)
|
||||
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||
const data1 = {
|
||||
...e.detail,
|
||||
sessionKey: this.sessionKey,
|
||||
unionId: uni.getStorageSync('unionid'),
|
||||
openId: uni.getStorageSync('openid'),
|
||||
appId: 'wx7a939c19b270cc3d'
|
||||
}
|
||||
let url1 = 0 == this.TabCur ? 'bindLoginByPhonePersonal' : 'bindLoginByPhoneCompany'
|
||||
this.bindLoginByPhone(data1, url1)
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '您已拒绝授权手机号'
|
||||
})
|
||||
}
|
||||
},
|
||||
bindLoginByPhone(data, url) {
|
||||
if (this.count < 1) {
|
||||
oilIdentityApi.bindLoginByPhone(data, url).then(res => {
|
||||
if (res.code == 20000) {
|
||||
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
tabSelect(e) {
|
||||
this.TabCur = e;
|
||||
},
|
||||
OtherloginSuccess(res){
|
||||
console.log('这里是OtherloginSuccess',res)
|
||||
let resData = res.data
|
||||
if (resData.authTokenDTO.loginFlag) {
|
||||
uni.setStorageSync('Authorization', resData.authTokenDTO.accessToken)
|
||||
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);
|
||||
// 这里有问题
|
||||
uni.redirectTo({
|
||||
url: '/BagStation/pages/SeparateProcess/stationDetail'
|
||||
})
|
||||
}
|
||||
},
|
||||
loginSuccess(res) {
|
||||
let resData = res.data
|
||||
if (resData.authTokenDTO.loginFlag) {
|
||||
uni.setStorageSync('Authorization', resData.authTokenDTO.accessToken)
|
||||
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);
|
||||
// 这里有问题
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.isKLUser{
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: #888888;
|
||||
text-align: center;
|
||||
padding: 2% 0s;
|
||||
}
|
||||
.login-bg {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-bg image {
|
||||
width: 750upx;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.login-page {
|
||||
height: 750rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
.bg-0{
|
||||
background-color: transparent;
|
||||
color: #555;
|
||||
}
|
||||
</style>
|
||||
540
BagAuth/pages/login/oldLogin.vue
Normal file
540
BagAuth/pages/login/oldLogin.vue
Normal file
@@ -0,0 +1,540 @@
|
||||
<!-- 验证码登录 账密登录 -->
|
||||
<template>
|
||||
<view class="login-page bg-white">
|
||||
<cu-custom 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="padding-xl ">
|
||||
<view class="image login-bg">
|
||||
<image :src="imgURL+'new-logo.png'" mode="widthFix"></image>
|
||||
<view class="text-bold text-lg padding-top">
|
||||
一路油你 星油能源
|
||||
</view>
|
||||
<view class="text-df text-grey padding-top-xs padding-bottom">
|
||||
登录后加油更便捷
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
|
||||
<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" />
|
||||
</view>
|
||||
<view class="" v-if="registered">
|
||||
<view class="cu-form-group yu-input" v-if="showRandom" v-show="next">
|
||||
<input placeholder="请输入验证码" type="number" v-model="company.random" />
|
||||
<view class='oil-main-color' @tap="sendRandom"> {{company.tips}}</view>
|
||||
</view>
|
||||
<view class="cu-form-group yu-input" v-else>
|
||||
<input placeholder="请输入密码" type="password" v-model="company.password" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="cu-form-group text-sm">
|
||||
<view class="" v-show="showRandom" @tap="accuntSourceSelect">
|
||||
当前为验证码登录
|
||||
</view>
|
||||
<view class="" v-show="!showRandom" @tap="accuntSourceSelect">
|
||||
当前为密码登录
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class=" flex flex-direction padding-top-lg" v-if="!registered">
|
||||
<button class="cu-btn margin bg-main-oil lg" @tap="ifRegistered">
|
||||
下一步
|
||||
</button>
|
||||
</view>
|
||||
<view class=" flex flex-direction padding-top-lg" v-if="next">
|
||||
<button v-show="showRandom" class="cu-btn bg-main-oil lg" @tap="loginRandom">
|
||||
登录
|
||||
</button>
|
||||
<button v-show="!showRandom" class="cu-btn bg-main-oil lg" @tap="loginPwd">
|
||||
登录
|
||||
</button>
|
||||
|
||||
</view>
|
||||
</form>
|
||||
|
||||
</scroll-view>
|
||||
|
||||
<view class="cu-load load-modal" v-if="loadModal">
|
||||
</view>
|
||||
<loginBottom @onCheck="checkAgree" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import loginBottom from './components/loginBottom.vue'
|
||||
import authApi from '@/api/auth.js'
|
||||
import md5 from 'js-md5'
|
||||
export default {
|
||||
components: {
|
||||
loginBottom
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showRandom: true,
|
||||
animation: '',
|
||||
hasPhone: false,
|
||||
userHandle: false,
|
||||
TabCur: 1,
|
||||
verifyCodeToken: "",
|
||||
accuntSource: false,
|
||||
imgURL: this.global.imgURL,
|
||||
loadModal: false,
|
||||
active: 1,
|
||||
|
||||
person: {
|
||||
sended: false,
|
||||
password: "",
|
||||
tips: '发送验证码',
|
||||
intervalID: '',
|
||||
random: '',
|
||||
registered: false
|
||||
},
|
||||
registered: false,
|
||||
company: {
|
||||
sended: false,
|
||||
password: "",
|
||||
tips: '发送验证码',
|
||||
intervalID: '',
|
||||
random: '',
|
||||
registered: false
|
||||
},
|
||||
driver: {
|
||||
username: ""
|
||||
},
|
||||
count: 0,
|
||||
loginRes: {},
|
||||
checked: false,
|
||||
next: false
|
||||
}
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
checkAgree(val) {
|
||||
this.checked = val
|
||||
// this.showRandom = true
|
||||
},
|
||||
ifRegistered() {
|
||||
if (this.driver.username.length != 11) {
|
||||
uni.showToast({
|
||||
title: '手机码验证不通过',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (this.showRandom) {
|
||||
this.sendRandom()
|
||||
} else {
|
||||
let type = this.TabCur == 0 ? 'Personal' : 'Company'
|
||||
authApi.loginByPhoneNext({
|
||||
username: this.driver.username
|
||||
}, type).then(res => {
|
||||
if (res.code == 20000) {
|
||||
// 存在 next
|
||||
this.registered = true
|
||||
this.next = true
|
||||
} else if (res.code == 42008) {
|
||||
uni.showModal({
|
||||
title: res.msg,
|
||||
confirmText: '企业会员暂不开放注册',
|
||||
confirmColor: '#FF6700'
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
sendRandom() {
|
||||
// 判断该手机号是否已注册
|
||||
if (1 == this.TabCur) {
|
||||
// 1 企业 0个人
|
||||
authApi.checkCompanyAccount({
|
||||
username: this.driver.username
|
||||
}).then(res => {
|
||||
if (res.data != null) {
|
||||
if (res.data.code == 40001) {
|
||||
uni.showModal({
|
||||
title: res.data.msg,
|
||||
content: '企业账号只能由企业分配,请确认是否当前手机号,如有疑问,请联系客服处理',
|
||||
showCancel: false,
|
||||
confirmColor: '#FF6700',
|
||||
success: (res) => {
|
||||
if (confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (res.code == 20000) {
|
||||
this.company.registered = true
|
||||
this.verifyCodeToken = res.data.verifyCodeToken
|
||||
uni.showToast({
|
||||
title: res.msg
|
||||
})
|
||||
this.showRandom = true
|
||||
this.next = true
|
||||
this.registered = true
|
||||
var second = 60
|
||||
this.company.intervalID = setInterval(() => {
|
||||
if (second > 0) {
|
||||
this.company.tips = second + '秒后可重发'
|
||||
second--
|
||||
} else {
|
||||
clearInterval(this.company.intervalID)
|
||||
this.company.tips = '发送验证码'
|
||||
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let that = this
|
||||
authApi.checkPersonalAccount({
|
||||
username: this.driver.username
|
||||
}).then(res => {
|
||||
if (res.data != null) {
|
||||
if (res.data.code == 40001) {
|
||||
uni.showModal({
|
||||
title: res.data.msg,
|
||||
confirmText: '立即注册',
|
||||
confirmColor: '#FF6700',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setStorageSync('username', that.driver.username)
|
||||
uni.navigateTo({
|
||||
url: '/BagAuth/pages/login/register'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (res.code == 20000) {
|
||||
this.person.registered = true
|
||||
this.verifyCodeToken = res.data.verifyCodeToken
|
||||
uni.showToast({
|
||||
title: res.msg
|
||||
})
|
||||
this.showRandom = true
|
||||
this.person.sended = true
|
||||
this.sended = true
|
||||
var second = 60
|
||||
this.person.intervalID = setInterval(() => {
|
||||
if (second > 0) {
|
||||
this.person.tips = second + '秒后可重发'
|
||||
second--
|
||||
} else {
|
||||
clearInterval(this.person.intervalID)
|
||||
this.person.tips = '重发验证码'
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
checkAccount() {
|
||||
|
||||
},
|
||||
// sendRandom() {
|
||||
// if (this.TabCur == 0) {
|
||||
// if (this.company.tips == '重发验证码') {
|
||||
// this.ifRegistered()
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
// if (this.TabCur == 1) {
|
||||
// if (this.person.tips == '重发验证码') {
|
||||
// this.ifRegistered()
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
// uni.showToast({
|
||||
// title: '别急,等会儿再发哦',
|
||||
// icon: 'none',
|
||||
// position: 'bottom'
|
||||
// })
|
||||
// },
|
||||
|
||||
loginPwd() {
|
||||
if (!this.checked) {
|
||||
uni.showToast({
|
||||
title: '请您阅读并同意协议',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
let data = {
|
||||
username: this.driver.username,
|
||||
password: this.TabCur == 0 ? md5(this.person.password) : md5(this.company.password),
|
||||
unionId: uni.getStorageSync('unionid')
|
||||
}
|
||||
let type = this.TabCur == 0 ? 'Personal' : 'Company'
|
||||
authApi.loginPwd(data, type).then(res => {
|
||||
this.loginSuccess(res)
|
||||
})
|
||||
},
|
||||
loginRandom() {
|
||||
if (!this.checked) {
|
||||
uni.showToast({
|
||||
title: '请您阅读并同意协议',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
let data = {
|
||||
verifyCodeToken: this.verifyCodeToken,
|
||||
username: this.driver.username,
|
||||
verifyCode: this.TabCur == 0 ? this.person.random : this.company.random,
|
||||
unionId: uni.getStorageSync('unionid')
|
||||
}
|
||||
let type = this.TabCur == 0 ? 'Personal' : 'Company'
|
||||
authApi.loginRandom(data, type).then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.loginSuccess(res)
|
||||
}
|
||||
})
|
||||
},
|
||||
checkPersonal() {
|
||||
if (this.accuntSource) {
|
||||
authApi.checkPersonalRDM({
|
||||
username: this.driver.username
|
||||
}).then(res => {
|
||||
|
||||
})
|
||||
} else {
|
||||
authApi.checkPersonalPWD({
|
||||
username: this.driver.username
|
||||
}).then(res => {
|
||||
if (res.code == 20000) {}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
loginSuccess(res) {
|
||||
let resData = res.data
|
||||
if (resData.authTokenDTO.loginFlag) {
|
||||
uni.setStorageSync('Authorization', resData.authTokenDTO.accessToken)
|
||||
uni.setStorageSync('accountStatus', resData.isCompanyAccount)
|
||||
uni.getUserProfile({
|
||||
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);
|
||||
// 这里有问题
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
}
|
||||
},
|
||||
checkCompany() {
|
||||
if (this.accuntSource) {
|
||||
authApi.checkCompanyRDM({
|
||||
username: this.driver.username
|
||||
}).then(res => {
|
||||
|
||||
})
|
||||
} else {
|
||||
authApi.checkCompanyPWD({
|
||||
username: this.driver.username
|
||||
}).then(res => {
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
// checkPersonalRDM(){
|
||||
// authApi.checkPersonalRDM({username:this.driver.username}).then(res=>{
|
||||
|
||||
// })
|
||||
// },
|
||||
// checkPersonalRDM(){
|
||||
// authApi.checkPersonalRDM({username:this.driver.username}).then(res=>{
|
||||
|
||||
// })
|
||||
// },
|
||||
getUserInfo() {
|
||||
|
||||
},
|
||||
clearStorage() {
|
||||
uni.clearStorage()
|
||||
},
|
||||
decryptPhoneNumber(e) {
|
||||
// console.log(e.detail)
|
||||
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||
const data1 = {
|
||||
...this.loginRes,
|
||||
...e.detail
|
||||
}
|
||||
this.bindLoginByPhone(data1)
|
||||
} else {
|
||||
this.userHandle = true
|
||||
uni.showModal({
|
||||
title: '用户拒绝了手机号的授权,并给你一个大耳巴子',
|
||||
content: `如有疑问,请联系客服处理`
|
||||
})
|
||||
}
|
||||
},
|
||||
bindLoginByPhone(data) {
|
||||
if (this.count < 1) {
|
||||
oilIdentityApi.bindLoginByPhone(data).then(res => {
|
||||
if (res.code == '000') {
|
||||
this.bindLoginByPhone(data)
|
||||
this.count++
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
loginWeixin() {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: loginRes => {
|
||||
const code = loginRes.code
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// reqRandom() {
|
||||
// if (this.driver.phone && this.driver.phone.length === 11) {
|
||||
// uni.showToast({
|
||||
// title: '发送中...',
|
||||
// duration: 0,
|
||||
// icon: 'loding',
|
||||
// mask: true
|
||||
// })
|
||||
// this.phoneError = ''
|
||||
// this.disabled = true
|
||||
// this.btnColor = '#333'
|
||||
|
||||
// const data2 = {
|
||||
// ...this.driver,
|
||||
// IMEI: this.IMEI,
|
||||
// serviceCode: 'LSM_SENDMESSAGES',
|
||||
// type: 'LSM_APP_LOGIN'
|
||||
// }
|
||||
|
||||
// authApi.api(data2).then(res => {
|
||||
// console.log('验证码参数', data2)
|
||||
// console.log('验证码返回参数res', res)
|
||||
// if (res.code === '1000') {
|
||||
// this.disabled = true
|
||||
// uni.hideLoading()
|
||||
// uni.showToast({
|
||||
// title: '验证码发送成功',
|
||||
// icon: 'success',
|
||||
// position: 'bottom'
|
||||
// })
|
||||
// this.btnColor = '#333'
|
||||
// let second = 60
|
||||
// const timer = setInterval(() => {
|
||||
// second--
|
||||
// if (second) {
|
||||
// this.tips = `${second}秒后重发`
|
||||
// } else {
|
||||
// clearInterval(timer)
|
||||
// this.tips = `发送验证码`
|
||||
// this.disabled = false
|
||||
// this.btnColor = '#FF6700'
|
||||
// }
|
||||
// }, 1000)
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: '请输入正确手机号',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
|
||||
tabSelect(e) {
|
||||
this.TabCur = e;
|
||||
var anmiaton = 'animation-fades'
|
||||
this.animation = anmiaton;
|
||||
setTimeout(() => {
|
||||
this.animation = '';
|
||||
}, 1000)
|
||||
},
|
||||
accuntSourceSelect() {
|
||||
this.showRandom = !this.showRandom
|
||||
},
|
||||
ifSuccess(code, data) {
|
||||
if (code === '1000') {
|
||||
// // // // console.log('122')
|
||||
|
||||
uni.showToast({
|
||||
title: `登录成功!`
|
||||
})
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.login-bg {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-bg image {
|
||||
width: 100upx;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.login-page {
|
||||
height: 750rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.login-shadow {
|
||||
border-radius: 50upx 50upx 0 0;
|
||||
box-shadow: 0px -10px 20px 2px rgba(0, 0, 0, 0.06);
|
||||
margin-top: -50upx;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.bg-mask {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.bg-mask::after {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.yu-input {
|
||||
background: #FAFAFA
|
||||
}
|
||||
</style>
|
||||
74
BagAuth/pages/userPage/userPage.vue
Normal file
74
BagAuth/pages/userPage/userPage.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<view class="page-content my-bg">
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">个人中</block>
|
||||
</cu-custom>
|
||||
<view class="cu-list menu-avatar">
|
||||
<view class="cu-item arrow">
|
||||
<view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg);"></view>
|
||||
<view class="content">
|
||||
<view class="text-grey">用户姓名</view>
|
||||
<view class="text-gray text-sm flex">
|
||||
<view class="text-cut">
|
||||
<!-- <text class="cuIcon-infofill text-red margin-right-xs"></text> -->
|
||||
当前:个人账户
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="cuIcon-right text-grey "></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-list menu ">
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="cu-item arrow">
|
||||
<view class="content">
|
||||
<text class="color-000">登入密码</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">管理登入密码</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="padding margin-top bg-white margin-bottom">
|
||||
<view class="cu-item text-center">
|
||||
<text class="color-000 text-center">切换账号</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="padding bg-white">
|
||||
<view class="cu-item text-center">
|
||||
<text class="color-000 text-center">退出</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cu-list+.cu-list {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
min-height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user