Browse Source

更新优化教材创建、列表显示

cehn 3 months ago
parent
commit
4edc6194a9

+ 6 - 1
projects/textbook/src/app/app.routes.ts

@@ -3,10 +3,15 @@ import { AuthGuard } from '../services/auth.guard';
 import { CompUserComponent } from './comp-user/comp-user.component';
 import { ProfileComponent } from '../modules/user/profile/profile.component'
 import { CompManageComponent } from './comp-manage/comp-manage.component'
-import { TextbookDetailsComponent } from '../modules/common/textbook-details/textbook-details.component';
+import {PageHomeComponent} from '../modules/textbook/page-home/page-home.component'
 export const routes: Routes = [
   { path: '', redirectTo:'user/login', pathMatch: "full",}, // 默认跳转到 ''
   // { path: '',loadComponent:()=>import('../modules/textbook/page-home/page-home.component').then(m=>m.PageHomeComponent) }, // 默认跳转到 ''
+  {
+    path: 'home', // 首页
+    canActivate: mapToCanActivate([AuthGuard]),
+    component: PageHomeComponent,
+  },
   {
     path: 'user', // 用户登录/注册
     component: CompUserComponent,

+ 33 - 13
projects/textbook/src/app/textbook/textbook.component.html

@@ -131,25 +131,35 @@
           {{ data?.get("title") || "-" }}
         </td>
         <td nzEllipsis>
-          {{ data?.get("ISBN") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("ISBN") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
-          {{ data?.get("author") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("author") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
-          {{ data?.get("lang") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("lang") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
-          {{ data?.get("majorPoniter") || "-" }}
+          {{ data?.get("majorPoniter")?.code + '/'+data?.get("majorPoniter")?.name || "-" }}
         </td>
         <td nzEllipsis>
-          {{ data?.get("editionUnit") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("editionUnit") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
           {{ data?.get("approval") || "-" }}
         </td>
         <td nzEllipsis>
-          {{ data?.get("carrierShape") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("carrierShape") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
           {{ data?.get("department")?.get("name") || "-" }}
@@ -182,7 +192,7 @@
                 <button
                   nz-button
                   (click)="
-                    toUrl('/nav-admin/manage/textbook/details/' + data.id)
+                    toUrl('/common/textbook/details/' + data.id)
                   "
                   nzType="link"
                   style="color: #231c1f"
@@ -362,23 +372,33 @@
           }}
         </td>
         <td nzEllipsis>
-          {{ data?.get("author") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("author") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
-          {{ data?.get("unit") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("unit") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
           {{ data?.get("major")?.name || "-" }}
         </td>
         <td nzEllipsis>
-          {{ data?.get("lang") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("lang") + ' ' || "-" }}
+          }
         </td>
 
         <td nzEllipsis>
-          {{ data?.get("ISBN") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("ISBN") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis>
-          {{ data?.get("editionUnit") || "-" }}
+          @for (vul of data?.get('childrens'); track vul) {
+            {{ vul?.get("editionUnit") + ' ' || "-" }}
+          }
         </td>
         <td nzEllipsis nzRight>
           @if(manage){
@@ -408,7 +428,7 @@
                 <button
                   nz-button
                   (click)="
-                    toUrl('/nav-admin/manage/textbook/details/' + data.id)
+                    toUrl('/common/textbook/details/' + data.id)
                   "
                   nzType="link"
                   style="color: #231c1f"

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

@@ -276,7 +276,7 @@ export class TextbookComponent implements OnInit {
       this.loading = false;
       return r;
     }
-    query.include('department');
+    query.include('department','childrens');
     this.count = await query.count();
     query.limit(this.limit);
     query.skip(this.limit * (this.pageIndex - 1));

+ 5 - 0
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.ts

@@ -240,6 +240,11 @@ export class BasicInComponent implements OnInit {
       objectId: '',
     });
     if (this.validateForm?.value?.type == '全册') {
+      if(this.eduTextbookVolumeList.length < 2){
+        for (let index = 0; index <  2 - this.eduTextbookVolumeList.length; index++) {
+          this.eduTextbookVolumeList.push({objectId:''})
+        }
+      }
       list.forEach((item: any, index: number) => {
         this.eduTextbookVolumeList[index] = item;
       });

+ 1 - 1
projects/textbook/src/modules/textbook/page-home/header/header.component.html

@@ -46,7 +46,7 @@
     }@else{
     <div class="login-manage-box"> 
         <div class="manage-box">
-            <button class="manage-button" (click)="authServr.profileVerify()">进入后台</button>
+            <button class="manage-button" (click)="authServr.profileVerify(modal,true)">进入后台</button>
         </div>
     </div>
     }

+ 3 - 0
projects/textbook/src/modules/textbook/page-home/header/header.component.ts

@@ -12,6 +12,8 @@ import { Router, RouterModule } from '@angular/router';
 import { NzButtonModule } from 'ng-zorro-antd/button';
 import { CommonModule } from '@angular/common';
 import { AuthServr } from '../../../../services/auth.service';
+import { NzModalService } from 'ng-zorro-antd/modal';
+
 @Component({
   selector: 'app-header',
   templateUrl: './header.component.html',
@@ -77,6 +79,7 @@ export class HeaderComponent {
     private message: NzMessageService,
     public router:Router,
     public authServr: AuthServr,
+    public modal:NzModalService
     ){
     // this.accServ.getBilling();
     this.isCapacitor = this.platform.is("capacitor")

+ 4 - 2
projects/textbook/src/services/auth.service.ts

@@ -134,7 +134,7 @@ export class AuthServr {
     });
   }
   //验证用户类型
-  async profileVerify(modal?: NzModalService) {
+  async profileVerify(modal?: NzModalService, manage?:boolean) {
     if(!Parse.User.current()?.id) return
     let query = new Parse.Query('Profile');
     query.equalTo('user', Parse.User.current()?.id);
@@ -157,7 +157,9 @@ export class AuthServr {
             let profile = r.toJSON();
             localStorage.setItem('profile', JSON.stringify(profile));
             this.textbook.profile = profile;
-            this.router.navigate([this.roterPath[r.get('identity')]]);
+            let url = this.roterPath[r.get('identity')]
+            // if(!manage) url = '/home'
+            this.router.navigate([url]);
             // this.message.success('登录成功');
             return;
           }

+ 6 - 5
projects/textbook/src/services/textbook.ts

@@ -221,17 +221,18 @@ export class textbookServer {
   /* 批量预设(临时) */
   async saveProcess() {
     // let count = 0
-
     // let query = new Parse.Query('EduProcess')
-    // query.equalTo('num',null)
+    // // query.equalTo('num',null)
     // query.notEqualTo('isDeleted',true)
-    // query.select('name','num')
-    // query.limit(1000)
+    // // query.select('name','num')
+    // query.limit(2000)
+    // query.select('objectId')
     // let res = await query.find()
     // console.log(res);
     // for (let index = 0; index < res.length; index++) {
     //     const item = res[index]
-    //     item.set('num',0)
+    //     item?.set('startDate', new Date('2024-08-05 8:00'));
+    //     item?.set('deadline', new Date('2024-09-30 23:59'));
     //     await item.save()
     //     console.log(count);
     // }