loginPhone.vue
2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
<div class="login_container">
<UserCommon>
<template slot="top">
<NafmHeader bgColor="transparent" />
</template>
</UserCommon>
<div class="login_content">
<LoginTabs :type="1" />
<div class="login_form_box">
<div class="login_form">
<van-field v-model.trim="phone" clearable type="tel" maxlength="11" :left-icon="phoneIcon" placeholder="请输入手机号" />
<van-field v-model.trim="password" clearable label="" type="tel" maxlength="6" :left-icon="VerificationIcon" placeholder="请输入验证码">
<template #button>
<SendVerificationCode :phone="phone" :data="objParams" />
</template>
</van-field>
<div class="login_btn" :class="{loginActive:isBothValue}" @click="handleLogin">登 录</div>
<div class="register_btn" @click="jumpRigster">立即注册</div>
</div>
</div>
</div>
<OtherLogin />
</div>
</template>
<script>
import UserCommon from '@/components/UserCommon'
import LoginTabs from './components/LoginTabs'
import OtherLogin from './components/OtherLogin'
import SendVerificationCode from '@/components/SendVerificationCode'
import utils from "@/utils/";
export default {
name: 'Login',
components: {
UserCommon,
LoginTabs,
OtherLogin,
SendVerificationCode
},
data() {
return {
phone: null,
password: "",
objParams: {
type: 'phone'
},
type: 'phone',
phoneIcon: require('@/assets/icon/user.png'),
VerificationIcon: require('@/assets/icon/verification.png'),
}
},
computed: {
isBothValue() {
if (this.phone && this.password) {
return true
} else {
return false
}
},
},
methods: {
// 登录操作
handleLogin() {
if (!this.phone) {
Toast('请输入手机号')
return
}
if (!utils.phoneRegCheck(this.phone)) {
Toast("请输入正确的手机号码!");
return
}
if (!this.password) {
Toast('请输入验证码')
return
}
// todo 请求接口
console.log(1)
},
// 跳转注册页面
jumpRigster() {
this.$router.push({
path: '/user/register'
})
},
}
}
</script>
<style lang="less" scoped>
@import "./less/login.less";
// /deep/ .van-field__body input::-webkit-input-placeholder {
// color: #8F9196;
// }
</style>