b29942a5075fd44b50ea665f2423f2e30776e38b.svn-base 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. var reorder = 0;
  2. function loadUpload(i,e,key,upload,assets)
  3. {
  4. e.uploadify({
  5. 'formData' : {'key' : key},
  6. 'swf' : assets + 'uploadify.swf',
  7. 'buttonText' : '选择文件',
  8. 'uploader' : upload,
  9. 'cancelImg' : assets + 'image/uploadify-cancel.png',
  10. 'width':'160',//选择文件按钮的宽度
  11. 'height':'160',//选择文件按钮的高度
  12. 'buttonText' : '',
  13. //'buttonClass' : 'update',
  14. 'onUploadSuccess':function(file,data,response)
  15. {
  16. console.info(data);
  17. var data = eval('('+data+')');
  18. if(data.status)
  19. {
  20. var value = e.attr('v');
  21. if(value.indexOf('mul') != -1 && $(value).length)
  22. {
  23. var img = '<img src="'+data.url+'" width="">';
  24. $(value).eq(reorder).html(img);
  25. $("#content").val($("#content").val() + "<br />" + img);
  26. reorder++;
  27. if(reorder > 5)
  28. {
  29. reorder = 0;
  30. }
  31. }
  32. else
  33. {
  34. jQuery("#"+file.id).find('.data').html('上传完毕');
  35. jQuery("#"+file.id).hide();
  36. jQuery('#'+value).val(data.url);
  37. jQuery('#show_'+value).attr('style','background:url("'+data.url+'") no-repeat;background-size:contain;');
  38. var img = '<img src="'+data.url+'" width="">';
  39. var vv = '';
  40. $(".img_value").each(function()
  41. {
  42. if($(this).val())
  43. {
  44. vv += '<img src="'+data.url+'" width=""><br />';
  45. }
  46. });
  47. //alert(vv);
  48. $("#content").val(vv);
  49. }
  50. }
  51. else
  52. {
  53. jQuery("#"+file.id).find('.data').html("<font color='red'>"+data.message+"</font>");
  54. return false;
  55. }
  56. }
  57. });
  58. }
  59. if(jQuery.browser.msie){
  60. SWFUpload.prototype.getFlashHTML = function () {
  61. return ['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
  62. '<param name="wmode" value="', this.settings.button_window_mode , '" />',
  63. '<param name="movie" value="', this.settings.flash_url, '" />',
  64. '<param name="quality" value="high" />',
  65. '<param name="menu" value="false" />',
  66. '<param name="allowScriptAccess" value="always" />',
  67. '<param name="flashvars" value="' + this.getFlashVars() + '" />',
  68. '</object>'].join("");
  69. }
  70. }