Просмотр исходного кода

Merge branch 'master' of http://git.fmode.cn:3000/bin/edu-textbook

MetaPunkGames 8 месяцев назад
Родитель
Сommit
bb1fcb4926

+ 0 - 1
projects/textbook/src/modules/nav-admin/page-user/page-user.component.html

@@ -188,7 +188,6 @@
                 <button
                   (click)="updateUser(data, '删除')"
                   nz-button
-                  [disabled]="user?.get('isDeleted')"
                   nzType="link"
                   style="color: #231c1f"
                 >

+ 9 - 0
projects/textbook/src/modules/nav-admin/page-user/page-user.component.ts

@@ -12,6 +12,7 @@ import { CommonCompModule } from '../../../services/common.modules';
 import { NzEmptyModule } from 'ng-zorro-antd/empty';
 import { NzModalService } from 'ng-zorro-antd/modal';
 import { textbookServer } from '../../../services/textbook';
+import { NzMessageService } from 'ng-zorro-antd/message';
 @Component({
   selector: 'app-page-user',
   templateUrl: './page-user.component.html',
@@ -51,6 +52,7 @@ export class PageUserComponent implements OnInit {
     public tbookSer: textbookServer,
     private modal: NzModalService,
     private route: Router,
+    private message: NzMessageService,
     private activeRoute: ActivatedRoute
   ) {
     this.user = Parse.User.current();
@@ -114,6 +116,7 @@ export class PageUserComponent implements OnInit {
     let query = Parse.Query.fromJSON('Profile', queryParams);
     query.include('user');
     query.notEqualTo('identity', '国家级管理员');
+    query.descending('createdAt')
     if(this.tbookSer.profile.identity == '工作联系人'){
       query.containedIn('identity', ['个人', '评审专家','高校联系人']);
     }else if(this.tbookSer.profile.identity == '高校联系人'){
@@ -161,6 +164,12 @@ export class PageUserComponent implements OnInit {
   }
   async updateUser(data: Parse.Object, type: string) {
     console.log(type);
+    if(this.tbookSer.profile.identity != '国家级管理员'
+     && (data?.get('identity') == '工作联系人' || data?.get('identity') == '高校联系人')
+     ){
+      this.message.warning('暂无权限')
+      return
+    }
     this.modal.confirm({
       nzTitle: '操作提示',
       nzContent: `确定${type}吗?`,

+ 23 - 7
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.html

@@ -95,9 +95,13 @@
             style="display: flex; flex-direction: column"
             formControlName="type"
           >
-            <label nz-radio nzValue="单册" (click)="requiredTypeNumber(false)">单册</label>
+            <label nz-radio nzValue="单册" (click)="requiredTypeNumber(false)"
+              >单册</label
+            >
             <div class="basic-row">
-              <label nz-radio nzValue="全册" (click)="requiredTypeNumber(true)">全册</label>
+              <label nz-radio nzValue="全册" (click)="requiredTypeNumber(true)"
+                >全册</label
+              >
               @if (validateForm.value.type =='全册') {
               <nz-input-group
                 style="flex: 1; margin-left: 20px"
@@ -365,7 +369,9 @@
             formControlName="importantProject"
           >
             @for (item of importantProjectList; track item.value) {
-            <label (click)="onChangeRadio()" nz-radio [nzValue]="item.value">{{ item.title }}</label>
+            <label (click)="onChangeRadio()" nz-radio [nzValue]="item.value">{{
+              item.title
+            }}</label>
             } @if (validateForm.value.importantProject ==
             '其他省部级及以上项目') {
             <input
@@ -385,7 +391,7 @@
       >
       <nz-form-control nzErrorTip="请输入版权页截图" [nzSm]="12" [nzXs]="12">
         <nz-input-group>
-          <nz-upload
+          <!-- <nz-upload
             formControlName="copyrightImgUrl"
             nzAction="https://www.mocky.io/v2/5cc8019d300000980a055e76"
             [nzHeaders]="{ authorization: 'authorization-text' }"
@@ -395,7 +401,12 @@
               <span nz-icon nzType="upload"></span>
               上传截图
             </button>
-          </nz-upload>
+          </nz-upload> -->
+          <app-comp-upload
+            [width]="320"
+            (change)="upload($event, 'copyrightImgUrl')"
+            title="上传截图"
+          ></app-comp-upload>
         </nz-input-group>
       </nz-form-control>
     </nz-form-item>
@@ -406,7 +417,7 @@
       <nz-form-control nzErrorTip="" [nzSm]="12" [nzXs]="12">
         <nz-input-group>
           <div class="row-block">
-            <nz-upload
+            <!-- <nz-upload
               formControlName="CIPImgUrl"
               nzAction="https://www.mocky.io/v2/5cc8019d300000980a055e76"
               [nzHeaders]="{ authorization: 'authorization-text' }"
@@ -416,7 +427,12 @@
                 <span nz-icon nzType="upload"></span>
                 上传截图
               </button>
-            </nz-upload>
+            </nz-upload> -->
+            <app-comp-upload
+              [width]="320"
+              (change)="upload($event, 'CIPImgUrl')"
+              title="上传截图"
+            ></app-comp-upload>
             <div class="tips">
               <span
                 nz-icon

+ 19 - 4
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.ts

@@ -17,6 +17,7 @@ import {
   NonNullableFormBuilder,
   Validators,
 } from '@angular/forms';
+import { CompUploadComponent } from '../../../../app/comp-upload/comp-upload.component';
 @Component({
   selector: 'app-basic',
   imports: [
@@ -25,7 +26,8 @@ import {
     NzSelectModule,
     NzRadioModule,
     NzUploadModule,
-    NzTagModule
+    NzTagModule,
+    CompUploadComponent
   ],
   standalone: true,
   templateUrl: './basic-in.component.html',
@@ -91,8 +93,8 @@ export class BasicInComponent implements OnInit {
     printSum: [0, [Validators.required]],
     importantProject: ['', [Validators.required]],
     importantProjectOther: [''],
-    copyrightImgUrl: ['https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf'],
-    CIPImgUrl: ['https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf'],
+    copyrightImgUrl: [''],
+    CIPImgUrl: [''],
     // remember: [true],
   });
   //教材应用对象及所诉学科专业类
@@ -219,7 +221,13 @@ export class BasicInComponent implements OnInit {
       this.msg.error(`${info.file.name} file upload failed.`);
     }
   }
-
+  upload(e: any, type:string) {
+    console.log(e);
+    let file = e[0];
+    if(type == 'copyrightImgUrl' || type == 'CIPImgUrl' ){
+      this.validateForm.value[type] = file
+    }
+  }
   async submitForm(event?: string): Promise<void> {
     console.log(this.validateForm.value);
     if (this.validateForm.valid) {
@@ -327,6 +335,13 @@ export class BasicInComponent implements OnInit {
     this.eduTextbook?.set('importantProjectOther', params.importantProjectOther);
     this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
     this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
+    if(this.tbookSer.profile?.user?.department.objectId){
+      this.eduTextbook?.set('department', {
+        __type: 'Pointer',
+        className: 'Department',
+        objectId: this.tbookSer.profile.user.department.objectId,
+      });
+    }
     await this.eduTextbook?.save();
     return
   }