diff --git a/uni_modules/uni-login-page/js_sdk/validator/uni-id-users.js b/uni_modules/uni-login-page/js_sdk/validator/uni-id-users.js index eeb8b22d803bfe26c5b396dec77b345fe4c4b484..a2a390d85f60b8908fab36ca90165cacbc258cc3 100644 --- a/uni_modules/uni-login-page/js_sdk/validator/uni-id-users.js +++ b/uni_modules/uni-login-page/js_sdk/validator/uni-id-users.js @@ -55,6 +55,36 @@ const validator = { } ], "label": "昵称" + }, + "pwd":{ + "rules": [{ + + required: true, + errorMessage: '请输入密码', + + }, + { + minLength: 6, + maxLength: 20, + errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', + } + ], + "label": "密码" + }, + "pwd2":{ + "rules": [{ + + required: true, + errorMessage: '再次输入密码', + + }, + { + minLength: 6, + maxLength: 20, + errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', + } + ], + "label": "确认密码" } } diff --git a/uni_modules/uni-login-page/pages/register/register.vue b/uni_modules/uni-login-page/pages/register/register.vue index 42ef5fbbf89d1e7b8ab998bd36360ceea245a236..97443f12716931a48201b1f290e0e80bce5974f5 100644 --- a/uni_modules/uni-login-page/pages/register/register.vue +++ b/uni_modules/uni-login-page/pages/register/register.vue @@ -10,6 +10,12 @@ + + + + + + @@ -41,7 +47,9 @@ formData: { "username": "", "gender": 0, - "nickname": "" + "nickname": "", + 'pwd':'', + 'pwd2':'' }, formOptions: { "gender_localdata": [{ @@ -58,7 +66,7 @@ ] }, rules: { - ...getValidator(["username", "gender", "nickname"]) + ...getValidator(["username", "gender", "nickname", 'pwd', 'pwd2']) } } }, @@ -69,7 +77,12 @@ /** * 触发表单提交 */ - submit() { + submit() { + if(this.formData.pwd != this.formData.pwd2)return uni.showToast({ + title: '两次输入密码不一致', + icon: 'none' + }); + uni.showLoading({ mask: true })