|
@@ -69,11 +69,11 @@
|
|
|
|
|
|
<div class="row cl">
|
|
|
<label class="form-label col-xs-4 col-sm-3">零件图片:</label>
|
|
|
- <div class="formControls col-xs-8 col-sm-9">
|
|
|
- <input type="file" name="file" id="fileid">
|
|
|
+ <div class="formControls col-xs-8 col-sm-9" id="fileDiv">
|
|
|
+ <input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;">
|
|
|
<img alt="介绍图" src="/common/images/pts/addparts.jpg" id="partsImg" width="90" height="80">
|
|
|
<input type="hidden" id="componentsImg" name="componentsImg" value=""/>
|
|
|
- <button type="button" class="btn" style="background: #32a3d8;color: #fff;-webkit-transform:translateY(-5%);" id="uploadSubmit"><i class="Hui-iconfont"></i> 上传</button>
|
|
|
+ <#--<button type="button" class="btn" style="background: #32a3d8;color: #fff;-webkit-transform:translateY(-5%);" id="uploadSubmit"><i class="Hui-iconfont"></i> 上传</button>-->
|
|
|
</div>
|
|
|
</div>
|
|
|
<#--<div class="row cl">
|
|
@@ -280,23 +280,30 @@
|
|
|
});
|
|
|
|
|
|
|
|
|
- $('#uploadSubmit').click(function() {
|
|
|
+ /* $('#uploadSubmit').click(function() {*/
|
|
|
+ $('#fileid').change(function() {
|
|
|
+ fileUpload();
|
|
|
+ });
|
|
|
+
|
|
|
+ function fileUpload() {
|
|
|
$.ajaxFileUpload({
|
|
|
- url:"${path}/admin/machineParts/fileUpload",//需要链接到服务器地址
|
|
|
+ url:"${path}/admin/machineParts/fileUpload",
|
|
|
secureuri:false,
|
|
|
fileElementId:"fileid",//文件选择框的id属性
|
|
|
dataType: 'json', //json
|
|
|
success: function (data) {
|
|
|
if(data.returnCode == 200){
|
|
|
- alert(${path});
|
|
|
$('#componentsImg').val(data.returnMsg.imgUrl);
|
|
|
- $('#partsImg').attr("src",${path}+"/"+data.returnMsg.imgUrl);
|
|
|
+ $('#partsImg').attr("src",data.returnMsg.imgUrl);
|
|
|
+ $("#fileid").remove();
|
|
|
+ /*<input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;">*/
|
|
|
+ $("#fileDiv").prepend('<input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;" onchange="fileUpload()">');
|
|
|
}else{
|
|
|
- alert('上传失败!');
|
|
|
+ layer.msg('上传失败,请重试!',{icon: 5,time:2000});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
</script>
|
|
|
<!--/请在上方写此页面业务相关的脚本-->
|
|
|
</body>
|