mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-24 15:14:01 +08:00
Feat: add get extame
This commit is contained in:
parent
245ad7b31c
commit
4bd41fc28c
8
frontend/src/tools/fileManager.ts
Normal file
8
frontend/src/tools/fileManager.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { t } from "@/lang/i18n";
|
||||
|
||||
export const getExtName = (fileName: string) => {
|
||||
const i = fileName.lastIndexOf(".");
|
||||
const suffix = fileName.substring(i + 1).toUpperCase();
|
||||
|
||||
return `${suffix} ${t("文件")}`;
|
||||
};
|
@ -34,6 +34,7 @@ import {
|
||||
import { throttle } from "lodash";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { parseForwardAddress } from "@/tools/protocol";
|
||||
import { getExtName } from "@/tools/fileManager";
|
||||
|
||||
const props = defineProps<{
|
||||
card: LayoutCard;
|
||||
@ -91,11 +92,11 @@ const columns = computed(() => {
|
||||
},
|
||||
{
|
||||
align: "center",
|
||||
title: t("文件类型"),
|
||||
title: t("类型"),
|
||||
dataIndex: "type",
|
||||
key: "type",
|
||||
customRender: (e: { text: number }) => {
|
||||
return e.text == 1 ? t("文件") : t("目录");
|
||||
customRender: (e: { text: number; record: { name: string } }) => {
|
||||
return e.text == 1 ? getExtName(e.record.name) : t("文件夹");
|
||||
},
|
||||
minWidth: "200px"
|
||||
},
|
||||
@ -462,7 +463,7 @@ const rowSelection: TableProps["rowSelection"] = {
|
||||
}
|
||||
};
|
||||
|
||||
const rwoClickTable = async (item: string, type: number) => {
|
||||
const rowClickTable = async (item: string, type: number) => {
|
||||
if (type === 1) return;
|
||||
|
||||
spinning.value = true;
|
||||
@ -682,7 +683,7 @@ onMounted(() => {
|
||||
<a-button
|
||||
type="link"
|
||||
class="file-name"
|
||||
@click="rwoClickTable(record.name, record.type)"
|
||||
@click="rowClickTable(record.name, record.type)"
|
||||
>
|
||||
<span class="mr-4">
|
||||
<file-outlined v-if="record.type === 1" />
|
||||
@ -716,7 +717,7 @@ onMounted(() => {
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>
|
||||
<a-button size="">
|
||||
{{ t("TXT_CODE_fe731dfc") }}
|
||||
<DownOutlined />
|
||||
</a-button>
|
||||
|
Loading…
Reference in New Issue
Block a user