mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-06 20:43:03 +08:00
fix(type): 修复类型检查错误
This commit is contained in:
1
shims.d.ts
vendored
1
shims.d.ts
vendored
@@ -12,3 +12,4 @@ declare module 'vue-prism-component' {
|
|||||||
export default component
|
export default component
|
||||||
}
|
}
|
||||||
declare module 'vue-shepherd';
|
declare module 'vue-shepherd';
|
||||||
|
declare module 'colorthief';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ValidationRule } from 'vuetify/types/services/validation'
|
type ValidationRule = (value: any) => string | boolean
|
||||||
|
|
||||||
// 必输校验
|
// 必输校验
|
||||||
export const requiredValidator: ValidationRule = (value: any) => {
|
export const requiredValidator: ValidationRule = (value: any) => {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import FileToolbar from './filebrowser/FileToolbar.vue'
|
|||||||
import FileNavigator from './filebrowser/FileNavigator.vue'
|
import FileNavigator from './filebrowser/FileNavigator.vue'
|
||||||
import type { EndPoints, FileItem, StorageConf } from '@/api/types'
|
import type { EndPoints, FileItem, StorageConf } from '@/api/types'
|
||||||
import { storageIconDict } from '@/api/constants'
|
import { storageIconDict } from '@/api/constants'
|
||||||
|
import type { AxiosInstance } from 'axios'
|
||||||
|
|
||||||
// LocalStorage keys
|
// LocalStorage keys
|
||||||
const SORT_KEY = 'fileBrowser.sort'
|
const SORT_KEY = 'fileBrowser.sort'
|
||||||
@@ -16,7 +17,7 @@ const props = defineProps({
|
|||||||
tree: Boolean,
|
tree: Boolean,
|
||||||
endpoints: Object as PropType<EndPoints>,
|
endpoints: Object as PropType<EndPoints>,
|
||||||
axios: {
|
axios: {
|
||||||
type: Function,
|
type: Object as PropType<AxiosInstance>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
axiosconfig: Object,
|
axiosconfig: Object,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { AxiosRequestConfig } from 'axios'
|
import type { AxiosRequestConfig, AxiosInstance } from 'axios'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { useConfirm } from '@/composables/useConfirm'
|
import { useConfirm } from '@/composables/useConfirm'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
@@ -28,7 +28,7 @@ const inProps = defineProps({
|
|||||||
icons: Object,
|
icons: Object,
|
||||||
endpoints: Object as PropType<EndPoints>,
|
endpoints: Object as PropType<EndPoints>,
|
||||||
axios: {
|
axios: {
|
||||||
type: Function,
|
type: Object as PropType<AxiosInstance>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
refreshpending: Boolean,
|
refreshpending: Boolean,
|
||||||
@@ -196,7 +196,7 @@ async function list_files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = (await inProps.axios.request(config)) ?? []
|
const data = ((await inProps.axios.request(config)) as any) ?? []
|
||||||
// 如果当前路径已经变化,则放弃此次加载结果
|
// 如果当前路径已经变化,则放弃此次加载结果
|
||||||
if (prevURI !== takeURISnapshot()) {
|
if (prevURI !== takeURISnapshot()) {
|
||||||
return;
|
return;
|
||||||
@@ -300,7 +300,7 @@ async function download(item: FileItem) {
|
|||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const result: Blob = await inProps.axios.request(config)
|
const result: Blob = (await inProps.axios.request(config)) as any
|
||||||
if (result) {
|
if (result) {
|
||||||
const downloadUrl = URL.createObjectURL(result)
|
const downloadUrl = URL.createObjectURL(result)
|
||||||
window.open(downloadUrl, '_blank')
|
window.open(downloadUrl, '_blank')
|
||||||
@@ -318,7 +318,7 @@ async function getImgLink(item: FileItem) {
|
|||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}
|
}
|
||||||
// 加载二进制数据
|
// 加载二进制数据
|
||||||
const result: Blob = await inProps.axios.request(config)
|
const result: Blob = (await inProps.axios.request(config)) as any
|
||||||
if (result) {
|
if (result) {
|
||||||
// 创建图片地址
|
// 创建图片地址
|
||||||
currentImgLink.value = URL.createObjectURL(result)
|
currentImgLink.value = URL.createObjectURL(result)
|
||||||
@@ -395,7 +395,7 @@ async function rename() {
|
|||||||
method: inProps.endpoints?.rename.method || 'post',
|
method: inProps.endpoints?.rename.method || 'post',
|
||||||
data: currentItem.value,
|
data: currentItem.value,
|
||||||
}
|
}
|
||||||
const result: { [key: string]: any } = await inProps.axios?.request(config)
|
const result: { [key: string]: any } = (await inProps.axios?.request(config)) as any
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
$toast.error(result.message)
|
$toast.error(result.message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import type { FileItem } from '@/api/types'
|
import type { FileItem } from '@/api/types'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
import type { AxiosRequestConfig } from 'axios'
|
import type { AxiosRequestConfig, AxiosInstance } from 'axios'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { usePWA } from '@/composables/usePWA'
|
import { usePWA } from '@/composables/usePWA'
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
endpoints: Object,
|
endpoints: Object,
|
||||||
axios: {
|
axios: {
|
||||||
type: Function,
|
type: Object as PropType<AxiosInstance>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -131,7 +131,7 @@ async function loadSubdirectories(path: string) {
|
|||||||
data: fakeItem,
|
data: fakeItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await props.axios?.request(config)
|
const result = (await props.axios?.request(config)) as any
|
||||||
if (result && Array.isArray(result)) {
|
if (result && Array.isArray(result)) {
|
||||||
// 过滤出目录项
|
// 过滤出目录项
|
||||||
const dirs = result.filter(item => item.type === 'dir')
|
const dirs = result.filter(item => item.type === 'dir')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { AxiosRequestConfig } from 'axios'
|
import type { AxiosRequestConfig, AxiosInstance } from 'axios'
|
||||||
import type { EndPoints, FileItem } from '@/api/types'
|
import type { EndPoints, FileItem } from '@/api/types'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
@@ -23,7 +23,7 @@ const inProps = defineProps({
|
|||||||
},
|
},
|
||||||
endpoints: Object as PropType<EndPoints>,
|
endpoints: Object as PropType<EndPoints>,
|
||||||
axios: {
|
axios: {
|
||||||
type: Function,
|
type: Object as PropType<AxiosInstance>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Icon } from '@iconify/vue'
|
import { Icon } from '@iconify/vue'
|
||||||
import { aliases } from 'vuetify/lib/iconsets/mdi'
|
import { aliases } from 'vuetify/iconsets/mdi'
|
||||||
|
|
||||||
const alertTypeIcon = {
|
const alertTypeIcon = {
|
||||||
success: 'mdi-check-circle-outline',
|
success: 'mdi-check-circle-outline',
|
||||||
|
|||||||
Reference in New Issue
Block a user