...
|
...
|
@@ -6,21 +6,18 @@ var $ = require('yoho-jquery'), |
|
|
Swiper = require('yoho-swiper'),
|
|
|
tip = require('../plugin/tip');
|
|
|
|
|
|
// Handlebars = require('yoho-handlebars');
|
|
|
|
|
|
var searching,
|
|
|
shopId,
|
|
|
navSwiper,
|
|
|
stoping;
|
|
|
stoping,
|
|
|
navType;
|
|
|
|
|
|
var shopNav = require('template/shopCollect/shop-nav.hbs'),
|
|
|
shopList = require('template/shopCollect/shop-list.hbs');
|
|
|
|
|
|
require('../common');
|
|
|
require('../common/share')
|
|
|
|
|
|
var navType = window.queryString;
|
|
|
|
|
|
require('../common');
|
|
|
navType = window.queryString;
|
|
|
|
|
|
// 店铺列表数据
|
|
|
function shopListData(tabName, stoping) {
|
...
|
...
|
@@ -45,6 +42,7 @@ function shopListData(tabName, stoping) { |
|
|
|
|
|
stoping = false;
|
|
|
|
|
|
//店铺收藏
|
|
|
$('.collect-btn').on('click', function() {
|
|
|
var opt,
|
|
|
$this = $(this);
|
...
|
...
|
@@ -86,7 +84,12 @@ function shopListData(tabName, stoping) { |
|
|
}
|
|
|
|
|
|
if (data.code === 400) {
|
|
|
window.location.href = 'http://www.yohobuy.com/passport/login';
|
|
|
|
|
|
url = data.data;
|
|
|
if ($('#jump-login').length <= 0) {
|
|
|
$('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>');
|
|
|
}
|
|
|
$('#jump-login').click();
|
|
|
}
|
|
|
searching = false;
|
|
|
},
|
...
|
...
|
@@ -104,7 +107,6 @@ function shopListData(tabName, stoping) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
// 导航数据
|
|
|
function shopNavData() {
|
|
|
$.ajax({
|
...
|
...
|
@@ -119,6 +121,14 @@ function shopNavData() { |
|
|
|
|
|
$('.shop-nav').html(navString);
|
|
|
|
|
|
//导航滑动效果
|
|
|
navSwiper = new Swiper('.shop-nav', {
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
|
|
slideElement: 'li'
|
|
|
});
|
|
|
|
|
|
//加载第一页数据
|
|
|
if (navType.id) {
|
|
|
$('.shop-nav').find('li').each(function() {
|
|
|
if (navType.id === $(this).data('type')) {
|
...
|
...
|
@@ -126,12 +136,12 @@ function shopNavData() { |
|
|
shopListData($(this).data('type'));
|
|
|
}
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
$('.shop-nav').find('li').eq(0).addClass('active');
|
|
|
shopListData($('.shop-nav').find('li').eq(0).data('type'));
|
|
|
}
|
|
|
|
|
|
//导航点击事件
|
|
|
$('.shop-nav').find('li').on('click', function() {
|
|
|
var $this = $(this),
|
|
|
tabName = $this.data('type');
|
...
|
...
|
@@ -149,19 +159,15 @@ function shopNavData() { |
|
|
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
|
|
|
//tip.show('网络断开连接了~');
|
|
|
$('.shop-nav').hide();
|
|
|
$('.shop-list').hide();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
$(function() {
|
|
|
navSwiper = new Swiper('.shop-nav', {
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
|
|
slideElement: 'li'
|
|
|
});
|
|
|
shopNavData();
|
|
|
|
|
|
if ($('.banner-swiper').find('li').size() > 1) {
|
|
|
bannerSwiper = new Swiper('.banner-swiper', {
|
...
|
...
|
@@ -176,5 +182,5 @@ $(function() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
shopNavData();
|
|
|
|
|
|
}); |
...
|
...
|
|