linwe
2024-06-03 625b99aaaa484ccfb629ae7b49ec6e07b9541ba1
src/util/util.js
@@ -77,7 +77,12 @@
 * 加密处理
 */
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) => {
@@ -109,16 +114,16 @@
    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();
  });
};
@@ -285,16 +290,16 @@
  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;
@@ -302,13 +307,13 @@
    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
@@ -345,7 +350,7 @@
  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) {
@@ -375,11 +380,11 @@
  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;
@@ -409,7 +414,9 @@
    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