From 4af8bdc1b46c47c8491592bccc67380128d0e203 Mon Sep 17 00:00:00 2001 From: Qing Date: Fri, 30 Jun 2023 00:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=94=A8=E6=88=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Home.vue | 128 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 3 deletions(-) diff --git a/src/components/Home.vue b/src/components/Home.vue index 25b42da..566fe38 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -88,7 +88,7 @@ -
+
记住我 @@ -112,7 +112,59 @@ title="注册" :visible.sync="registerDialogVisible" width="25vw"> - 注册 +
+ + + + + + + + + + + + + + + + +
+ + + + + 已有账户?去登录! +
+ + +
+
@@ -137,6 +189,11 @@ export default { code: null, remember:null }, + resisterRuleForm: { + username: null, + password: null, + code: null, + }, rules: { username: [ // required:规则,trigger:失去焦点触发 @@ -158,6 +215,12 @@ export default { closeLogin(){ this.loginDialogVisible=false; }, + openResister(){ + this.registerDialogVisible=true; + }, + closeRegister(){ + this.registerDialogVisible=false; + }, // ******登录***** account() { // console.log(this.getCookie("username")); @@ -261,13 +324,72 @@ export default { this.icon = "el-icon-lock"; } }, + loginFun(){ + this.loginDialogVisible = true; + this.registerDialogVisible = false; + }, // ******登录方法结束***** // ----------注册------------ registerFun() { this.loginDialogVisible = false; this.registerDialogVisible = true; - } + }, + resisterForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + //取参数 + // let params = new URLSearchParams(); + // params.append("username", this.ruleForm.username); + // params.append("password", this.ruleForm.password); + // params.append("code", this.ruleForm.code); + // params.append("remember",this.ruleForm.remember) + if (this.checked == true) { + //存入cookie + this.setCookie(this.ruleForm.username, this.ruleForm.password,7); //保存7天 + } else { + this.clearCookie(); + } + + //调用方法提交 + axios({ + method: 'post', + // 请求的地址 + url: 'http://localhost:8082/helloGithub_war_exploded/userRegister', + // URL 中的查询参数 + params: { + username: this.resisterRuleForm.username, + password: this.resisterRuleForm.password, + code: this.resisterRuleForm.code, + + } + }).then(function (res){ + // Vue.prototype.$message({ + // message: '成功!', + // type: 'success' + // }); + if(res.data.code===200){ + Vue.prototype.$notify({ + title: '成功', + message: ('i', { style: 'color: teal'}, res.data.msg), + type: 'success' + }); + }else{ + Vue.prototype.$notify.error({ + title: '错误', + message: res.data.msg + }); + } + console.log(res); + }); + } else { + this.closeLogin(); + return false; + } + this.closeLogin(); + + }); + }, //----------注册结束---------- } }