Authored by ZhongW

封面排序

... ... @@ -33,10 +33,10 @@
<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">
[[if _item.isDefault=="Y"]]
<a href="javascript:;" class="btn btn-default btn-metro info" data-i="0">默认</a>
[[else]]
[[else]]
<a href="javascript:;" class="btn btn-default btn-metro" data-i="0">默认</a>
[[/if]]
... ... @@ -54,7 +54,11 @@
[[else]]
<a href="javascript:;" class="btn btn-default btn-metro" data-i="2">女封</a>
[[/if]]
[[/if]]
[[/if]]
</div>
<div class="cover-color">
<a href="javascript:;" class="btn btn-primary move_sort left" data-i=[[_index]]>左移</a>
<a href="javascript:;" class="btn btn-primary move_sort right" id=[[index]]"move_right"[[_index]] data-i=[[_index]]>右移</a>
</div>
</li>
[[/each]]
... ...
... ... @@ -325,6 +325,21 @@ function renderGoodList() {
goodsList: goodsList,
gender:gender
}));
for(var i in goodsList){
// var index = goodsList[i].goodsImagesList.length;
// alert(index);
// $(".right").each(function(){
// alert($(this).attr("data-i"))
// })
// $(".cover-image-list").hasAttr()
// alert(typeof($(".move_sort").find(".right").attr("data-i")))
// if(=="undefined"
// $(".move_sort") data-i ind("")
// addFengmian(uesImgIndex, uesImgMap[i]);
}
//添加封面图
common.edit.ajaxfileupload(".fenmianfile", {
params: {
... ... @@ -489,6 +504,28 @@ $(document).on("click", "#fenMainSave", function () {
return false;
});
//图片排序
$(document).on('click', '.move_sort', function() {
if($(this).hasClass("right")){
var img_index = $(this).attr("data-i");
var img = goodsList[0].goodsImagesList[img_index];
var imgright = goodsList[0].goodsImagesList[parseInt(img_index)+1];
goodsList[0].goodsImagesList[img_index] = imgright;
goodsList[0].goodsImagesList[parseInt(img_index)+1] = img;
// goodsList[0].goodsImagesList.splice(img_index, 1);
// goodsList[0].goodsImagesList.push(img);
}else{
var img_index = $(this).attr("data-i");
var img = goodsList[0].goodsImagesList[img_index];
var imgleft = goodsList[0].goodsImagesList[parseInt(img_index)-1];
goodsList[0].goodsImagesList[img_index] = imgleft;
goodsList[0].goodsImagesList[parseInt(img_index)-1] = img;
}
renderGoodList();
});
GOLABDATA.on("fenmian", function () {
var map = {
goodsImagesBoList: []
... ...