...
|
...
|
@@ -67,7 +67,7 @@ g.init("/shotManage/proPhoto/index2"); |
|
|
var Bll = {
|
|
|
pictureBoList: [],
|
|
|
selectedBoId: [],
|
|
|
clonePics:[],
|
|
|
clonePics: [],
|
|
|
//重新渲染图片列表
|
|
|
rendBoList: function (pictureBoList) {
|
|
|
$(".image-list").html('');
|
...
|
...
|
@@ -78,9 +78,9 @@ var Bll = { |
|
|
));
|
|
|
},
|
|
|
//获取编辑时新增的图片
|
|
|
getNewPics:function(pictureBoList){
|
|
|
var newPic=[];
|
|
|
if(pictureBoList.length>0){
|
|
|
getNewPics: function (pictureBoList) {
|
|
|
var newPic = [];
|
|
|
if (pictureBoList.length > 0) {
|
|
|
for (var i = 0; i < pictureBoList.length; i++) {
|
|
|
if (!pictureBoList[i].id) {
|
|
|
newPic.push(pictureBoList[i])
|
...
|
...
|
@@ -91,7 +91,7 @@ var Bll = { |
|
|
},
|
|
|
//模态
|
|
|
toast: function (url, item, datacall) {
|
|
|
Bll.pictureBoList = item.pictureBoList||[];
|
|
|
Bll.pictureBoList = item.pictureBoList || [];
|
|
|
Bll.selectedBoId = [];
|
|
|
var a = new common.dialog({
|
|
|
title: "图片",
|
...
|
...
|
@@ -100,31 +100,27 @@ var Bll = { |
|
|
button: [
|
|
|
{
|
|
|
value: "提交", callback: function () {
|
|
|
var data={};
|
|
|
if(item.__state=='add'){
|
|
|
var data = {};
|
|
|
if (item.__state == 'add') {
|
|
|
data = datacall && datacall(Bll.clonePics, Bll.selectedBoId);
|
|
|
}else{
|
|
|
} else {
|
|
|
data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId);
|
|
|
}
|
|
|
console.log("最终提交数据data",data);
|
|
|
console.log("最终提交数据data", data);
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: data
|
|
|
}, function (res) {
|
|
|
|
|
|
if (res.code == '200') {
|
|
|
g.reload();
|
|
|
a.close();
|
|
|
}
|
|
|
else{
|
|
|
console.log("res",res);
|
|
|
if(res.data.length>0){
|
|
|
var mess="失败列表:";
|
|
|
for(var i=0;i<res.data.length;i++){
|
|
|
mess=mess+res.data[i].originalName+";"
|
|
|
if (res.data.length > 0) {
|
|
|
var mess = "失败列表:";
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
|
mess =mess + '<p>'+res.data[i].originalName + ';'+'</p>';
|
|
|
}
|
|
|
common.util.__tip(mess, 'warning');
|
|
|
}
|
|
|
g.reload();
|
|
|
a.close();
|
|
|
}
|
|
|
});
|
|
|
return false;
|
...
|
...
|
@@ -145,13 +141,13 @@ var Bll = { |
|
|
valid_extensions: ['png', 'jpg', 'jpeg'],
|
|
|
onComplete: function (response) {
|
|
|
if (response.status && response.code == 200) {
|
|
|
for(var i=0;i<response.data.length;i++){
|
|
|
for (var i = 0; i < response.datas.length; i++) {
|
|
|
Bll.pictureBoList.push({
|
|
|
"fileName": response.data[i],
|
|
|
"fileName": response.datas[i],
|
|
|
"originalName": response.names[i]
|
|
|
});
|
|
|
Bll.clonePics.push({
|
|
|
"fileName": response.data[i],
|
|
|
"fileName": response.datas[i],
|
|
|
"originalName": response.names[i]
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -169,7 +165,7 @@ $('#upload-btn').on('click', function () { |
|
|
var item = {
|
|
|
__state: "add"
|
|
|
};
|
|
|
Bll.clonePics=[];
|
|
|
Bll.clonePics = [];
|
|
|
Bll.toast('/shotManage/proPhoto/add', item, function (pictureBoList, selectedBoId) {
|
|
|
return {
|
|
|
productPhotoAddStrList: JSON.stringify(pictureBoList)
|
...
|
...
|
@@ -181,8 +177,8 @@ $('#upload-btn').on('click', function () { |
|
|
$(document).on('click', '.update', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
item.__state = "update";
|
|
|
Bll.clonePics=[];
|
|
|
Array.prototype.push.apply(Bll.clonePics,item.pictureBoList);
|
|
|
Bll.clonePics = [];
|
|
|
Array.prototype.push.apply(Bll.clonePics, item.pictureBoList);
|
|
|
Bll.toast('/shotManage/proPhoto/add', item, function (pictureBoList, selectedBoId) {
|
|
|
return {
|
|
|
productSkn: item.productSkn,
|
...
|
...
|
@@ -195,7 +191,7 @@ $(document).on('click', '.update', function () { |
|
|
//删除单张图片
|
|
|
$(document).on('click', '.remove1', function () {
|
|
|
var index = $(this).data("index");
|
|
|
if(Bll.clonePics[index].id){
|
|
|
if (Bll.clonePics[index].id) {
|
|
|
Bll.selectedBoId.push(Bll.clonePics[index].id);
|
|
|
}
|
|
|
Bll.clonePics.splice(index, 1);
|
...
|
...
|
|