diff --git a/src/components/Register.vue b/src/components/Register.vue index 1a48fa5..6791ba5 100644 --- a/src/components/Register.vue +++ b/src/components/Register.vue @@ -50,8 +50,14 @@ export default { ...mapActions([USER_REGISTER]), submit () { this.btn = false - if (this.user.password !== this.user.password1) { - this.openNotify('两次密码不一样!') + // console.info(this) + console.info(this.user.username) + if (this.user.username === '') { + this.openNotify('用户名不能为空') + } else if (this.user.password === '' || this.user.password === null) { + this.openNotify('密码不能为空') + } else if (this.user.password !== this.user.password1) { + this.openNotify('两次密码不相同') } else if (Boolean(this.user.username) && Boolean(this.user.password)) { this.USER_REGISTER(this.user) this.openNotify('注册成功,正在跳转') diff --git a/src/store/user.js b/src/store/user.js index e55fddd..28b17ce 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -69,7 +69,6 @@ export default { }, user) { Vue.http.post(registerApi.url, registerApi.request).then(success => { log.log('ty') // TODO: 用promise返回状态 - // alert('注册成功!') }) } }