formRule.config.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * 应用表单校验相关配置
  3. * 依赖:graceChecker.js 进行校验
  4. *
  5. * 使用:引入该js到页面,let res = graceChecker.check({phoneNo:"",code:""},formRule.loginRule)
  6. */
  7. export default {
  8. /* 用户密码登录 */
  9. loginByPassRule: [{
  10. name: 'mobile',
  11. checkType: 'notnull',
  12. checkRule: '',
  13. errorMsg: '手机号不能为空'
  14. }, {
  15. name: 'mobile',
  16. checkType: 'phoneno',
  17. checkRule: '',
  18. errorMsg: '手机号格式不正确'
  19. }, {
  20. name: 'password',
  21. checkType: 'string',
  22. checkRule: '6,18',
  23. errorMsg: '请输入6-18位密码'
  24. }],
  25. /* 用户验证码登录 */
  26. loginByCodeRule: [{
  27. name: 'mobile',
  28. checkType: 'notnull',
  29. checkRule: '',
  30. errorMsg: '手机号不能为空'
  31. }, {
  32. name: 'mobile',
  33. checkType: 'phoneno',
  34. checkRule: '',
  35. errorMsg: '手机号格式不正确'
  36. }, {
  37. name: 'code',
  38. checkType: 'string',
  39. checkRule: '4',
  40. errorMsg: '请输入4位验证码'
  41. }],
  42. /* 发送验证码验证手机号 */
  43. sendCodeRule: [{
  44. name: 'mobile',
  45. checkType: 'notnull',
  46. checkRule: '',
  47. errorMsg: '手机号不能为空'
  48. }, {
  49. name: 'mobile',
  50. checkType: 'phoneno',
  51. checkRule: '',
  52. errorMsg: '手机号格式不正确'
  53. }],
  54. /* 用户注册 */
  55. registerRule: [{
  56. name: 'mobile',
  57. checkType: 'notnull',
  58. checkRule: '',
  59. errorMsg: '手机号不能为空'
  60. }, {
  61. name: 'mobile',
  62. checkType: 'phoneno',
  63. checkRule: '',
  64. errorMsg: '手机号格式不正确'
  65. }, {
  66. name: 'code',
  67. checkType: 'string',
  68. checkRule: '4',
  69. errorMsg: '请输入4位验证码'
  70. }, {
  71. name: 'password',
  72. checkType: 'string',
  73. checkRule: '6,18',
  74. errorMsg: '请输入6-18位密码'
  75. }
  76. ],
  77. /* 密码重置 */
  78. resetPasswordRule: [{
  79. name: 'mobile',
  80. checkType: 'notnull',
  81. checkRule: '',
  82. errorMsg: '手机号不能为空'
  83. }, {
  84. name: 'mobile',
  85. checkType: 'phoneno',
  86. checkRule: '',
  87. errorMsg: '手机号格式不正确'
  88. }, {
  89. name: 'code',
  90. checkType: 'string',
  91. checkRule: '4',
  92. errorMsg: '请输入4位验证码'
  93. }, {
  94. name: 'password',
  95. checkType: 'string',
  96. checkRule: '6,18',
  97. errorMsg: '请输入6-18位密码'
  98. }
  99. ]
  100. };