fix history

This commit is contained in:
jxxghp
2023-06-28 12:34:21 +08:00
parent 7401ef7941
commit 824b27020c
5 changed files with 141 additions and 56 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
"vue-router": "^4.2.0", "vue-router": "^4.2.0",
"vue3-apexcharts": "^1.4.1", "vue3-apexcharts": "^1.4.1",
"vue3-perfect-scrollbar": "^1.6.0", "vue3-perfect-scrollbar": "^1.6.0",
"vuetify": "3.2.1", "vuetify": "3.3.5",
"vuex": "^4.1.0", "vuex": "^4.1.0",
"vuex-persistedstate": "^4.1.0", "vuex-persistedstate": "^4.1.0",
"webfontloader": "^1.6.28" "webfontloader": "^1.6.28"
+5 -48
View File
@@ -1,53 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import DemoSimpleTableBasics from '@/views/pages/tables/DemoSimpleTableBasics.vue' import TransferHistoryView from '@/views/reorganize/TransferHistoryView.vue';
import DemoSimpleTableDensity from '@/views/pages/tables/DemoSimpleTableDensity.vue'
import DemoSimpleTableFixedHeader from '@/views/pages/tables/DemoSimpleTableFixedHeader.vue'
import DemoSimpleTableHeight from '@/views/pages/tables/DemoSimpleTableHeight.vue'
import DemoSimpleTableTheme from '@/views/pages/tables/DemoSimpleTableTheme.vue'
</script> </script>
<template> <template>
<VRow> <div>
<VCol cols="12"> <TransferHistoryView />
<VCard title="Basic"> </div>
<DemoSimpleTableBasics />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Theme">
<VCardText>
use <code>theme</code> prop to switch table to the dark theme.
</VCardText>
<DemoSimpleTableTheme />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Density">
<VCardText>
You can show a dense version of the table by using the <code>density</code> prop.
</VCardText>
<DemoSimpleTableDensity />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Height">
<VCardText>
You can set the height of the table by using the <code>height</code> prop.
</VCardText>
<DemoSimpleTableHeight />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Fixed Header">
<VCardText>
You can fix the header of table by using the <code>fixed-header</code> prop.
</VCardText>
<DemoSimpleTableFixedHeader />
</VCard>
</VCol>
</VRow>
</template> </template>
+3 -2
View File
@@ -42,7 +42,7 @@ const fetchBackgroundImage = async () => {
const login = () => { const login = () => {
errorMessage.value = '' errorMessage.value = ''
// 进行表单校验 // 进行表单校验
if (refForm.value && !refForm.value.validate()) { if (!form.value.username || !form.value.password) {
return return
} }
@@ -135,7 +135,7 @@ onMounted(() => {
</VCardText> </VCardText>
<VCardText> <VCardText>
<VForm @submit.prevent="login" ref="refForm"> <VForm @submit.prevent="()=>{}" ref="refForm">
<VRow> <VRow>
<!-- username --> <!-- username -->
<VCol cols="12"> <VCol cols="12">
@@ -180,6 +180,7 @@ onMounted(() => {
<VBtn <VBtn
block block
type="submit" type="submit"
@click="login"
> >
登录 登录
</VBtn> </VBtn>
@@ -0,0 +1,127 @@
<script setup lang="ts">
import api from "@/api";
import { onMounted, ref } from "vue";
interface TransferHistory {
// ID
id: number;
// 源目录
src?: string;
// 目的目录
dest?: string;
// 转移模式link/copy/move/softlink
mode?: string;
// 类型:电影、电视剧
type?: string;
// 二级分类
category?: string;
// 标题
title?: string;
// 年份
year?: string;
// TMDBID
tmdbid?: number;
// IMDBID
imdbid?: string;
// TVDBID
tvdbid?: number;
// 豆瓣ID
doubanid?: string;
// 季Sxx
seasons?: string;
// 集Exx
episodes?: string;
// 海报
image?: string;
// 下载器Hash
download_hash?: string;
// 状态 1-成功,0-失败
status: boolean;
// 失败原因
errmsg?: string;
// 日期
date?: string;
}
// 表头
const headers = [
{ title: "标题", key: "title" },
{ title: "目录", key: "src"},
{ title: "转移方式", key: "mode"},
{ title: "状态", key: "status"},
{ title: "失败原因", key: "errmsg"},
];
// 数据列表
const dataList = ref<TransferHistory[]>([]);
// 获取订阅列表数据
const fetchData = async () => {
try {
dataList.value = await api.get("/history/transfer");
} catch (error) {
console.error(error);
}
};
// 根据 type 返回不同的图标
const getIcon = (type: string) => {
if (type === "电影") {
return "mdi-movie";
} else if (type === "电视剧") {
return "mdi-television-classic";
} else {
return "mdi-help-circle";
}
};
// 计算颜色
const getStatusColor = (status: boolean) => {
return status ? 'success' : 'error';
};
// 加载时获取数据
onMounted(fetchData);
const search = ref("");
</script>
<template>
<VCard title="历史记录">
<VDataTable
:headers="headers"
:items="dataList"
show-select
>
<template #item.title="{ item }">
<div class="d-flex">
<VAvatar><VIcon :icon="getIcon(item.raw.type || '')"></VIcon></VAvatar>
<div class="d-flex flex-column ms-1 text-high-emphasis">
<span class="d-block">
{{ item.raw.title }} {{ item.raw.seasons }}{{ item.raw.episodes }}
</span>
<small>{{ item.raw.category }}</small>
</div>
</div>
</template>
<template #item.src="{ item }">
<small>{{ item.raw.src }} <br>=> {{ item.raw.dest }}</small>
</template>
<template #item.mode="{ item }">
<VChip variant="outlined" color="primary" size="small">{{ item.raw.mode }}</VChip>
</template>
<template #item.status="{ item }">
<VChip :color="getStatusColor(item.raw.status)" size="small">
{{ item.raw.status ? '成功' : '失败' }}
</VChip>
</template>
<template #item.errmsg="{ item }">
{{ item.raw.errmsg }}
</template>
<template #no-data>
没有数据
</template>
</VDataTable>
</VCard>
</template>
+4 -4
View File
@@ -7183,10 +7183,10 @@ vue@^3.3.2:
"@vue/server-renderer" "3.3.2" "@vue/server-renderer" "3.3.2"
"@vue/shared" "3.3.2" "@vue/shared" "3.3.2"
vuetify@3.2.1: vuetify@3.3.5:
version "3.2.1" version "3.3.5"
resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.2.1.tgz#caa1d306a3ef8d52d300be4c7f6d94dc4fd897e4" resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.3.5.tgz#b927214d106122240e79f4d65e49bfec0e86e189"
integrity sha512-XOGfDuDGG4j/dJSu73JrkfrGB141LoiLyoZecGtUou24xMf17Rnk+pzOH+YYRVgQ7HFc4kG95DzFmAXS5ysEGA== integrity sha512-vkfPgPmKfSJa+jq6Ov+CTg7L1t2jLPKa7Slef9OrVHcLqg+gLuIj0z4PJE6E9HjFTUbgZShShOGxps52REJRIA==
vuex-persistedstate@^4.1.0: vuex-persistedstate@^4.1.0:
version "4.1.0" version "4.1.0"