Authored by 沈志敏

fix bug

... ... @@ -32,7 +32,7 @@ export default {
simplevars(),
nested(),
cssnext({ warnForDuplicates: false, }),
cssnano(),
cssnano({zindex: false}),
],
extensions: ['.css'],
}),
... ...
... ... @@ -5,7 +5,7 @@
left: 0;
width: 100%;
height: 100%;
z-index: 1;
z-index: 1000;
background: rgba(0, 0, 0, .5);
}
... ...
... ... @@ -5,7 +5,7 @@
left: 0;
width: 100%;
height: 100%;
z-index: 1;
z-index: 1000;
background: rgba(0, 0, 0, .5);
}
... ...
... ... @@ -120,86 +120,68 @@
<img src="http://img02.yohoboys.com/staticimg/2016/04/22/14/02a8b1c09363f84c34aa56d11bb5cd7eb4.png">
</a>
<a class="anchor" href='http://union.yoho.cn/union/downapp.html'></a>
<input id="imgwh" type="hidden" name="" value="200x300">
<div class="feature-product-info">
<a class="product-brand" href="xxx">
<span class="brand-name">xxx</span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="xxx">
<div>
<img class="product-detail-img" src="xxx">
</div>
<div class="product-detail-text">
<div class="name">
<span class="product-name">xxx</span>
<div class="product-source" condition='{"sort":"123,3213,3123,3123","enum":1, "pid":1}'>
<input id="imgwh" type="hidden" value="200x300">
<div class="feature-product-info">
<a class="product-brand" href="xxx">
<span class="brand-name">xxx</span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="xxx">
<div>
<img class="product-detail-img" src="xxx">
</div>
<div class="price">
<span class="sale-price">xxx</span>
<span class="market-price">xxx</span>
<div class="product-detail-text">
<div class="name">
<span class="product-name">xxx</span>
</div>
<div class="price">
<span class="sale-price">xxx</span>
<span class="market-price">xxx</span>
</div>
</div>
</div>
</a>
</div>
<div class="feature-product-info">
<a class="product-brand" href="">
<span class="brand-name"></span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="">
<div>
<img class="product-detail-img" src="">
</div>
<div class="product-detail-text">
<div class="name">
<span class="product-name"></span>
</div>
<div class="price">
<span class="sale-price"></span>
<span class="market-price"></span>
</a>
</div>
<div class="feature-product-info">
<a class="product-brand" href="">
<span class="brand-name"></span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="">
<div>
<img class="product-detail-img" src="">
</div>
</div>
</a>
</div>
<div class="feature-product-info">
<a class="product-brand" href="">
<span class="brand-name"></span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="">
<div>
<img class="product-detail-img" src="">
</div>
<div class="product-detail-text">
<div class="name">
<span class="product-name"></span>
<div class="product-detail-text">
<div class="name">
<span class="product-name"></span>
</div>
<div class="price">
<span class="sale-price"></span>
<span class="market-price"></span>
</div>
</div>
<div class="price">
<span class="sale-price"></span>
<span class="market-price"></span>
</div>
</div>
</a>
</div>
<div class="feature-product-info">
<a class="product-brand" href="">
<span class="brand-name"></span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="">
<div>
<img class="product-detail-img" src="">
</div>
<div class="product-detail-text">
<div class="name">
<span class="product-name"></span>
</a>
</div>
<div class="feature-product-info">
<a class="product-brand" href="">
<span class="brand-name"></span>
<span class="brand-go">进入店铺</span>
</a>
<a class="product-detail" href="">
<div>
<img class="product-detail-img" src="">
</div>
<div class="price">
<span class="sale-price"></span>
<span class="market-price"></span>
<div class="product-detail-text">
<div class="name">
<span class="product-name"></span>
</div>
<div class="price">
<span class="sale-price"></span>
<span class="market-price"></span>
</div>
</div>
</div>
</a>
</a>
</div>
</div>
<script src="//cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>
<script src="../dist/js-sdk/1.0.0/jssdk.js"></script>
... ...
... ... @@ -4,38 +4,46 @@ import utils from './utils';
import cookies from './cookies';
let _getProduct = function(param) {
jsonp({
url: '//m.yohobuy.com/activity/individuation?callback=?',
data: param
}).then((res)=> {
if (res && res.length) {
let data,
goods = $('.feature-product-info');
$('.product-source').each(function(indx, el){
el = $(el);
let cond = JSON.parse(el.attr('condition') || '{}');
if (!goods.length) {
return;
}
jsonp({
url: '//m.yohobuy.com/activity/individuation?callback=?',
data: Object.assign({}, param, cond)
}).then((res)=> {
if (res && res.length) {
let data,
goods = el.find('.feature-product-info');
// 获取图片宽x高
let imgwh = $('#imgwh').val() || '';
imgwh = imgwh.split('x') || [];
if (!goods.length) {
return;
}
let w = imgwh[0] || 450,
h = imgwh[1] || 500;
// 获取图片宽x高
let imgwh = el.find('#imgwh').val() || '';
imgwh = imgwh.split('x') || [];
goods.each(function(idex, el) {
data = res[idex];
el = $(el);
let w = imgwh[0] || 450,
h = imgwh[1] || 500;
el.find('.brand-name').html(data.brand_name);
el.find('a.product-brand').attr('href', `//m.yohobuy.com/product/index/brand?domain=${data.brand_domain}`);
el.find('a.product-detail').attr('href', `//m.yohobuy.com/product/pro_${data.product_id}_${data.goods_id}/${data.cn_alphabet}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn}}}`);
el.find('.product-detail-img').attr('src', utils.image(data.default_images, w, h, 2, 60));
el.find('.product-name').html(data.product_name);
el.find('.sale-price').html(${data.sales_price}`);
el.find('.market-price').html(${data.market_price}`);
});
}
goods.each(function(indx, el) {
data = res[indx];
if (!data) {
return;
}
el = $(el);
el.find('.brand-name').html(data.brand_name);
el.find('a.product-brand').attr('href', `//m.yohobuy.com/product/index/brand?domain=${data.brand_domain}`);
el.find('a.product-detail').attr('href', `//m.yohobuy.com/product/pro_${data.product_id}_${data.goods_id}/${data.cn_alphabet}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn}}}`);
el.find('.product-detail-img').attr('src', utils.image(data.default_images, w, h, 2, 60));
el.find('.product-name').html(data.product_name);
el.find('.sale-price').html(${data.sales_price}`);
el.find('.market-price').html(${data.market_price}`);
});
}
});
});
};
... ...
... ... @@ -65,6 +65,9 @@ let _bindEvent = function() {
$tipTmpl.fadeOut();
e.preventDefault();
});
$body.on('click', '.featuretip .refresh', function() {
location.reload();
});
$body.on('click', '.featuretip.tip-wrap', function(e) {
if ('featuretip tip-wrap' === e.target.className) {
$tipTmpl.fadeOut();
... ... @@ -73,21 +76,6 @@ let _bindEvent = function() {
});
};
let _bindUnionType = function() {
let qs = _queryString();
let union_type = qs.mkt_code || qs.union_type;
if (union_type) {
$('a').each(function(indx, el) {
el = $(el);
let h = el.attr('href');
if (h.indexOf('union.yoho.cn/union/downapp.html') > -1) {
el.attr('href', h + '?union_type=' + union_type);
}
});
}
};
export default {
queryString: _queryString,
init() {
... ... @@ -96,9 +84,6 @@ export default {
// 绑定事件
_bindEvent();
// 下载链接绑定union_type
_bindUnionType();
},
isApp() {
let qs = _queryString();
... ... @@ -129,7 +114,7 @@ export default {
if (data.close) {
$tipTmpl.find('.button').addClass('close');
} else {
$tipTmpl.find('.button').html('刷新');
$tipTmpl.find('.button').addClass('refresh').html('刷新');
}
$('body').append($tipTmpl);
... ...