增加文章、商品列表修改排序功能
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<tr>
|
||||
<th>栏目名称</th>
|
||||
<th>ID</th>
|
||||
<th class="text-center" style="width:140px">排序</th>
|
||||
<th class="text-center" style="width:130px">排序</th>
|
||||
<th class="text-center">文章数量</th>
|
||||
<th class="text-center">隐藏</th>
|
||||
<th width="200">操作</th>
|
||||
@@ -70,10 +70,10 @@
|
||||
return false;
|
||||
}
|
||||
//console.log(rank);
|
||||
//if (!isIntNum(rank)) {
|
||||
// layer.alert("排序只能是数字!", { icon: 2 });
|
||||
// return false;
|
||||
//}
|
||||
if (!isInt(rank)) {
|
||||
layer.alert("排序只能是数字!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
|
||||
@@ -142,33 +142,45 @@
|
||||
title: '所属栏目'
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '文章标题'
|
||||
title: '文章标题',
|
||||
formatter: function (value, row, index) {
|
||||
return '<a href="/Article/Detail/' + row["id"] + '" target="_blank" title="新窗口打开预览文章">' + value + '</a>'
|
||||
}
|
||||
}, {
|
||||
field: 'sequence',
|
||||
title: '排序'
|
||||
title: '排序',
|
||||
width: 130,
|
||||
formatter: function (value, row, index) {
|
||||
return '<div class="input-group"><input type="number" class="form-control" id="ac_rank_' + row["id"] + '" name="ac_rank_' + row["id"] + '" value="' + value + '" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveSequence(' + row["id"] + ')"><i class="fa fa-save"></i></a></div>'
|
||||
}
|
||||
}, {
|
||||
field: 'addTime',
|
||||
title: '添加时间'
|
||||
title: '添加时间',
|
||||
width:150
|
||||
}, {
|
||||
field: 'isNew',
|
||||
title: '最新',
|
||||
align: 'center',
|
||||
formatter: 'newFormatter'
|
||||
formatter: 'newFormatter',
|
||||
width: 65
|
||||
}, {
|
||||
field: 'isRecommend',
|
||||
title: '推荐',
|
||||
align: 'center',
|
||||
formatter: 'recommendFormatter'
|
||||
formatter: 'recommendFormatter',
|
||||
width: 65
|
||||
}, {
|
||||
field: 'isHide',
|
||||
title: '隐藏',
|
||||
align: 'center',
|
||||
formatter: 'hideFormatter'
|
||||
formatter: 'hideFormatter',
|
||||
width: 65
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
formatter: 'actionFormatter',
|
||||
width:140
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -228,7 +240,45 @@
|
||||
};
|
||||
|
||||
return oInit;
|
||||
};
|
||||
};
|
||||
function doSaveSequence(id) {
|
||||
var rank = $("#ac_rank_" + id).val();
|
||||
if (rank == '') {
|
||||
layer.alert("请输入排序!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
//console.log(rank);
|
||||
if (!isInt(rank)) {
|
||||
layer.alert("排序只能是数字!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Article/DoEditArticleSequence",
|
||||
data: { id: id, rank: rank },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
//window.location.href = window.location.href;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user