Authored by 陈峰

Merge branch 'feature/pc_session_type' into 'master'

Feature/pc session type



See merge request !7
This diff could not be displayed because it is too large.
1 { 1 {
2 "name": "yoho-js-sdk", 2 "name": "yoho-js-sdk",
3 - "version": "1.3.3", 3 + "version": "1.3.4",
4 "description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。", 4 "description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。",
5 "keywords": [ 5 "keywords": [
6 "YOHO!", 6 "YOHO!",
@@ -4,7 +4,14 @@ import utils from './utils'; @@ -4,7 +4,14 @@ import utils from './utils';
4 4
5 let _noLoginUrl = function() { 5 let _noLoginUrl = function() {
6 let referrer = location.href.split('?')[0]; 6 let referrer = location.href.split('?')[0];
7 - return '//m.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href) + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + referrer.replace(/\//g, '\\/') + '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'; 7 + let domain = 'm.yohobuy.com';
  8 + let url = utils.urlParse(referrer);
  9 +
  10 + if (url.host !== 'm.yohobuy.com') {
  11 + domain = 'www.yohobuy.com';
  12 + }
  13 +
  14 + return `//${domain}/signin.html?refer=` + encodeURIComponent(location.href) + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + referrer.replace(/\//g, '\\/') + '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}';
8 }; 15 };
9 16
10 export default { 17 export default {
@@ -41,6 +41,12 @@ let _queryString = function() { @@ -41,6 +41,12 @@ let _queryString = function() {
41 return $.extend({}, window._jssdkQS); 41 return $.extend({}, window._jssdkQS);
42 }; 42 };
43 43
  44 +let _urlParse = function(url) {
  45 + var parser = document.createElement('a');
  46 + parser.href = url;
  47 + return parser;
  48 +};
  49 +
44 let _sParamByIframe = function() { 50 let _sParamByIframe = function() {
45 let paramsObj = _queryString(); 51 let paramsObj = _queryString();
46 let queryArray = []; 52 let queryArray = [];
@@ -96,6 +102,7 @@ let _bindEvent = function() { @@ -96,6 +102,7 @@ let _bindEvent = function() {
96 export default { 102 export default {
97 queryString: _queryString, 103 queryString: _queryString,
98 isMobile: isMobile, 104 isMobile: isMobile,
  105 + urlParse: _urlParse,
99 init() { 106 init() {
100 //发送活动页参数 107 //发送活动页参数
101 _sParamByIframe(); 108 _sParamByIframe();