import { RhLabelService } from './../../label.service'; import { Component, OnInit, Input } from '@angular/core'; import { RhApiUrlsService } from 'rh-base/core'; @Component({ selector: 'rh-new-download-printer-plugin', templateUrl: './new-download-printer-plugin.component.html', styleUrls: ['./new-download-printer-plugin.component.less'] }) export class NewDownloadPrinterPluginComponent implements OnInit { toolUrl!: string; driveUrl!: string; /** * @rhPrintPlugin 是否需要下载打印插件 是:true;否:false * @rhPrintDriver 是否需要安装驱动程序 是:true;否:false */ @Input() rhPrintPlugin = true; @Input() rhPrintDriver = true; /** 是否需要传输当前host作为参数 */ @Input() rhHostPara = false; constructor(private operator: RhLabelService, private apiUrls: RhApiUrlsService) {} ngOnInit(): void { this.toolUrl = this.operator.DownLoadPrintToolsNew() + this.getHostPara(); this.driveUrl = this.operator.DownLoadNetFrameworkNew() + this.getHostPara(); } getHostPara() { if (this.rhHostPara) { let hostIp = window.location.host.split(':')[0]; if (hostIp.includes('localhost')) { hostIp = this.apiUrls.appConfigSer.appConfig.ServerIp as string; } return `?hostIp=${hostIp}`; } else { return ''; } } }