Authored by 马力

vedio

... ... @@ -46,6 +46,7 @@
<script type="text/template" id="fenmianTemp">
[[each goodsList as item index]]
<div class="form-group">
<div class="cover-color" style="text-align: left; margin-left: 10px">颜色封面:</div>
<div class="fm-side col-sm-2">
<div class="goods-img-left">
<p>SKC: [[item.productSkc]]</p>
... ... @@ -60,9 +61,7 @@
[[if index2%2==1]] </td></tr><tr><td>[[/if]]
[[/each]]</td>
</tr></table>
</div>
<div class="cover-color">颜色封面:</div>
</div>
<ul class="cover-image-list col-sm-10 image_index_class" style="padding: 0;margin: 0;" data-index=[[index]]>
[[each item.goodsImagesList as _item _index]]
... ... @@ -71,7 +70,7 @@
<a class="fileinput-button-icon" href="javascript:void(0);"><img src="[[_item.imageUrl]]"></a>
<i class="remove-item-btn glyphicon glyphicon-remove-circle"></i>
</div>
<div class="cover-color">
<div class="cover-color" style="line-height: 26px; height: 52px;">
[[if _item.isDefault=="Y"]]
<a href="javascript:;" class="btn btn-default btn-metro info" data-i="0">默认</a>
[[else]]
... ... @@ -92,6 +91,11 @@
[[else]]
<a href="javascript:;" class="btn btn-default btn-metro" data-i="2">女封</a>
[[/if]]
[[/if]]
[[if _item.vedioUrlId && _item.vedioUrlId != ""]]
<a href="javascript:;" class="btn-use-vedio btn btn-default info" data-index="[[_index]]" data-skcIndex="[[index]]" data-productSkc="[[item.productSkc]]" data-vedioId="[[_item.vedioUrlId]]">调用视频</a>
[[else]]
<a href="javascript:;" class="btn-use-vedio btn btn-default " data-index="[[_index]]" data-skcIndex="[[index]]" data-productSkc="[[item.productSkc]]">调用视频</a>
[[/if]]
</div>
</li>
... ...
... ... @@ -623,3 +623,67 @@ function sknDefaultImgFileupload() {
}
});
}
//封面视频调用弹出
var uesVedioDialog = null, uesVedioIndex=0;
$(document).on('click', '.btn-use-vedio', function() {
var productSkc = $(this).attr('data-productSkc'); // 当前点击的图片的skc信息
var skcIndex = $(this).attr('data-skcIndex');
var uesVedioIndex = $(this).data("index"); // 当前点击图片在当前skc中的序号
var selectVedioId = $(this).attr("data-vedioId"); // 当前图片已经选择的视频id 没选择则为null
common.util.__ajax({
url: '/productVideo/queryProductVideoList',
data: {
skn: NETSALEDATA.baseProductInfo.baseProduct.productSkn
}
}, function(res) {
var data = res.data;
var imgHtml = '';
if (res.code == 200 && data instanceof Array) {
var vedioHtml = "<div class = 'vedioList' style='border-top:solid black 1px;padding:8px;'><table><tr>";
$.each(data, function(i, vedioItem) {
var select_img_class = "";
if (selectVedioId && selectVedioId == vedioItem.id) {
select_img_class = " select_img";
}
vedioHtml += '<td><div style="height:123px; width:125px;margin:5px;text-align: center;line-height:20px" ><a style="display:inline-block" class="vedio_a'+ select_img_class + '"><img class="use-vedio"'
+ ' src="http://admin.portal.yohobuy.com/static/assets/images/defaultvideo.png'
+ '" alt="" data-vedioid="' + vedioItem.id + '" data-index="' + i + '" style="cursor:pointer;" /></a><span style="display:inline;height:100%;line-height:0px">' + vedioItem.videoName + "-"
+ vedioItem.id +'</span></div></td>';
})
vedioHtml += "</tr></table></div>";
imgHtml += vedioHtml;
uesVedioDialog = common.dialog.confirm("调用视频", imgHtml, function(){ // 确认事件触发
var newSelectVedioId = $(".vedio_a.select_img").find('img').attr('data-vedioid'); // 重新选择的视频id 如果无值则代表需要清除当前封面的视频
if (newSelectVedioId) {
$('a[data-index='+ uesVedioIndex +'][data-productSkc='+ productSkc +']').attr('data-vedioId', newSelectVedioId).addClass('info');
} else {
$('a[data-index='+ uesVedioIndex +'][data-productSkc='+ productSkc +']').attr('data-vedioId', '').removeClass('info');
}
resetVedioId(skcIndex, uesVedioIndex, newSelectVedioId);
},function(){ // 取消的事件触发
});
} else {
common.util.__tip('没有可调用的图片', 'warning');
}
}, true);
});
//点击调用的视频列表添加到封面上
$(document).on('click', '.use-vedio', function(event) {
var index=$(this).data("index");
$(".vedio_a").not($(this).parent("a")).removeClass("select_img");
$(this).parent("a").toggleClass("select_img");
});
//设置视频Id到内存中goodList中
function resetVedioId(skcIndex, uesVedioIndex, newSelectVedioId) {
//var list = goodsList[skcIndex].goodsImagesList;
var item = goodsList[skcIndex].goodsImagesList[uesVedioIndex];
item.vedioUrlId = newSelectVedioId;
renderGoodList();
};
\ No newline at end of file
... ...