Authored by lijing

普通秒杀详情跳转

... ... @@ -2,7 +2,7 @@
const shopModel = require('../models/shopCollect'),
headerModel = require('../../../doraemon/models/header'),
_ = require('lodash');
const crypto = global.yoho.crypto;
const shopIndex = (req, res) => {
... ... @@ -54,8 +54,19 @@ const shopList = (req, res, next) => {
}).catch(next);
};
// 获取文章收藏状态
const shopFav = (req, res, next) => {
let uid = req.query.uid || req.user.uid || '';
let shopIds = req.query.shopIds;
shopModel.shopFav(uid, shopIds).then((result) => {
res.json(result);
}).catch(next);
};
module.exports = {
shopIndex,
shopList,
shopNav
shopNav,
shopFav
};
... ...
... ... @@ -56,8 +56,24 @@ const banner = () => {
});
};
const shopFav = (uid, shopIds) => {
return api.get('', {
method: 'app.shops.promoteFavorite',
shop_ids: shopIds,
uid: uid
}, {
cache: true,
code: 200
}).then((result) => {
if (result.data) {
return result.data;
}
});
};
module.exports = {
shopList,
shopNav,
banner
banner,
shopFav
};
... ...
... ... @@ -95,6 +95,7 @@ router.get('/coin/sendCoin', coin.sendCoin);
router.get('/shopCollect', shopCollect.shopIndex);// 店铺收藏
router.get('/shopList', shopCollect.shopList);// 店铺收藏列表
router.get('/shopNav', shopCollect.shopNav);// 店铺收藏导航
router.get('/shopfavStatus', shopCollect.shopFav);// 店铺收藏状态
router.get('/share', share.getShareContent);
module.exports = router;
... ...
... ... @@ -158,6 +158,8 @@ const index = (req, res, next) => {
if (focusIndex !== -1) {
result.activitys[focusIndex].focus = true;
focusIndex = true;
} else {
focusIndex = false;
}
}
... ... @@ -179,12 +181,13 @@ const index = (req, res, next) => {
if (nowTime < nextTime) { // 下一个时间段与当前时间来区别是否正在抢购
activity.now = true;
focusIndex || (activity.focus = true);
focusIndex || (activity.focus = focusIndex = true);
} else {
activity.over = true;
}
} else { // 大于这个时间段但是后面没有秒抢时间端了,则依然显示抢购中
activity.now = true;
focusIndex || (activity.focus = focusIndex = true);
}
} else {
activity.wait = true;
... ...
... ... @@ -8,7 +8,6 @@
const helpers = global.yoho.helpers;
module.exports = (req, res, next) => {
console.log('....');
if (!req.user.uid) {
if (req.xhr) {
return res.json({
... ...
... ... @@ -2,7 +2,7 @@
<div class="shop-info" data-id="{{shopsId}}">
<div class="info-title">
<div class="collect">
<span class="fans">粉丝{{collectionNum}}</span>
<span class="fans">粉丝{{collectionNum}}</span>
<i class="iconfont collect-btn {{#if isFavorite}}already-collect{{/ if}}">&#xe605;</i>
</div>
... ...
... ... @@ -13,7 +13,8 @@ var searching,
bannerSwiper,
navType,
appVersion = $('input[name="app_version"]').val(),
uid = $('input[name="uid"]').val();
uid = $('input[name="uid"]').val(),
ids = [];
var shopNav = require('shopCollect/shop-nav.hbs'),
shopList = require('shopCollect/shop-list.hbs');
... ... @@ -23,6 +24,39 @@ require('../common/share');
navType = window.queryString;
function shopFav(shopIds) {
return $.ajax({
method: 'get',
url: '/activity/shopfavStatus',
data: {
uid: window.queryString.uid || uid,
shopIds: shopIds
},
success: function(data) {
var i,
it,
$it;
for (i = 0; i < data.length; i++) {
it = data[i];
if (it && it.id) {
$it = $('.shop-info[data-id=' + it.id + ']', $('.shop-list'));
if (it.favorite === 'Y') {
$it.find('.collect-btn').addClass('already-collect');
} else {
$it.find('.collect-btn').removeClass('already-collect');
}
}
}
},
error: function() {
tip.show('网络断开连接了~');
}
});
}
// 店铺列表数据
function shopListData(tabName, stoping) {
... ... @@ -47,6 +81,18 @@ function shopListData(tabName, stoping) {
stoping = false;
// 获取收藏状态
$('.shop-list').find('.shop-info').each(function() {
var id = $(this).data('id');
if (id) {
ids.push(id);
}
});
shopFav(ids.join(','));
// 店铺收藏
$('.collect-btn').on('click', function() {
var opt,
... ...
... ... @@ -55,6 +55,7 @@
.fans {
margin-right: 30px;
color: #666;
}
.collect-btn {
... ... @@ -76,22 +77,33 @@
}
p {
display: block;
float: left;
margin-left: 25px;
font-size: 22px;
width: 170px;
height: 65px;
}
span {
display: inline-block;
height: 35px;
line-height: 35px;
overflow: hidden;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.shop-name {
width: 170px;
font-weight: bold;
font-size: 24px;
height: 35px;
}
.giving {
width: 170px;
color: #b0b0b0;
}
}
... ...