prepare.html
6.5 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
<div id="content-container" class="container">
<div class="text-center">
<img src="{$userinfo.avatar}" class="img-circle" width="80" height="80" alt=""/>
<div style="margin-top:15px;">{$userinfo.nickname|htmlentities}</div>
</div>
<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>