123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- {eyou:volist name="$users_para" id="vo"}
- {eyou:switch name="vo.dtype"}
- {eyou:case value="hidden"}
- <!-- 隐藏域 start -->
- <div class="form-group" style="display: none;">
- <div class="row">
- <div class="ey-form-file-title col-md-3"></div>
- <div class="col-md-9">
- <input type="hidden" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
- </div>
- </div>
- </div>
- <!-- 隐藏域 start -->
- {/eyou:case}
-
- {eyou:case value="mobile"}
- <!-- 手机文本框 start -->
- <div class="wx-form-group">
- <input type="text" class="wx-form-control" required id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" maxlength="11" value="{$vo.dfvalue|default=''}" placeholder="{$vo.title}">
- </div>
- {eyou:if condition="isset($usersConfig['users_verification']) && 3 == $usersConfig['users_verification']"}
- <div class="wx-form-group">
- <div class="field">
- <input type="hidden" name="__mobile_1_token__" value="{$Request.token.__mobile_1_token__}" />
- <input type="text" class="wx-form-control" id="{$vo.fieldArr}_{$vo.name|default=''}_code" name="{$vo.fieldArr}[{$vo.name|default=''}_code]" placeholder="手机验证码" autocomplete="off">
- <input type="button" id="{$vo.fieldArr}_{$vo.name|default=''}_button" onclick="get_{$vo.fieldArr}{$vo.name|default=''}_code();" class="sento" value="获取验证码"/>
- </div>
- </div>
- <script type="text/javascript">
- function get_{$vo.fieldArr}{$vo.name|default=''}_code() {
- var mobile = $("#{$vo.fieldArr}_{$vo.name|default=''}").val();
- // 手机号是否为空
- if (!mobile) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}").focus();
- layer.msg('请输入{$vo.title}!', {time: 1500});
- return false;
- }
-
- // 手机格式不正确
- var reg = /^1[0-9]{10}$/i;
- if (!reg.test(mobile)) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}").focus();
- layer.msg('请输入正确的{$vo.title}!', {time: 1500});
- return false;
- }
-
- // 设置为不可点击
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('获取中…').attr('disabled', 'disabled');
-
- var __mobile_1_token__ = $('input[name=__mobile_1_token__]').val();
- $.ajax({
- url: "{eyou:url link='api/Ajax/SendMobileCode' /}",
- data: {type:'reg', mobile:mobile, is_mobile:true, title:'账号注册', source:0, __mobile_1_token__:__mobile_1_token__},
- type:'post',
- dataType:'json',
- success:function(res){
- if (res.code == 1) {
- {$vo.fieldArr}{$vo.name|default=''}_countdown();
- layer.msg(res.msg, {time: 1500});
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('获取验证码').removeAttr("disabled");
- layer.alert(res.msg, {icon: 2, title: false, closeBtn: 0});
- }
- },
- error : function() {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('获取验证码').removeAttr("disabled");
- layer.alert('发送失败,请尝试重新发送!', {icon: 5, title: false, closeBtn: 0});
- }
- });
- }
-
- function {$vo.fieldArr}{$vo.name|default=''}_countdown(){
- // 倒计时
- var setTime;
- var time = 120;
- setTime = setInterval(function() {
- if(0 >= time) {
- clearInterval(setTime);
- return false;
- }
-
- time--;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val(time + '秒').attr('disabled', 'disabled');
- if(time == 0) $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('获取验证码').removeAttr("disabled");
- }, 1000);
- }
- </script>
- {/eyou:if}
- <!-- 手机文本框 end -->
- {/eyou:case}
-
- {eyou:case value="email"}
- <!-- 邮箱文本框 start -->
- <div class="wx-form-group">
- <input type="text" class="wx-form-control" required id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}" placeholder="{$vo.title}" >
- </div>
- {eyou:if condition="isset($usersConfig['users_verification']) && 2 == $usersConfig['users_verification']"}
- <div class="wx-form-group">
- <div class="field">
- <input type="text" class="wx-form-control" id="{$vo.fieldArr}_{$vo.name|default=''}_code" name="{$vo.fieldArr}[{$vo.name|default=''}_code]" value="" placeholder="邮箱验证码">
- <input type="button" id="{$vo.fieldArr}_{$vo.name|default=''}_button" onclick="get_{$vo.fieldArr}{$vo.name|default=''}_code();" class="sento" value="点击发送" />
- </div>
- </div>
- <script type="text/javascript">
- function get_{$vo.fieldArr}{$vo.name|default=''}_code(){
- var email = $("#{$vo.fieldArr}_{$vo.name|default=''}").val();
- var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
- // 邮箱格式不正确
- if(!reg.test(email)){
- layer.msg('请正确输入邮箱地址!', {time: 1500});
- return false;
- }
-
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('发送中…');
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").attr('disabled', 'disabled');
- $.ajax({
- // async:false,
- url: "{eyou:url link='user/Smtpmail/send_email' /}",
- data: {type:'reg',email:email,title:'账号注册',scene:2},
- type:'post',
- dataType:'json',
- success:function(res){
- if(res.code == 1){
- {$vo.fieldArr}{$vo.name|default=''}_countdown();
- layer.msg(res.msg, {time: 1500});
- }else{
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('点击发送');
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").removeAttr("disabled");
- showErrorAlert(res.msg);
- }
- },
- error : function(e) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('点击发送');
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").removeAttr("disabled");
- showErrorAlert(e.responseText);
- }
- });
- }
-
- function {$vo.fieldArr}{$vo.name|default=''}_countdown(){
- // 倒计时
- var setTime;
- var time = {php}echo config('global.email_send_time');{/php};
- setTime = setInterval(function(){
- if(0 >= time){
- clearInterval(setTime);
- return;
- }
- time--;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val(time+'秒');
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").attr('disabled', 'disabled');
-
- if(time == 0){
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").val('点击发送');
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").removeAttr("disabled");
- }
- },1000);
- }
- </script>
- {/eyou:if}
- <!-- 邮箱文本框 end -->
- {/eyou:case}
-
- {/eyou:switch}
- {/eyou:volist}
|