mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 08:06:43 +08:00
fix download
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { formatFileSize } from "@/@core/utils/formatters";
|
import { formatFileSize } from "@/@core/utils/formatters";
|
||||||
import api from "@/api";
|
import api from "@/api";
|
||||||
|
import { doneNProgress, startNProgress } from "@/api/nprogress";
|
||||||
import { Context } from "@/api/types";
|
import { Context } from "@/api/types";
|
||||||
import { useToast } from "vue-toast-notification";
|
import { useToast } from "vue-toast-notification";
|
||||||
import { useConfirm } from "vuetify-use-dialog";
|
import { useConfirm } from "vuetify-use-dialog";
|
||||||
@@ -56,6 +57,7 @@ const handleAddDownload = async () => {
|
|||||||
|
|
||||||
// 添加下载
|
// 添加下载
|
||||||
const addDownload = async () => {
|
const addDownload = async () => {
|
||||||
|
startNProgress();
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.post("download", {
|
const result: { [key: string]: any } = await api.post("download", {
|
||||||
media_in: media?.value,
|
media_in: media?.value,
|
||||||
@@ -67,11 +69,13 @@ const addDownload = async () => {
|
|||||||
`${torrent.value?.site_name} ${torrent.value?.title} 添加下载成功!`
|
`${torrent.value?.site_name} ${torrent.value?.title} 添加下载成功!`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(`添加下载失败:${result.message}`);
|
// 添加下载失败
|
||||||
|
$toast.error(`${torrent.value?.site_name} ${torrent.value?.title} 添加下载失败!`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
doneNProgress();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开种子详情页面
|
// 打开种子详情页面
|
||||||
@@ -87,11 +91,13 @@ const downloadTorrentFile = async () => {
|
|||||||
// 促销Chip颜色
|
// 促销Chip颜色
|
||||||
const getVolumeFactorColor = (downloadVolume: number, uploadVolume: number) => {
|
const getVolumeFactorColor = (downloadVolume: number, uploadVolume: number) => {
|
||||||
if (downloadVolume === 0) {
|
if (downloadVolume === 0) {
|
||||||
return "text-white bg-green-700";
|
return "text-white bg-green-500";
|
||||||
} else if (uploadVolume >= 2) {
|
} else if (downloadVolume < 1) {
|
||||||
|
return "text-white bg-sky-500";
|
||||||
|
} else if (uploadVolume != 1) {
|
||||||
return "text-white bg-blue-700";
|
return "text-white bg-blue-700";
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "text-white";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -196,7 +202,7 @@ onMounted(() => {
|
|||||||
</VChip>
|
</VChip>
|
||||||
<VChip
|
<VChip
|
||||||
v-if="torrent?.downloadvolumefactor !== 1 || torrent?.uploadvolumefactor !== 1"
|
v-if="torrent?.downloadvolumefactor !== 1 || torrent?.uploadvolumefactor !== 1"
|
||||||
:color="
|
:class="
|
||||||
getVolumeFactorColor(torrent?.downloadvolumefactor, torrent?.uploadvolumefactor)
|
getVolumeFactorColor(torrent?.downloadvolumefactor, torrent?.uploadvolumefactor)
|
||||||
"
|
"
|
||||||
variant="elevated"
|
variant="elevated"
|
||||||
|
|||||||
Reference in New Issue
Block a user