seimin 1 년 전
부모
커밋
2bcbb88d0b

+ 1 - 1
proxy.conf.json

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "/service": {
3
-    "target": "http://192.168.3.108",
3
+    "target": "http://192.168.4.170",
4 4
     "logLevel": "debug",
5 5
     "changeOrigin": true,
6 6
     "pathRewrite": {

+ 4 - 2
src/app/app.component.ts

@@ -9,13 +9,15 @@ import { ToolService } from './services/tool.service';
9 9
 export class AppComponent {
10 10
   constructor(private titleService:Title, private tool:ToolService){
11 11
     this.tool.getSysNameAndLogoAsync().subscribe(result => {
12
-      let logoTitle = '';
12
+      let logoTitle = result.sysName || '';
13 13
       let logoUrl = result.logo || '';
14
+      let faviconUrl = result.favicon || '';
14 15
       this.tool.setSysName(logoTitle);
15 16
       this.tool.setLogo(logoUrl);
17
+      this.tool.setFavicon(faviconUrl);
16 18
       this.titleService.setTitle(this.tool.logoTitle);
17 19
       console.log(document.querySelector('#favicon'));
18
-      (document.querySelector('#favicon') as any).href = this.tool.logoUrl;
20
+      (document.querySelector('#favicon') as any).href = this.tool.faviconUrl;
19 21
     })
20 22
   }
21 23
 }

+ 6 - 0
src/app/services/tool.service.ts

@@ -7,6 +7,7 @@ import { MainService } from "./main.service";
7 7
 export class ToolService {
8 8
   logoUrl = '';
9 9
   logoTitle = '';
10
+  faviconUrl = '';
10 11
 
11 12
   constructor(private mainService: MainService) {}
12 13
 
@@ -25,6 +26,11 @@ export class ToolService {
25 26
     this.logoUrl = logoUrl;
26 27
   }
27 28
 
29
+  // 设置faviconUrl
30
+  setFavicon(faviconUrl){
31
+    this.faviconUrl = faviconUrl;
32
+  }
33
+
28 34
   // 获取权限中的院区
29 35
   getHospitalList() {
30 36
     return (

+ 1 - 1
src/app/views/hushijiandan/hushijiandan.component.html

@@ -9,7 +9,7 @@
9 9
       <div
10 10
         class="sidebar-logo display_flex align-items_center justify-content_flex-center"
11 11
       >
12
-        <div style="line-height: normal;">
12
+        <div style="line-height: normal;height: 100%;">
13 13
           <!-- <img src="../../assets/images/xiehe_logo.jpg" style="width:100%;" alt="logo" /> -->
14 14
           <img [src]="tool.logoUrl" alt="logo" />
15 15
           <span>{{tool.logoTitle}}</span>

+ 2 - 2
src/app/views/main/main.component.html

@@ -1,7 +1,7 @@
1 1
 <nz-layout class="app-layout display_flex flex_auto ant-layout-has-sider">
2 2
   <overlay-scrollbars #osComponentRef1 class="menu-sidebar">
3
-    <div class="sidebar-logo display_flex align-items_center">
4
-      <div style="line-height: normal;">
3
+    <div class="sidebar-logo display_flex align-items_center justify-content_flex-center">
4
+      <div style="line-height: normal;height:100%;">
5 5
         <img [src]="tool.logoUrl" [alt]="tool.logoTitle">
6 6
         <span>{{tool.logoTitle}}</span>
7 7
       </div>

+ 22 - 1
src/app/views/sys-config/sys-config.component.html

@@ -27,7 +27,7 @@
27 27
               nzListType="picture-card"
28 28
               [nzShowUploadList]="false"
29 29
               [nzBeforeUpload]="beforeUpload"
30
-              (nzChange)="handleChange($event)"
30
+              (nzChange)="handleChange($event, 'avatarUrl')"
31 31
             >
32 32
               <ng-container *ngIf="!avatarUrl">
33 33
                 <i class="upload-icon" nz-icon [nzType]="avatarLoading ? 'avatarLoading' : 'plus'"></i>
@@ -38,6 +38,27 @@
38 38
           </nz-form-control>
39 39
         </nz-form-item>
40 40
         <nz-form-item class="formItem">
41
+          <nz-form-label [nzSpan]="24" class="label" nzFor="favicon">favicon图标</nz-form-label>
42
+          <nz-form-control [nzSpan]="24" nzErrorTip="请选择系统favicon图标!">
43
+            <nz-upload nzFor="favicon"
44
+              class="avatar-uploader"
45
+              nzAction="/service/common/common/uploadAttachment/faviconLogo/777/777"
46
+              [nzCustomRequest]="customReq"
47
+              nzName="file"
48
+              nzListType="picture-card"
49
+              [nzShowUploadList]="false"
50
+              [nzBeforeUpload]="beforeUpload"
51
+              (nzChange)="handleChange($event, 'avatarUrl1')"
52
+            >
53
+              <ng-container *ngIf="!avatarUrl1">
54
+                <i class="upload-icon" nz-icon [nzType]="avatarLoading ? 'avatarLoading' : 'plus'"></i>
55
+                <div class="ant-upload-text">点击上传</div>
56
+              </ng-container>
57
+              <img *ngIf="avatarUrl1" [src]="avatarUrl1" class="avatar" />
58
+            </nz-upload>
59
+          </nz-form-control>
60
+        </nz-form-item>
61
+        <nz-form-item class="formItem">
41 62
           <nz-form-label [nzSpan]="24" nzFor="defaultPwd" nzRequired class="label">用户默认密码</nz-form-label>
42 63
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入用户默认密码!">
43 64
             <input nz-input formControlName="defaultPwd" id="defaultPwd" placeholder="请输入用户默认密码">

+ 2 - 2
src/app/views/sys-config/sys-config.component.less

@@ -4,8 +4,8 @@
4 4
   flex-direction: column;
5 5
   justify-content: space-between;
6 6
   .avatar {
7
-    width: 128px;
8
-    max-height: 128px;
7
+    width: 86px;
8
+    max-height: 86px;
9 9
   }
10 10
   .upload-icon {
11 11
     font-size: 32px;

+ 13 - 16
src/app/views/sys-config/sys-config.component.ts

@@ -55,6 +55,7 @@ export class SysConfigComponent implements OnInit {
55 55
       systemName: [""],
56 56
       largeScreenName: [""],
57 57
       logo: [""],
58
+      favicon: [""],
58 59
       defaultRoleOfNurse: [null, [Validators.required]],
59 60
       formUrl: [{ value: null, disabled: true }, [Validators.required]],
60 61
       serviceUrl: [{ value: null, disabled: true }, [Validators.required]],
@@ -65,8 +66,16 @@ export class SysConfigComponent implements OnInit {
65 66
     this.getDeptType();
66 67
     this.coopBtns = this.tool.initCoopBtns(this.route);
67 68
     this.getRoleList();
69
+    this.getLogoOrFavicon();
68 70
     this.avatarUrl = this.tool.logoUrl;
69
-    this.validateForm.controls.logo.setValue(this.tool.logoUrl);
71
+    this.avatarUrl1 = this.tool.logoUrl;
72
+  }
73
+
74
+  getLogoOrFavicon(){
75
+    this.tool.getSysNameAndLogoAsync().subscribe(result => {
76
+      this.avatarUrl = result.logo || '';
77
+      this.avatarUrl1 = result.favicon || '';
78
+    })
70 79
   }
71 80
 
72 81
   // 角色列表
@@ -289,6 +298,7 @@ export class SysConfigComponent implements OnInit {
289 298
 
290 299
   avatarLoading = false;
291 300
   avatarUrl: string;
301
+  avatarUrl1: string;
292 302
   beforeUpload = (file: File) => {
293 303
     return new Observable((observer: Observer<boolean>) => {
294 304
       const isPic = (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg');
@@ -314,20 +324,7 @@ export class SysConfigComponent implements OnInit {
314 324
     reader.readAsDataURL(img);
315 325
   }
316 326
 
317
-  private checkImageDimension(file: File): Promise<boolean> {
318
-    return new Promise(resolve => {
319
-      const img = new Image(); // create image
320
-      img.src = window.URL.createObjectURL(file);
321
-      img.onload = () => {
322
-        const width = img.naturalWidth;
323
-        const height = img.naturalHeight;
324
-        window.URL.revokeObjectURL(img.src!);
325
-        resolve(width === height && width >= 300);
326
-      };
327
-    });
328
-  }
329
-
330
-  handleChange(info: { file: UploadFile }): void {
327
+  handleChange(info: { file: UploadFile }, avatarUrl): void {
331 328
     switch (info.file.status) {
332 329
       case 'uploading':
333 330
         this.avatarLoading = true;
@@ -336,7 +333,7 @@ export class SysConfigComponent implements OnInit {
336 333
         // Get this url from response in real world.
337 334
         this.getBase64(info.file!.originFileObj!, (img: string) => {
338 335
           this.avatarLoading = false;
339
-          this.avatarUrl = img;
336
+          this[avatarUrl] = img;
340 337
         });
341 338
         break;
342 339
       case 'error':