Commit 6f0ad156 by 梁建民

限制长度

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