Authored by 张孝茹

详情页 alt 全球购 tdk

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 const headerModel = require('../../../doraemon/models/header'); 3 const headerModel = require('../../../doraemon/models/header');
4 const model = require('../models/global'); 4 const model = require('../models/global');
  5 +const _ = require('lodash');
5 6
6 const list = (req, res, next) => { 7 const list = (req, res, next) => {
7 let brand = req.query.brand; 8 let brand = req.query.brand;
@@ -84,6 +85,13 @@ const detail = (req, res, next) => { @@ -84,6 +85,13 @@ const detail = (req, res, next) => {
84 let appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.globalpurchase","params":${JSON.stringify(appParams)}}`; 85 let appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.globalpurchase","params":${JSON.stringify(appParams)}}`;
85 86
86 res.render('global/detail', { 87 res.render('global/detail', {
  88 + title: (_.get(result, 'brand_info.brand_name', '') ? '【' + result.brand_info.brand_name + '】' : '') +
  89 + _.get(result, 'product_name', '') + '|YOHO!BUY 有货',
  90 + keywords: _.get(result, 'brand_info.brand_name', '') + ',' + _.get(result, 'brand_info.brand_name', '') +
  91 + '价格,' + _.get(result, 'brand_info.brand_name', '') + '图片,',
  92 + description: _.get(result, 'product_name', '') + ' 有货网仅售' + _.get(result, 'sales_price', '') + '元,购买' +
  93 + _.get(result, 'brand_info.brand_name', '') + ',了解' + _.get(result, 'brand_info.brand_name', '') +
  94 + '商品信息就上有货网!',
87 module: 'product', 95 module: 'product',
88 page: 'global-detail', 96 page: 'global-detail',
89 pageHeader: headerModel.setNav({ 97 pageHeader: headerModel.setNav({
@@ -4,6 +4,7 @@ const utils = '../../../utils'; @@ -4,6 +4,7 @@ const utils = '../../../utils';
4 const productProcess = require(`${utils}/product-process`); 4 const productProcess = require(`${utils}/product-process`);
5 const globalapi = global.yoho.GlobalAPI; 5 const globalapi = global.yoho.GlobalAPI;
6 const $ = require('cheerio'); 6 const $ = require('cheerio');
  7 +const _ = require('lodash');
7 8
8 exports.list = (param) => { 9 exports.list = (param) => {
9 return globalapi.get('product/api/v2/detail/getlist', param).then((result) => { 10 return globalapi.get('product/api/v2/detail/getlist', param).then((result) => {
@@ -46,13 +47,15 @@ exports.detail = (param) => { @@ -46,13 +47,15 @@ exports.detail = (param) => {
46 47
47 if (goods.length === 1) { 48 if (goods.length === 1) {
48 result.bannerTop = { 49 result.bannerTop = {
49 - img: (goods[0].images_list[0] || {}).image_url 50 + img: (goods[0].images_list[0] || {}).image_url,
  51 + imgAlt: _.get(result, 'brand_info.brand_name', '') + '|' + _.get(result, 'product_name', '')
50 }; 52 };
51 } else { 53 } else {
52 result.bannerTop = { 54 result.bannerTop = {
53 list: goods.map((g) => { 55 list: goods.map((g) => {
54 return { 56 return {
55 - img: (g.images_list[0] || {}).image_url 57 + img: (g.images_list[0] || {}).image_url,
  58 + imgAlt: _.get(result, 'brand_info', 'brand_name', '') + '|' + _.get(result, 'product_name', '')
56 }; 59 };
57 }) 60 })
58 }; 61 };
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 {{/ bannerTop}} 20 {{/ bannerTop}}
21 </div> 21 </div>
22 22
23 - <div class="goods-name"><span class="name">{{product_name}}</span></div> 23 + <div class="goods-name"><h1 class="name">{{product_name}}</h1></div>
24 24
25 <div class="price-date"> 25 <div class="price-date">
26 <div> 26 <div>
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 <li class="swiper-slide"> 6 <li class="swiper-slide">
7 <a href="javascript:;"> 7 <a href="javascript:;">
8 {{#if @first}} 8 {{#if @first}}
9 - <img src="{{image2 img w=450 h=600 q=60}}" alt=""> 9 + <img src="{{image2 img w=450 h=600 q=60}}" alt="{{imgAlt}}">
10 {{else}} 10 {{else}}
11 - <img class="swiper-lazy" data-src="{{image2 img w=450 h=600 q=60}}" alt=""> 11 + <img class="swiper-lazy" data-src="{{image2 img w=450 h=600 q=60}}" alt="{{imgAlt}}">
12 {{/if}} 12 {{/if}}
13 </a> 13 </a>
14 </li> 14 </li>
@@ -27,10 +27,10 @@ @@ -27,10 +27,10 @@
27 <div class="banner-top-single"> 27 <div class="banner-top-single">
28 {{#if url}} 28 {{#if url}}
29 <a href="{{url}}"> 29 <a href="{{url}}">
30 - <img class="img" src="{{image2 img w=450 h=600 q=60}}"> 30 + <img class="img" src="{{image2 img w=450 h=600 q=60}}" alt="{{imgAlt}}">
31 </a> 31 </a>
32 {{^}} 32 {{^}}
33 - <img class="img" src="{{image2 img w=450 h=600 q=60}}"> 33 + <img class="img" src="{{image2 img w=450 h=600 q=60}}" alt="{{imgAlt}}">
34 {{/if}} 34 {{/if}}
35 35
36 </div> 36 </div>
@@ -111,7 +111,11 @@ class DetailProcess { @@ -111,7 +111,11 @@ class DetailProcess {
111 value.img = _.replace(value.img, '/quality/80', '/quality/70'); 111 value.img = _.replace(value.img, '/quality/80', '/quality/70');
112 112
113 bannerList.push({ 113 bannerList.push({
114 - img: value.img 114 + img: value.img,
  115 + imgAlt: _.get(origin, 'brand_info.brand_name_en', '') + '|' +
  116 + _.get(origin, 'brand_info.brand_name_cn', '') + '|' +
  117 + (_.get(origin, 'gender', '1') === '1' ? '男' : '女') + '|' +
  118 + _.get(origin, 'small_sort_name', '') + '|' + _.get(origin, 'product_name', '')
115 }); 119 });
116 }); 120 });
117 121