Authored by htoooth

fix

... ... @@ -216,6 +216,7 @@ function _getSkuDataByProductBaseInfo(data) {
let defaultImage = '';// 默认图
let defaultSkuFlag = false; // 选中状态
let marketPrice = _.get(data, 'market_price', 0.0);
let imageAlt = _imageAlt(data); // eslint-disable-line
if (_.isEmpty(_.get(data, 'goods_list', []))) {
return {
... ... @@ -256,7 +257,8 @@ function _getSkuDataByProductBaseInfo(data) {
url: '',
shower: good.image_url,
img: good.image_url,
title: goodsDetail.title
title: goodsDetail.title,
imageAlt
});
}
});
... ... @@ -335,7 +337,8 @@ function _getSkuDataByProductBaseInfo(data) {
return {
defaultImage: defaultImage,
skuGoods: skuGoods,
totalStorageNum: totalStorageNum
totalStorageNum: totalStorageNum,
imageAlt
};
}
... ... @@ -927,6 +930,33 @@ function _genderHelper(gender) {
}
}
function _imageAlt(goodsInfo) {
let navs = _getSortNavAsync({data: goodsInfo}, null);
let alt = '';
if (_.get(goodsInfo, 'brand_info.brand_name_en')) {
alt += _.get(goodsInfo, 'brand_info.brand_name_en') + '|';
}
if (_.get(goodsInfo, 'brand_info.brand_name_cn')) {
alt += _.get(goodsInfo, 'brand_info.brand_name_cn') + '|';
}
if (_.get(goodsInfo, 'gender')) {
alt += _genderHelper(_.get(goodsInfo, 'data.gender', '1,3')) + '|';
}
if (_.get(navs, '[1].name')) {
alt += navs[1].name + '|';
}
if (_.get(goodsInfo, 'product_name', '')) {
alt += _.get(goodsInfo, 'product_name', '');
}
return alt;
}
/**
* 获取seo信息
*
... ... @@ -935,49 +965,35 @@ function _genderHelper(gender) {
* @return array
*/
function _getSeoByGoodsInfo(goodsInfo, navs) {
let title = '';
let brandName = '';
let sortName = '';
let productName = _.get(goodsInfo, 'data.product_name', '');
goodsInfo = goodsInfo || {};
navs = navs || [];
if (_.get(goodsInfo, 'data.brand_info.brand_name', '')) {
brandName = goodsInfo.brandName;
}
if (_.get(goodsInfo, 'data.brand_info.brand_name_en')) {
title += _.get(goodsInfo, 'data.brand_info.brand_name_en') + '|';
}
if (_.get(goodsInfo, 'data.brand_info.brand_name_cn')) {
title += _.get(goodsInfo, 'data.brand_info.brand_name_cn') + '|';
}
if (_.get(goodsInfo, 'data.gender')) {
title += _genderHelper(_.get(goodsInfo, 'data.gender', '1,3')) + '|';
brandName = _.get(goodsInfo, 'data.brand_info.brand_name');
}
if (_.get(navs, '[1].name')) {
sortName = navs[1].name;
title += navs[1].name + '|';
}
title += _.get(goodsInfo, 'data.product_name') + '正品 | YOHO!BUY 有货';
let title = `【${brandName}${sortName}】` + productName + ' | YOHO!BUY 有货';
let keywords = brandName + sortName + ',' + brandName + '专卖店,' + brandName + '官方授权店,' +
brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购';
let keywords = brandName + sortName + ',' + brandName + sortName + '价格,' + brandName + sortName + '图片';
let description = `YOHO!BUY 有货-${brandName}官方授权店,${goodsInfo.name}图片、报价、介绍。` +
`YOHO!BUY 有货${brandName}专卖店提供${brandName}正品、${brandName}真品、 ${brandName}打折、${brandName}代购等。`;
let description = `${productName},有货网仅售${_.get(goodsInfo, 'data.format_sales_price')}元,` +
`购买${brandName + sortName},了解${brandName + sortName}商品信息就上有货网!`;
let cononicalURL = goodsInfo.productUrl;
let cononicalURL = helpers.getUrlBySkc(_.get(goodsInfo, 'data.product_skn'));
return {
title: title,
keywords: keywords.replace(/~+/, ''),
description: description,
cononicalURL: cononicalURL
cononicalURL: cononicalURL,
};
}
... ... @@ -1222,6 +1238,7 @@ function _detailDataPkg(origin, uid, vipLevel, cookies) {
result.img = skuData.defaultImage;
result.colors = skuData.skuGoods;
result.imageAlt = skuData.imageAlt
let totalStorageNum = skuData.totalStorageNum;
// 限购商品
... ...
... ... @@ -13,7 +13,7 @@
<span class="ac-type">{{type}}</span>
<span class="ac-des {{#if_cond ../activity.length '>' 3}}small{{/if_cond}}">
{{#if url}}
<a target="_blank" href="{{url}}">{{des}}</a>
<a target="_blank" href="{{url}}" rel="nofollow">{{des}}</a>
{{^}}
<span>{{des}}</span>
{{/if}}
... ... @@ -30,7 +30,7 @@
<span class="ac-type">{{type}}</span>
<span class="ac-des {{#if_cond ../activity.length '>' 3}}small{{/if_cond}}">
{{#if url}}
<a target="_blank" href="{{url}}">{{des}}</a>
<a target="_blank" href="{{url}}" rel="nofollow">{{des}}</a>
{{^}}
<span>{{des}}</span>
{{/if}}
... ...
... ... @@ -95,7 +95,7 @@
退回商品保证吊牌、标签、包装完整,详情点击
<br />
<a href="//www.yohobuy.com/help/detail?id=49"
target="_blank">&gt;&gt;退换货政策</a>
target="_blank" rel="nofollow">&gt;&gt;退换货政策</a>
</span>
</span>
</p>
... ... @@ -114,7 +114,7 @@
<div class="common-question">
<p>
<span class="common-advice">
<a href="#textbox-wrapper" id="common-advice">
<a href="#textbox-wrapper" id="common-advice" rel="nofollow">
<i class="iconfont advice"> &#xe602;</i>
我要咨询<i class="iconfont click">&#xe608;</i>
</a>
... ...
... ... @@ -29,9 +29,8 @@
{{/ isPresell}}
{{/ tags}}
</div>
<div id="min-img">
<img id="img-show" class="img-show" src="{{image2 img w=420 h=560}}" alt="{{name}}">
<img id="img-show" class="img-show" src="{{image2 img w=420 h=560}}" alt="{{imageAlt}}">
<div class="magnifier move-object hide"></div>
<div class="magnifier move-over"></div>
<div id="max" class="magnifier max hide">
... ... @@ -49,14 +48,14 @@
{{#if focus}}
{{# thumbs}}
<img class="thumb {{#if @first}}active{{/if}}" src="{{image2 img w=75 h=100}}"
alt="{{title}}"
alt="{{imageAlt}}"
data-shower="{{image2 shower w=420 h=560}}"
data-origin="{{image2 shower w=750 h=1000}}">
{{/ thumbs}}
{{^}}
{{# thumbs}}
<img class="thumb lazy"
alt="{{title}}"
alt="{{imageAlt}}"
data-original="{{image2 img w=75 h=100}}"
data-shower="{{image2 shower w=420 h=560}}"
data-origin="{{image2 shower w=750 h=1000}}">
... ...