登录对接
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<image class="login-box-logo" mode="widthFix" src="/static/logo.png"></image>
|
||||
<template v-if="loginType == 'yzm'">
|
||||
<view class="login-box-input mt100">
|
||||
<input class="login-box-input-main" v-model="yzmForm.phone" placeholder="请输入手机号" />
|
||||
<input class="login-box-input-main" maxlength="11" v-model="yzmForm.phone" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<!-- <view class="login-box-input mt40">
|
||||
<input class="login-box-input-main" v-model="yzmForm.imgCode" placeholder="图形验证码" />
|
||||
@@ -17,8 +17,12 @@
|
||||
</view> -->
|
||||
<view class="login-box-input mt40">
|
||||
<input class="login-box-input-main" v-model="yzmForm.code" placeholder="手机验证码" />
|
||||
<view class="ml40" style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
|
||||
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
|
||||
<view
|
||||
class="ml40"
|
||||
style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
|
||||
v-if="waitTime > 0"
|
||||
>{{ waitTime + 's后重新获取' }}</view
|
||||
>
|
||||
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
|
||||
</view>
|
||||
</template>
|
||||
@@ -39,13 +43,13 @@
|
||||
<view class="login-box-footer">
|
||||
<view @click="loginType = 'pwd'" v-if="loginType == 'yzm'">账号密码登录</view>
|
||||
<view @click="loginType = 'yzm'" v-else>短信验证码登录</view>
|
||||
<view style="flex:1"></view>
|
||||
<view style="flex: 1"></view>
|
||||
<navigator url="/pages/user/forget" hover-class="none">忘记密码</navigator>
|
||||
<view style="margin:0 10px;color:#999">|</view>
|
||||
<view style="margin: 0 10px; color: #999">|</view>
|
||||
<navigator url="/pages/user/register" hover-class="none">快速注册</navigator>
|
||||
</view>
|
||||
<view class="login-box-tips">
|
||||
<view style="color:#999">点击登录即表示同意</view>
|
||||
<view style="color: #999">点击登录即表示同意</view>
|
||||
<navigator url="/pages/mine/agreement" hover-class="none">《用户协议》</navigator>
|
||||
<navigator url="/pages/mine/policy" hover-class="none">《个人信息保护政策》</navigator>
|
||||
</view>
|
||||
@@ -55,9 +59,9 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { apiGetYms, apiLogin } from '@/common/api/user'
|
||||
import { apiGetYms, apiLogin, apiYsmLogin } from '@/common/api/user'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
loginType: 'pwd',
|
||||
@@ -74,46 +78,47 @@ export default {
|
||||
waitTime: 0,
|
||||
tenantId: '',
|
||||
companyName: '',
|
||||
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
getCode () {
|
||||
getCode() {
|
||||
if (!this.yzmForm.phone) {
|
||||
return this.$util.toast('请输入手机号!')
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '请稍等'
|
||||
title: '请稍等',
|
||||
})
|
||||
apiGetYms({
|
||||
phone: this.yzmForm.phone,
|
||||
type: 0,
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
console.log(res);
|
||||
this.waitTime = 60
|
||||
this.inter = setInterval(() => {
|
||||
if (this.waitTime == 0) {
|
||||
clearInterval(this.inter)
|
||||
} else {
|
||||
this.waitTime--
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err);
|
||||
})
|
||||
.then((res) => {
|
||||
uni.hideLoading()
|
||||
console.log(res)
|
||||
this.waitTime = 60
|
||||
this.inter = setInterval(() => {
|
||||
if (this.waitTime == 0) {
|
||||
clearInterval(this.inter)
|
||||
} else {
|
||||
this.waitTime--
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
login () {
|
||||
console.log(this.loginType);
|
||||
login() {
|
||||
console.log(this.loginType)
|
||||
if (this.loginType == 'pwd') {
|
||||
this.pwdLogin()
|
||||
} else {
|
||||
this.yzmLogin()
|
||||
}
|
||||
},
|
||||
pwdLogin () {
|
||||
pwdLogin() {
|
||||
if (!this.pwdForm.phone && !this.pwdForm.pwd) {
|
||||
return this.$util.toast('请填写登录信息!')
|
||||
}
|
||||
@@ -121,24 +126,23 @@ export default {
|
||||
phone: this.pwdForm.phone,
|
||||
key: this.pwdForm.pwd,
|
||||
type: 1,
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
uni.setStorageSync('userInfo', res.data)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
})
|
||||
},
|
||||
yzmLogin () {
|
||||
yzmLogin() {
|
||||
if (!this.yzmForm.phone && !this.yzmForm.code) {
|
||||
return this.$util.toast('请填写登录信息!')
|
||||
}
|
||||
apiLogin({
|
||||
apiYsmLogin({
|
||||
phone: this.yzmForm.phone,
|
||||
key: this.yzmForm.code,
|
||||
type: 0,
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
smsCode: this.yzmForm.code,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
uni.setStorageSync('userInfo', res.data)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
@@ -146,11 +150,10 @@ export default {
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad (o) {
|
||||
},
|
||||
onLoad(o) {},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
<style lang="scss">
|
||||
.login {
|
||||
.login-title {
|
||||
padding-left: 64rpx;
|
||||
@@ -252,4 +255,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user