diff --git a/angular.json b/angular.json index 9b9432c4..a59093a6 100644 --- a/angular.json +++ b/angular.json @@ -35,8 +35,19 @@ "styles": [ "node_modules/perfect-scrollbar/css/perfect-scrollbar.css", "node_modules/quill/dist/quill.snow.css", - "src/styles.less" + "src/styles.less", + { + "input": "src/styles/default.less", + "bundleName": "default", + "inject": false + }, + { + "input": "src/styles/compact.less", + "bundleName": "compact", + "inject": false + } ], + "scripts": [ "node_modules/quill/dist/quill.min.js", "node_modules/perfect-scrollbar/dist/perfect-scrollbar.js", diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9ed3961e..7b66e545 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -5,6 +5,7 @@ import { environment } from '@env/environment'; import { NzIconService } from 'ng-zorro-antd/icon'; import { NzModalService } from 'ng-zorro-antd/modal'; import { VERSION as VERSION_ZORRO } from 'ng-zorro-antd/version'; +import { ThemeService } from './theme.service'; @Component({ selector: 'app-root', @@ -17,7 +18,8 @@ export class AppComponent implements OnInit { private router: Router, private titleSrv: TitleService, private modalSrv: NzModalService, - private iconService: NzIconService + private iconService: NzIconService, + private themeService: ThemeService ) { renderer.setAttribute(el.nativeElement, 'ng-alain-version', VERSION_ALAIN.full); renderer.setAttribute(el.nativeElement, 'ng-zorro-version', VERSION_ZORRO.full); @@ -47,5 +49,14 @@ export class AppComponent implements OnInit { this.modalSrv.closeAll(); } }); + const screen: any = window.screen + var zoom = window.devicePixelRatio || screen.deviceXDPI / screen?.logicalXDPI; + console.log(zoom) + if (document.body.clientWidth >= 1280) { + if (zoom != 1 && zoom != 2 && zoom != 3) { + this.themeService.toggleTheme().then(); + } + } + } } diff --git a/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts index 19d3e353..9dcc07d7 100644 --- a/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts +++ b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts @@ -144,30 +144,30 @@ export class SupplyManagementBulkAssignedCarComponent implements OnInit { title: '司机姓名', index: 'name', className: 'text-center', - width: '80px' + width: '20%' }, { title: '手机号', index: 'telephone', className: 'text-center', - width: '100px' + width: '15%' }, { title: '车队长', render: 'captain', className: 'text-center', - width: '200px' + width: '30%' }, { title: '指定车辆', render: 'carNo', className: 'text-center', - width: '100px' + width: '15%' }, { title: '操作', className: 'text-center', - width: '80px', + width: '20%', buttons: [ { text: '移除', diff --git a/src/app/routes/sys-setting/components/network-freight/network-freight.component.less b/src/app/routes/sys-setting/components/network-freight/network-freight.component.less index 55ba55e0..efdf7dd2 100644 --- a/src/app/routes/sys-setting/components/network-freight/network-freight.component.less +++ b/src/app/routes/sys-setting/components/network-freight/network-freight.component.less @@ -14,10 +14,10 @@ min-height: 32px; } - input { - width : 100px; - margin-left: 10px; - } + // input { + // width : 100px; + // margin-left: 10px; + // } .ant-form-item-control-input-content { display: flex; diff --git a/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.html b/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.html index 2e0189b6..aadc3214 100644 --- a/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.html +++ b/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.html @@ -11,7 +11,7 @@
-

{{ userDetail?.name }} +

{{ userDetail?.realName }}

@@ -103,10 +103,10 @@ 银行结算信息 - + {{ userIdentityDetail?.name }} - + {{ userIdentityDetail?.certificateNumber }} diff --git a/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.ts b/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.ts index 9335ba47..93498067 100644 --- a/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.ts +++ b/src/app/routes/usercenter/components/driver/captain/captain-detail/captain-detail.component.ts @@ -65,8 +65,6 @@ export class CaptainDetailComponent implements OnInit { /** 启用/冻结司机 */ userAction(status: number) { - console.log(this.userDetail); - this.nzModalService.warning({ nzTitle: status === 1 ? '确定启用该司机吗?' : '确定冻结该司机吗?', nzContent: status === 1 ? '启用后,该司机将恢复正常使用功能,请再次确认!' : '冻结后,司机将被限制使用,无法登陆,请谨慎操作!', diff --git a/src/app/routes/usercenter/components/driver/detail/detail.component.html b/src/app/routes/usercenter/components/driver/detail/detail.component.html index 53d25019..6816bba8 100644 --- a/src/app/routes/usercenter/components/driver/detail/detail.component.html +++ b/src/app/routes/usercenter/components/driver/detail/detail.component.html @@ -11,7 +11,7 @@
-

{{ userDetail?.name }} +

{{ userDetail?.realName }}

@@ -215,7 +215,7 @@ - + + @@ -301,16 +301,16 @@ - + 服务评级 (暂无评级) - + - + 关联企业 { diff --git a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html index 8ae7a79e..7c9edf4e 100644 --- a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html +++ b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.html @@ -42,7 +42,7 @@
- diff --git a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts index c9fa67f7..e4aa738f 100644 --- a/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts +++ b/src/app/routes/usercenter/components/freight/freight-config/freight-config.component.ts @@ -51,6 +51,7 @@ export class FreightConfigComponent implements OnInit { }); } } + this.selectedRows = []; return requestOptions; }; @@ -166,7 +167,7 @@ export class FreightConfigComponent implements OnInit { } exportList() { - const params = { listSource: 1, pageSize: -1 }; + const params = { listSource: 1, pageSize: -1 }; if (this.sf) { Object.assign(params, { ...this.sf.value @@ -282,7 +283,7 @@ export class FreightConfigComponent implements OnInit { format: item => `${item.contractSurchargeRatio}%` }, { - title: '合同单业务量(元)', + title: '合同单业务量(万元)', index: 'contractQuota', width: 170, type: 'widget', @@ -290,7 +291,7 @@ export class FreightConfigComponent implements OnInit { widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.contractQuota }) } }, { - title: '货源单业务量(元)', + title: '货源单业务量(万元)', index: 'goodsQuota', width: 170, type: 'widget', diff --git a/src/app/shared/components/dynamic-setting/dynamic-setting-h5/dynamic-setting-h5.component.less b/src/app/shared/components/dynamic-setting/dynamic-setting-h5/dynamic-setting-h5.component.less index c6877599..2693c49f 100644 --- a/src/app/shared/components/dynamic-setting/dynamic-setting-h5/dynamic-setting-h5.component.less +++ b/src/app/shared/components/dynamic-setting/dynamic-setting-h5/dynamic-setting-h5.component.less @@ -24,7 +24,7 @@ } .ant-form-item-label>label { - height: 36px; + height: 42px; } .se__horizontal>.se__item .se__label-text { diff --git a/src/app/theme.service.ts b/src/app/theme.service.ts new file mode 100644 index 00000000..fd40476a --- /dev/null +++ b/src/app/theme.service.ts @@ -0,0 +1,73 @@ +import { Injectable } from '@angular/core'; + +enum ThemeType { + compact = 'compact', + default = 'default', +} + +@Injectable({ + providedIn: 'root', +}) +export class ThemeService { + currentTheme = ThemeType.default; + + constructor() {} + + private reverseTheme(theme: string): ThemeType { + return theme === ThemeType.compact ? ThemeType.default : ThemeType.compact; + } + + private removeUnusedTheme(theme: ThemeType): void { + document.documentElement.classList.remove(theme); + const removedThemeStyle = document.getElementById(theme); + if (removedThemeStyle) { + document.head.removeChild(removedThemeStyle); + } + } + + private loadCss(href: string, id: string): Promise { + return new Promise((resolve, reject) => { + const style01 = document.createElement('link'); + style01.rel = 'stylesheet'; + style01.href = 'compact.css'; + style01.onload = resolve; + style01.onerror = reject; + document.body.after(style01); + + const style = document.createElement('link'); + style.rel = 'stylesheet'; + style.href = href; + style.onload = resolve; + style.onerror = reject; + document.body.after(style); + + + }); + + } + + public loadTheme(firstLoad = true): Promise { + //const theme = this.currentTheme; + const theme = 'assets/style.compact'; + if (firstLoad) { + document.documentElement.classList.add(theme); + } + return new Promise((resolve, reject) => { + this.loadCss(`${theme}.css`, theme).then( + (e) => { + if (!firstLoad) { + document.documentElement.classList.add(theme); + } + this.removeUnusedTheme(this.reverseTheme(theme)); + resolve(e); + }, + (e) => reject(e) + ); + }); + } + + public toggleTheme(): Promise { + this.currentTheme = this.reverseTheme(this.currentTheme); + return this.loadTheme(false); + } +} diff --git a/src/index.html b/src/index.html index ca137d18..3afb9aef 100644 --- a/src/index.html +++ b/src/index.html @@ -15,13 +15,13 @@ 运多星运营平台 - + -