mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-06 01:06:39 +00:00
上传后台管理系统代码
This commit is contained in:
4
novel-admin/src/main/resources/static/js/plugins/validate/additional-methods.min.js
vendored
Normal file
4
novel-admin/src/main/resources/static/js/plugins/validate/additional-methods.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,169 @@
|
||||
/*this is basic form validation using for validation person's basic information author:Clara Guo data:2017/07/20*/
|
||||
$(document).ready(function(){
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function(form) {
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
//手机号码验证身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$)
|
||||
jQuery.validator.addMethod("isPhone",function(value,element){
|
||||
var length = value.length;
|
||||
var phone=/^1[3|4|5|7|8][0-9]\d{8}$/;
|
||||
return this.optional(element)||(length == 11 && phone.test(value));
|
||||
},"请填写正确的11位手机号");
|
||||
//电话号码验证
|
||||
jQuery.validator.addMethod("isTel",function(value,element){
|
||||
var tel = /^(0\d{2,3}-)?\d{7,8}$/g;//区号3,4位,号码7,8位
|
||||
return this.optional(element) || (tel.test(value));
|
||||
},"请填写正确的座机号码");
|
||||
//姓名校验
|
||||
jQuery.validator.addMethod("isName",function(value,element){
|
||||
var name=/^[\u4e00-\u9fa5]{2,6}$/;
|
||||
return this.optional(element) || (name.test(value));
|
||||
},"姓名只能用汉字,长度2-4位");
|
||||
//校验用户名
|
||||
jQuery.validator.addMethod("isUserName",function(value,element){
|
||||
var userName=/^[a-zA-Z0-9]{2,13}$/;
|
||||
return this.optional(element) || (userName).test(value);
|
||||
},'请输入数字或者字母,不包含特殊字符');
|
||||
|
||||
//校验身份证
|
||||
jQuery.validator.addMethod("isIdentity",function(value,element){
|
||||
var id= /^(\d{15}$|^\d{18}$|^\d{17}(\d|X))$/;
|
||||
return this.optional(element) || (id.test(value));
|
||||
},"请输入正确的15或18位身份证号,末尾为大写X");
|
||||
//校验出生日期
|
||||
jQuery.validator.addMethod("isBirth",function(value,element){
|
||||
var birth = /^(19|20)\d{2}-(1[0-2]|0?[1-9])-(0?[1-9]|[1-2][0-9]|3[0-1])$/;
|
||||
return this.optional(element) || (birth).test(value);
|
||||
},"出生日期格式示例2000-01-01");
|
||||
//校验新旧密码是否相同
|
||||
jQuery.validator.addMethod("isdiff",function(){
|
||||
var p1=$("#pwdOld").val();
|
||||
var p2=$("#pwdNew").val();
|
||||
if(p1==p2){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
//校验新密码和确认密码是否相同
|
||||
jQuery.validator.addMethod("issame",function(){
|
||||
var p3=$("#confirm_password").val();
|
||||
var p4=$("#pwdNew").val();
|
||||
if(p3==p4){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//校验基础信息表单
|
||||
$("#basicInfoForm").validate({
|
||||
errorElement:'span',
|
||||
errorClass:'help-block error-mes',
|
||||
rules:{
|
||||
name:{
|
||||
required:true,
|
||||
isName:true
|
||||
},
|
||||
sex:"required",
|
||||
birth:"required",
|
||||
mobile:{
|
||||
required:true,
|
||||
isPhone:true
|
||||
},
|
||||
email:{
|
||||
required:true,
|
||||
email:true
|
||||
}
|
||||
},
|
||||
messages:{
|
||||
name:{
|
||||
required:"请输入中文姓名",
|
||||
isName:"姓名只能为汉字"
|
||||
},
|
||||
sex:{
|
||||
required:"请输入性别"
|
||||
},
|
||||
birth:{
|
||||
required:"请输入出生年月"
|
||||
},
|
||||
mobile:{
|
||||
required:"请输入手机号",
|
||||
isPhone:"请填写正确的11位手机号"
|
||||
},
|
||||
email:{
|
||||
required:"请输入邮箱",
|
||||
email:"请填写正确的邮箱格式"
|
||||
}
|
||||
},
|
||||
|
||||
errorPlacement:function(error,element){
|
||||
element.next().remove();
|
||||
element.closest('.gg-formGroup').append(error);
|
||||
},
|
||||
|
||||
highlight:function(element){
|
||||
$(element).closest('.gg-formGroup').addClass('has-error has-feedback');
|
||||
},
|
||||
success:function(label){
|
||||
var el = label.closest('.gg-formGroup').find("input");
|
||||
el.next().remove();
|
||||
label.closest('.gg-formGroup').removeClass('has-error').addClass("has-feedback has-success");
|
||||
label.remove();
|
||||
},
|
||||
submitHandler:function(form){
|
||||
alert("保存成功!");
|
||||
}
|
||||
});
|
||||
|
||||
//校验修改密码表单
|
||||
$("#modifyPwd").validate({
|
||||
onfocusout: function(element) { $(element).valid()},
|
||||
debug:false, //表示校验通过后是否直接提交表单
|
||||
onkeyup:false, //表示按键松开时候监听验证
|
||||
rules:{
|
||||
pwdOld:{
|
||||
required:true,
|
||||
minlength:6
|
||||
},
|
||||
pwdNew:{
|
||||
required:true,
|
||||
minlength:6,
|
||||
isdiff:true,
|
||||
//issame:true,
|
||||
},
|
||||
confirm_password:{
|
||||
required:true,
|
||||
minlength:6,
|
||||
issame:true,
|
||||
}
|
||||
|
||||
},
|
||||
messages:{
|
||||
pwdOld : {
|
||||
required:'必填',
|
||||
minlength:$.validator.format('密码长度要大于6')
|
||||
},
|
||||
pwdNew:{
|
||||
required:'必填',
|
||||
minlength:$.validator.format('密码长度要大于6'),
|
||||
isdiff:'原密码与新密码不能重复',
|
||||
|
||||
},
|
||||
confirm_password:{
|
||||
required:'必填',
|
||||
minlength:$.validator.format('密码长度要大于6'),
|
||||
issame:'新密码要与确认新密码一致',
|
||||
}
|
||||
|
||||
},
|
||||
errorElement:"mes",
|
||||
errorClass:"gg-star",
|
||||
errorPlacement: function(error, element)
|
||||
{
|
||||
element.closest('.gg-formGroup').append(error);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
4
novel-admin/src/main/resources/static/js/plugins/validate/jquery.validate.min.js
vendored
Normal file
4
novel-admin/src/main/resources/static/js/plugins/validate/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
27
novel-admin/src/main/resources/static/js/plugins/validate/messages_zh.min.js
vendored
Normal file
27
novel-admin/src/main/resources/static/js/plugins/validate/messages_zh.min.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
|
||||
* http://jqueryvalidation.org/
|
||||
* Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
|
||||
! function (a) {
|
||||
"function" == typeof define && define.amd ? define(["jquery", "jquery.validate.min"], a) : a(jQuery)
|
||||
}(function (a) {
|
||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||
a.extend(a.validator.messages, {
|
||||
required: icon + "必填",
|
||||
remote: icon + "请修正此栏位",
|
||||
email: icon + "请输入有效的电子邮件",
|
||||
url: icon + "请输入有效的网址",
|
||||
date: icon + "请输入有效的日期",
|
||||
dateISO: icon + "请输入有效的日期 (YYYY-MM-DD)",
|
||||
number: icon + "请输入正确的数字",
|
||||
digits: icon + "只能输入数字",
|
||||
creditcard: icon + "请输入有效的信用卡号码",
|
||||
equalTo: icon + "你的输入不相同",
|
||||
extension: icon + "请输入有效的后缀",
|
||||
maxlength: a.validator.format(icon + "最多 {0} 个字"),
|
||||
minlength: a.validator.format(icon + "最少 {0} 个字"),
|
||||
rangelength: a.validator.format(icon + "请输入长度为 {0} 至 {1} 之间的字串"),
|
||||
range: a.validator.format(icon + "请输入 {0} 至 {1} 之间的数值"),
|
||||
max: a.validator.format(icon + "请输入不大于 {0} 的数值"),
|
||||
min: a.validator.format(icon + "请输入不小于 {0} 的数值")
|
||||
})
|
||||
});
|
Reference in New Issue
Block a user