Authored by 毕凯

个人中心登录处理

@@ -129,6 +129,7 @@ const index = (params) => { @@ -129,6 +129,7 @@ const index = (params) => {
129 signinUrl: helpers.urlFormat('/signin.html', { 129 signinUrl: helpers.urlFormat('/signin.html', {
130 refer: helpers.urlFormat('/home') 130 refer: helpers.urlFormat('/home')
131 }), 131 }),
  132 + referUrl: helpers.urlFormat('/home'),
132 verifyUrl: helpers.urlFormat('/activity/student/register') 133 verifyUrl: helpers.urlFormat('/activity/student/register')
133 }; 134 };
134 135
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 {{/unless}} 20 {{/unless}}
21 {{^}} 21 {{^}}
22 <div class="user-info"> 22 <div class="user-info">
23 - <a class="login-btn" href="{{signinUrl}}"> 23 + <a class="login-btn" href="{{signinUrl}}" data-refer="{{referUrl}}">
24 登录/注册 24 登录/注册
25 </a> 25 </a>
26 {{#if @root.studentSwitch}} 26 {{#if @root.studentSwitch}}
@@ -10,6 +10,8 @@ require('common'); @@ -10,6 +10,8 @@ require('common');
10 let $ = require('yoho-jquery'), 10 let $ = require('yoho-jquery'),
11 noticeScroll = require('plugin/notice-scroll'); 11 noticeScroll = require('plugin/notice-scroll');
12 12
  13 +let yohoApp = require('../yoho-app');
  14 +
13 let $userAvatar = $('.user-avatar'), 15 let $userAvatar = $('.user-avatar'),
14 $listItem = $('.list-item'); 16 $listItem = $('.list-item');
15 17
@@ -82,3 +84,10 @@ $('.res-c').on('click', 'a', function() { @@ -82,3 +84,10 @@ $('.res-c').on('click', 'a', function() {
82 }, true); 84 }, true);
83 } 85 }
84 }); 86 });
  87 +
  88 +$('.login-btn').on('click', function() {
  89 + let refer = $(this).data('refer') || '';
  90 +
  91 + yohoApp.goLogin(refer);
  92 + return false;
  93 +});
@@ -130,8 +130,13 @@ yoho = { @@ -130,8 +130,13 @@ yoho = {
130 goLogin: function(refer, data) { 130 goLogin: function(refer, data) {
131 let url; 131 let url;
132 132
  133 + if (refer.indexOf('//') === 0) {
  134 + refer = location.protocol + refer;
  135 + }
  136 +
133 url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer); 137 url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer);
134 refer = yoho.parseUrl(refer || location.href); 138 refer = yoho.parseUrl(refer || location.href);
  139 +
135 if (this.isApp) { 140 if (this.isApp) {
136 url = location.href; 141 url = location.href;
137 if (this.isAndroid) { 142 if (this.isAndroid) {