feat: 添加文件图标
parent
c84da369cf
commit
2ae413ccb2
|
|
@ -75,7 +75,6 @@ jobs:
|
||||||
|
|
||||||
- name: 登陆到部署环境执行更新命令
|
- name: 登陆到部署环境执行更新命令
|
||||||
uses: appleboy/ssh-action@v1.0.0
|
uses: appleboy/ssh-action@v1.0.0
|
||||||
if: false
|
|
||||||
with:
|
with:
|
||||||
host: ${{ env.deploy_host }}
|
host: ${{ env.deploy_host }}
|
||||||
port: ${{ env.deploy_port }}
|
port: ${{ env.deploy_port }}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -93,13 +93,6 @@ const buttons = [
|
||||||
Message.info("暂无通知");
|
Message.info("暂无通知");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
icon: "icon-park-outline-moon",
|
|
||||||
tooltip: "主题",
|
|
||||||
onClick: () => {
|
|
||||||
appStore.toggleDark();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
icon: "icon-park-outline-config",
|
icon: "icon-park-outline-config",
|
||||||
tooltip: "设置",
|
tooltip: "设置",
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@
|
||||||
<ul v-if="fileList.length" class="h-[424px] overflow-hidden p-0 m-0">
|
<ul v-if="fileList.length" class="h-[424px] overflow-hidden p-0 m-0">
|
||||||
<a-scrollbar outer-class="h-full overflow-hidden" class="h-full overflow-auto pr-[20px] divide-y">
|
<a-scrollbar outer-class="h-full overflow-hidden" class="h-full overflow-auto pr-[20px] divide-y">
|
||||||
<li v-for="item in fileList" :key="item.uid" class="flex items-center gap-2 py-3">
|
<li v-for="item in fileList" :key="item.uid" class="flex items-center gap-2 py-3">
|
||||||
<div class="text-2xl">
|
<div class="text-4xl rounded pr-0.5 flex justify-center">
|
||||||
<i :class="getIconnameByMimetype(item.file?.type ?? 'video')"></i>
|
<i :class="getIcon(item.file?.type ?? 'video')"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 overflow-hidden">
|
<div class="flex-1 overflow-hidden">
|
||||||
<div class="truncate text-slate-900">
|
<div class="truncate text-slate-900">
|
||||||
|
|
@ -56,7 +56,9 @@
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.status === 'done'" class="text-green-600">
|
<span v-else-if="item.status === 'done'" class="text-green-600">
|
||||||
完成(耗时:{{ fileMap.get(item.uid)?.cost || 0 }}秒)
|
完成(
|
||||||
|
耗时:{{ fileMap.get(item.uid)?.cost || 0 }}秒,
|
||||||
|
平均:{{ numeral(fileMap.get(item.uid)?.aspeed || 0).format("0 b") }}/s)
|
||||||
</span>
|
</span>
|
||||||
<span v-else="item.status === 'error'" class="text-red-500">
|
<span v-else="item.status === 'error'" class="text-red-500">
|
||||||
失败(原因:{{ fileMap.get(item.uid)?.error }})
|
失败(原因:{{ fileMap.get(item.uid)?.error }})
|
||||||
|
|
@ -100,7 +102,7 @@ import { delConfirm } from "@/utils";
|
||||||
import { FileItem, Message, RequestOption, UploadInstance } from "@arco-design/web-vue";
|
import { FileItem, Message, RequestOption, UploadInstance } from "@arco-design/web-vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import numeral from "numeral";
|
import numeral from "numeral";
|
||||||
import { getIconnameByMimetype } from "./util";
|
import { getIcon } from "./util";
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: "success", item: FileItem): void;
|
(event: "success", item: FileItem): void;
|
||||||
|
|
@ -117,6 +119,7 @@ const fileMap = reactive<
|
||||||
lastTime: number;
|
lastTime: number;
|
||||||
lastLoaded: number;
|
lastLoaded: number;
|
||||||
speed: number;
|
speed: number;
|
||||||
|
aspeed: number;
|
||||||
cost: number;
|
cost: number;
|
||||||
error: string;
|
error: string;
|
||||||
} | null
|
} | null
|
||||||
|
|
@ -242,6 +245,7 @@ const upload = (option: RequestOption) => {
|
||||||
lastLoaded: 0,
|
lastLoaded: 0,
|
||||||
cost: 0,
|
cost: 0,
|
||||||
speed: 0,
|
speed: 0,
|
||||||
|
aspeed: 0,
|
||||||
error: "网络异常",
|
error: "网络异常",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -258,6 +262,7 @@ const upload = (option: RequestOption) => {
|
||||||
const nowTime = Date.now();
|
const nowTime = Date.now();
|
||||||
const diff = (e.loaded - lastLoaded) / (nowTime - lastTime);
|
const diff = (e.loaded - lastLoaded) / (nowTime - lastTime);
|
||||||
const speed = Math.floor(diff * 1000);
|
const speed = Math.floor(diff * 1000);
|
||||||
|
item.aspeed = (item.speed + speed) / 2
|
||||||
item.speed = speed;
|
item.speed = speed;
|
||||||
item.lastLoaded = e.loaded;
|
item.lastLoaded = e.loaded;
|
||||||
item.lastTime = nowTime;
|
item.lastTime = nowTime;
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,26 @@ const typeIconMap: Record<string, string> = {
|
||||||
unknown: "icon-park-outline-file-question",
|
unknown: "icon-park-outline-file-question",
|
||||||
};
|
};
|
||||||
|
|
||||||
const imageIconMap: Record<string, string> = {
|
|
||||||
jpg: "icon-park-outline-file-jpg",
|
|
||||||
png: "icon-park-outline-file-jpg",
|
|
||||||
};
|
|
||||||
|
|
||||||
function getIconnameByMimetype(mimetype: string) {
|
function getIconnameByMimetype(mimetype: string) {
|
||||||
const [type, subtype] = mimetype.split("/");
|
const [type, subtype] = mimetype.split("/");
|
||||||
return typeIconMap[type] || typeIconMap.unknown;
|
return typeIconMap[type] || typeIconMap.unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { getIconnameByMimetype };
|
function getIcon(mimetype: string) {
|
||||||
|
if (mimetype.startsWith("image")) {
|
||||||
|
return "icon-fmt-png";
|
||||||
|
}
|
||||||
|
if (mimetype.startsWith("video")) {
|
||||||
|
return "icon-fmt-video";
|
||||||
|
}
|
||||||
|
if (mimetype.startsWith("text")) {
|
||||||
|
return "icon-fmt-txt";
|
||||||
|
}
|
||||||
|
if (mimetype.startsWith("audio")) {
|
||||||
|
return "icon-fmt-mp";
|
||||||
|
}
|
||||||
|
return "icon-fmt-visio";
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getIcon, getIconnameByMimetype };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
import { FileCategory, api } from "@/api";
|
import { FileCategory, api } from "@/api";
|
||||||
import { createColumn, updateColumn, useAniTable } from "@/components";
|
import { createColumn, updateColumn, useAniTable } from "@/components";
|
||||||
import { delConfirm } from "@/utils";
|
import { delConfirm } from "@/utils";
|
||||||
|
import { Message } from "@arco-design/web-vue";
|
||||||
import numeral from "numeral";
|
import numeral from "numeral";
|
||||||
import AniGroup from "./components/group.vue";
|
import AniGroup from "./components/group.vue";
|
||||||
import AniUpload from "./components/upload.vue";
|
import AniUpload from "./components/upload.vue";
|
||||||
import { Message } from "@arco-design/web-vue";
|
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const image = ref("");
|
const image = ref("");
|
||||||
|
|
@ -190,7 +190,7 @@ const [fileTable, fileCtx] = useAniTable({
|
||||||
<route lang="json">
|
<route lang="json">
|
||||||
{
|
{
|
||||||
"meta": {
|
"meta": {
|
||||||
"sort": 10304,
|
"sort": 10305,
|
||||||
"title": "素材管理",
|
"title": "素材管理",
|
||||||
"icon": "icon-park-outline-movie-board"
|
"icon": "icon-park-outline-movie-board"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
<route lang="json">
|
<route lang="json">
|
||||||
{
|
{
|
||||||
"meta": {
|
"meta": {
|
||||||
"sort": 10300,
|
"sort": 10301,
|
||||||
"title": "文章管理",
|
"title": "文章管理",
|
||||||
"icon": "icon-park-outline-editor"
|
"icon": "icon-park-outline-editor"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
"vite.config.ts",
|
"vite.config.ts",
|
||||||
"scripts/vite/**/*.ts",
|
"scripts/vite/**/*.ts",
|
||||||
"scripts/vite/file.json",
|
"scripts/vite/file.json",
|
||||||
|
"scripts/vite/fmt.json",
|
||||||
"package.json",
|
"package.json",
|
||||||
"src/types/env.d.ts"
|
"src/types/env.d.ts"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { defineConfig, loadEnv } from "vite";
|
||||||
import Page from "vite-plugin-pages";
|
import Page from "vite-plugin-pages";
|
||||||
import { arcoToUnoColor } from "./scripts/vite/color";
|
import { arcoToUnoColor } from "./scripts/vite/color";
|
||||||
import iconFile from "./scripts/vite/file.json";
|
import iconFile from "./scripts/vite/file.json";
|
||||||
|
import iconFmt from "./scripts/vite/fmt.json";
|
||||||
import plugin from "./scripts/vite/plugin";
|
import plugin from "./scripts/vite/plugin";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,6 +84,7 @@ export default defineConfig(({ mode }) => {
|
||||||
prefix: "",
|
prefix: "",
|
||||||
collections: {
|
collections: {
|
||||||
"icon-file": iconFile,
|
"icon-file": iconFile,
|
||||||
|
"icon-fmt": iconFmt,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue