diff --git a/admin/src/api/album_cate.ts b/admin/src/api/album_cate.ts index 7501ae6..845878e 100644 --- a/admin/src/api/album_cate.ts +++ b/admin/src/api/album_cate.ts @@ -8,7 +8,7 @@ import { getToken } from '@/utils/auth' type album_cate = { id?: number pid?: number - type?: number + // type?: number name?: string isDelete?: number createTime?: string @@ -18,7 +18,7 @@ type album_cate = { // 查询 type album_cate_query = { pid?: number - type?: number + // type?: number name?: string createTimeStart?: string createTimeEnd?: string @@ -29,7 +29,7 @@ type album_cate_query = { type album_cate_edit = { id?: number pid?: number - type?: number + // type?: number name?: string } diff --git a/admin/src/components/material/file.vue b/admin/src/components/material/file.vue index b49decb..0b14bc1 100644 --- a/admin/src/components/material/file.vue +++ b/admin/src/components/material/file.vue @@ -28,12 +28,25 @@ export default defineComponent({ default: '100px' }, // 文件类型 - type: { + ext: { type: String, - default: 'image' + default: '' } }, - emits: ['close'] + emits: ['close'], + computed: { + type() { + const imageExt = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] + const videoExt = ['mp4', 'avi', 'mov'] + if (imageExt.includes(this.ext)) { + return 'image' + } + if (videoExt.includes(this.ext)) { + return 'video' + } + return 'file' + } + } }) diff --git a/admin/src/components/material/hook.ts b/admin/src/components/material/hook.ts index d89768f..81d79ce 100644 --- a/admin/src/components/material/hook.ts +++ b/admin/src/components/material/hook.ts @@ -15,7 +15,7 @@ import { shallowRef, ref, reactive } from 'vue' import type { Ref } from 'vue' // 左侧分组的钩子函数 -export function useCate(type: number) { +export function useCate() { const treeRef = shallowRef>() // 分组列表 const cateLists = ref([]) @@ -25,18 +25,12 @@ export function useCate(type: number) { // 获取分组列表 const getCateLists = async () => { - const data = await fileCateLists({ - type - }) + const data = await fileCateLists({}) const item: any[] = [ { name: '全部', id: 0 } - // { - // name: '未分组', - // id: 0 - // } ] cateLists.value = data cateLists.value.unshift(...item) @@ -48,7 +42,6 @@ export function useCate(type: number) { // 添加分组 const handleAddCate = async (value: string) => { await fileCateAdd({ - type, name: value, pid: 0 }) @@ -92,7 +85,7 @@ export function useCate(type: number) { // 处理文件的钩子函数 export function useFile( cateId: Ref, - type: Ref, + ext: string[], limit: Ref, size: number ) { @@ -103,7 +96,7 @@ export function useFile( const isIndeterminate = ref(false) const fileParams = reactive({ name: '', - type: type, + ext: ext, cid: cateId }) const { pager, getLists, resetPage } = usePaging({ diff --git a/admin/src/components/material/index.vue b/admin/src/components/material/index.vue index d438207..c35dfd1 100644 --- a/admin/src/components/material/index.vue +++ b/admin/src/components/material/index.vue @@ -85,22 +85,10 @@
- 本地上传 - - @@ -139,7 +127,7 @@ @@ -151,6 +139,9 @@ + + +