记住我
@@ -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();
+
+ });
+ },
//----------注册结束----------
}
}