warrior 8 달 전
부모
커밋
1c7ee2c582

+ 1 - 1
projects/textbook/src/app/app.component.ts

@@ -17,6 +17,6 @@ export class AppComponent {
   initParseService(){
     Parse.initialize("edu-textbook");
     (Parse as any).serverURL = ("http://localhost:61337/parse");
-    localStorage.setItem('company','Nc5qrhudIa')
+    localStorage.setItem('company','RbIKpmuaMC')
   }
 }

+ 1 - 1
projects/textbook/src/app/comp-nav/comp-nav.component.html

@@ -3,7 +3,7 @@
   <div class="title">{{tbookSer.profile?.name}}</div>
   <div class="space"></div>
   <div class="user">
-    <button mat-icon-button routerLink="/user/login" aria-label="LogOut" style="margin-top: -10px;">
+    <button mat-icon-button (click)="authServr.logout()" aria-label="LogOut" style="margin-top: -10px;">
       <mat-icon>logout</mat-icon>
     </button>
   </div>

+ 3 - 2
projects/textbook/src/app/comp-nav/comp-nav.component.ts

@@ -4,7 +4,7 @@ import { textbookServer } from "../../services/textbook";
 import { MatButtonModule } from '@angular/material/button';
 import { MatIconModule } from '@angular/material/icon';
 import { RouterModule,Router } from '@angular/router';
-
+import { AuthServr } from '../../services/auth.service'
 @Component({
   selector: 'app-comp-nav',
   standalone: true,
@@ -20,7 +20,8 @@ export class CompNavComponent implements OnInit {
 
   constructor(
     public router: Router,
-    public tbookSer: textbookServer
+    public tbookSer: textbookServer,
+    public authServr:AuthServr
   ) {}
 
   ngOnInit() {}

+ 6 - 4
projects/textbook/src/modules/login/login/login.component.ts

@@ -58,7 +58,7 @@ export class LoginComponent {
     {
       name: '作者/教师/主编',
       type: 6,
-      route:'/nav-author/textbook/list'
+      route:'/nav-author/manage/textbook'
     },
   ];
   currentProfile: any = this.selector[0];
@@ -67,13 +67,15 @@ export class LoginComponent {
     private fb: NonNullableFormBuilder,
     public router: Router,
     private authServr: AuthServr
-  ) {}
+  ) {
+  }
   submitForm(): void {
     if (this.validateForm.valid) {
-      console.log('submit', this.currentProfile);
+      let {userName, password, code } = this.validateForm.value
+      console.log(userName, password,);
       localStorage.setItem('profile', JSON.stringify(this.currentProfile));
       this.tbookSer.profile = this.currentProfile;
-      this.authServr.login('admin', '12345', this.tbookSer.company).then(() => {
+      this.authServr.login(userName, password, this.tbookSer.company).then(() => {
         this.router.navigate([this.currentProfile.route]);
       });
     } else {

+ 17 - 23
projects/textbook/src/modules/nav-author/modules.routes.ts

@@ -1,33 +1,27 @@
-import { NgModule } from "@angular/core";
-import { RouterModule, Routes } from "@angular/router";
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
 import { PageHomeComponent } from './page-home/page-home.component';
-import { PageTextbookComponent } from "./page-textbook/page-textbook.component";
-import { ApplyComponent } from "./apply/apply.component";
-import { ProfileComponent } from '../user/profile/profile.component'
+import { PageTextbookComponent } from './page-textbook/page-textbook.component';
+import { ApplyComponent } from './apply/apply.component';
+import { ProfileComponent } from '../user/profile/profile.component';
 const routes: Routes = [
   {
     path: 'manage',
     component: PageHomeComponent,
-    children:[
+    children: [
       {
-        path: 'textbook',
-        component: PageHomeComponent,
-        children:[
-          {
-            path: "apply",
-            component:ApplyComponent
-          },
-          {
-            path: "list",
-            component:PageTextbookComponent
-          },
-          {
-            path: "recycle",
-            component:PageTextbookComponent
-          },
-        ]
+        path: 'apply',//创建教材
+        component: ApplyComponent,
       },
-    ]
+      {
+        path: 'textbook',//列表
+        component: PageTextbookComponent,
+      },
+      {
+        path: 'recycle',//回收站
+        component: PageTextbookComponent,
+      },
+    ],
   },
   {
     path: 'profile',

+ 6 - 3
projects/textbook/src/modules/nav-author/page-home/page-home.component.ts

@@ -31,19 +31,22 @@ export class PageHomeComponent  implements OnInit {
         {
           name:'创建教材',
           id:'1-1',
-          path:"/nav-author/textbook/list"
+          path:"/nav-author/manage/apply"
         },
         {
           name:'教材列表',
           id:'1-2',
-          path:"/nav-author/manage/textbook/list"
+          path:"/nav-author/manage/textbook",
         },
       ]
     },
     {
       name:'回收站',
       id:'2',
-      path:'/nav-author/apply'
+      path:'/nav-author/manage/textbook',
+      params:{
+        isDeleted:true
+      }
     },
     {
       name:'个人信息',

+ 1 - 1
projects/textbook/src/services/auth.service.ts

@@ -12,7 +12,7 @@ export class AuthServr {
 
   redirectUrl: string = '';
   constructor(public router: Router) {}
-  login(username:string, password:string, company:string) {
+  login(username:any, password:any, company:string) {
     return new Promise(async (resolve, reject) => {
       let a = /^1[3456789]\d{9}$/;
       //如果是手机号登录,获取对应的mobile