-
Notifications
You must be signed in to change notification settings - Fork 6.4k
/
form_vcode.html
189 lines (179 loc) · 7.95 KB
/
form_vcode.html
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
183
184
185
186
187
188
189
<div class="page">
<div class="weui-form">
<div class="weui-form__bd">
<div class="weui-form__text-area">
<h2 class="weui-form__title">验证码</h2>
<div class="weui-form__desc">验证手机号样式</div>
</div>
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells">
<div class="weui-cell weui-cell_active">
<div class="weui-cell__hd"><label for="js_input1" class="weui-label">手机号</label></div>
<div class="weui-cell__bd">
<input id="js_input1" class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入手机号" value="12345678907"/>
</div>
<div class="weui-cell__ft">
<button type="button" id="showIOSDialog1" class="weui-btn_reset weui-btn_icon">
<i role="img" alt="帮助" class="js_target weui-icon-info-circle"></i>
</button>
</div>
</div>
<div id="js_cell_vcode" class="weui-cell weui-cell_active weui-cell_vcode weui-cell_wrap">
<div class="weui-cell__hd"><label for="js_input2" class="weui-label">验证码</label></div>
<div class="weui-cell__bd weui-flex">
<input id="js_input2" class="weui-input weui-cell__control weui-cell__control_flex" type="text" pattern="[0-9]*" id="js_input" placeholder="输入验证码" maxlength="6"/>
<button id="js_input_clear" class="weui-btn_reset weui-btn_icon weui-btn_input-clear">
<i class="weui-icon-clear"></i>
</button>
<button id="js_btn_vcode" role="button" class="js_target weui-cell__control weui-btn weui-btn_default weui-vcode-btn">获取验证码</button>
</div>
</div>
</div>
<div class="weui-cells__tips"><a class="weui-link weui-wa-hotarea" href="javascript:">收不到验证码</a></div>
</div>
</div>
</div>
<div style="display: none;" class="weui-form__ft">
<div class="weui-form__tips-area">
<label id="weuiAgree" for="weuiAgreeCheckbox" class="weui-agree weui-wa-hotarea">
<input id="weuiAgreeCheckbox" type="checkbox" class="weui-agree__checkbox"/><span class="weui-agree__text">阅读并同意<a href="/example/" target="_blank">《相关条款》</a>
</span>
</label>
</div>
<div class="weui-form__opr-area">
<button class="weui-btn weui-btn_primary" type="button" id="showTooltips">确定</button>
</div>
</div>
<div class="weui-form__ft">
<div class="weui-form__tips-area">
<div class="weui-form__tips__group weui-form__tips__group_primary">
<div class="weui-form__tips__wrp">
<label id="weuiAgree1" for="weuiAgreeCheckbox1" class="weui-agree weui-wa-hotarea">
<input id="weuiAgreeCheckbox1" type="checkbox" class="weui-agree__checkbox"/><span class="weui-agree__text">阅读并同意<a href="/example/" target="_blank">《相关条款》</a>
</span>
</label>
</div>
<div class="weui-form__tips__wrp">
<label id="weuiAgree0" for="weuiAgreeCheckbox0" class="weui-agree weui-wa-hotarea">
<input id="weuiAgreeCheckbox0" type="checkbox" class="weui-agree__checkbox"/><span class="weui-agree__text">以上信息用于核对账号绑定的身份</span>
</label>
</div>
</div>
</div>
<div class="weui-form__opr-area">
<button class="weui-btn weui-btn_primary" type="button" id="showTooltips">确定</button>
</div>
</div>
</div>
<div role="alert" id="js_toast" style="display: none;">
<div class="weui-mask_transparent"></div>
<div class="weui-toast">
<i class="weui-icon-success-no-circle weui-icon_toast"></i>
<p class="weui-toast__content">已完成</p>
</div>
</div>
<div role="alert" id="js_agree_msg" class="weui-hidden_abs" style="display: none;">未同意《相关条款》</div>
<div id="dialogs">
<!--BEGIN dialog1-->
<div role="dialog" aria-modal="true" class="js_dialog" id="iosDialog1" style="display: none;">
<div class="weui-mask"></div>
<div id="js_half_screen_dialog" class="weui-half-screen-dialog">
<div class="weui-half-screen-dialog__hd">
<div class="weui-half-screen-dialog__hd__side">
<button id="dialogClose" class="weui-icon-btn">关闭<i class="weui-icon-close-thin"></i></button>
</div>
<div class="weui-half-screen-dialog__hd__main">
<strong class="weui-half-screen-dialog__title">标题</strong>
</div>
</div>
<div class="weui-half-screen-dialog__bd">
<br>
<br>
可放自定义内容
<br>
<br>
<br>
<br>
</div>
</div>
</div>
<!--END dialog1-->
</div>
</div>
<script type="text/javascript">
$(function(){
var $tooltips = $('.js_tooltips');
var $toast = $('#js_toast');
var $input = $('#js_input1');
var $inputClear = $('#js_input_clear');
var $agree= $('#weuiAgree');
var $agreeMsg= $('#js_agree_msg');
var $agreeCheckbox = $('#weuiAgreeCheckbox');
var $iosDialog1 = $('#iosDialog1');
var $halfScreenDialog = $('#js_half_screen_dialog');
$input.on('input', function(){
var $value = $input.val();
if ($value){
$('#showTooltips').removeAttr('disabled');
$('#showTooltips').attr('aria-disabled','false');
}else{
$('#showTooltips').addAttr('disabled');
$('#showTooltips').attr('aria-disabled','true');
}
});
//$agreeCheckbox.on('change', function(){
//});
$('#showTooltips').on('click', function(){
if ($tooltips.css('display') != 'none') return;
// toptips的fixed, 如果有`animation`, `position: fixed`不生效
$('.page.cell').removeClass('slideIn');
if($agreeCheckbox.prop("checked")){
$agree.removeClass('weui-agree_warn');
$toast.fadeIn(100);
$toast.attr('aria-live','assertive');
setTimeout(function () {
$toast.fadeOut(100);
$toast.attr('aria-live','off');
}, 2000);
}else{
// $agree.addClass('weui-agree_animate');
$agree.addClass('weui-agree_warn');
$agreeMsg.show();
setTimeout(function () {
// $agree.removeClass('weui-agree_animate');
$agreeMsg.hide();
}, 200);
}
});
$('#dialogs').on('click', '.weui-mask', function(){
$halfScreenDialog.removeClass('weui-half-screen-dialog_show');
$(this).parents('.js_dialog').fadeOut(200);
$iosDialog1.attr('aria-modal','false');
$('#showIOSDialog1').attr('tabindex','-1').trigger('focus');
});
$('#dialogClose').on('click', function(){
$halfScreenDialog.removeClass('weui-half-screen-dialog_show');
$(this).parents('.js_dialog').fadeOut(200);
$iosDialog1.attr('aria-modal','false');
$('#showIOSDialog1').attr('tabindex','-1').trigger('focus');
});
$('#showIOSDialog1').on('click', function(){
$iosDialog1.fadeIn(200);
$halfScreenDialog.addClass('weui-half-screen-dialog_show');
$iosDialog1.attr('aria-modal','true');
setTimeout(function () {
$('#dialogClose').trigger('focus');
}, 500);
});
$('.weui-cell').on('click', function(e){
if(e.target.classList.contains('js_target')){
return;
}
$(this).find('input').trigger('focus');
});
$inputClear.on('click', function(){
$input.val('');
});
});
</script>