seimin 1 year ago
parent
commit
2bcbb88d0b

+ 1 - 1
proxy.conf.json

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

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

@@ -9,13 +9,15 @@ import { ToolService } from './services/tool.service';
9
 export class AppComponent {
9
 export class AppComponent {
10
   constructor(private titleService:Title, private tool:ToolService){
10
   constructor(private titleService:Title, private tool:ToolService){
11
     this.tool.getSysNameAndLogoAsync().subscribe(result => {
11
     this.tool.getSysNameAndLogoAsync().subscribe(result => {
12
-      let logoTitle = '';
12
+      let logoTitle = result.sysName || '';
13
       let logoUrl = result.logo || '';
13
       let logoUrl = result.logo || '';
14
+      let faviconUrl = result.favicon || '';
14
       this.tool.setSysName(logoTitle);
15
       this.tool.setSysName(logoTitle);
15
       this.tool.setLogo(logoUrl);
16
       this.tool.setLogo(logoUrl);
17
+      this.tool.setFavicon(faviconUrl);
16
       this.titleService.setTitle(this.tool.logoTitle);
18
       this.titleService.setTitle(this.tool.logoTitle);
17
       console.log(document.querySelector('#favicon'));
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
 export class ToolService {
7
 export class ToolService {
8
   logoUrl = '';
8
   logoUrl = '';
9
   logoTitle = '';
9
   logoTitle = '';
10
+  faviconUrl = '';
10
 
11
 
11
   constructor(private mainService: MainService) {}
12
   constructor(private mainService: MainService) {}
12
 
13
 
@@ -25,6 +26,11 @@ export class ToolService {
25
     this.logoUrl = logoUrl;
26
     this.logoUrl = logoUrl;
26
   }
27
   }
27
 
28
 
29
+  // 设置faviconUrl
30
+  setFavicon(faviconUrl){
31
+    this.faviconUrl = faviconUrl;
32
+  }
33
+
28
   // 获取权限中的院区
34
   // 获取权限中的院区
29
   getHospitalList() {
35
   getHospitalList() {
30
     return (
36
     return (

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

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

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

@@ -1,7 +1,7 @@
1
 <nz-layout class="app-layout display_flex flex_auto ant-layout-has-sider">
1
 <nz-layout class="app-layout display_flex flex_auto ant-layout-has-sider">
2
   <overlay-scrollbars #osComponentRef1 class="menu-sidebar">
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
         <img [src]="tool.logoUrl" [alt]="tool.logoTitle">
5
         <img [src]="tool.logoUrl" [alt]="tool.logoTitle">
6
         <span>{{tool.logoTitle}}</span>
6
         <span>{{tool.logoTitle}}</span>
7
       </div>
7
       </div>

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

@@ -27,7 +27,7 @@
27
               nzListType="picture-card"
27
               nzListType="picture-card"
28
               [nzShowUploadList]="false"
28
               [nzShowUploadList]="false"
29
               [nzBeforeUpload]="beforeUpload"
29
               [nzBeforeUpload]="beforeUpload"
30
-              (nzChange)="handleChange($event)"
30
+              (nzChange)="handleChange($event, 'avatarUrl')"
31
             >
31
             >
32
               <ng-container *ngIf="!avatarUrl">
32
               <ng-container *ngIf="!avatarUrl">
33
                 <i class="upload-icon" nz-icon [nzType]="avatarLoading ? 'avatarLoading' : 'plus'"></i>
33
                 <i class="upload-icon" nz-icon [nzType]="avatarLoading ? 'avatarLoading' : 'plus'"></i>
@@ -38,6 +38,27 @@
38
           </nz-form-control>
38
           </nz-form-control>
39
         </nz-form-item>
39
         </nz-form-item>
40
         <nz-form-item class="formItem">
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
           <nz-form-label [nzSpan]="24" nzFor="defaultPwd" nzRequired class="label">用户默认密码</nz-form-label>
62
           <nz-form-label [nzSpan]="24" nzFor="defaultPwd" nzRequired class="label">用户默认密码</nz-form-label>
42
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入用户默认密码!">
63
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入用户默认密码!">
43
             <input nz-input formControlName="defaultPwd" id="defaultPwd" placeholder="请输入用户默认密码">
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
   flex-direction: column;
4
   flex-direction: column;
5
   justify-content: space-between;
5
   justify-content: space-between;
6
   .avatar {
6
   .avatar {
7
-    width: 128px;
8
-    max-height: 128px;
7
+    width: 86px;
8
+    max-height: 86px;
9
   }
9
   }
10
   .upload-icon {
10
   .upload-icon {
11
     font-size: 32px;
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
       systemName: [""],
55
       systemName: [""],
56
       largeScreenName: [""],
56
       largeScreenName: [""],
57
       logo: [""],
57
       logo: [""],
58
+      favicon: [""],
58
       defaultRoleOfNurse: [null, [Validators.required]],
59
       defaultRoleOfNurse: [null, [Validators.required]],
59
       formUrl: [{ value: null, disabled: true }, [Validators.required]],
60
       formUrl: [{ value: null, disabled: true }, [Validators.required]],
60
       serviceUrl: [{ value: null, disabled: true }, [Validators.required]],
61
       serviceUrl: [{ value: null, disabled: true }, [Validators.required]],
@@ -65,8 +66,16 @@ export class SysConfigComponent implements OnInit {
65
     this.getDeptType();
66
     this.getDeptType();
66
     this.coopBtns = this.tool.initCoopBtns(this.route);
67
     this.coopBtns = this.tool.initCoopBtns(this.route);
67
     this.getRoleList();
68
     this.getRoleList();
69
+    this.getLogoOrFavicon();
68
     this.avatarUrl = this.tool.logoUrl;
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
   avatarLoading = false;
299
   avatarLoading = false;
291
   avatarUrl: string;
300
   avatarUrl: string;
301
+  avatarUrl1: string;
292
   beforeUpload = (file: File) => {
302
   beforeUpload = (file: File) => {
293
     return new Observable((observer: Observer<boolean>) => {
303
     return new Observable((observer: Observer<boolean>) => {
294
       const isPic = (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg');
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
     reader.readAsDataURL(img);
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
     switch (info.file.status) {
328
     switch (info.file.status) {
332
       case 'uploading':
329
       case 'uploading':
333
         this.avatarLoading = true;
330
         this.avatarLoading = true;
@@ -336,7 +333,7 @@ export class SysConfigComponent implements OnInit {
336
         // Get this url from response in real world.
333
         // Get this url from response in real world.
337
         this.getBase64(info.file!.originFileObj!, (img: string) => {
334
         this.getBase64(info.file!.originFileObj!, (img: string) => {
338
           this.avatarLoading = false;
335
           this.avatarLoading = false;
339
-          this.avatarUrl = img;
336
+          this[avatarUrl] = img;
340
         });
337
         });
341
         break;
338
         break;
342
       case 'error':
339
       case 'error':