Authored by ccbikai(👎🏻🍜)

Merge branch 'gray'

... ... @@ -187,7 +187,7 @@ const index = (req, res, next) => {
let param = {
uid: req.user.uid || req.query.uid,
udid: req.user.udid,
type: req.query.type || '0',
type: req.query.type || req.query.id || '0',
gender: req.query.gender || req.query.channel && typeLib.gender[req.query.channel] || '1,3'
};
... ...
... ... @@ -135,7 +135,7 @@ const _article = (param) => {
page: param.page || 1,
uid: param.uid,
udid: param.udid,
sort_id: 0,
sort_id: param.type || 0,
tag: param.tag ? param.tag : null,
limit: 4
... ... @@ -223,7 +223,7 @@ const getArticle = (param) => {
let swp = [];
let swiperList = result[1].data.list.adlist;
let swiperList = _.get(result[1], 'data.list.adlist', []);
swiperList.forEach(val => {
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const mRoot = '../models';
const appSrc = require('../../../config/download');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const detailModel = require(`${mRoot}/detail`); // 商品详情 model
const introModel = require(`${mRoot}/intro`); // 商品尺码信息 model
... ... @@ -193,6 +194,43 @@ exports.consultsubmit = (req, res, next) => {
}).catch(next);
};
/**
* 限定商品 详情页;
*/
exports.limit = (req, res, next) => {
res.locals.module = 'product';
res.locals.page = 'limit';
const uid = req.user.uid;
const productCode = (req.query.code || '').trim();
if (!productCode) {
return next(/* 404 */);
}
detailModel.getLimitProductData(uid, productCode)
.then(result => {
if (_.isEmpty(result)) {
return next();
}
result.appSrc = appSrc.common;
result.wxshare = {
shareLink: helpers.urlFormat('/product/detail/limit', {code: productCode}),
shareImg: result.banner.replace('//', 'http://'),
shareTitle: result.name,
shareDesc: '我在Yoho!Buy有货发现了一个限定发售商品',
};
res.render('detail/limit', result);
})
.catch(error => {
next(error);
});
};
/**
* 商品基本信息 SKN 进入 pagecache重构
* @param {[type]} req [description]
... ... @@ -310,6 +348,7 @@ exports.indexData = (req, res, next) => {
return res.json(result);
}).catch(next);
};
... ...
... ... @@ -822,11 +822,80 @@ let _productInfoBySkns = (skns) => {
});
};
const getLimitProductData = (uid, limitProductCode) => {
const param = {
method: 'app.limitProduct.limitProductDetail',
limitProductCode,
uid
};
return api.get('', param).then(result => {
if (!(result && result.data)) {
return Promise.reject(result);
}
let obj = {};
// if (!result.data.hasOwnProperty('attachment')) {
// return
// }
obj.price = result.data.price;
obj.name = result.data.productName;
obj.releaseDate = `${result.data.saleTime}发售`;
obj.banner = helpers.image(result.data.defaultUrl, 750, '');
obj.description = result.data.description;
obj.attaches = [];
result.data.attachment = result.data.attachment || [];
for (let item of result.data.attachment) {
if (item.isDefault === 1) { // 排除默认图片
continue;
}
let attach = {};
switch (item.attachType) {
case 1:
attach.isImg = true;
attach.attachUrl = helpers.image(item.attachUrl, 750, '');
attach.attachName = item.intro;
attach.intro = item.intro;
break;
case 2:
attach.isVideo = true;
attach.attachUrl = item.attachUrl;
attach.img = helpers.image(item.intro, 750, '');
break;
case 3:
attach.isText = true;
attach.intro = item.intro;
break;
default:
break;
}
attach.orderBy = item.orderBy;
obj.attaches.push(attach);
}
if (obj.attaches.length > 1) {
obj.attaches.sort((v1, v2) => {
return v1.orderBy - v2.orderBy;
});
}
return obj;
});
};
module.exports = {
getProductData,
getProductAsyncData,
getNewProductAsyncData,
getUserProfile: _getUserProfile,
productInfoBySkns: _productInfoBySkns,
detailDataPkgAsync: _detailDataPkgAsync
detailDataPkgAsync: _detailDataPkgAsync,
getLimitProductData
};
... ...
... ... @@ -75,16 +75,22 @@ router.post('/detail/info', detail.getUser, detail.indexData); // 商å“详情é¡
router.post('/detail/newinfo', detail.getUser, newDetail.indexData); // 商品详情页-异步数据 (优化)
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
router.get('/detail/coupon.json', detail.brandCoupon); // 品牌券
router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品牌券
router.get('/recom/maylike', recom.mayLike); // 你可能喜欢
// 限定商品
router.get('/detail/limit', detail.limit);
router.get('/recom/maylike', recom.mayLike);// 你可能喜欢
router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢
router.get('/recom/maylikelife', recom.mayLikelife); // 创意生活你可能喜欢
router.get('/seckillDetail/seckillData/:productskn', seckillDetail.getSeckillData); // 秒杀数据接口
router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口
router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口
... ...
<div class="limit-good-page yoho-page">
<div class="top clearfix">
<p>我在Yoho!Buy有货发现了一个限定发售商品</p>
</div>
<div class="banner">
<img src="{{banner}}" alt="">
</div>
<div class="detail clearfix">
<p class="name">{{name}}</p>
<div class="sale-info">
<span class="price">{{price}}</span>
<span class="date">
<span class="iconfont">&#xe603;</span>
<span class="text">{{releaseDate}}</span>
</span>
</div>
</div>
{{#if attaches}}
<div class="good-desc">
{{# attaches}}
{{#if isImg}}
<img src="{{attachUrl}}" alt="{{attachName}}">
{{else if isText}}
<p class="desc">{{intro}}</p>
{{else}}
<video poster="{{img}}" controls="controls" controls="controls" preload="metadata" loop="loop" width="100%" name="media">
<source src="{{attachUrl}}" type="video/ogg;codecs=" theora,vorbis"" media="screen" />
<source src="{{attachUrl}}"/>
</video>
{{/if}}
{{/attaches}}
</div>
{{/if}}
<div class="bottom">
<div class="logo"></div>
<div class="left">
<a href="{{appSrc}}">
<button class="btn">
立即下载
</button>
</a>
</div>
<div class="right">
<span>下载Yoho!Buy有货APP</span>
<span>抢购超级限量款</span>
</div>
</div>
{{#wxshare}}
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/wxshare}}
</div>
... ...
module.exports = {
common: 'http://www.yohoshow.com/about/index/yohobuyqr/',
android: '',
iphone: '',
ipad: ''
};
... ...
{
"name": "m-yohobuy-node",
"version": "5.4.20",
"version": "5.4.21",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -63,9 +63,9 @@ setTimeout(function() {
info.initInfosEvt($infosContainer);
// 文字介绍收起与展开
moreHammer = new Hammer(document.getElementById('more-intro-click-range'));
moreHammer.on('tap', function(e) {
$('#more-intro-click-range').on('click', function(e) {
var $this = $imt.parent();
e.preventDefault(); // 防止收缩后误点到商品产生跳转
$this.toggleClass('spread');
... ... @@ -83,7 +83,6 @@ moreHammer.on('tap', function(e) {
$(window).scrollTop(0, 400); // 滑动到顶部
}
e.srcEvent.preventDefault(); // 防止收缩后误点到商品产生跳转
});
if ($('#brand-like').length) {
... ...
var shareAction = require('common/share');
$(function() {
shareAction({
title: $('#shareTitle').val(),
link: $('#shareLink').val(),
desc: $('#shareDesc').val(),
imgUrl: $('#shareImg').val(),
});
});
... ...
... ... @@ -390,11 +390,11 @@
}
.hover {
position: fixed;
width: 100%;
position: fixed !important;
width: 100% !important;
background-color: black;
height: 100%;
top: 0;
top: 0 !important;
left: 0;
right: 0;
border: 0;
... ...
... ... @@ -8,3 +8,4 @@
@import "newsale/hot-rank";
@import "bundle/index";
@import "detail/limit-help";
@import "detail/limit";
... ...
... ... @@ -9,3 +9,4 @@
@import "cart/chose-panel";
@import "common/suspend-home";
@import "bundle";
@import "limit";
... ...
.limit-good-page {
background-color: #f4f4f4;
color: #444;
.top {
font-size: 24px;
height: 80px;
line-height: 88px;
margin-bottom: 4px;
background-color: #fff;
padding: 8px 0 8px 20px;
div {
width: 0%;
display: inline-block;
img {
width: 60px;
position: relative;
top: 10px;
}
}
p {
display: inline-block;
width: 80%;
}
}
.detail {
background-color: #fff;
padding: 24px 32px;
border-bottom: 1PX solid #e6e6e6;
margin-bottom: 1rem;
.name {
font-size: 36px;
margin-bottom: 20px;
}
.sale-info {
height: 40px;
line-height: 40px;
}
.price {
font-size: 32px;
color: #d0021b;
float: left;
}
.date {
font-size: 24px;
float: right;
.text {
position: relative;
top: 3.2px;
}
}
.iconfont {
vertical-align: middle;
}
}
.good-desc {
padding: 20px;
border-top: 1PX solid #e6e6e6;
background-color: #fff;
p {
font-size: 24px;
line-height: 40px;
text-indent: 2em;
}
img {
margin: 12px 0;
max-width: 100%;
}
}
.bottom {
background-color: #fff;
padding: 20px 80px 80px;
margin: 0 auto;
.logo {
height: 100px;
background-image: resolve("product/logo-bottom.png");
background-size: 100%;
background-repeat: no-repeat;
background-position: center;
}
.btn {
font-size: 32px;
background-color: #fff;
border: 1PX solid #444;
border-radius: 8px;
padding: 12px 24px;
}
.btn:active {
background-color: #ccc;
}
.left,
.right {
float: left;
}
.left {
width: 39%;
}
.right {
width: 60%;
font-size: 26px;
span {
display: block;
width: 95%;
margin: 0 auto;
}
}
}
}
... ...