diff --git a/flask-ui/src/api/index.ts b/flask-ui/src/api/index.ts index 8c55f12..77ec1e3 100644 --- a/flask-ui/src/api/index.ts +++ b/flask-ui/src/api/index.ts @@ -1,5 +1,7 @@ import request from "../utils/request.ts" +type ResponseData = Promise<{ code: number, message: Array }> + export function book_download() { return request({ url: "/book/download", @@ -24,7 +26,7 @@ export function video_hasTorrent() { }) } -export function file_rename() { +export function file_rename(): ResponseData { return request({ url: "/file/rename", }) @@ -60,7 +62,7 @@ export function test() { }) } -export function torrent_statistics(){ +export function torrent_statistics(): ResponseData { return request({ url: "/torrent/statistics", }) diff --git a/flask-ui/src/utils/request.ts b/flask-ui/src/utils/request.ts index 66392a7..a2f9ce1 100644 --- a/flask-ui/src/utils/request.ts +++ b/flask-ui/src/utils/request.ts @@ -6,7 +6,7 @@ import axios, { } from "axios" // 定义响应数据结构 -interface ResponseData { +interface ResponseData { code: number msg: string data?: T @@ -18,8 +18,8 @@ interface RequestCache { time: number } -let downloadLoadingInstance: any -export let isRelogin: { show: boolean } = {show: false} +// let downloadLoadingInstance: any +// export let isRelogin: { show: boolean } = {show: false} axios.defaults.headers["Content-Type"] = "application/json; charset=UTF-8" const service: AxiosInstance = axios.create({ diff --git a/flask-ui/src/views/AboutView.vue b/flask-ui/src/views/AboutView.vue index 79b2eb6..7955d36 100644 --- a/flask-ui/src/views/AboutView.vue +++ b/flask-ui/src/views/AboutView.vue @@ -2,70 +2,22 @@ import {onMounted, ref} from 'vue' import {torrent_statistics} from '@/api' -interface StatisticsData { - [key: string]: any -} - -let aa = ref({}) -let bb = ref("") -let cc = ref("") -let dd = ref("") - +const aa = ref([]) onMounted(async () => { const res = await torrent_statistics() console.log(res.message) - aa.value = res.message }) -const getSecondLevelOptions = () => { - if (!bb.value || !aa.value[bb.value]) { - return [] - } - return aa.value[bb.value] -} - -const getThirdLevelOptions = () => { - if (!bb.value || !cc.value || !aa.value[bb.value] || !aa.value[bb.value][cc.value]) { - return [] - } - console.log(aa.value[bb.value]) - return aa.value[bb.value][cc.value] -} -