code.vue
4.18 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
<view class="code-page">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="f__login">
<view class="loginPhone">
<view style="margin-top: 173rpx;">
<text style="font-size: 22px;color: #3A4759 ;position: relative;">手机验证码登录</text>
<view class="circleStyle"></view>
</view>
<view class="form-row">
<input class="input" type="number" v-model="phone" placeholder="请输入手机号码"
placeholder-style="font-weight:normal;color:#bbbbbb;"></input>
</view>
<view class="form-row">
<input class="input" type="number" v-model="vCode" placeholder="请输入验证码"
placeholder-style="font-weight:normal;color:#bbbbbb;"></input>
<view style="color:#6299ff" class="getvcode" :class="{forhidden:readonly}" @click="getVcode">{{ codeText }}</view>
</view>
<button class="submit" size="default" @click="onSubmit">
<text style="color:#FFFFFF">登录</text>
</button>
<view class="u-flex" style="flex-direction: row;margin-top: 20rpx;justify-content: space-between;">
<view style="color: #999999;font-size: 13px;" @click="openAccountFunc">账号密码登录</view>
</view>
<view class="circleStyleBottom"></view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
readonly: false,
codeText: '发送验证码',
phone: '', //号码
vCode: '', //验证码
}
},
methods: {
//验证码按钮文字状态
getCodeState() {
const _this = this;
this.readonly = true;
this.codeText = '60S后重新获取';
var s = 60;
clear = setInterval(() => {
s--;
_this.codeText = s + 'S后重新获取';
if (s <= 0) {
clearInterval(clear);
_this.codeText = '发送验证码';
_this.readonly = false;
}
}, 1000);
},
//获取验证码
getVcode() {
console.log('getVcode')
if (this.readonly) {
uni.showToast({
title: '验证码已发送~',
icon: 'none'
});
return;
}
if (this.phone == '') {
uni.showToast({
title: '请输入手机号~',
icon: 'none'
});
return;
}
const phoneRegular = /^1\d{10}$/;
if (!phoneRegular.test(this.phone)) {
uni.showToast({
title: '手机号格式不正确~',
icon: 'none'
});
return;
}
let httpData = {}
// 获取验证码接口
// uni.$u.http.post('您的接口', httpData).then(res => {
this.getCodeState(); //开始倒计时
// })
},
onSubmit() {},
openAccountFunc(){
uni.navigateTo({
url:"./login"
})
}
}
}
</script>
<style lang="scss" scoped>
.code-page{
min-height: 100vh;
background-color: #fff;
}
.f__login {
padding: 48rpx 32rpx;
border-radius: 18rpx 18rpx 0 0;
z-index: 99;
position: relative;
}
.loginPhone {
.circleStyle {
position: absolute;
width: 145rpx;
height: 300rpx;
left: -31rpx;
top: 10rpx;
border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0;
background-color: #f0f2f5;
opacity: 0.5;
}
.form-row {
position: relative;
border-bottom: 1rpx solid #e8e8e8;
.input {
font-size: 34rpx;
line-height: 102rpx;
height: 94rpx;
width: 100%;
box-sizing: border-box;
font-size: 30rpx;
padding: 0;
font-weight: bold;
}
.getvcode {
font-size: 26rpx;
height: 80rpx;
color: #333;
line-height: 80rpx;
// background: #eee;
min-width: 188rpx;
text-align: center;
border-radius: 8rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
z-index: 11;
&.forhidden {
// background: #eee;
// color: #cccccc;
}
}
}
.submit {
margin-top: 60rpx;
width: 100%;
position: relative;
background: linear-gradient(90deg, #5DC2FC 0%, #377DFF 100%);
border-radius: 46px;
}
.circleStyleBottom {
position: absolute;
width: 145rpx;
height: 300rpx;
right: -31rpx;
top: 804rpx;
//#ifndef MP
top: 804rpx;
//#endif
border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0;
background: linear-gradient(241deg, #00c9a7 0%, rgba(0, 223, 252, 0.5) 100%);
opacity: 0.1;
transform: rotate(180deg);
}
}
</style>