diff --git a/angular.json b/angular.json
index 8753b78..78118bd 100644
--- a/angular.json
+++ b/angular.json
@@ -33,7 +33,8 @@
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/popper.js/dist/umd/popper.js",
- "node_modules/bootstrap/dist/js/bootstrap.js"
+ "node_modules/bootstrap/dist/js/bootstrap.js",
+ "node_modules"
]
},
"configurations": {
diff --git a/package.json b/package.json
index 541f92b..acfb681 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"@ng-bootstrap/ng-bootstrap": "^6.0.0-rc.0",
"@ngx-translate/core": "^12.1.1",
"@ngx-translate/http-loader": "^4.0.0",
+ "angular2-cookie": "^1.2.6",
"bootstrap": "^4.4.1",
"jquery": "^3.4.1",
"popper.js": "^1.16.1",
diff --git a/src/app/account/login/login.component.html b/src/app/account/login/login.component.html
index a1a768c..14d402c 100644
--- a/src/app/account/login/login.component.html
+++ b/src/app/account/login/login.component.html
@@ -7,7 +7,7 @@
+
-
+
+
+
+
diff --git a/src/app/account/login/login.component.ts b/src/app/account/login/login.component.ts
index ffac637..b77bffe 100644
--- a/src/app/account/login/login.component.ts
+++ b/src/app/account/login/login.component.ts
@@ -1,21 +1,23 @@
import {Component, OnInit} from '@angular/core';
import {FormBuilder} from '@angular/forms';
-import {Height} from '../../height';
-
+import {Commons} from '../../commons';
+import {Router} from '@angular/router';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
// 登陆模块
-export class LoginComponent extends Height implements OnInit {
+export class LoginComponent extends Commons implements OnInit {
// 登陆表单
loginForm = this.fb.group({
managerName: [''],
password: ['']
});
- constructor(private fb: FormBuilder) {
+
+
+ constructor(private fb: FormBuilder,private router: Router) {
super();
}
@@ -25,8 +27,17 @@ export class LoginComponent extends Height implements OnInit {
// 登陆方法
login() {
console.debug(this.loginForm.value);
- alert('执行登陆操作');
- }
+ this.request('http://localhost:8080/api/manager/login', JSON.stringify(this.loginForm.value),
+ res => {
+ this.message = res.message;
+ if (res.result === 'OK') {
+ this.messageStyle = 'info';
+ this.router.navigateByUrl('/forum');
+ } else {
+ this.messageStyle = 'warning';
+ }
+ });
+ }
}
diff --git a/src/app/account/register/register.component.html b/src/app/account/register/register.component.html
index 2923632..c668d71 100644
--- a/src/app/account/register/register.component.html
+++ b/src/app/account/register/register.component.html
@@ -15,7 +15,7 @@
+
+ class="btn btn-info btn-lg ml-3">{{ 'button.backLogin' | translate }}
+
+
+
diff --git a/src/app/account/register/register.component.ts b/src/app/account/register/register.component.ts
index 6d07bfd..bd8f345 100644
--- a/src/app/account/register/register.component.ts
+++ b/src/app/account/register/register.component.ts
@@ -1,13 +1,13 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder} from '@angular/forms';
-import {Height} from '../../height';
+import {Commons} from '../../commons';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss']
})
// 注册模块
-export class RegisterComponent extends Height implements OnInit {
+export class RegisterComponent extends Commons implements OnInit {
// 注册表单
registerForm = this.fb.group({
managerName: [],
@@ -25,6 +25,10 @@ export class RegisterComponent extends Height implements OnInit {
}
register() {
- alert('确认注册');
+ this.request('http://localhost:8080/api/manager/register', JSON.stringify(this.registerForm.value),
+ res => {
+ this.message = res.message;
+ this.messageStyle = (res.result === 'OK' ? 'info' : 'warning');
+ });
}
}
diff --git a/src/app/account/resetpwd/resetpwd.component.html b/src/app/account/resetpwd/resetpwd.component.html
index 923289d..e09b382 100644
--- a/src/app/account/resetpwd/resetpwd.component.html
+++ b/src/app/account/resetpwd/resetpwd.component.html
@@ -33,7 +33,7 @@
+ class="btn btn-info btn-lg ml-3">{{ 'button.backLogin' | translate }}
diff --git a/src/app/account/resetpwd/resetpwd.component.ts b/src/app/account/resetpwd/resetpwd.component.ts
index d101ba6..efc288a 100644
--- a/src/app/account/resetpwd/resetpwd.component.ts
+++ b/src/app/account/resetpwd/resetpwd.component.ts
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms';
-import {Height} from '../../height';
+import {Commons} from '../../commons';
@Component({
selector: 'app-resetpwd',
@@ -8,7 +8,7 @@ import {Height} from '../../height';
styleUrls: ['./resetpwd.component.scss']
})
// 重置密码模块
-export class ResetpwdComponent extends Height implements OnInit {
+export class ResetpwdComponent extends Commons implements OnInit {
// 重置密码表单
resetForm = this.fb.group({
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index d2e75da..de11fab 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,8 +1,7 @@
import {Component} from '@angular/core';
-import {Router, ActivatedRoute, NavigationStart} from '@angular/router';
+import {Router, ActivatedRoute} from '@angular/router';
import {TranslateService} from '@ngx-translate/core';
-import { filter } from 'rxjs/operators';
-import { Observable } from 'rxjs-compat';
+
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
@@ -13,13 +12,8 @@ export class AppComponent {
// 登陆状态
isLogin;
- navStart: Observable