|
@@ -11,9 +11,9 @@ color.html = '<tr class="color_list">'
|
|
|
+ '<td style="text-align: center;" width="10"><input type="text" class="input-text input-number item-num" value="" name="colorBar" id="" placeholder="69码" datatype="*1-20" errormsg="69码格式不正确!"></td>'
|
|
|
+ '<td style="text-align: center;" width="10"><input type="text" class="input-text input-number item-num" value="0" name="colorIsWeight" id="" style="width: 100%;text-align: center;" placeholder="重量" onkeyup="keyFun($(this),9999,1)" onpaste="keyFun($(this),9999,1)"></td>'
|
|
|
+ '<td style="text-align: center;" width="10"><select class="select" id="" name="colorIsMachine" ><option value="2" >否</option><option value="1" >是</option></select></td>'
|
|
|
- + '<td style="text-align: center;" width="10"><input type="file" class="color_file" name="file" id="fileId_'+ colorNum +'" style="display: none">'
|
|
|
- + '<a href="javascript:void(0)" class="del_product all_down" onclick="fileOnclick(this)">上传图片</a>'
|
|
|
- + '<input name="colorPicture" style="display: none;"></td>'
|
|
|
+ + '<td style="text-align: center;" width=""><input type="file" class="color_file" name="file" id="fileId_'+ colorNum +'" style="display: none">'
|
|
|
+ + '<div class="download_file"><a href="javascript:void(0)" class="del_product all_down" num="'+ num +'" onclick="fileOnclick(this)">上传图片</a></div>'
|
|
|
+ + '<input class="colorPicture" name="colorPicture" id="xxx" value="" style="display: none;"></td>'
|
|
|
+ '<td style="text-align: center;" width="10"> <a href="javascript:void(0)" class="del_product all_down" onclick="delTr($(this))" >删除</a></td>'
|
|
|
+ '</tr>';
|
|
|
|
|
@@ -32,19 +32,20 @@ function add_color(){
|
|
|
$("#add_color").append(getColorHtml());
|
|
|
|
|
|
$("#fileId_"+color.num).change(function() {
|
|
|
- fileUpload();
|
|
|
+ fileUpload("fileId_"+color.num);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function fileOnclick(node){
|
|
|
- $(node).siblings('.color_file').click();
|
|
|
- $("#fileId_"+color.num).change(function() {
|
|
|
- fileUpload("fileId_" + color.num);
|
|
|
- });
|
|
|
+ $(node).parent().siblings('.color_file').click();
|
|
|
}
|
|
|
|
|
|
$(function(){
|
|
|
$("#add_color").append(getColorHtml());
|
|
|
+
|
|
|
+ $("#fileId_0").change(function() {
|
|
|
+ fileUpload("fileId_0");
|
|
|
+ });
|
|
|
})
|
|
|
|
|
|
$(function(){
|
|
@@ -115,15 +116,18 @@ function delTr($this){
|
|
|
$this.parents("tr").remove();
|
|
|
}
|
|
|
|
|
|
-function fileUpload(nodo) {
|
|
|
+function fileUpload(idValue) {
|
|
|
$.ajaxFileUpload({
|
|
|
url:"/admin/product/fileUpload",
|
|
|
secureuri:false,
|
|
|
- fileElementId : nodo,//文件选择框的id属性
|
|
|
+ fileElementId : idValue,//文件选择框的id属性/名称
|
|
|
dataType: 'json', //json
|
|
|
success: function (data) {
|
|
|
if(data.returnCode == 200){
|
|
|
-
|
|
|
+ var html = '<img style="width: 75px;" src="'+ url_path + data.returnMsg.imgUrl +'" class="del_product all_down" onclick="fileOnclick(this)">';
|
|
|
+ $("#"+idValue).parent().find(".download_file").html(html);
|
|
|
+ // $("#"+idValue).parent().find(".colorPicture").val(data.returnMsg.imgUrl);
|
|
|
+ $("#xxx").val(data.returnMsg.imgUrl);
|
|
|
}else{
|
|
|
layer.msg('上传失败,请重试!',{icon: 5,time:2000});
|
|
|
}
|