www_fpvone_cn/application/index/view/third/prepare.html

133 lines
6.6 KiB
HTML

<div id="content-container" class="container" style="margin-top:60px;">
{if isset($userinfo['avatar'])}
<div class="text-center">
<img src="{$userinfo.avatar}" class="img-circle" width="80" height="80" alt=""/>
<div style="margin-top:15px;">{$userinfo.nickname|default=''|htmlentities}</div>
</div>
{/if}
<div class="user-section login-section" style="margin-top:20px;">
<div class="logon-tab clearfix">
<a href="javascript:" data-type="bind" class="active">绑定已有账号</a>
<a href="javascript:" data-type="register">创建新账号</a>
</div>
<div class="bind-main login-main">
<form name="form" id="bind-form" class="form-vertical" method="POST" action="{:url('user/login')}">
{:token()}
<input type="hidden" name="platform" value="{$platform|htmlentities}"/>
<input type="hidden" name="url" value="{$url|htmlentities}"/>
<div class="form-group">
<label class="control-label">{:__('Account')}</label>
<div class="controls">
<input type="text" id="account" name="account" data-rule="required" class="form-control input-lg" placeholder="{:__('Email/Mobile/Username')}">
<p class="help-block"></p>
</div>
</div>
<div class="form-group">
<label class="control-label">{:__('Password')}</label>
<div class="controls">
<input type="password" id="password" name="password" data-rule="required;password" class="form-control input-lg" placeholder="{:__('Password must be 6 to 30 characters')}">
<p class="help-block"></p>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block btn-lg">{:__('确认绑定')}</button>
</div>
</form>
</div>
<div class="register-main login-main hidden">
<form name="form" id="register-form" class="form-vertical" method="POST" action="{:url('user/register')}">
{:token()}
<input type="hidden" name="platform" value="{$platform|htmlentities}"/>
<input type="hidden" name="url" value="{$url|htmlentities}"/>
<div class="form-group">
<label class="control-label">{:__('Email')}</label>
<div class="controls">
<input type="text" id="email" name="email" data-rule="required;email" class="form-control input-lg" placeholder="{:__('Email')}">
<p class="help-block"></p>
</div>
</div>
<div class="form-group">
<label class="control-label">{:__('Username')}</label>
<div class="controls">
<input type="text" id="username" name="username" data-rule="required;username" class="form-control input-lg" placeholder="{:__('Username must be 3 to 30 characters')}">
<p class="help-block"></p>
</div>
</div>
<div class="form-group">
<label class="control-label">{:__('Password')}</label>
<div class="controls">
<input type="password" id="password" name="password" data-rule="required;password" class="form-control input-lg" placeholder="{:__('Password must be 6 to 30 characters')}">
<p class="help-block"></p>
</div>
</div>
<div class="form-group">
<label class="control-label">{:__('Mobile')}</label>
<div class="controls">
<input type="text" id="mobile" name="mobile" data-rule="required;mobile" class="form-control input-lg" placeholder="{:__('Mobile')}">
<p class="help-block"></p>
</div>
</div>
{if $captchaType}
<div class="form-group">
<label class="control-label">{:__('Captcha')}</label>
<div class="controls">
<div class="input-group">
{include file="common/captcha" event="register" type="$captchaType" /}
</div>
<p class="help-block"></p>
</div>
</div>
{/if}
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block btn-lg">{:__('创建账号并绑定')}</button>
</div>
</form>
</div>
</div>
</div>
<script>
require.callback = function () {
define('frontend/third', ['jquery', 'bootstrap', 'frontend', 'template', 'form'], function ($, undefined, Frontend, Template, Form) {
var Controller = {
prepare: function () {
var validatoroptions = {
invalid: function (form, errors) {
$.each(errors, function (i, j) {
Layer.msg(j);
});
}
};
$(".user-section .logon-tab > a").on("click", function () {
$(".bind-main,.register-main").addClass("hidden");
$("." + $(this).data("type") + "-main").removeClass("hidden");
$(".user-section .logon-tab > a").removeClass("active");
$(this).addClass("active");
});
//本地验证未通过时提示
$("#register-form").data("validator-options", validatoroptions);
//为表单绑定事件
Form.api.bindevent($("#bind-form"), function (data, ret) {
location.href = "{$bindurl}";
return false;
}, function (data, ret) {
});
//为表单绑定事件
Form.api.bindevent($("#register-form"), function (data, ret) {
location.href = "{$bindurl}";
return false;
}, function (data) {
$("input[name=captcha]").next(".input-group-btn").find("img").trigger("click");
});
}
};
return Controller;
});
}
</script>