Authored by unknown

Merge branch 'feature/passport' of http://git.dev.yoho.cn/web/yohobuy into feature/passport

@@ -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">&#xe600;</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">&#xe613;</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>
  1 +{{> layout/header}}
  2 +<div class="login-page passport-page yoho-page clearfix">
  3 + {{# passport}}
  4 + {{> passport/cover}}
  5 + <div class="content">
  6 + <div class="register-page">
  7 + <form id="register-form" class="register-form" method="POST" action="{{actionUrl}}" autocomplete="off">
  8 + <ul>
  9 + <li class="clearfix">
  10 + <select id="region" class="region" name="region">
  11 + {{#each region}}
  12 + <option {{#if selected}}selected="selected"{{/if}} value="{{id}}">{{name}}</option>
  13 + {{/each}}
  14 + </select>
  15 + </li>
  16 + <li class="clearfix">
  17 + <span id="country-code" class="country-code">{{location}}</span>
  18 + <input value="" id="phone-num" class="input va phone-num" type="text" name="phoneNum" placeholder="请输入手机号码" autocomplete="off">
  19 + </li>
  20 + <li class="w330 clearfix">
  21 + <input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="图形验证码" autocomplete="off" maxlength="4">
  22 + <img id="captcha-img" class="captcha-img" src="{{captchaUrl}}" alt="">
  23 + <a class="link change-captcha">换一张</a>
  24 + </li>
  25 + <li class="clearfix">
  26 + <input id="msg-captcha" class="input va msg-captcha" type="text" name="msgCaptcha" placeholder="短信验证码" autocomplete="off" maxlength="4">
  27 + <input id="send-captcha" class="btn send-captcha disable" type="button" value="获取短信验证码" disabled="">
  28 + <span id="msg-tip" class="hide msg-tip">短信验证码已发送至您的手机,请查收</span>
  29 + </li>
  30 + <li class="clearfix">
  31 + <input id="pwd" class="input va pwd" name="pwd" placeholder="设置密码" autocomplete="off" maxlength="20" type="password">
  32 + <div class="pwd-intensity-container">
  33 + <span class="pwd-intensity low">低</span>
  34 + <span class="pwd-intensity mid">中</span>
  35 + <span class="pwd-intensity high">高</span>
  36 + </div>
  37 + <div id="pwd-tips" class="hide pwd-tips">
  38 + <div class="default" id="pwd-tip1">密码只支持6-20位字符</div>
  39 + <div class="default" id="pwd-tip2">建议由字母、 数字、 符号两种以上组合</div>
  40 + </div>
  41 + </li>
  42 +
  43 + <li class="items-container clearfix">
  44 + <input id="agree-terms" class="agree-terms" type="checkbox" checked="">
  45 + <span>
  46 + 我已阅读并同意遵守
  47 + <a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
  48 + </span>
  49 + </li>
  50 + <li class="clearfix">
  51 + <input name="refer" id="refer" type="hidden" value="{{referUrl}}">
  52 + <input id="register-btn" class="btn register-btn disable" type="submit" value="立即注册" disabled="">
  53 + </li>
  54 + <li class="quick-login-container">
  55 + 我已注册YOHO!有货账号
  56 + <a class="link go-login" href="{{loginUrl}}">快速登录</a>
  57 + </li>
  58 + </ul>
  59 + <div id="err-tip" class="err-tip hide">
  60 + <span></span>
  61 + <b></b>
  62 + </div>
  63 + </form>
  64 + </div>
  65 + </div>
  66 + {{/ passport}}
  67 +</div>
  68 +{{> layout/footer}}
  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: '&#xe612;',
  24 + unchecked: '&#xe613;'
  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 "login"; 1 +@import "login", "register";
2 2
3 .passport-page { 3 .passport-page {
4 width: 1150px; 4 width: 1150px;
  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 +}
  1 +/*
  2 + * @description 注册页样式
  3 + * @author chenglong.wang@yoho.cn
  4 + * @time 2015/12/11
  5 + */
  6 +
  7 +.content {
  8 +
  9 + .register-page {
  10 + font-size: 14px;
  11 + color: #b9b9b9;
  12 + }
  13 +
  14 + .register-form {
  15 + height: auto;
  16 +
  17 + li {
  18 + margin-bottom: 25px;
  19 + width: 270px;
  20 + position: relative;
  21 +
  22 + &.w330 {
  23 + width: 330px;
  24 + }
  25 +
  26 + input, select {
  27 + outline: none;
  28 + }
  29 +
  30 + input {
  31 + height: 43px;
  32 + line-height: 43px;
  33 + font-size: 16px;
  34 + width: 268px;
  35 + border: 1px solid #dbdbdb;
  36 + text-indent: 10px;
  37 + font-family: '黑体' Regular;
  38 + color: #9a9a9a;
  39 + padding: 0;
  40 +
  41 + &.phone-num {
  42 + width: 209px;
  43 + display: block;
  44 + float: left;
  45 + }
  46 +
  47 + &.captcha, &.msg-captcha{
  48 + width: 160px;
  49 + float: left;
  50 + }
  51 +
  52 + &.send-captcha {
  53 + top: 0;
  54 + background: #555;
  55 + position: absolute;
  56 + width: 100px;
  57 + right: 0;
  58 + font-size: 12px;
  59 + text-indent: 0;
  60 + letter-spacing: 0;
  61 + }
  62 +
  63 + &.agree-terms {
  64 + width: initial;
  65 + height: initial;
  66 + vertical-align: middle;
  67 + }
  68 + }
  69 +
  70 + .link {
  71 + text-decoration: underline;
  72 + color: #ff1901;
  73 + }
  74 +
  75 + .btn {
  76 + height: 45px;
  77 + line-height: 45px;
  78 + color: #fff;
  79 + border: none;
  80 + padding: 0;
  81 + font-family: '黑体' Regular;
  82 + text-align: center;
  83 + }
  84 +
  85 + //区域下拉选择框
  86 + select.region {
  87 + height: 30px;
  88 + padding: 4px 0;
  89 + width: 132px;
  90 + border-color: #c1c1c1;
  91 + color: #9a9a9a;
  92 + font-size: 16px;
  93 + font-family: '黑体' Regular;
  94 + }
  95 +
  96 + //手机号
  97 + .country-code {
  98 + width: 58px;
  99 + height: 43px;
  100 + line-height: 43px;
  101 + text-align: center;
  102 + white-space: nowrap;
  103 + border: 1px solid #dbdbdb;
  104 + border-right: 0;
  105 + font-size: 16px;
  106 + display: block;
  107 + float: left;
  108 + }
  109 +
  110 + //验证码
  111 + .captcha-img {
  112 + height: 37px;
  113 + width: 90px;
  114 + border: 0;
  115 + vertical-align: middle;
  116 + outline: none;
  117 + margin-left: 10px;
  118 + margin-top: 4px;
  119 + float: left;
  120 + }
  121 + .change-captcha {
  122 + margin-left: 10px;
  123 + cursor: pointer;
  124 + float: left;
  125 + height: 43px;
  126 + line-height: 43px;
  127 + }
  128 +
  129 + //密码强度
  130 + .pwd-intensity-container {
  131 + width: 270px;
  132 + text-align: right;
  133 + margin-top: 5px;
  134 +
  135 + .pwd-intensity {
  136 + height: 15px;
  137 + font-size: 12px;
  138 + background-color: #e8e8e8;
  139 + padding: 1px 10px;
  140 + text-align: center;
  141 + }
  142 + }
  143 +
  144 + //服务条款
  145 + &.items-container {
  146 + font-size: 13px;
  147 + text-align: right;
  148 + white-space: nowrap;
  149 + }
  150 +
  151 + //立即注册
  152 + .register-btn {
  153 + width: 270px;
  154 + font-size: 20px;
  155 + font-weight: bold;
  156 +
  157 + &.disable {
  158 + background: #555;
  159 + }
  160 + }
  161 +
  162 + //立即登录
  163 + &.quick-login-container {
  164 + width: 270px;
  165 + font-size: 13px;
  166 + text-align: right;
  167 + white-space: nowrap;
  168 + }
  169 + }
  170 + }
  171 +}
@@ -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);
  1 +<?php
  2 +
  3 +use Action\AbstractAction;
  4 +
  5 +class RegisterController extends AbstractAction
  6 +{
  7 + /**
  8 + * 登录页
  9 + */
  10 + public function indexAction()
  11 + {
  12 + $data = array(
  13 + 'registerPage' => true,
  14 + 'passport' => array(
  15 + 'actionUrl' => '/passport/register/mobileregister',
  16 + 'region' => array(
  17 + array(
  18 + 'id' => 12,
  19 + 'name' => '中国',
  20 + 'selected' => true
  21 + ),
  22 + array(
  23 + 'id' => 13,
  24 + 'name' => '中国澳门',
  25 + 'selected' => false
  26 + ),
  27 + array(
  28 + 'id' => 14,
  29 + 'name' => '中国台湾',
  30 + 'selected' => false
  31 + ),
  32 + array(
  33 + 'id' => 15,
  34 + 'name' => '中国香港',
  35 + 'selected' => false
  36 + ),
  37 + array(
  38 + 'id' => 16,
  39 + 'name' => '马来西亚',
  40 + 'selected' => false
  41 + ),
  42 + ),
  43 + 'location' => '+86',
  44 + 'captchaUrl' => 'http://www.yohobuy.com/passport/images?t=1449799445',
  45 + 'itemUrl' => '##',
  46 + 'refUrl' => 'http://www.yohobuy.com/',
  47 + 'loginUrl' => '/signin.html?refer=http://www.yohobuy.com/',
  48 + 'coverHref' => '/passport',
  49 + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190'
  50 + )
  51 + );
  52 + $this->_view->display('index', $data);
  53 + }
  54 +}