From 324aaa30572881f5ef3edf835af4923a31503733 Mon Sep 17 00:00:00 2001 From: pixelmaxQM Date: Sat, 21 Mar 2026 07:32:55 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?getUrl=E5=87=BD=E6=95=B0=E6=9B=BF=E4=BB=A3=E7=A1=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/utils/format.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/web/src/utils/format.js b/web/src/utils/format.js index 9cd6b834e..3f1e1a830 100644 --- a/web/src/utils/format.js +++ b/web/src/utils/format.js @@ -1,6 +1,7 @@ import { formatTimeToStr } from '@/utils/date' import { getDict } from '@/utils/dictionary' import { ref } from 'vue' +import { getUrl } from './image' export const formatBoolean = (bool) => { if (bool !== null) { @@ -78,25 +79,15 @@ export const getDictFunc = async (type) => { return dicts } -const path = import.meta.env.VITE_FILE_API export const ReturnArrImg = (arr) => { const imgArr = [] if (arr instanceof Array) { // 如果是数组类型 for (const arrKey in arr) { - if (arr[arrKey].slice(0, 4) !== 'http') { - imgArr.push(path + arr[arrKey]) - } else { - imgArr.push(arr[arrKey]) - } + imgArr.push(getUrl(arr[arrKey])) } } else { - // 如果不是数组类型 - if (arr?.slice(0, 4) !== 'http') { - imgArr.push(path + arr) - } else { - imgArr.push(arr) - } + imgArr.push(getUrl(arr)) } return imgArr } @@ -104,7 +95,7 @@ export const ReturnArrImg = (arr) => { export const returnArrImg = ReturnArrImg export const onDownloadFile = (url) => { - window.open(path + url) + window.open(getUrl(url)) } const colorToHex = (u) => { let e = u.replace('#', '').match(/../g)