|
@@ -9,6 +9,7 @@ import {
|
|
|
} from '@angular/forms';
|
|
|
import { CommonCompModule } from '../common.modules';
|
|
|
import { textbookServer } from '../../../services/textbook';
|
|
|
+import { AuthServr } from '../../../services/auth.service';
|
|
|
@Component({
|
|
|
selector: 'app-login',
|
|
|
standalone: true,
|
|
@@ -32,46 +33,49 @@ export class LoginComponent {
|
|
|
{
|
|
|
name: '国家级管理员',
|
|
|
type: 1,
|
|
|
- route:'/nav-admin/home'
|
|
|
+ route: '/nav-admin/home',
|
|
|
},
|
|
|
{
|
|
|
name: '省级教育行政部门',
|
|
|
type: 2,
|
|
|
- route:'/nav-province-submit/home'
|
|
|
+ route: '/nav-province-submit/home',
|
|
|
},
|
|
|
{
|
|
|
name: '流程管理员登录',
|
|
|
type: 3,
|
|
|
- route:'/nav-province-contact/home'
|
|
|
+ route: '/nav-province-contact/home',
|
|
|
},
|
|
|
{
|
|
|
name: '省属高校联系人',
|
|
|
type: 4,
|
|
|
- route:'/nav-province-school-contact/home'
|
|
|
+ route: '/nav-province-school-contact/home',
|
|
|
},
|
|
|
{
|
|
|
name: '教材评审组成员',
|
|
|
type: 5,
|
|
|
- route:'/nav-review/home'
|
|
|
+ route: '/nav-review/home',
|
|
|
},
|
|
|
{
|
|
|
name: '作者/教师/主编',
|
|
|
type: 6,
|
|
|
- route:'/nav-author/home'
|
|
|
+ route: '/nav-author/home',
|
|
|
},
|
|
|
];
|
|
|
- currentProfile: any = this.selector[0]
|
|
|
+ currentProfile: any = this.selector[0];
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
private fb: NonNullableFormBuilder,
|
|
|
- public router: Router
|
|
|
+ public router: Router,
|
|
|
+ private authServr: AuthServr
|
|
|
) {}
|
|
|
submitForm(): void {
|
|
|
if (this.validateForm.valid) {
|
|
|
console.log('submit', this.currentProfile);
|
|
|
- localStorage.setItem('profile', JSON.stringify(this.currentProfile))
|
|
|
- this.tbookSer.profile = this.currentProfile
|
|
|
- this.router.navigate([this.currentProfile.route]);
|
|
|
+ localStorage.setItem('profile', JSON.stringify(this.currentProfile));
|
|
|
+ this.tbookSer.profile = this.currentProfile;
|
|
|
+ this.authServr.login('admin', '12345', this.tbookSer.company).then(() => {
|
|
|
+ this.router.navigate([this.currentProfile.route]);
|
|
|
+ });
|
|
|
} else {
|
|
|
Object.values(this.validateForm.controls).forEach((control) => {
|
|
|
if (control.invalid) {
|