This commit is contained in:
jxxghp
2023-07-12 13:00:22 +08:00
parent f96156057d
commit 7e22486d44
3 changed files with 106 additions and 37 deletions

View File

@@ -116,6 +116,26 @@ const getVolumeFactorColor = (downloadVolume: number, uploadVolume: number) => {
onMounted(() => {
getSiteIcon();
});
// 弹出菜单
const dropdownItems = ref([
{
title: "查看详情",
value: 1,
props: {
prependIcon: "mdi-information",
click: openTorrentDetail,
},
},
{
title: "下载种子",
value: 2,
props: {
prependIcon: "mdi-download",
click: downloadTorrentFile,
},
},
]);
</script>
<template>
<VCard :width="props.width" :height="props.height" @click="handleAddDownload">
@@ -136,17 +156,16 @@ onMounted(() => {
<VIcon icon="mdi-dots-vertical" color="white" />
<VMenu activator="parent" close-on-content-click>
<VList>
<VListItem variant="plain" @click="openTorrentDetail">
<VListItem
v-for="(item, i) in dropdownItems"
variant="plain"
:key="i"
@click="item.props.click"
>
<template #prepend>
<VIcon icon="mdi-information"></VIcon>
<VIcon :icon="item.props.prependIcon"></VIcon>
</template>
<VListItemTitle>查看详情</VListItemTitle>
</VListItem>
<VListItem variant="plain" @click="downloadTorrentFile">
<template #prepend>
<VIcon icon="mdi-download"></VIcon>
</template>
<VListItemTitle>下载种子</VListItemTitle>
<VListItemTitle v-text="item.title"></VListItemTitle>
</VListItem>
</VList>
</VMenu>

View File

@@ -14,18 +14,20 @@ const allSites = ref<Site[]>([]);
// 种子优先规则下拉框
const TorrentPriorityItems = [
{ title: "站点优先", value: 'site' },
{ title: "做种数优先", value: 'seeder' },
{ title: "站点优先", value: "site" },
{ title: "做种数优先", value: "seeder" },
];
// 种子优先规则
const selectedTorrentPriority = ref<string>('seeder');
const selectedTorrentPriority = ref<string>("seeder");
// 查询所有站点
const querySites = async () => {
try {
const data: Site[] = await api.get("site");
allSites.value = data;
// 过滤站点,只有启用的站点才显示
allSites.value = data.filter((item) => item.is_active);
querySelectedSites();
} catch (error) {
console.log(error);
}
@@ -44,7 +46,9 @@ const querySelectedSites = async () => {
// 查询种子优先规则
const queryTorrentPriority = async () => {
try {
const result: { [key: string]: any } = await api.get("system/setting/TorrentsPriority");
const result: { [key: string]: any } = await api.get(
"system/setting/TorrentsPriority"
);
selectedTorrentPriority.value = result.data?.value;
} catch (error) {
console.log(error);
@@ -89,7 +93,6 @@ const saveTorrentPriority = async () => {
onMounted(() => {
querySites();
querySelectedSites();
queryTorrentPriority();
});
</script>
@@ -102,7 +105,13 @@ onMounted(() => {
<VCardItem>
<VChipGroup v-model="selectedSites" column multiple>
<VChip filter variant="outlined" v-for="site in allSites" :key="site.id" :value="site.id">
<VChip
filter
variant="outlined"
v-for="site in allSites"
:key="site.id"
:value="site.id"
>
{{ site.name }}
</VChip>
</VChipGroup>
@@ -116,7 +125,12 @@ onMounted(() => {
<VCol cols="12">
<VCard title="优先规则">
<VCardText>
<VSelect v-model="selectedTorrentPriority" :items="TorrentPriorityItems" label="下载优先规则" outlined></VSelect>
<VSelect
v-model="selectedTorrentPriority"
:items="TorrentPriorityItems"
label="下载优先规则"
outlined
></VSelect>
</VCardText>
<VCardItem>
<VBtn type="submit" @click="saveTorrentPriority"> 保存 </VBtn>

View File

@@ -45,25 +45,6 @@ const getStatusColor = (status: boolean) => {
return status ? "success" : "error";
};
// 弹出菜单
const dropdownItems = ref([
{
title: "重新整理",
value: 1,
props: {
prependIcon: "mdi-redo-variant",
},
},
{
title: "删除",
value: 2,
props: {
prependIcon: "mdi-trash-can-outline",
color: "error",
},
},
]);
// 转移方式字典
const TransferDict: { [key: string]: string } = {
copy: "复制",
@@ -72,8 +53,45 @@ const TransferDict: { [key: string]: string } = {
softlink: "软链接",
};
// 删除历史记录
const removeHistory = async () => {
try {
} catch (error) {
console.error(error);
}
};
// 重新整理
const rehandleHistory = async () => {
try {
} catch (e) {
console.log(e);
}
};
// 加载时获取数据
onMounted(fetchData);
// 弹出菜单
const dropdownItems = ref([
{
title: "重新整理",
value: 1,
props: {
prependIcon: "mdi-redo-variant",
click: rehandleHistory,
},
},
{
title: "删除",
value: 2,
props: {
prependIcon: "mdi-trash-can-outline",
color: "error",
click: removeHistory,
},
},
]);
</script>
<template>
@@ -121,7 +139,25 @@ onMounted(fetchData);
{{ item.raw.errmsg }}
</template>
<template #item.actions="{ item }">
<MoreBtn :item-props="true" :menu-list="dropdownItems" />
<IconBtn>
<VIcon icon="mdi-dots-vertical" />
<VMenu activator="parent" close-on-content-click>
<VList>
<VListItem
v-for="(item, i) in dropdownItems"
variant="plain"
:base-color="item.props.color"
:key="i"
@click="item.props.click"
>
<template #prepend>
<VIcon :icon="item.props.prependIcon"></VIcon>
</template>
<VListItemTitle v-text="item.title"></VListItemTitle>
</VListItem>
</VList>
</VMenu>
</IconBtn>
</template>
<template #no-data> 没有数据 </template>
</VDataTable>