Commit 6f0ad156 by 梁建民

限制长度

parent 919173ff
......@@ -32,7 +32,7 @@
<span class="input_title lineBlock">*型号:</span>
<div class="input_parent">
<input type="text" name="goods_name" placeholder="请输入商品型号" class="input boxsiz"
lay-verify="required">
lay-verify="required|limitLength">
</div>
</div>
<div class="brand input_div ">
......
......@@ -41,7 +41,7 @@
<span class="input_title lineBlock">*型号:</span>
<div class="input_parent">
<input type="text" name="goods_name" placeholder="请输入商品型号" class="input boxsiz"
lay-verify="required">
lay-verify="required|limitLength">
</div>
</div>
<div class="brand input_div ">
......
......@@ -29,7 +29,7 @@
<span class="input_title lineBlock">*型号:</span>
<div class="input_parent">
<input type="text" name="goods_name" placeholder="请输入商品型号"
class="input boxsiz" lay-verify="required">
class="input boxsiz" lay-verify="required|limitLength">
</div>
</div>
<div class="brand input_div ">
......
......@@ -274,6 +274,7 @@
});
}
});
$('.form_content').on('click', '.deleteicon', function () {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
......@@ -295,6 +296,14 @@
});
layui.form.verify({
limitLength: function(value, item){
if(value.length < 3){
return '型号长度必须大于三'
}
}
});
return this;
},
}, $(function () {
......
......@@ -193,6 +193,14 @@ $(function () {
});
layui.form.verify({
limitLength: function(value, item){
if(value.length < 3){
return '型号长度必须大于三'
}
}
});
}
};
......
! function () {
!function () {
window.ReleaseInquiry = {
isClick: false,
imgUrl: "",
......@@ -6,12 +6,12 @@
this.created(this).mounted(this).isIe(this).handleBind(this);
},
created: function (opt) {
return this;
},
mounted: function (opt) {
return this;
},
uploadFun: function () {
......@@ -22,8 +22,8 @@
data: {
token: Util.getCookie('token'),
source: 2,
},
field: "upload",
before: function () {
......@@ -46,10 +46,10 @@
err: function () {
layer.closeAll('loading');
layer.msg('上传失败');
}
});
},
isIe: function (opt) {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
......@@ -61,7 +61,8 @@
iframe.attachEvent("onload", opt.iframeOnload);
} else {
iframe.onload = opt.iframeOnload;
};
}
;
opt.formSubmit();
$('#mineFiles').on('change', function () {
layer.load(1, {
......@@ -100,7 +101,7 @@
} catch (e) {
layer.closeAll('loading');
layer.msg('上传失败');
}
if (json) {
layer.closeAll('loading');
......@@ -111,79 +112,80 @@
ReleaseInquiry.imgUrl = json.data[0] || '';
} else {
layer.msg(json.errmsg)
}
}
},
handleBind: function (opt) {
//货期选择
layui.form.on('radio(delivery)', function (data) {
var str = '期货';
data.value == '现货' ? str = '现货' : str = '期货';
var getTpl = deliveryHtml.innerHTML;
layui.laytpl(getTpl).render(str, function (html) {
$("#day").empty().html(html);
});
});
//天数同步期货
$(document).on('input propertychange', 'input[name="day"]', function () {
var val = $(this).val();
$("#daytext").val(val + '天');
});
$('.cz').on('click', function () {
$('#xj_form')[0].reset();
})
//上传商品发布
layui.form.on('submit(add)', function (data) {
$(data.elem).addClass("layui-btn-disabled");
var parmas = $.extend({}, data.field, {
goods_images: opt.imgUrl
})
if (!opt.isClick) {
opt.isClick = true;
IcController.getData(apis.inquiryadd + '?token=' + Util.getCookie('token'), 'get', parmas, function (res) {
if (res.errcode == 0) {
layer.msg('发布询价成功', {
time: 2000
}, function () {
window.location.href = '/inquiry';
});
} else {
layer.msg(res.errmsg);
opt.isClick = false;
$(data.elem).removeClass("layui-btn-disabled");
}
});
}
});
$('.form_content').on('click', '.deleteicon', function () {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
//ie版本
$('#fileLoad').show();
......@@ -194,8 +196,19 @@
$('.upload_result').hide();
$('.upload_result img').attr('src', '');
opt.imgUrl = "";
})
});
layui.form.verify({
limitLength: function(value, item){
if(value.length < 3){
return '型号长度必须大于三'
}
}
});
return this;
},
}, $(function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment