|
@@ -5,14 +5,506 @@ |
|
@@ -5,14 +5,506 @@ |
5
|
*/
|
5
|
*/
|
6
|
|
6
|
|
7
|
var $ = require('jquery');
|
7
|
var $ = require('jquery');
|
|
|
8
|
+
|
|
|
9
|
+
|
|
|
10
|
+var noticeSuccess = false;
|
|
|
11
|
+
|
|
|
12
|
+function JsonPCallBack(data) {
|
|
|
13
|
+ var topbanner;
|
|
|
14
|
+
|
|
|
15
|
+ if (+data.code === 200) {
|
|
|
16
|
+ if (typeof data.data === 'object') {
|
|
|
17
|
+ topbanner = '<a target="_blank" href="' + data.data.url + '" class="page-top-banner"' +
|
|
|
18
|
+ 'style="height:50px;border:none;background-image:url(' + window.unescape(data.data.src) + ');' +
|
|
|
19
|
+ 'background-position: center;display:block;background-color:#ff5409;"> </a>';
|
|
|
20
|
+ $('body').prepend(topbanner);
|
|
|
21
|
+ }
|
|
|
22
|
+ }
|
|
|
23
|
+}
|
|
|
24
|
+
|
|
|
25
|
+function NoticeCallBack(data) {
|
|
|
26
|
+ if (+data.code === 200) {
|
|
|
27
|
+ noticeSuccess = true;
|
|
|
28
|
+ }
|
|
|
29
|
+}
|
|
|
30
|
+window.JsonPCallBack = JsonPCallBack;
|
|
|
31
|
+
|
|
|
32
|
+window.NoticeCallBack = NoticeCallBack;
|
|
|
33
|
+/**
|
|
|
34
|
+ * 检测是否获得公告
|
|
|
35
|
+ * @return {[type]} [description]
|
|
|
36
|
+ */
|
|
|
37
|
+function checkNotice() {
|
|
|
38
|
+ var noticeinner;
|
|
|
39
|
+
|
|
|
40
|
+ if (!noticeSuccess) {
|
|
|
41
|
+ noticeinner = '<div class="noticewrapper">' +
|
|
|
42
|
+ '<div class="noticecontainer">' +
|
|
|
43
|
+ '<h1 class="noticetitle">关于系统升级的公告</h1>' +
|
|
|
44
|
+ '<div class="noticecontent">' +
|
|
|
45
|
+ '<p class="tips">尊敬的顾客:</p>' +
|
|
|
46
|
+ '<p class="detail">您好!为了向您提供更优质的服务,目前系统正在升级,请耐心等待。</p>' +
|
|
|
47
|
+ '<p class="detail">' +
|
|
|
48
|
+ '系统升级期间,部分地区用户体验会有暂时中断,如遇紧急事宜,欢迎垂询客服热线:400-889-9646 09:00-22:30(周一至周日)。稍后系统将恢复正常' +
|
|
|
49
|
+ '</p>' +
|
|
|
50
|
+ '<p class="detail">使用,欢迎您继续光顾YOHO!BUY有货!带来不便之处深表歉意,请您谅解!</p>' +
|
|
|
51
|
+ '</div>' +
|
|
|
52
|
+ '</div>' +
|
|
|
53
|
+ '</div>';
|
|
|
54
|
+ $('.header-topwrapper').append(noticeinner);
|
|
|
55
|
+ }
|
|
|
56
|
+}
|
|
|
57
|
+/**
|
|
|
58
|
+ * 获得banner数据
|
|
|
59
|
+ * @param {[string]} code [banner对应的编码]
|
|
|
60
|
+ * @return {[type]} [description]
|
|
|
61
|
+ */
|
|
|
62
|
+function getBannerData(code) {
|
|
|
63
|
+ var script = document.createElement('script');
|
|
|
64
|
+
|
|
|
65
|
+ script.src = 'http://new.yohobuy.com/resource/getbanner?content_code=' +
|
|
|
66
|
+ code + '&client_type=web&callback=JsonPCallBack';
|
|
|
67
|
+ document.getElementsByTagName('head')[0].appendChild(script);
|
|
|
68
|
+}
|
|
|
69
|
+/**
|
|
|
70
|
+ * 获取公告的jsonp请求
|
|
|
71
|
+ * @param {[type]} code [description]
|
|
|
72
|
+ * @return {[type]} [description]
|
|
|
73
|
+ */
|
|
|
74
|
+function getNoticeData(code) {
|
|
|
75
|
+ var script = document.createElement('script');
|
|
|
76
|
+
|
|
|
77
|
+ script.src = 'http://new.yohobuy.com/resource/getbanner?content_code=' +
|
|
|
78
|
+ code + '&client_type=web&callback=NoticeCallBack';
|
|
|
79
|
+ document.getElementsByTagName('head')[0].appendChild(script);
|
|
|
80
|
+ window.setTimeout(checkNotice, 5000); //5s后检测是否成功
|
|
|
81
|
+}
|
|
|
82
|
+/**
|
|
|
83
|
+ * 显示和隐藏
|
|
|
84
|
+ * @param {[type]} sourceClass [description]
|
|
|
85
|
+ * @param {[type]} targetClass [description]
|
|
|
86
|
+ * @return {[type]} [description]
|
|
|
87
|
+ */
|
|
|
88
|
+function toggleDisplay(sourceClass, targetClass) {
|
|
|
89
|
+ var $that,
|
|
|
90
|
+ targetobj;
|
|
|
91
|
+
|
|
|
92
|
+ $(sourceClass).hover(function(e) {
|
|
|
93
|
+ e.preventDefault();
|
|
|
94
|
+ $that = $(this);
|
|
|
95
|
+ targetobj = $(targetClass)[0];
|
|
|
96
|
+ if (targetobj.style.display === '') {
|
|
|
97
|
+ $that.addClass('acttags');
|
|
|
98
|
+ targetobj.style.display = 'block';
|
|
|
99
|
+ } else {
|
|
|
100
|
+ $that.removeClass('acttags');
|
|
|
101
|
+ targetobj.style.display = '';
|
|
|
102
|
+ }
|
|
|
103
|
+ });
|
|
|
104
|
+}
|
|
|
105
|
+
|
|
|
106
|
+/**
|
|
|
107
|
+ * 执行顶部显示和隐藏
|
|
|
108
|
+ * @return {[type]} [description]
|
|
|
109
|
+ */
|
|
|
110
|
+function actionTopTagToggle() {
|
|
|
111
|
+ var tags = [{
|
|
|
112
|
+ sourceClass: '.myyoho',
|
|
|
113
|
+ targetClass: '.myyoho-info'
|
|
|
114
|
+ }, {
|
|
|
115
|
+ sourceClass: '.phone',
|
|
|
116
|
+ targetClass: '.qr'
|
|
|
117
|
+ }],
|
|
|
118
|
+ obj,
|
|
|
119
|
+ i;
|
|
|
120
|
+
|
|
|
121
|
+ for (i = 0; i < tags.length; i++) {
|
|
|
122
|
+ obj = tags[i];
|
|
|
123
|
+ toggleDisplay(obj.sourceClass, obj.targetClass);
|
|
|
124
|
+ }
|
|
|
125
|
+}
|
|
|
126
|
+/**
|
|
|
127
|
+ * 执行顶部群组鼠标交互
|
|
|
128
|
+ * @return {[type]} [description]
|
|
|
129
|
+ */
|
|
|
130
|
+function actionYoHoGroup() {
|
|
|
131
|
+ var $this;
|
|
|
132
|
+
|
|
|
133
|
+ $('.yohogroup').mouseenter(function() {
|
|
|
134
|
+ $this = $(this);
|
|
|
135
|
+ $this.text($this.attr('cn'));
|
|
|
136
|
+ });
|
|
|
137
|
+ $('.yohogroup').mouseleave(function() {
|
|
|
138
|
+ $this = $(this);
|
|
|
139
|
+ $this.text($this.attr('en'));
|
|
|
140
|
+ });
|
|
|
141
|
+}
|
|
|
142
|
+
|
|
|
143
|
+/**
|
|
|
144
|
+ * 检测是否支持css3的动画
|
|
|
145
|
+ * @return {Boolean} [description]
|
|
|
146
|
+ */
|
|
|
147
|
+function isSupportCss3Animation() {
|
|
|
148
|
+ var thisFunc,
|
|
|
149
|
+ prefixList = ['webkit', 'moz', 'ms'],
|
|
|
150
|
+ i;
|
|
|
151
|
+
|
|
|
152
|
+ for (i = 0; i < prefixList.length; i++) {
|
|
|
153
|
+ thisFunc = prefixList[i] + 'RequestAnimationFrame';
|
|
|
154
|
+ if (window[thisFunc]) {
|
|
|
155
|
+ return true;
|
|
|
156
|
+ } else {
|
|
|
157
|
+ return false;
|
|
|
158
|
+ }
|
|
|
159
|
+ }
|
|
|
160
|
+
|
|
|
161
|
+}
|
|
|
162
|
+/**
|
|
|
163
|
+ * css3动画
|
|
|
164
|
+ * @param {Array} ) { var thisFunc, prefixList [description]
|
|
|
165
|
+ * @return {[type]} [description]
|
|
|
166
|
+ */
|
|
|
167
|
+function requestFrameCloser() {
|
|
|
168
|
+ var prefixList = ['webkit', 'moz', 'ms'];
|
|
|
169
|
+ var func1 = prefixList[0] + 'RequestAnimationFrame';
|
|
|
170
|
+ var func2 = prefixList[1] + 'RequestAnimationFrame';
|
|
|
171
|
+ var func3 = prefixList[2] + 'RequestAnimationFrame';
|
|
|
172
|
+
|
|
|
173
|
+ if (window[func1]) {
|
|
|
174
|
+ return function(callback) {
|
|
|
175
|
+ window[func1](callback);
|
|
|
176
|
+ };
|
|
|
177
|
+ }
|
|
|
178
|
+ if (window[func2]) {
|
|
|
179
|
+ return function(callback) {
|
|
|
180
|
+ window[func2](callback);
|
|
|
181
|
+ };
|
|
|
182
|
+ }
|
|
|
183
|
+ if (window[func3]) {
|
|
|
184
|
+ return function(callback) {
|
|
|
185
|
+ window[func3](callback);
|
|
|
186
|
+ };
|
|
|
187
|
+ }
|
|
|
188
|
+ return function(callback) {
|
|
|
189
|
+ window.setTimeout(callback, 67);
|
|
|
190
|
+ };
|
|
|
191
|
+}
|
|
|
192
|
+
|
|
|
193
|
+
|
|
|
194
|
+window.requestFrame = requestFrameCloser();
|
|
|
195
|
+window.start = 0;
|
|
|
196
|
+window.$logotrans = $('.icon-logo');
|
|
|
197
|
+window.isen = true;
|
|
|
198
|
+
|
|
|
199
|
+/**
|
|
|
200
|
+ * css3动画
|
|
|
201
|
+ * @return {[type]} [description]
|
|
|
202
|
+ */
|
|
|
203
|
+
|
|
|
204
|
+function tsAnimate() {
|
|
|
205
|
+ window.start += 10;
|
|
|
206
|
+ window.$logotrans.css({
|
|
|
207
|
+ transform: 'rotateX(' + window.start + 'deg)',
|
|
|
208
|
+ '-webkit-transform': 'rotateX(' + window.start + 'deg)',
|
|
|
209
|
+ '-moz-transform': 'rotateX(' + window.start + 'deg)'
|
|
|
210
|
+ });
|
|
|
211
|
+ if (window.start / 90 % 2 === 1) {
|
|
|
212
|
+ if (window.isen) {
|
|
|
213
|
+ window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo1.png)');
|
|
|
214
|
+ window.isen = false;
|
|
|
215
|
+ } else {
|
|
|
216
|
+ window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
|
|
217
|
+ window.isen = true;
|
|
|
218
|
+ }
|
|
|
219
|
+ }
|
|
|
220
|
+ if (window.start / 90 % 2 === 0 && window.start % 360 !== 0) {
|
|
|
221
|
+ window.setTimeout(tsAnimate, 3000);
|
|
|
222
|
+ } else {
|
|
|
223
|
+ if (window.start % 360 === 0) {
|
|
|
224
|
+ window.setTimeout(tsAnimate, 1 * 60 * 1000);
|
|
|
225
|
+ } else {
|
|
|
226
|
+ window.requestFrame(function() {
|
|
|
227
|
+ tsAnimate();
|
|
|
228
|
+ });
|
|
|
229
|
+ }
|
|
|
230
|
+ }
|
|
|
231
|
+}
|
|
|
232
|
+
|
|
|
233
|
+window.loopdurationtime = 500;
|
|
|
234
|
+window.globaltimeout;
|
|
|
235
|
+window.onetimeoout;
|
|
|
236
|
+/**
|
|
|
237
|
+ * 淡出
|
|
|
238
|
+ * @return {[type]} [description]
|
|
|
239
|
+ */
|
|
|
240
|
+function fadeAnimate() {
|
|
|
241
|
+ if (window.globaltimeout) {
|
|
|
242
|
+ window.clearTimeout(window.globaltimeout);
|
|
|
243
|
+ }
|
|
|
244
|
+ window.logotrans.fadeOut(window.loopdurationtime, function() {
|
|
|
245
|
+ window.isen = false;
|
|
|
246
|
+ window.logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo.png)');
|
|
|
247
|
+ window.logotrans.fadeIn(window.loopdurationtime, function() {
|
|
|
248
|
+ window.onetimeoout = window.setTimeout(function() {
|
|
|
249
|
+ window.logotrans.fadeOut(window.loopdurationtime, function() {
|
|
|
250
|
+ window.clearTimeout(window.onetimeoout);
|
|
|
251
|
+ window.isen = true;
|
|
|
252
|
+ window.logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
|
|
253
|
+ window.logotrans.fadeIn(window.loopdurationtime, function() {
|
|
|
254
|
+ window.globaltimeout = window.setTimeout(fadeAnimate, 1 * 60 * 1000);
|
|
|
255
|
+ });
|
|
|
256
|
+ });
|
|
|
257
|
+ }, 3000);
|
|
|
258
|
+ });
|
|
|
259
|
+ });
|
|
|
260
|
+}
|
|
|
261
|
+/**
|
|
|
262
|
+ * 执行头部logo动画
|
|
|
263
|
+ * @return {[type]} [description]
|
|
|
264
|
+ */
|
|
|
265
|
+function actionTopLogoAnimate() {
|
|
|
266
|
+ if (isSupportCss3Animation()) {
|
|
|
267
|
+ window.setTimeout(tsAnimate, 3000);
|
|
|
268
|
+ } else {
|
|
|
269
|
+ window.setTimeout(fadeAnimate, 3000);
|
|
|
270
|
+ }
|
|
|
271
|
+}
|
8
|
/**
|
272
|
/**
|
9
|
- * 回到顶部
|
|
|
10
|
- * @type {[type]}
|
273
|
+ * 查询跳转后保留关键字
|
|
|
274
|
+ * @return {[type]} [description]
|
11
|
*/
|
275
|
*/
|
12
|
-var $returnTop = $('.return-top');
|
276
|
+function actionAddKeyWords() {
|
|
|
277
|
+ var $keywords = $('#nav_keyword').text();
|
|
|
278
|
+ var defaultsearch = 'vans';
|
|
|
279
|
+ var $querykey = $('#query_key');
|
13
|
|
280
|
|
14
|
-$returnTop.click(function() {
|
|
|
15
|
- $('html,body').animate({
|
|
|
16
|
- scrollTop: 0
|
|
|
17
|
- }, 500);
|
|
|
18
|
-}); |
|
|
|
|
281
|
+ if ($keywords !== '') {
|
|
|
282
|
+ $querykey.css({
|
|
|
283
|
+ color: '#000'
|
|
|
284
|
+ });
|
|
|
285
|
+ $querykey.val($keywords);
|
|
|
286
|
+ } else {
|
|
|
287
|
+ $querykey.css({
|
|
|
288
|
+ color: '#e0e0e0'
|
|
|
289
|
+ });
|
|
|
290
|
+ $querykey.val(defaultsearch);
|
|
|
291
|
+ $querykey.on('focus', function(e) {
|
|
|
292
|
+ $querykey.css({
|
|
|
293
|
+ color: '#000'
|
|
|
294
|
+ });
|
|
|
295
|
+ $querykey.val('');
|
|
|
296
|
+ });
|
|
|
297
|
+ }
|
|
|
298
|
+}
|
|
|
299
|
+window.dataLayer = [];
|
|
|
300
|
+
|
|
|
301
|
+function getSource(column, postition, event) {
|
|
|
302
|
+ try {
|
|
|
303
|
+ window.dataLayer.push({
|
|
|
304
|
+ louceng: column,
|
|
|
305
|
+ weizhi: postition,
|
|
|
306
|
+ event: event
|
|
|
307
|
+ });
|
|
|
308
|
+ } catch (e) {}
|
|
|
309
|
+}
|
|
|
310
|
+/**
|
|
|
311
|
+ * 搜寻的时候过滤非法字符(+-/:等非法字符单独出现)
|
|
|
312
|
+ * @type {RegExp}
|
|
|
313
|
+ */
|
|
|
314
|
+window.reg = /^[\^\!\+\-\(\)\:\[\]\\\{\}\~\*\?\|\&\;\/\s]{0,}$/g;
|
|
|
315
|
+window.keyword = '';
|
|
|
316
|
+window.link = '';
|
|
|
317
|
+
|
|
|
318
|
+window.submitSearch = function() {
|
|
|
319
|
+ var $keywordinput = $('#query_key').val();
|
|
|
320
|
+ var column = 'Search';
|
|
|
321
|
+ var postition = 'Head Search';
|
|
|
322
|
+ var event = 'Search';
|
|
|
323
|
+ var $formatkeyword,
|
|
|
324
|
+ $formatkeywordinput;
|
|
|
325
|
+
|
|
|
326
|
+ $formatkeyword = $.trim(window.keyword.toLowerCase());
|
|
|
327
|
+ $formatkeywordinput = $.trim($keywordinput.toLowerCase());
|
|
|
328
|
+ getSource(column, postition, event);
|
|
|
329
|
+ if (window.link !== '' && window.keyword !== '' && $formatkeyword === $formatkeywordinput) {
|
|
|
330
|
+ location.href = window.link.replace('\'', '');
|
|
|
331
|
+ } else {
|
|
|
332
|
+ if (window.reg.test($keywordinput)) {
|
|
|
333
|
+ location.href = 'http://search.yohobuy.com/error?query=' + $keywordinput + '&result=error';
|
|
|
334
|
+ } else {
|
|
|
335
|
+ $('#searchForm').submit();
|
|
|
336
|
+ return false;
|
|
|
337
|
+ }
|
|
|
338
|
+ }
|
|
|
339
|
+};
|
|
|
340
|
+/**
|
|
|
341
|
+ * banner和地址的映射
|
|
|
342
|
+ * @type {Object}
|
|
|
343
|
+ */
|
|
|
344
|
+window.bannerMap = {
|
|
|
345
|
+ listboys: '4f78b0f418fc42314d8b6e791cfb7fa8',
|
|
|
346
|
+ listgirls: '00c1f025a51b6b597dc37925951ea27d',
|
|
|
347
|
+ listkids: 'b02df11184727701ade1b6de9737d08c',
|
|
|
348
|
+ listlifestyle: 'fd35c52dced0c880976ba858346d1fc5',
|
|
|
349
|
+ searchboys: '9fb8986ea700cc27a8057361c3924394',
|
|
|
350
|
+ searchgirls: 'e3e207a1443ca60c8037fe52a5560c18',
|
|
|
351
|
+ searchkids: '620fc77f479da8feaeb06f2324e5d0bb',
|
|
|
352
|
+ searchlifestyle: 'a3c93301c6ffaf3ed0f36a4a451be36d',
|
|
|
353
|
+ uniquebrandboys: '2ebb0810c0d1a67e5229149c9c3aba7d',
|
|
|
354
|
+ uniquebrandgirls: '99e23385f4ba4b65f406b7e2968ac821',
|
|
|
355
|
+ uniquebrandkids: 'a74ebc9b17840c91b9ea46568111fe6b',
|
|
|
356
|
+ uniquebrandlifestyle: '0e8c81ead53f56302baa4d0ad967f527',
|
|
|
357
|
+ brandsboys: '77b352db07129c76a9d532acad149f9f',
|
|
|
358
|
+ brandsgirls: 'bf047f16e52ebc38be5ce9c7623831e6',
|
|
|
359
|
+ brandskids: 'e3ae1ce9b5e13c6d271ef3eccb831652',
|
|
|
360
|
+ brandslifestyle: 'e4ac8029c30f65d7f1af030980d140fe',
|
|
|
361
|
+ newboys: '869d3c5f3b450fb52101d00a61ce87cb',
|
|
|
362
|
+ newgirls: 'd953b6dfdac02483d1dcce8d96055954',
|
|
|
363
|
+ newkids: '0874cb6d75df8e0e78f2d475e53ecc08',
|
|
|
364
|
+ newlifestyle: '43e8fc8e178115c262bbce2bd0012db7',
|
|
|
365
|
+ saleboys: 'c846e3165c994769b4201d8c32f3ae9b',
|
|
|
366
|
+ salegirls: '52b1d389edcbc62d65de71b80c4d6ad0',
|
|
|
367
|
+ salekids: 'ad8b1703c761ba00973868ab5199cc27',
|
|
|
368
|
+ salelifestyle: '7acc64905c70ac91846f43fb2cec4bbd',
|
|
|
369
|
+ homeboys: 'b0856a771ef1b59ab1234c74688fa42d',
|
|
|
370
|
+ homegirls: '2bd61fa12e4933211518f70fe5ce3c48',
|
|
|
371
|
+ homekids: '895c59e8c64b40399c9533509507320c',
|
|
|
372
|
+ homelifestyle: '2e037d4e25d2767352ca3e0a4627f7bd',
|
|
|
373
|
+ indexboys: '0c911d3000f52e8ca7cffb74f5864c29',
|
|
|
374
|
+ indexgirls: 'b645b8980c423ab30485e0a9d08c2ef7',
|
|
|
375
|
+ indexkids: '17f6d5d5d454d2c507bc5fcbc90f7756',
|
|
|
376
|
+ indexlifestyle: '735cd393e841762af8793c346abbbc36'
|
|
|
377
|
+};
|
|
|
378
|
+/**
|
|
|
379
|
+ * cookie集合
|
|
|
380
|
+ * @type {Object}
|
|
|
381
|
+ */
|
|
|
382
|
+window.cookieMap = {};
|
|
|
383
|
+
|
|
|
384
|
+function actionExeCookieMap() {
|
|
|
385
|
+ var cookies = document.cookie;
|
|
|
386
|
+ var cookiearr = cookies.split(';');
|
|
|
387
|
+ var i;
|
|
|
388
|
+ var temparr;
|
|
|
389
|
+ var key;
|
|
|
390
|
+
|
|
|
391
|
+ for (i = 0; i < cookiearr.length; i++) {
|
|
|
392
|
+ temparr = cookiearr[i].split('=');
|
|
|
393
|
+ key = temparr[0].replace(/\s/g, '');
|
|
|
394
|
+ window.cookieMap[key] = temparr[1];
|
|
|
395
|
+ }
|
|
|
396
|
+}
|
|
|
397
|
+
|
|
|
398
|
+
|
|
|
399
|
+/**
|
|
|
400
|
+ * 获得banner & 异常通知
|
|
|
401
|
+ * @return {[type]} [description]
|
|
|
402
|
+ */
|
|
|
403
|
+function actionGetBannerAndNotice() {
|
|
|
404
|
+ var INDEXKIDS = 'indexkids',
|
|
|
405
|
+ INDEXLIFESTYLE = 'indexlifestyle',
|
|
|
406
|
+ INDEXBOYS = 'indexboys',
|
|
|
407
|
+ INDEXWOMAN = 'indexgirls',
|
|
|
408
|
+ UNIQUEBRAND = 'uniquebrand';
|
|
|
409
|
+ var url = window.location.href;
|
|
|
410
|
+ var host = window.location.host;
|
|
|
411
|
+ var code = '';
|
|
|
412
|
+ var firstarea;
|
|
|
413
|
+
|
|
|
414
|
+ if (url.indexOf('search') !== -1) {
|
|
|
415
|
+ code = window.bannerMap['search' + window.cookieMap._Channel];
|
|
|
416
|
+ }
|
|
|
417
|
+ if (url.indexOf('list') !== -1) {
|
|
|
418
|
+ code = window.bannerMap['list' + window.cookieMap._Channel];
|
|
|
419
|
+ }
|
|
|
420
|
+ if (url.indexOf('brands') !== -1) {
|
|
|
421
|
+ code = window.bannerMap['brands' + window.cookieMap._Channel];
|
|
|
422
|
+ }
|
|
|
423
|
+ if (url.indexOf('new') !== -1) {
|
|
|
424
|
+ code = window.bannerMap['new' + window.cookieMap._Channel];
|
|
|
425
|
+ }
|
|
|
426
|
+ if (url.indexOf('sale') !== -1) {
|
|
|
427
|
+ code = window.bannerMap['sale' + window.cookieMap._Channel];
|
|
|
428
|
+ }
|
|
|
429
|
+ if (url.indexOf('home') !== -1) {
|
|
|
430
|
+ code = window.bannerMap['home' + window.cookieMap._Channel];
|
|
|
431
|
+ }
|
|
|
432
|
+ if (url.indexOf('kids') !== -1) {
|
|
|
433
|
+ code = window.bannerMap[INDEXKIDS];
|
|
|
434
|
+ }
|
|
|
435
|
+ if (url.indexOf('woman') !== -1) {
|
|
|
436
|
+ code = window.bannerMap[INDEXWOMAN];
|
|
|
437
|
+ }
|
|
|
438
|
+ if (url.indexOf('lifestyle') !== -1) {
|
|
|
439
|
+ code = window.bannerMap[INDEXLIFESTYLE];
|
|
|
440
|
+ }
|
|
|
441
|
+ if (url.indexOf('www.yohobuy.com') !== -1 && window.location.pathname === '/') {
|
|
|
442
|
+ code = window.bannerMap[INDEXBOYS];
|
|
|
443
|
+ }
|
|
|
444
|
+ firstarea = host.split('.')[0];
|
|
|
445
|
+ if (firstarea !== 'list' && firstarea !== 'search' && firstarea !== 'www' &&
|
|
|
446
|
+ firstarea !== 'new' && firstarea !== 'item' && firstarea !== 'guang') {
|
|
|
447
|
+ code = window.bannerMap[UNIQUEBRAND + window.cookieMap._Channel];
|
|
|
448
|
+ }
|
|
|
449
|
+
|
|
|
450
|
+ getBannerData(code); //获得banner信息
|
|
|
451
|
+ getNoticeData(code); //获得公告信息
|
|
|
452
|
+
|
|
|
453
|
+}
|
|
|
454
|
+
|
|
|
455
|
+function brandSwitch(index) {
|
|
|
456
|
+ $('.hot-brands').find('ul').stop().animate({
|
|
|
457
|
+ opacity: 0,
|
|
|
458
|
+ 'z-index': 1
|
|
|
459
|
+ }, 200).eq(index).animate({
|
|
|
460
|
+ opacity: 1,
|
|
|
461
|
+ 'z-index': 2
|
|
|
462
|
+ }, 200);
|
|
|
463
|
+}
|
|
|
464
|
+/**
|
|
|
465
|
+ * 品牌左右切换
|
|
|
466
|
+ * @return {[type]} [description]
|
|
|
467
|
+ */
|
|
|
468
|
+function actionBrandChange() {
|
|
|
469
|
+ var activeIndex = 0,
|
|
|
470
|
+ swiperLen;
|
|
|
471
|
+
|
|
|
472
|
+ if ($('.hot-brands').size() > 0) {
|
|
|
473
|
+ swiperLen = $('.hot-brands').find('ul').size();
|
|
|
474
|
+ $('.hot-brands').find('ul').eq(0).css({
|
|
|
475
|
+ opacity: 1,
|
|
|
476
|
+ 'z-index': 2
|
|
|
477
|
+ });
|
|
|
478
|
+ $('.brands-control').on('click', '.next', function() {
|
|
|
479
|
+ if (activeIndex === swiperLen - 1) {
|
|
|
480
|
+ activeIndex = 0;
|
|
|
481
|
+ } else {
|
|
|
482
|
+ activeIndex++;
|
|
|
483
|
+ }
|
|
|
484
|
+ brandSwitch(activeIndex);
|
|
|
485
|
+ });
|
|
|
486
|
+ $('.brands-control').on('click', '.prev', function() {
|
|
|
487
|
+ if (activeIndex === 0) {
|
|
|
488
|
+ activeIndex = swiperLen - 1;
|
|
|
489
|
+ } else {
|
|
|
490
|
+ activeIndex--;
|
|
|
491
|
+ }
|
|
|
492
|
+ brandSwitch(activeIndex);
|
|
|
493
|
+ });
|
|
|
494
|
+
|
|
|
495
|
+
|
|
|
496
|
+ }
|
|
|
497
|
+}
|
|
|
498
|
+/**
|
|
|
499
|
+ * 初始化函数
|
|
|
500
|
+ * @return {[type]} [description]
|
|
|
501
|
+ */
|
|
|
502
|
+exports.init = function() {
|
|
|
503
|
+ actionExeCookieMap();
|
|
|
504
|
+ actionYoHoGroup();
|
|
|
505
|
+ actionTopTagToggle();
|
|
|
506
|
+ actionTopLogoAnimate();
|
|
|
507
|
+ actionGetBannerAndNotice();
|
|
|
508
|
+ actionBrandChange();
|
|
|
509
|
+ actionAddKeyWords();
|
|
|
510
|
+}; |