Authored by zhangxiaoru

shop

... ... @@ -41,7 +41,6 @@ const shopIndex = (req, res) => {
const shopNav = (req, res, next) => {
shopModel.shopNav().then((result) => {
console.log(result);
res.json(result);
}).catch(next);
};
... ...
... ... @@ -97,7 +97,8 @@ function shopListData(tabName, stoping) {
$('.collect-btn').on('click', function(e) {
var opt,
$this = $(this),
fansCount = parseInt($this.parent().find('.fans-count').html());
fansCount = $this.parent().find('.fans-count').html();
console.log(fansCount)
shopId = $this.parents('.shop-info').data('id');
... ... @@ -132,11 +133,15 @@ function shopListData(tabName, stoping) {
if ($this.hasClass('already-collect')) {
$this.removeClass('already-collect');
tip.show('店铺取消收藏成功');
$this.parent().find('.fans-count').html(fansCount - 1);
if(fansCount.indexOf('w') === -1) {
$this.parent().find('.fans-count').html(parseInt(fansCount) - 1);
}
} else {
$this.addClass('already-collect');
tip.show('店铺收藏成功');
$this.parent().find('.fans-count').html(fansCount + 1);
if(fansCount.indexOf('w') === -1) {
$this.parent().find('.fans-count').html(parseInt(fansCount) + 1);
}
}
}
... ...
... ... @@ -64,8 +64,10 @@
color: #b0b0b0;
display: inline-block;
width: 50px;
font-size: 26px;
font-size: 32px;
text-align: center;
position: relative;
top: 4px;
}
.already-collect {
... ... @@ -111,6 +113,8 @@
.giving {
color: #b0b0b0;
font-size: 22px;
position: relative;
bottom: -3px;
}
}
... ...