| | |
| | | formData.append('file', $('#file')[0].files[0]) //把file添加进去 name命名为img |
| | | layer.load(); //上传loading |
| | | $.ajax({ |
| | | url: Feng.ctxPath + '/upload/image1', |
| | | url: Feng.ctxPath + '/upload/image', |
| | | data: formData, |
| | | type: "POST", |
| | | async: true, |
| | | cache: false, |
| | | contentType: false, |
| | | processData: false, |
| | | success: function(res) { |
| | | success: function (res) { |
| | | layer.closeAll('loading'); //关闭loading |
| | | $('#file').val(''); |
| | | if(fileId == 'imgUrl'){ |
| | | $('#' + fileId).append('<div><img src="' + res + '" width="100px" class="imgUrl"><i class="fa fa-close" onclick="delImg(this, \'imgUrl\', 1)" style="color: red;color: red;font-size: 18px;position: absolute;left: 108px;top: -8px;"></i></div> '); |
| | | if (fileId == 'imgUrl') { |
| | | $('#' + fileId).append('<div><img src="' + res.data + '" width="100px" class="imgUrl"><i class="fa fa-close" onclick="delImg(this, \'imgUrl\', 1)" style="color: red;color: red;font-size: 18px;position: absolute;left: 108px;top: -8px;"></i></div> '); |
| | | let files = $('#' + fileId).find('img'); |
| | | $($('#' + fileId).parent('div')).siblings('label').text('*车辆图片(' + files.length + '/15):'); |
| | | } |
| | | if(fileId == 'videoUrl'){ |
| | | $('#' + fileId).append('<div><video src="' + res + '" controls style="width: 200px !important;" class="videoUrl"></video><i class="fa fa-close" onclick="delImg(this, \'videoUrl\', 2)" style="color: red;color: red;font-size: 18px;position: absolute;left: 108px;top: -8px;"></i></div> '); |
| | | if (fileId == 'videoUrl') { |
| | | $('#' + fileId).append('<div><video src="' + res.data + '" controls style="width: 200px !important;" class="videoUrl"></video><i class="fa fa-close" onclick="delImg(this, \'videoUrl\', 2)" style="color: red;color: red;font-size: 18px;position: absolute;left: 108px;top: -8px;"></i></div> '); |
| | | let files = $('#' + fileId).find('video'); |
| | | $($('#' + fileId).parent('div')).siblings('label').text('*车辆视频(' + files.length + '/1):'); |
| | | } |
| | | if(fileId == 'describeImgUrl'){ |
| | | $('#' + fileId).append('<div><img src="' + res + '" width="100px" class="describeImgUrl"/><i class="fa fa-close" onclick="delImg(this, \'describeImgUrl\')" style="color: red;color: red;font-size: 18px;position: absolute;left: 108px;top: -8px;"></i></div> '); |
| | | if (fileId == 'describeImgUrl') { |
| | | $('#' + fileId).append('<div><img src="' + res.data + '" width="100px" class="describeImgUrl"/><i class="fa fa-close" onclick="delImg(this, \'describeImgUrl\')" style="color: red;color: red;font-size: 18px;position: absolute;left: 108px;top: -8px;"></i></div> '); |
| | | } |
| | | } |
| | | }) |