| | |
| | | * 加密处理 |
| | | */ |
| | | export const encryption = (params) => { |
| | | let { data, type, param, key } = params; |
| | | let { |
| | | data, |
| | | type, |
| | | param, |
| | | key |
| | | } = params; |
| | | let result = JSON.parse(JSON.stringify(data)); |
| | | if (type == "Base64") { |
| | | param.forEach((ele) => { |
| | |
| | | callback(); |
| | | } |
| | | |
| | | document.addEventListener("fullscreenchange", function () { |
| | | document.addEventListener("fullscreenchange", function() { |
| | | listen(); |
| | | }); |
| | | document.addEventListener("mozfullscreenchange", function () { |
| | | document.addEventListener("mozfullscreenchange", function() { |
| | | listen(); |
| | | }); |
| | | document.addEventListener("webkitfullscreenchange", function () { |
| | | document.addEventListener("webkitfullscreenchange", function() { |
| | | listen(); |
| | | }); |
| | | document.addEventListener("msfullscreenchange", function () { |
| | | document.addEventListener("msfullscreenchange", function() { |
| | | listen(); |
| | | }); |
| | | }; |
| | |
| | | const dualScreenTop = |
| | | window.screenTop !== undefined ? window.screenTop : screen.top; |
| | | |
| | | const width = window.innerWidth |
| | | ? window.innerWidth |
| | | : document.documentElement.clientWidth |
| | | ? document.documentElement.clientWidth |
| | | : screen.width; |
| | | const height = window.innerHeight |
| | | ? window.innerHeight |
| | | : document.documentElement.clientHeight |
| | | ? document.documentElement.clientHeight |
| | | : screen.height; |
| | | const width = window.innerWidth ? |
| | | window.innerWidth : |
| | | document.documentElement.clientWidth ? |
| | | document.documentElement.clientWidth : |
| | | screen.width; |
| | | const height = window.innerHeight ? |
| | | window.innerHeight : |
| | | document.documentElement.clientHeight ? |
| | | document.documentElement.clientHeight : |
| | | screen.height; |
| | | |
| | | const left = width / 2 - w / 2 + dualScreenLeft; |
| | | const top = height / 2 - h / 2 + dualScreenTop; |
| | |
| | | url, |
| | | title, |
| | | "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=" + |
| | | w + |
| | | ", height=" + |
| | | h + |
| | | ", top=" + |
| | | top + |
| | | ", left=" + |
| | | left |
| | | w + |
| | | ", height=" + |
| | | h + |
| | | ", top=" + |
| | | top + |
| | | ", left=" + |
| | | left |
| | | ); |
| | | |
| | | // Puts focus on the newWindow |
| | |
| | | xhr.open("get", path); |
| | | xhr.responseType = "blob"; |
| | | xhr.send(); |
| | | xhr.onload = function () { |
| | | xhr.onload = function() { |
| | | if (this.status === 200 || this.status === 304) { |
| | | // 如果是IE10及以上,不支持download属性,采用msSaveOrOpenBlob方法,但是IE10以下也不支持msSaveOrOpenBlob |
| | | if ("msSaveOrOpenBlob" in navigator) { |
| | |
| | | xhr.open("get", path); |
| | | xhr.responseType = "blob"; |
| | | xhr.send(); |
| | | xhr.onload = function () { |
| | | xhr.onload = function() { |
| | | if (this.status === 200 || this.status === 304) { |
| | | const fileReader = new FileReader(); |
| | | fileReader.readAsDataURL(this.response); |
| | | fileReader.onload = function () { |
| | | fileReader.onload = function() { |
| | | const a = document.createElement("a"); |
| | | a.style.display = "none"; |
| | | a.href = this.result; |
| | |
| | | link.click(); |
| | | } else if (typeof window.navigator.msSaveBlob !== "undefined") { |
| | | // IE |
| | | var blob = new Blob([data], { type: "application/force-download" }); |
| | | var blob = new Blob([data], { |
| | | type: "application/force-download" |
| | | }); |
| | | window.navigator.msSaveBlob(blob, filename); |
| | | } else { |
| | | // Firefox |