Showing
10 changed files
with
318 additions
and
2 deletions
@@ -3,7 +3,62 @@ | @@ -3,7 +3,62 @@ | ||
3 | {{# passport}} | 3 | {{# passport}} |
4 | {{> passport/cover}} | 4 | {{> passport/cover}} |
5 | <div class="content"> | 5 | <div class="content"> |
6 | - | 6 | + <form id="login-form" method="POST" action="/passport/index/login"> |
7 | + <ul class="login-ul"> | ||
8 | + <li class="relative clearfix"> | ||
9 | + <h2 class="title">会员登录</h2> | ||
10 | + <span id="country-code" class="country-code right"> | ||
11 | + <em>{{countryName}} +{{countryCode}}</em> | ||
12 | + <i class="iconfont"></i> | ||
13 | + <ul id="country-list" class="country-list"> | ||
14 | + {{#each countryList}} | ||
15 | + <li data-cc="{{code}}">{{name}} +{{code}}</li> | ||
16 | + {{/each}} | ||
17 | + </ul> | ||
18 | + </span> | ||
19 | + </li> | ||
20 | + <li class="relative"> | ||
21 | + <input id="account" class="account input va" name="account" type="text" placeholder="邮箱/手机号码" autocomplete="off"> | ||
22 | + <ul id="email-autocomplete" class="email-autocomplete hide"></ul> | ||
23 | + </li> | ||
24 | + <li class="relative"> | ||
25 | + <input id="password" class="password input va" name="password" type="text" placeholder="密码" autocomplete="off" maxlength="20"> | ||
26 | + <span id="caps-lock" class="caps-lock hide">大写状态开启</span> | ||
27 | + </li> | ||
28 | + <li> | ||
29 | + <span id="login-btn" class="login-btn btn">登录</span> | ||
30 | + </li> | ||
31 | + <li class="other-opts"> | ||
32 | + <span class="remeber-me"> | ||
33 | + <i class="iconfont"></i> | ||
34 | + 记住登录状态 | ||
35 | + </span> | ||
36 | + <span class="right"> | ||
37 | + <a class="forget-password" href="{{forgetPwd}}">忘记密码?</a> | ||
38 | + | | ||
39 | + <a class="fast-reg" href="{{fastReg}}">快速注册</a> | ||
40 | + </span> | ||
41 | + </li> | ||
42 | + <li class="third-party-login"> | ||
43 | + <a href="{{qqLogin}}"> | ||
44 | + <span class="icon qq"></span> | ||
45 | + </a> | ||
46 | + <a href="{{weiboLogin}}"> | ||
47 | + <span class="icon weibo"></span> | ||
48 | + </a> | ||
49 | + <a href="{{alipayLogin}}"> | ||
50 | + <span class="icon alipay"></span> | ||
51 | + </a> | ||
52 | + <a href="{{doubanLogin}}"> | ||
53 | + <span class="icon douban"></span> | ||
54 | + </a> | ||
55 | + <a href="{{renrenLogin}}"> | ||
56 | + <span class="icon renren"></span> | ||
57 | + </a> | ||
58 | + </li> | ||
59 | + </ul> | ||
60 | + <input id="country-code-hide" name="countryCode" type="hidden" value="{{countryCode}}"> | ||
61 | + </form> | ||
7 | </div> | 62 | </div> |
8 | {{/ passport}} | 63 | {{/ passport}} |
9 | </div> | 64 | </div> |
web-static/img/passport-s1e0ee48eb1.png
0 → 100644
3.76 KB
web-static/img/passport/alipay.png
0 → 100644
2.01 KB
web-static/img/passport/douban.png
0 → 100644
1.59 KB
web-static/img/passport/qq.png
0 → 100644
1.66 KB
web-static/img/passport/renren.png
0 → 100644
1.94 KB
web-static/img/passport/weibo.png
0 → 100644
2.08 KB
1 | +/** | ||
2 | + * 登录 | ||
3 | + * @author: xuqi<qi.xu@yoho.cn> | ||
4 | + * @date: 2015/12/11 | ||
5 | + */ | ||
6 | +var $ = require('yoho.jquery'); | ||
7 | + | ||
8 | +var mailPostfix = { | ||
9 | + num: ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'], | ||
10 | + other: ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'] | ||
11 | +}; | ||
12 | + | ||
13 | +var $account = $('#account'); | ||
14 | + | ||
15 | +var $countryCodeHide = $('#country-code-hide'), | ||
16 | + $countryCodeEm = $('#country-code > em'), | ||
17 | + $countryList = $('#country-list'); | ||
18 | + | ||
19 | +var $emailAutoComplete = $('#email-autocomplete'); | ||
20 | + | ||
21 | +//checkbox status unicode | ||
22 | +var checkbox = { | ||
23 | + checked: '', | ||
24 | + unchecked: '' | ||
25 | +}; | ||
26 | + | ||
27 | +var emailAcTime; | ||
28 | + | ||
29 | +//展开地区列表 | ||
30 | +$('#country-code').on('click', function() { | ||
31 | + if ($countryList.css('display') === 'none') { | ||
32 | + $countryList.slideDown(); | ||
33 | + } | ||
34 | +}); | ||
35 | + | ||
36 | +//选中地区列表项 | ||
37 | +$countryList.on('click', 'li', function() { | ||
38 | + var $this = $(this), | ||
39 | + cc = $this.data('cc'); | ||
40 | + | ||
41 | + $countryCodeEm.html($this.html()); | ||
42 | + | ||
43 | + $countryCodeHide.val(cc); | ||
44 | + | ||
45 | + $countryList.slideUp(); | ||
46 | +}); | ||
47 | + | ||
48 | +//点击其他区域,收起区域列表 | ||
49 | +$(document).on('click', function(e) { | ||
50 | + if ($(e.target).closest('#country-code').length > 0) { | ||
51 | + return; | ||
52 | + } | ||
53 | + | ||
54 | + if ($countryList.css('display') === 'block') { | ||
55 | + $countryList.slideUp(); | ||
56 | + } | ||
57 | +}); | ||
58 | + | ||
59 | +//邮箱自动完成 | ||
60 | +$account.on('keyup', function() { | ||
61 | + var account = $.trim($(this).val()), | ||
62 | + html = '', | ||
63 | + accountMatch, | ||
64 | + matchStr, | ||
65 | + postfix, | ||
66 | + i; | ||
67 | + | ||
68 | + //输入@时自动补全邮箱后缀 | ||
69 | + //此处>0非错误,用于避免输入的第一个字符为@被识别为邮箱 | ||
70 | + if (account.indexOf('@') > 0) { | ||
71 | + accountMatch = account.match(/^[0-9]+@(.*)/); | ||
72 | + if (accountMatch) { | ||
73 | + | ||
74 | + //数字邮箱补全 | ||
75 | + postfix = mailPostfix.num; | ||
76 | + } else { | ||
77 | + postfix = mailPostfix.other; | ||
78 | + } | ||
79 | + | ||
80 | + matchStr = accountMatch[1]; | ||
81 | + for (i = 0; i < postfix.length; i++) { | ||
82 | + if (postfix[i].indexOf(matchStr) > -1) { | ||
83 | + html += '<li>' + account.slice(0, account.indexOf('@')) + '@' + postfix[i] + '</li>'; | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
87 | + if (html !== '') { | ||
88 | + $emailAutoComplete.html(html).removeClass('hide'); | ||
89 | + } else { | ||
90 | + | ||
91 | + //隐藏autocomplete | ||
92 | + $emailAutoComplete.html('').addClass('hide'); | ||
93 | + } | ||
94 | + } | ||
95 | +}).on('blur', function() { | ||
96 | + emailAcTime = setTimeout(function() { | ||
97 | + $emailAutoComplete.addClass('hide'); | ||
98 | + }, 200); | ||
99 | +}); | ||
100 | + | ||
101 | +//邮箱自动完成列表项点击 | ||
102 | +$emailAutoComplete.on('click', 'li', function() { | ||
103 | + clearTimeout(emailAcTime); //清空默认关闭 | ||
104 | + | ||
105 | + $account.val($(this).text()); | ||
106 | + | ||
107 | + $emailAutoComplete.addClass('hide'); | ||
108 | +}); | ||
109 | + | ||
110 | +//记住登录状态 | ||
111 | +$('.remeber-me').on('click', function() { | ||
112 | + var $this = $(this); | ||
113 | + | ||
114 | + $this.toggleClass('checked'); | ||
115 | + | ||
116 | + if ($this.hasClass('checked')) { | ||
117 | + $this.children('i').html(checkbox.checked); | ||
118 | + } else { | ||
119 | + $this.children('i').html(checkbox.unchecked); | ||
120 | + } | ||
121 | +}); |
1 | +@import "passport/*.png"; | ||
2 | +$third: sprite-map("passport/*.png"); | ||
3 | + | ||
4 | +.login-page { | ||
5 | + .relative { | ||
6 | + position: relative; | ||
7 | + } | ||
8 | + | ||
9 | + .right { | ||
10 | + float: right; | ||
11 | + } | ||
12 | + | ||
13 | + .login-ul > li { | ||
14 | + margin-bottom: 25px; | ||
15 | + } | ||
16 | + | ||
17 | + .title { | ||
18 | + float: left; | ||
19 | + font-size: 20px; | ||
20 | + } | ||
21 | + | ||
22 | + .country-code { | ||
23 | + cursor: pointer; | ||
24 | + color: #b9b9b9; | ||
25 | + } | ||
26 | + | ||
27 | + .country-list { | ||
28 | + display: none; | ||
29 | + position: absolute; | ||
30 | + padding: 0 10px; | ||
31 | + background: #fff; | ||
32 | + border: 1px solid #000; | ||
33 | + top: 20px; | ||
34 | + right: 0; | ||
35 | + z-index: 1; | ||
36 | + | ||
37 | + @include border-radius(5px); | ||
38 | + | ||
39 | + li { | ||
40 | + height: 20px; | ||
41 | + line-height: 20px; | ||
42 | + color: #000; | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + .email-autocomplete { | ||
47 | + position: absolute; | ||
48 | + width: 248px; | ||
49 | + padding: 0 10px; | ||
50 | + z-index: 1; | ||
51 | + margin-top: 5px; | ||
52 | + border-radius: 5px; | ||
53 | + cursor: pointer; | ||
54 | + border: 1px solid #fefefe; | ||
55 | + background-color: #161616; | ||
56 | + color: #fff; | ||
57 | + | ||
58 | + li { | ||
59 | + height: 24px; | ||
60 | + line-height: 24px; | ||
61 | + } | ||
62 | + } | ||
63 | + | ||
64 | + .remeber-me { | ||
65 | + cursor: pointer; | ||
66 | + } | ||
67 | + | ||
68 | + .other-opts { | ||
69 | + color: #b9b9b9; | ||
70 | + font-size: 14px; | ||
71 | + | ||
72 | + .iconfont { | ||
73 | + font-size: 14px; | ||
74 | + } | ||
75 | + | ||
76 | + .fast-reg { | ||
77 | + color: #ff1901; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + .forget-password { | ||
82 | + color: #b9b9b9; | ||
83 | + } | ||
84 | + | ||
85 | + .third-party-login { | ||
86 | + display: table; | ||
87 | + | ||
88 | + a { | ||
89 | + display: table-cell; | ||
90 | + width: 54px; | ||
91 | + background-size: 100% 100%; | ||
92 | + } | ||
93 | + | ||
94 | + .icon { | ||
95 | + display: block; | ||
96 | + width: 30px; | ||
97 | + height: 30px; | ||
98 | + margin: 0 auto; | ||
99 | + } | ||
100 | + | ||
101 | + .qq { | ||
102 | + background: sprite($third, qq) no-repeat; | ||
103 | + } | ||
104 | + | ||
105 | + .weibo { | ||
106 | + background: sprite($third, weibo) no-repeat; | ||
107 | + } | ||
108 | + | ||
109 | + .alipay { | ||
110 | + background: sprite($third, alipay) no-repeat; | ||
111 | + } | ||
112 | + | ||
113 | + .douban { | ||
114 | + background: sprite($third, douban) no-repeat; | ||
115 | + } | ||
116 | + | ||
117 | + .renren { | ||
118 | + background: sprite($third, renren) no-repeat; | ||
119 | + } | ||
120 | + } | ||
121 | +} |
@@ -14,7 +14,26 @@ class LoginController extends AbstractAction | @@ -14,7 +14,26 @@ class LoginController extends AbstractAction | ||
14 | 'passport' => array( | 14 | 'passport' => array( |
15 | 'coverHref' => '/passport', | 15 | 'coverHref' => '/passport', |
16 | 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190', | 16 | 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190', |
17 | - 'countrys' => array() | 17 | + 'countryCode' => '86', |
18 | + 'countryName' => '中国', | ||
19 | + 'countryList' => array( | ||
20 | + array( | ||
21 | + 'code' => '61', | ||
22 | + 'name' => '澳大利亚' | ||
23 | + ), | ||
24 | + array( | ||
25 | + 'code' => '82', | ||
26 | + 'name' => '韩国' | ||
27 | + ), | ||
28 | + array( | ||
29 | + 'code' => '1', | ||
30 | + 'name' => '加拿大' | ||
31 | + ), | ||
32 | + array( | ||
33 | + 'code' => '86', | ||
34 | + 'name' => '中国' | ||
35 | + ) | ||
36 | + ) | ||
18 | ) | 37 | ) |
19 | ); | 38 | ); |
20 | $this->_view->display('index', $data); | 39 | $this->_view->display('index', $data); |
-
Please register or login to post a comment