|
@@ -23,7 +23,33 @@ const mycurrency = isMobile.any() ? '//m.yohobuy.com/home/mycurrency' : '//www.y |
|
@@ -23,7 +23,33 @@ const mycurrency = isMobile.any() ? '//m.yohobuy.com/home/mycurrency' : '//www.y |
23
|
const $tipTmpl = $('<div class="featuretip tip-wrap"><div class="tip"><div class="title"></div><div class="content"></div><a class="button" href="">返回</a></div></div>'); // eslint-disable-line
|
23
|
const $tipTmpl = $('<div class="featuretip tip-wrap"><div class="tip"><div class="title"></div><div class="content"></div><a class="button" href="">返回</a></div></div>'); // eslint-disable-line
|
24
|
const $cointipTmpl = $('<div class="feature-coin tip-wrap"><div class="tip"><div class="tip-close">×</div><div class="title"></div><div class="content"></div><div class="bottom-button"><a class="button" href="">去逛逛</a><a class="coin" href=\'' + mycurrency + '?openby:yohobuy={"action":"go.mine"}\'>查看有货币</a></div></div></div>'); // eslint-disable-line
|
24
|
const $cointipTmpl = $('<div class="feature-coin tip-wrap"><div class="tip"><div class="tip-close">×</div><div class="title"></div><div class="content"></div><div class="bottom-button"><a class="button" href="">去逛逛</a><a class="coin" href=\'' + mycurrency + '?openby:yohobuy={"action":"go.mine"}\'>查看有货币</a></div></div></div>'); // eslint-disable-line
|
25
|
|
25
|
|
26
|
-let _initEvent = function() {
|
26
|
+let _queryString = function() {
|
|
|
27
|
+ if (!window._jssdkQS) {
|
|
|
28
|
+ let vars = {},
|
|
|
29
|
+ hash,
|
|
|
30
|
+ i,
|
|
|
31
|
+ hashes = window.location.search.slice(1).split('&');
|
|
|
32
|
+
|
|
|
33
|
+ for (i = 0; i < hashes.length; i++) {
|
|
|
34
|
+ hash = hashes[i].split('=');
|
|
|
35
|
+ vars[hash[0]] = hash[1];
|
|
|
36
|
+ }
|
|
|
37
|
+
|
|
|
38
|
+ window._jssdkQS = vars;
|
|
|
39
|
+ }
|
|
|
40
|
+
|
|
|
41
|
+ return window._jssdkQS;
|
|
|
42
|
+};
|
|
|
43
|
+
|
|
|
44
|
+let _sParamByIframe = function() {
|
|
|
45
|
+ let search = window.location.search;
|
|
|
46
|
+ if (search.indexOf('&expires=') === -1) {
|
|
|
47
|
+ search = search + '&expires=' + (24 * 60 * 60 * 1000);
|
|
|
48
|
+ }
|
|
|
49
|
+ $('<iframe style="display:none;" src="//m.yohobuy.com/activity/wechat/1111' + search + '"></iframe>').prependTo('body');
|
|
|
50
|
+};
|
|
|
51
|
+
|
|
|
52
|
+let _bindEvent = function() {
|
27
|
let $body = $('body');
|
53
|
let $body = $('body');
|
28
|
$body.on('click', '.feature-coin .close,.feature-coin .tip-close', function(e) {
|
54
|
$body.on('click', '.feature-coin .close,.feature-coin .tip-close', function(e) {
|
29
|
$cointipTmpl.fadeOut();
|
55
|
$cointipTmpl.fadeOut();
|
|
@@ -47,41 +73,39 @@ let _initEvent = function() { |
|
@@ -47,41 +73,39 @@ let _initEvent = function() { |
47
|
});
|
73
|
});
|
48
|
};
|
74
|
};
|
49
|
|
75
|
|
|
|
76
|
+let _bindUnionType = function() {
|
|
|
77
|
+ let qs = _queryString();
|
|
|
78
|
+ let union_type = qs.mkt_code || qs.union_type;
|
|
|
79
|
+
|
|
|
80
|
+ if (union_type) {
|
|
|
81
|
+ $('a').each(function(indx, el) {
|
|
|
82
|
+ el = $(el);
|
|
|
83
|
+ let h = el.attr('href');
|
|
|
84
|
+ if (h.indexOf('union.yoho.cn/union/downapp.html') > -1) {
|
|
|
85
|
+ el.attr('href', h + '?union_type=' + union_type);
|
|
|
86
|
+ }
|
|
|
87
|
+ });
|
|
|
88
|
+ }
|
|
|
89
|
+};
|
|
|
90
|
+
|
50
|
export default {
|
91
|
export default {
|
|
|
92
|
+ queryString: _queryString,
|
51
|
init() {
|
93
|
init() {
|
52
|
//发送活动页参数
|
94
|
//发送活动页参数
|
53
|
- let search = window.location.search;
|
|
|
54
|
- if (search.indexOf('&expires=') === -1) {
|
|
|
55
|
- search = search + '&expires=' + (24 * 60 * 60 * 1000);
|
|
|
56
|
- }
|
|
|
57
|
- $('<iframe style="display:none;" src="//m.yohobuy.com/activity/wechat/1111' + search + '"></iframe>').prependTo('body');
|
95
|
+ _sParamByIframe();
|
58
|
|
96
|
|
59
|
// 绑定事件
|
97
|
// 绑定事件
|
60
|
- _initEvent();
|
98
|
+ _bindEvent();
|
|
|
99
|
+
|
|
|
100
|
+ // 下载链接绑定union_type
|
|
|
101
|
+ _bindUnionType();
|
61
|
},
|
102
|
},
|
62
|
isApp() {
|
103
|
isApp() {
|
63
|
- let qs = this.queryString();
|
104
|
+ let qs = _queryString();
|
64
|
let isApp = !!qs.app_version || (qs.openrefer === 'app' && qs.uid);
|
105
|
let isApp = !!qs.app_version || (qs.openrefer === 'app' && qs.uid);
|
65
|
|
106
|
|
66
|
return !!isApp;
|
107
|
return !!isApp;
|
67
|
},
|
108
|
},
|
68
|
- queryString() {
|
|
|
69
|
- if (!window._jssdkQS) {
|
|
|
70
|
- let vars = {},
|
|
|
71
|
- hash,
|
|
|
72
|
- i,
|
|
|
73
|
- hashes = window.location.search.slice(1).split('&');
|
|
|
74
|
-
|
|
|
75
|
- for (i = 0; i < hashes.length; i++) {
|
|
|
76
|
- hash = hashes[i].split('=');
|
|
|
77
|
- vars[hash[0]] = hash[1];
|
|
|
78
|
- }
|
|
|
79
|
-
|
|
|
80
|
- window._jssdkQS = vars;
|
|
|
81
|
- }
|
|
|
82
|
-
|
|
|
83
|
- return window._jssdkQS;
|
|
|
84
|
- },
|
|
|
85
|
image(url, width, height, mode, quality) {
|
109
|
image(url, width, height, mode, quality) {
|
86
|
mode = !isNaN(Number(mode)) ? mode : 2;
|
110
|
mode = !isNaN(Number(mode)) ? mode : 2;
|
87
|
url = url || '';
|
111
|
url = url || '';
|