Authored by 毕凯

优化微信登录

@@ -190,6 +190,10 @@ if ($('.freebie').length > 0) { @@ -190,6 +190,10 @@ if ($('.freebie').length > 0) {
190 }); 190 });
191 } 191 }
192 192
  193 +if (/MicroMessenger/i.test(navigator.userAgent)) {
  194 + $('.btn-login').attr('href', '/passport/login/wechat?refer=' + location.href);
  195 +}
  196 +
193 $('.btn-balance').on('touchend', function() { 197 $('.btn-balance').on('touchend', function() {
194 var info = window.cookie('order-info'); 198 var info = window.cookie('order-info');
195 199
@@ -146,13 +146,22 @@ function reMarginFooter(fixedElement) { @@ -146,13 +146,22 @@ function reMarginFooter(fixedElement) {
146 146
147 var backToTopHammer; 147 var backToTopHammer;
148 148
  149 + var loginUrl;
  150 +
149 rePosFooter(); //计算底部位置 151 rePosFooter(); //计算底部位置
150 152
151 if (user === 0) { 153 if (user === 0) {
152 154
  155 + if (/MicroMessenger/i.test(navigator.userAgent)) {
  156 + loginUrl = '//m.yohobuy.com/passport/login/wechat?refer=' + location.href;
  157 + $('.login-btn').attr('href', loginUrl);
  158 + } else {
  159 + loginUrl = '//m.yohobuy.com/signin.html?refer=' + location.href;
  160 + }
  161 +
153 //未登录 162 //未登录
154 $op.prepend( 163 $op.prepend(
155 - '<a href="//m.yohobuy.com/signin.html?refer=' + location.href + '">登录</a>' + 164 + '<a href="' + loginUrl + '">登录</a>' +
156 '<span class="sep-line">|</span>' + 165 '<span class="sep-line">|</span>' +
157 '<a href="//m.yohobuy.com/reg.html">注册</a>' 166 '<a href="//m.yohobuy.com/reg.html">注册</a>'
158 ); 167 );
@@ -308,6 +317,3 @@ window.getShoppingKey = getShoppingKey; @@ -308,6 +317,3 @@ window.getShoppingKey = getShoppingKey;
308 window.rePosFooter = rePosFooter; 317 window.rePosFooter = rePosFooter;
309 318
310 window.reMarginFooter = reMarginFooter; 319 window.reMarginFooter = reMarginFooter;
311 -  
312 -  
313 -  
@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 <div class="content"> 7 <div class="content">
8 {{#if bindPwd}} 8 {{#if bindPwd}}
9 <div class="bind-tip"> 9 <div class="bind-tip">
10 - <p class="title">绑定成功!</p>  
11 - 您以后还可以使 机号+密码的形式登录有货哦! 10 + <p class="title">绑定成功!</p>
  11 + 您以后还可以使手机号+密码的形式登录有货哦!
12 </div> 12 </div>
13 {{/if}} 13 {{/if}}
14 <div class="input-container row has-eye"> 14 <div class="input-container row has-eye">
@@ -31,9 +31,16 @@ class IndexController extends AbstractAction @@ -31,9 +31,16 @@ class IndexController extends AbstractAction
31 { 31 {
32 $uid = $this->getUid($useSession); 32 $uid = $this->getUid($useSession);
33 if (!$uid) { 33 if (!$uid) {
  34 + $isWeixin = stripos($this->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false;
  35 +
  36 + if ($isWeixin) {
  37 + $this->go(Helpers::url('/passport/login/wechat', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
  38 + }
  39 + else {
34 $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN)))); 40 $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
35 } 41 }
36 } 42 }
  43 + }
37 44
38 /* 45 /*
39 * 购物车首页 46 * 购物车首页