Commit e0fdfcea authored by wangqinghua's avatar wangqinghua

bug 修正

parent f61dd0ed
......@@ -2,9 +2,13 @@ import {Injectable, OnInit} from '@angular/core';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {SERVER_API_URL, SERVER_API_URL_COMS} from '../../app.constants';
import {DatePipe} from '@angular/common';
import {WorkService} from '../../work/work.service';
declare var ActiveXObject: ActiveXObject;
interface ActiveXObject {
new (type: string): ActiveXObject;
new(type: string): ActiveXObject;
SendKeys(key: string): void;
}
......@@ -12,7 +16,7 @@ interface ActiveXObject {
export class CommonService implements OnInit {
constructor(private modalSer: NzModalService, private datePipe: DatePipe,
private message: NzMessageService) {
private message: NzMessageService,private workSer:WorkService) {
// 定义发射事件
}
......@@ -143,11 +147,11 @@ export class CommonService implements OnInit {
ieEDGE = navigator.userAgent.match(/Edge/g),
ieVer = (ie ? ie[1] : (ie11 ? 11 : (ieEDGE ? 12 : -1)));
if (ieVer > -1) {
if(typeof (<any>window).ActiveXObject !== "undefined") {
if (typeof (<any>window).ActiveXObject !== 'undefined') {
//这的方法 模拟f11键,使浏览器全屏
const wscript = new ActiveXObject("WScript.Shell");
if(wscript != null) {
wscript.SendKeys("{F11}");
const wscript = new ActiveXObject('WScript.Shell');
if (wscript != null) {
wscript.SendKeys('{F11}');
}
}
}
......@@ -227,7 +231,7 @@ export class CommonService implements OnInit {
}
//内存单位换算
unitConversion(unit){
unitConversion(unit) {
let res;
let Gbps = 1000 * 1000 * 1000;
let Mbps = 1000 * 1000;
......@@ -240,8 +244,25 @@ export class CommonService implements OnInit {
} else if (size / kbps > 1) {
res += (size / kbps).toFixed(2) + 'kbps';
} else {
res +=(size) + 'bps';
res += (size) + 'bps';
}
return res;
}
/**
* 文件预览
*/
previewFile(fileUrl) {
// this.workSer.getPreview().subscribe(
// (res)=>{
//
// }
// )
console.log(window.location.host + '/zabbixBox');
const previeUrl1 = "http://10.10.38.99:8282"+fileUrl;
// const previeUrl = "http://10.10.38.99:8282/file/knowledge/zyh.jpg";
window.open('http://10.10.38.99:8012/onlinePreview?url=' + encodeURIComponent(previeUrl1) );
// window.open('http://10.10.38.99:8012/onlinePreview?url=' + encodeURIComponent(previeUrl) );
// window.open(window.location.host + '/zabbixBox' + fileUrl);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment