acdr-ui/dist/dev/mp-weixin/sheep/validate/form.js.map

1 line
4.1 KiB
Plaintext

{"version":3,"file":"form.js","sources":["../../../../../src/sheep/validate/form.js"],"sourcesContent":["/**\r\n * Validate v1.0.0 通用验证\r\n * @description 项目中用到的表单验证规则\r\n */\r\nimport test from '@/sheep/helper/test.js'\r\n\r\n// 手机号\r\nexport const mobile = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入手机号',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n if (!test.mobile(value)) {\r\n callback('手机号码格式不正确')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n\r\n// 密码\r\nexport const password = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入密码',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\\S{5,12}$/.test(value)) {\r\n callback('需包含字母和数字,长度在6-12之间')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n\r\n// 短信验证码\r\nexport const code = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入验证码',\r\n },\r\n ],\r\n}\r\n\r\n// 真实姓名\r\nexport const realName = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入姓名',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n if (!test.chinese(value)) {\r\n callback('请输入汉字')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n\r\nexport const taxName = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入发票抬头名称',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n if (!test.chinese(value)) {\r\n callback('请输入汉字')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n\r\n// 税号\r\nexport const taxNo = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入税号',\r\n },\r\n ],\r\n}\r\n\r\n// 开户行\r\nexport const bankName = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入开户行',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n if (!test.chinese(value)) {\r\n callback('请输入汉字')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n// 银行卡号\r\nexport const bankCode = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入银行卡号',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n if (!test.number(value)) {\r\n callback('请输入正确账号')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n\r\n// 支付宝账号\r\nexport const alipayAccount = {\r\n rules: [\r\n {\r\n required: true,\r\n errorMessage: '请输入支付宝账号',\r\n },\r\n {\r\n validateFunction: function (rule, value, data, callback) {\r\n const isEmail = test.email(value)\r\n const isMobile = test.mobile(value)\r\n\r\n if (!isEmail && !isMobile) {\r\n callback('请输入正确账号')\r\n }\r\n return true\r\n },\r\n },\r\n ],\r\n}\r\n\r\nexport default {\r\n mobile,\r\n alipayAccount,\r\n bankCode,\r\n bankName,\r\n realName,\r\n password,\r\n code,\r\n taxNo,\r\n taxName,\r\n}\r\n"],"names":["test"],"mappings":";;AAOY,MAAC,SAAS;AAAA,EACpB,OAAO;AAAA,IACL;AAAA,MACE,UAAU;AAAA,MACV,cAAc;AAAA,IACf;AAAA,IACD;AAAA,MACE,kBAAkB,SAAU,MAAM,OAAO,MAAM,UAAU;AACvD,YAAI,CAACA,kBAAI,KAAC,OAAO,KAAK,GAAG;AACvB,mBAAS,WAAW;AAAA,QACrB;AACD,eAAO;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACH;AAGY,MAAC,WAAW;AAAA,EACtB,OAAO;AAAA,IACL;AAAA,MACE,UAAU;AAAA,MACV,cAAc;AAAA,IACf;AAAA,IACD;AAAA,MACE,kBAAkB,SAAU,MAAM,OAAO,MAAM,UAAU;AACvD,YAAI,CAAC,kDAAkD,KAAK,KAAK,GAAG;AAClE,mBAAS,oBAAoB;AAAA,QAC9B;AACD,eAAO;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACH;AAGY,MAAC,OAAO;AAAA,EAClB,OAAO;AAAA,IACL;AAAA,MACE,UAAU;AAAA,MACV,cAAc;AAAA,IACf;AAAA,EACF;AACH;;;;"}