Authored by yyq

Merge branch 'feature/activity' into release/question

... ... @@ -2,6 +2,9 @@
const model = require('../models/feature');
exports.index = function(req, res, next) {
// 唤起 APP 的路径
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param": {"share_id":"${req.query.share_id}"},"url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
model.index({
code: req.params.code,
type: req.query.type
... ...
... ... @@ -22,9 +22,9 @@
style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
{{#if param.bgimg}}
{{#isLazyLoad type @index}}
<img class="lazy" data-original="{{image2 param.bgimg q=75}}">
<img class="lazy" data-original="{{imageslim param.bgimg}}">
{{else}}
<img src="{{image2 param.bgimg q=75}}">
<img src="{{imageslim param.bgimg}}">
{{/isLazyLoad}}
{{/if}}
{{#component}}
... ... @@ -34,7 +34,7 @@
{{#if modalImg}}
<div class="modal">
<span class="modal-close"></span>
<img class="modal-img lazy" data-original="{{image2 modalImg q=75}}">
<img class="modal-img lazy" data-original="{{imageslim modalImg}}">
</div>
{{/if}}
{{/isEqualOr}}
... ... @@ -66,7 +66,7 @@
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide" style="{{styleFormat this percent=1}}">
<img src="{{image2 src q=75}}">
<img src="{{imageslim src}}">
<a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
</div>
{{/list}}
... ... @@ -88,7 +88,7 @@
{{#isEqualOr type 'productGroup'}}
{{! 商品池}}
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=75}}) repeat;background-size:100%;"{{/if}}>
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{imageslim proBgImg}}) repeat;background-size:100%;"{{/if}}>
<div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"
{{#unless defaultPros.length}}
{{#if searchCondition.item}}
... ... @@ -103,9 +103,9 @@
<div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}">
<a class="first-part product-detail" href='{{producturl}}'>
<div class="product-detail-imgbox">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=75}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=75}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{image2 productimg q=75}}">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{imageslim ../lefTopImg}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{imageslim ../rigTopImg}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{imageslim productimg}}">
</div>
{{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
<div class="product-detail-text">
... ... @@ -128,7 +128,7 @@
<div class="brand-div">
<span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
</div>
<img class="brand-img lazy" data-original="{{image2 ../brandImg q=75}}">
<img class="brand-img lazy" data-original="{{imageslim ../brandImg}}">
</a>
{{/if}}
</div>
... ... @@ -137,8 +137,8 @@
<div class="feature-product-info novisible">
<a class="first-part product-detail" href=''>
<div class="product-detail-imgbox">
{{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=75}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=75}}">{{/if}}
{{#if lefTopImg}}<img class="leftopimg" src="{{imageslim lefTopImg}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{imageslim rigTopImg}}">{{/if}}
<img class="product-detail-img" src="">
</div>
{{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
... ... @@ -161,7 +161,7 @@
<div class="brand-div">
<span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
</div>
<img class="brand-img" src="{{image2 brandImg q=75}}">
<img class="brand-img" src="{{imageslim brandImg}}">
</a>
{{/if}}
</div>
... ...
... ... @@ -15,6 +15,10 @@ let configFile = `
{
"appID": "EX33S4LRW7.com.yoho.buy",
"paths": [ "*" ]
},
{
"appID": "FP8T8KM2NE.com.yoho.buy.c3",
"paths": [ "*" ]
}
]
}
... ...
... ... @@ -26,7 +26,7 @@
var isWechat = /micromessenger/i.test(navigator.userAgent || '');
if (isWechat) {
document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', '');
(function () { if (typeof (WeixinJSBridge) == "undefined") { document.addEventListener("WeixinJSBridgeReady", function (a) { setTimeout(function () { WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 }, function (b) { }) }, 0) }) } else { setTimeout(function () { WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 }, function (a) { }) }, 0) } })();
(function(){function setWechatSize(){if(typeof WeixinJSBridge!=="undefined"&&WeixinJSBridge.invoke){WeixinJSBridge.invoke("setFontSizeCallback",{fontSize:0},function(){})}}if(typeof WeixinJSBridge!=="undefined"){setTimeout(setWechatSize,0)}else{document.addEventListener("WeixinJSBridgeReady",function(){setTimeout(setWechatSize,0)})};}());
}
</script>
... ...
{
"name": "m-yohobuy-node",
"version": "5.7.2",
"version": "5.7.3",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -103,7 +103,7 @@
"yoho-fastclick": "^1.0.6",
"yoho-hammer": "^2.0.7",
"yoho-iscroll": "^5.2.0",
"yoho-jquery": "^2.2.4",
"yoho-jquery": "^1.12.4",
"yoho-jquery-lazyload": "^1.9.12",
"yoho-jquery-qrcode": "^0.14.0",
"yoho-mlellipsis": "0.0.3",
... ...
... ... @@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调
// 隐藏筛选界面
function hideFilter() {
setTimeout(function() {
$filter.addClass('hide');
$filter && $filter.addClass('hide');
}, 301);
}
// 显示筛选界面
function showFilter() {
$filter.removeClass('hide');
$filter && $filter.removeClass('hide');
}
// 一级菜单点击时背景高亮
... ...
... ... @@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
finalDetail.push({
relatedReco: {
isApp: isApp,
goods: goodsData,
moreNum: goodsData.length - 2 > 0 ? goodsData.length - 2 : 0
goods: goodsData
}
});
}
... ... @@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
_.forEach(finalDetail, (value, key) => {
if (value.relatedReco) {
_.forEach(value.relatedReco.goods, (item, subKey) => {
if (goodsObj[item.id]) {
finalDetail[key].relatedReco.goods[subKey] = goodsObj[item.id];
let goodsIds = [];
_.forEach(value.relatedReco.goods, relatedGoods => {
goodsIds.push(relatedGoods.id);
});
goodsIds = _.uniq(goodsIds);
finalDetail[key].relatedReco.goods = [];
_.forEach(goodsIds, (item, subKey) => {
if (goodsObj[item]) {
finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
} else {
delete finalDetail[key].relatedReco.goods[subKey];
finalDetail[key].relatedReco.moreNum--;
}
});
let moreNum = _.get(finalDetail[key], 'relatedReco.goods.length', 0);
finalDetail[key].relatedReco.moreNum = moreNum - 2 > 0 ? moreNum - 2 : 0;
}
if (value.collocation) {
... ...
... ... @@ -143,6 +143,24 @@ module.exports = {
return '';
}
},
/**
* 图片质量调整
*/
imageslim: function(imageUrl) {
if (imageUrl && _.isString(imageUrl)) {
let urls = imageUrl.split('?');
let uri = urls[0];
if (uri.indexOf('http:') === 0) {
uri = uri.replace('http:', '');
}
return uri + '?imageslim';
} else {
return '';
}
},
isEqualOr: function() {
let args = Array.prototype.slice.call(arguments);
let v1 = args[0];
... ...