生成代码模版文件新增了查看详情、详情内图片预览、文件下载 (#1516)

* 生成代码模版文件新增了查看详情、详情内图片预览、文件下载
前端工具文件主要修改了utils>format.js

* 替换富文本组建路径

---------

Co-authored-by: CodeLucifer <tender_zhu@foxamil.com>
This commit is contained in:
DaMing
2023-08-17 17:22:30 +08:00
committed by GitHub
co-authored by CodeLucifer
parent 33cb2ed43d
commit 197c4c46ab
2 changed files with 162 additions and 46 deletions
+26
View File
@@ -26,3 +26,29 @@ export const getDictFunc = async(type) => {
const dicts = await getDict(type)
return dicts
}
const path = import.meta.env.VITE_BASE_PATH + ':' + import.meta.env.VITE_SERVER_PORT + '/'
export const ReturnArrImg = (arr) => {
let imgArr = []
if (arr instanceof Array){ // 如果是数组类型
for (let arrKey in arr) {
if (arr[arrKey].slice(0, 4) !== 'http'){
imgArr.push(path + arr[arrKey])
}else {
imgArr.push(arr[arrKey])
}
}
}else { // 如果不是数组类型
if (arr.slice(0, 4) !== 'http'){
imgArr.push(path + arr)
}else {
imgArr.push(arr)
}
}
return imgArr
}
export const onDownloadFile = (url) => {
window.open(path + url)
}