Showing
1 changed file
with
49 additions
and
13 deletions
@@ -333,13 +333,29 @@ | @@ -333,13 +333,29 @@ | ||
333 | for(var i=0; i<files.length;i++){ | 333 | for(var i=0; i<files.length;i++){ |
334 | var obj = files[i]; | 334 | var obj = files[i]; |
335 | if(obj!=null && obj!=''){ | 335 | if(obj!=null && obj!=''){ |
336 | + debugger | ||
337 | + if(obj.name.substring(obj.name.lastIndexOf(".")).toLowerCase() == '.png'){ | ||
338 | + $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;}); | ||
339 | + return false; | ||
340 | + } | ||
336 | if(obj.type.toLowerCase() == 'image/png'){ | 341 | if(obj.type.toLowerCase() == 'image/png'){ |
337 | $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;}); | 342 | $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;}); |
338 | return false; | 343 | return false; |
339 | } | 344 | } |
340 | } | 345 | } |
341 | } | 346 | } |
342 | - | 347 | + var imageCount = 0; |
348 | + $("input[name='url']").each(function(j,item){ | ||
349 | + debugger | ||
350 | + var url = item.value; | ||
351 | + if(url != ''){ | ||
352 | + imageCount++; | ||
353 | + } | ||
354 | + }); | ||
355 | + if(imageCount +files.length > 9 ){ | ||
356 | + $.messager.alert("提示","最多上传九张图片", "info"); | ||
357 | + return false; | ||
358 | + } | ||
343 | $.messager.progress({ | 359 | $.messager.progress({ |
344 | title: "正在执行", | 360 | title: "正在执行", |
345 | msg: "正在执行,请稍后...", | 361 | msg: "正在执行,请稍后...", |
@@ -351,6 +367,8 @@ | @@ -351,6 +367,8 @@ | ||
351 | debugger; | 367 | debugger; |
352 | if (!data || data.code != 200) { | 368 | if (!data || data.code != 200) { |
353 | $.messager.progress("close"); | 369 | $.messager.progress("close"); |
370 | + initimg(1,1); | ||
371 | + $(this).remove(); | ||
354 | $.messager.alert("错误",data.message); | 372 | $.messager.alert("错误",data.message); |
355 | return ""; | 373 | return ""; |
356 | } | 374 | } |
@@ -430,17 +448,17 @@ | @@ -430,17 +448,17 @@ | ||
430 | // if(num >9){ | 448 | // if(num >9){ |
431 | // return | 449 | // return |
432 | // } | 450 | // } |
433 | - var imageCount = 0; | ||
434 | - $("input[name='url']").each(function(j,item){ | ||
435 | - debugger | ||
436 | - var url = item.value; | ||
437 | - if(url != ''){ | ||
438 | - imageCount++; | ||
439 | - } | ||
440 | - }); | ||
441 | - if(imageCount > 8 ){ | ||
442 | - return; | ||
443 | - } | 451 | + // var imageCount = 0; |
452 | + // $("input[name='url']").each(function(j,item){ | ||
453 | + // debugger | ||
454 | + // var url = item.value; | ||
455 | + // if(url != ''){ | ||
456 | + // imageCount++; | ||
457 | + // } | ||
458 | + // }); | ||
459 | + // if(imageCount > 8 ){ | ||
460 | + // return; | ||
461 | + // } | ||
444 | $("#imageUpload"+num).imageUpload({ | 462 | $("#imageUpload"+num).imageUpload({ |
445 | width: 171, | 463 | width: 171, |
446 | height: 120, | 464 | height: 120, |
@@ -457,13 +475,29 @@ | @@ -457,13 +475,29 @@ | ||
457 | for(var i=0; i<files.length;i++){ | 475 | for(var i=0; i<files.length;i++){ |
458 | var obj = files[i]; | 476 | var obj = files[i]; |
459 | if(obj!=null && obj!=''){ | 477 | if(obj!=null && obj!=''){ |
478 | + debugger | ||
479 | + if(obj.name.substring(obj.name.lastIndexOf(".")).toLowerCase() == 'png'){ | ||
480 | + $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;}); | ||
481 | + return false; | ||
482 | + } | ||
460 | if(obj.type.toLowerCase() == 'image/png'){ | 483 | if(obj.type.toLowerCase() == 'image/png'){ |
461 | $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;}); | 484 | $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;}); |
462 | return false; | 485 | return false; |
463 | } | 486 | } |
464 | } | 487 | } |
465 | } | 488 | } |
466 | - | 489 | + var imageCount = 0; |
490 | + $("input[name='url']").each(function(j,item){ | ||
491 | + debugger | ||
492 | + var url = item.value; | ||
493 | + if(url != ''){ | ||
494 | + imageCount++; | ||
495 | + } | ||
496 | + }); | ||
497 | + if(imageCount +files.length > 9 ){ | ||
498 | + $.messager.alert("提示","最多上传九张图片", "info"); | ||
499 | + return false; | ||
500 | + } | ||
467 | $.messager.progress({ | 501 | $.messager.progress({ |
468 | title: "正在执行", | 502 | title: "正在执行", |
469 | msg: "正在执行,请稍后...", | 503 | msg: "正在执行,请稍后...", |
@@ -475,6 +509,8 @@ | @@ -475,6 +509,8 @@ | ||
475 | debugger; | 509 | debugger; |
476 | if (!data || data.code != 200) { | 510 | if (!data || data.code != 200) { |
477 | $.messager.progress("close"); | 511 | $.messager.progress("close"); |
512 | + initimg(num,1); | ||
513 | + $(this).remove(); | ||
478 | $.messager.alert("错误",data.message); | 514 | $.messager.alert("错误",data.message); |
479 | return ""; | 515 | return ""; |
480 | } | 516 | } |
-
Please register or login to post a comment