let docxIcon =
  "https://yth.scjg.ln.gov.cn/sgfs-enterprise/liaoning-app-file/file/liao-ning/doc@2x.png";
let pdfIcon =
  "https://yth.scjg.ln.gov.cn/sgfs-enterprise/liaoning-app-file/file/liao-ning/pdf@2x.png";
let pptIcon =
  "https://yth.scjg.ln.gov.cn/sgfs-enterprise/liaoning-app-file/file/liao-ning/ppt@2x.png";
let xlsxIcon =
  "https://yth.scjg.ln.gov.cn/sgfs-enterprise/liaoning-app-file/file/liao-ning/excel@2x.png";
let txtIcon =
  "https://yth.scjg.ln.gov.cn/sgfs-enterprise/liaoning-app-file/file/liao-ning/text@2x.png";
let noIcon =
  "https://yth.scjg.ln.gov.cn/sgfs-enterprise/liaoning-app-file/file/liao-ning/file@2x.png";

// 文件图标
export function fileType(url) {
  let typeName = url.substr(url.lastIndexOf("."));

  if (typeName == ".pdf") {
    return pdfIcon;
  }
  if (typeName == ".ppt" || typeName == ".pptx") {
    return pptIcon;
  }
  if (typeName == ".docx" || typeName == ".doc") {
    return docxIcon;
  }
  if (typeName == ".xlsx" || typeName == ".xls") {
    return xlsxIcon;
  }
  if (typeName == ".txt") {
    return txtIcon;
  }
  return noIcon;
}

// 上传文件-图标地址出去服务器域名

export function deletelDNS(url) {
  url = url.split("/");
  url =
    url[url.length - 4] +
    "/" +
    url[url.length - 3] +
    "/" +
    url[url.length - 2] +
    "/" +
    url[url.length - 1];
  return url;
}
