...
|
...
|
@@ -11,7 +11,6 @@ var common = require('../common/common'); |
|
|
var g = new common.grid({
|
|
|
el: '#content-list',
|
|
|
hash: false,
|
|
|
//查询参数
|
|
|
parms: function () {
|
|
|
return {
|
|
|
//查询参数
|
...
|
...
|
@@ -26,26 +25,26 @@ var g = new common.grid({ |
|
|
columns: [
|
|
|
{display: "SKN", name: "productSkn"},
|
|
|
{
|
|
|
display: "最后上传时间", name: "updateTime",
|
|
|
display: "最后上传时间", name: "lastAddTime",
|
|
|
render: function (item) {
|
|
|
var t = new Date(item.updateTime * 1000);
|
|
|
var t = new Date(item.lastAddTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
return "<p>" + formatted + "</p>";
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: "图片", name: "pictureBoList", render: function (item) {
|
|
|
var a=item.pictureBoList;
|
|
|
if(a.length>0){
|
|
|
var a = item.pictureBoList || [];
|
|
|
if (a.length > 0) {
|
|
|
var b;
|
|
|
for(var i=0;i< a.length;i++){
|
|
|
|
|
|
b=b+'<img src="' + item.pictureBoList[i].fileName + '" width="100" height="60"/>'
|
|
|
for (var i = 0; i < a.length; i++) {
|
|
|
b = b + '<img src="' + item.pictureBoList[i].fileName + '" width="100" height="60"/>'
|
|
|
}
|
|
|
return b.substr(9);
|
|
|
}
|
|
|
//return '<img src="' + item.pictureBoList[0].fileName + '" width="100" height="60"/>'
|
|
|
//console.log("item.pictureBoList", item.pictureBoList);
|
|
|
else {
|
|
|
return ""
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -59,8 +58,70 @@ var g = new common.grid({ |
|
|
]
|
|
|
});
|
|
|
g.init("/shotManage/proPhoto/index2");
|
|
|
var pictureBoList = [];
|
|
|
var Bll = {
|
|
|
toast: function (url, item, hint) {
|
|
|
var a = common.dialog.confirm(hint,
|
|
|
common.util.__template2($("#template1").html(), item),
|
|
|
function () {
|
|
|
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: {
|
|
|
productSku: parseInt($("#Sku").val()),
|
|
|
productPhotoAddBoList: JSON.stringify(pictureBoList)
|
|
|
}
|
|
|
}, function (res) {
|
|
|
g.reload();
|
|
|
//a.close();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
common.edit.ajaxfileupload(".picfile", {
|
|
|
params: {
|
|
|
__type: "upload",
|
|
|
bucket: "goodsimg"
|
|
|
},
|
|
|
valid_extensions: ['png', 'jpg', 'jpeg'],
|
|
|
onComplete: function (response) {
|
|
|
if (response.status && response.code == 200) {
|
|
|
var item = pictureBoList || [];
|
|
|
var data = {
|
|
|
"fileName": response.data
|
|
|
};
|
|
|
item.push(data);
|
|
|
console.log(JSON.stringify(pictureBoList))
|
|
|
$("#addPic").html(common.util.__template2($("#template2").html(),
|
|
|
{
|
|
|
pictureBoList: item
|
|
|
}
|
|
|
));
|
|
|
}
|
|
|
else {
|
|
|
common.util.__tip(response.message, 'warning');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
//上传图片--点击事件
|
|
|
$('#upload-btn').on('click', function () {
|
|
|
var item = {};
|
|
|
Bll.toast('/shotManage/proPhoto/add', item, "上传图片");
|
|
|
});
|
|
|
|
|
|
|
|
|
//查询按钮--点击事件
|
|
|
$(document).on('click', '#filter-btn', function () {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
//封面图删除
|
|
|
$(document).on('click', '.remove-item-btn', function() {
|
|
|
//界面删除
|
|
|
$(this).parents('.cover-image-item').remove();
|
|
|
//TODO 数组中删除
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|