diff --git a/admin/src/components/editor/index.vue b/admin/src/components/editor/index.vue index d5fa27f7..0bf0ff27 100644 --- a/admin/src/components/editor/index.vue +++ b/admin/src/components/editor/index.vue @@ -81,6 +81,7 @@ const tiny = reactive({ ], //工具栏配置,设为false则隐藏 paste_data_images: true, //图片是否可粘贴 file_picker_types: "file image media", + convert_urls : false, // false-保持图片域名完整性 // 文件上传处理函数 file_picker_callback: (callback: any, value: any, meta: any) => { if (meta.filetype == "image") { diff --git a/admin/src/components/material-select/file-item.vue b/admin/src/components/material-select/file-item.vue index 79e4db8e..706bf7af 100644 --- a/admin/src/components/material-select/file-item.vue +++ b/admin/src/components/material-select/file-item.vue @@ -1,40 +1,54 @@ + + diff --git a/admin/src/components/material-select/hook.ts b/admin/src/components/material-select/hook.ts index 8517462e..02b899f7 100644 --- a/admin/src/components/material-select/hook.ts +++ b/admin/src/components/material-select/hook.ts @@ -5,24 +5,26 @@ import { apiFileCateLists, apiFileDelete, apiFileList, - apiFileMove -} from '@/api/app' -import { usePages } from '@/core/hooks/pages' -import { ElMessage } from 'element-plus' -import { computed, inject, reactive, ref, Ref } from 'vue' + apiFileMove, +} from "@/api/app" +import { usePages } from "@/core/hooks/pages" +import { ElMessage } from "element-plus" +import { computed, inject, reactive, ref, Ref } from "vue" + + // 左侧分组的钩子函数 export function useCate(typeValue: Ref) { // 分组列表 const cateLists: Ref = ref([]) // 选中的分组id - const cateId = ref('') + const cateId = ref("") // 添加分组 const handleAddCate = (val: string) => { apiFileCateAdd({ type: typeValue.value, pid: 0, - name: val + name: val, }).then(() => { getCateLists() }) @@ -31,7 +33,7 @@ export function useCate(typeValue: Ref) { const handleEditCate = (val: string, id: number) => { apiFileCateEdit({ id, - name: val + name: val, }).then(() => { getCateLists() }) @@ -39,7 +41,7 @@ export function useCate(typeValue: Ref) { // 删除分组 const handleDeleteCate = (id: number) => { apiFileCateDelete({ - id + id, }).then(() => { getCateLists() }) @@ -49,17 +51,17 @@ export function useCate(typeValue: Ref) { return new Promise((resolve, reject) => { apiFileCateLists({ type: typeValue.value, - page_type: 1 + page_type: 1, }).then((res: any) => { const item: any[] = [ { - name: '全部', - id: '' + name: "全部", + id: "", }, { - name: '未分组', - id: 0 - } + name: "未分组", + id: 0, + }, ] cateLists.value = res?.lists cateLists.value.unshift(...item) @@ -73,23 +75,25 @@ export function useCate(typeValue: Ref) { handleAddCate, handleEditCate, handleDeleteCate, - getCateLists + getCateLists, } } + // 处理文件的钩子函数 export function useFile(cateId: Ref, type: Ref, limit: Ref) { const moveId = ref(0) const select: Ref = ref([]) const fileParams = reactive({ - name: '', + name: "", type: type, - cid: cateId + cid: cateId, }) const { pager, requestApi, resetPage } = usePages({ callback: apiFileList, params: fileParams }) + const selectStatus = computed( () => (id: number) => select.value.find((item: any) => item.id == id) @@ -102,20 +106,20 @@ export function useFile(cateId: Ref, type: Ref, limit: Ref) resetPage() } const batchFileDelete = (id?: number[]) => { - const ids = id ? id : select.value.map((item: any) => item.id) + let ids = id ? id : select.value.map((item: any) => item.id) apiFileDelete({ - ids - }).then(res => { + ids, + }).then((res) => { getFileList() clearSelect() }) } const batchFileMove = () => { - const ids = select.value.map((item: any) => item.id) + let ids = select.value.map((item: any) => item.id) apiFileMove({ ids, - cid: moveId.value - }).then(res => { + cid: moveId.value, + }).then((res) => { moveId.value = 0 getFileList() clearSelect() @@ -123,7 +127,7 @@ export function useFile(cateId: Ref, type: Ref, limit: Ref) } const selectFile = (item: any) => { - const index = select.value.findIndex((items: any) => items.id == item.id) + let index = select.value.findIndex((items: any) => items.id == item.id) if (index != -1) { select.value.splice(index, 1) return @@ -134,7 +138,7 @@ export function useFile(cateId: Ref, type: Ref, limit: Ref) select.value.push(item) return } - ElMessage.warning('已达到选择上限') + ElMessage.warning("已达到选择上限") return } select.value.push(item) @@ -143,7 +147,7 @@ export function useFile(cateId: Ref, type: Ref, limit: Ref) select.value = [] } const cancelSelete = (id: number) => { - select.value = select.value.filter(item => item.id != id) + select.value = select.value.filter((item) => item.id != id) } return { moveId, diff --git a/admin/src/components/material-select/index.vue b/admin/src/components/material-select/index.vue index edc80fb9..9c8c4f3d 100644 --- a/admin/src/components/material-select/index.vue +++ b/admin/src/components/material-select/index.vue @@ -1,3 +1,4 @@ +