|
@@ -6,21 +6,18 @@ var $ = require('yoho-jquery'), |
|
@@ -6,21 +6,18 @@ var $ = require('yoho-jquery'), |
6
|
Swiper = require('yoho-swiper'),
|
6
|
Swiper = require('yoho-swiper'),
|
7
|
tip = require('../plugin/tip');
|
7
|
tip = require('../plugin/tip');
|
8
|
|
8
|
|
9
|
- // Handlebars = require('yoho-handlebars');
|
|
|
10
|
-
|
|
|
11
|
var searching,
|
9
|
var searching,
|
12
|
shopId,
|
10
|
shopId,
|
13
|
- navSwiper,
|
|
|
14
|
- stoping;
|
11
|
+ stoping,
|
|
|
12
|
+ navType;
|
15
|
|
13
|
|
16
|
var shopNav = require('template/shopCollect/shop-nav.hbs'),
|
14
|
var shopNav = require('template/shopCollect/shop-nav.hbs'),
|
17
|
shopList = require('template/shopCollect/shop-list.hbs');
|
15
|
shopList = require('template/shopCollect/shop-list.hbs');
|
18
|
|
16
|
|
19
|
require('../common');
|
17
|
require('../common');
|
|
|
18
|
+require('../common/share')
|
20
|
|
19
|
|
21
|
-var navType = window.queryString;
|
|
|
22
|
-
|
|
|
23
|
-require('../common');
|
20
|
+navType = window.queryString;
|
24
|
|
21
|
|
25
|
// 店铺列表数据
|
22
|
// 店铺列表数据
|
26
|
function shopListData(tabName, stoping) {
|
23
|
function shopListData(tabName, stoping) {
|
|
@@ -45,6 +42,7 @@ function shopListData(tabName, stoping) { |
|
@@ -45,6 +42,7 @@ function shopListData(tabName, stoping) { |
45
|
|
42
|
|
46
|
stoping = false;
|
43
|
stoping = false;
|
47
|
|
44
|
|
|
|
45
|
+ //店铺收藏
|
48
|
$('.collect-btn').on('click', function() {
|
46
|
$('.collect-btn').on('click', function() {
|
49
|
var opt,
|
47
|
var opt,
|
50
|
$this = $(this);
|
48
|
$this = $(this);
|
|
@@ -86,7 +84,12 @@ function shopListData(tabName, stoping) { |
|
@@ -86,7 +84,12 @@ function shopListData(tabName, stoping) { |
86
|
}
|
84
|
}
|
87
|
|
85
|
|
88
|
if (data.code === 400) {
|
86
|
if (data.code === 400) {
|
89
|
- window.location.href = 'http://www.yohobuy.com/passport/login';
|
87
|
+
|
|
|
88
|
+ url = data.data;
|
|
|
89
|
+ if ($('#jump-login').length <= 0) {
|
|
|
90
|
+ $('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>');
|
|
|
91
|
+ }
|
|
|
92
|
+ $('#jump-login').click();
|
90
|
}
|
93
|
}
|
91
|
searching = false;
|
94
|
searching = false;
|
92
|
},
|
95
|
},
|
|
@@ -104,7 +107,6 @@ function shopListData(tabName, stoping) { |
|
@@ -104,7 +107,6 @@ function shopListData(tabName, stoping) { |
104
|
});
|
107
|
});
|
105
|
}
|
108
|
}
|
106
|
|
109
|
|
107
|
-
|
|
|
108
|
// 导航数据
|
110
|
// 导航数据
|
109
|
function shopNavData() {
|
111
|
function shopNavData() {
|
110
|
$.ajax({
|
112
|
$.ajax({
|
|
@@ -119,6 +121,14 @@ function shopNavData() { |
|
@@ -119,6 +121,14 @@ function shopNavData() { |
119
|
|
121
|
|
120
|
$('.shop-nav').html(navString);
|
122
|
$('.shop-nav').html(navString);
|
121
|
|
123
|
|
|
|
124
|
+ //导航滑动效果
|
|
|
125
|
+ navSwiper = new Swiper('.shop-nav', {
|
|
|
126
|
+ grabCursor: true,
|
|
|
127
|
+ slidesPerView: 'auto',
|
|
|
128
|
+ slideElement: 'li'
|
|
|
129
|
+ });
|
|
|
130
|
+
|
|
|
131
|
+ //加载第一页数据
|
122
|
if (navType.id) {
|
132
|
if (navType.id) {
|
123
|
$('.shop-nav').find('li').each(function() {
|
133
|
$('.shop-nav').find('li').each(function() {
|
124
|
if (navType.id === $(this).data('type')) {
|
134
|
if (navType.id === $(this).data('type')) {
|
|
@@ -126,12 +136,12 @@ function shopNavData() { |
|
@@ -126,12 +136,12 @@ function shopNavData() { |
126
|
shopListData($(this).data('type'));
|
136
|
shopListData($(this).data('type'));
|
127
|
}
|
137
|
}
|
128
|
});
|
138
|
});
|
129
|
-
|
|
|
130
|
} else {
|
139
|
} else {
|
131
|
$('.shop-nav').find('li').eq(0).addClass('active');
|
140
|
$('.shop-nav').find('li').eq(0).addClass('active');
|
132
|
shopListData($('.shop-nav').find('li').eq(0).data('type'));
|
141
|
shopListData($('.shop-nav').find('li').eq(0).data('type'));
|
133
|
}
|
142
|
}
|
134
|
|
143
|
|
|
|
144
|
+ //导航点击事件
|
135
|
$('.shop-nav').find('li').on('click', function() {
|
145
|
$('.shop-nav').find('li').on('click', function() {
|
136
|
var $this = $(this),
|
146
|
var $this = $(this),
|
137
|
tabName = $this.data('type');
|
147
|
tabName = $this.data('type');
|
|
@@ -149,19 +159,15 @@ function shopNavData() { |
|
@@ -149,19 +159,15 @@ function shopNavData() { |
149
|
|
159
|
|
150
|
},
|
160
|
},
|
151
|
error: function() {
|
161
|
error: function() {
|
152
|
- tip.show('网络断开连接了~');
|
|
|
153
|
-
|
162
|
+ //tip.show('网络断开连接了~');
|
|
|
163
|
+ $('.shop-nav').hide();
|
|
|
164
|
+ $('.shop-list').hide();
|
154
|
}
|
165
|
}
|
155
|
});
|
166
|
});
|
156
|
}
|
167
|
}
|
157
|
|
168
|
|
158
|
-
|
|
|
159
|
$(function() {
|
169
|
$(function() {
|
160
|
- navSwiper = new Swiper('.shop-nav', {
|
|
|
161
|
- grabCursor: true,
|
|
|
162
|
- slidesPerView: 'auto',
|
|
|
163
|
- slideElement: 'li'
|
|
|
164
|
- });
|
170
|
+ shopNavData();
|
165
|
|
171
|
|
166
|
if ($('.banner-swiper').find('li').size() > 1) {
|
172
|
if ($('.banner-swiper').find('li').size() > 1) {
|
167
|
bannerSwiper = new Swiper('.banner-swiper', {
|
173
|
bannerSwiper = new Swiper('.banner-swiper', {
|
|
@@ -176,5 +182,5 @@ $(function() { |
|
@@ -176,5 +182,5 @@ $(function() { |
176
|
});
|
182
|
});
|
177
|
}
|
183
|
}
|
178
|
|
184
|
|
179
|
- shopNavData();
|
185
|
+
|
180
|
}); |
186
|
}); |