diff --git a/src/layout/adder/AdderPage.tsx b/src/layout/adder/AdderPage.tsx index c2a9c79..a931873 100644 --- a/src/layout/adder/AdderPage.tsx +++ b/src/layout/adder/AdderPage.tsx @@ -1,6 +1,7 @@ import { computed, defineComponent, + onMounted, onUnmounted, provide, ref, @@ -24,6 +25,7 @@ import HotAdder from './HotAdder' import GameAdder from './GameAdder' import work_add_main_checked from '/icons/work_add_main_checked.png' import useAdderPageStore from './useAdderPageStore' +import search from '../header/search' addIcons(MdKeyboardcommandkey, FaCompass, FaPencilRuler, IoGameController) const ItemButton = defineComponent({ @@ -83,9 +85,11 @@ export default defineComponent(() => { const addTo = ref(layout.state.currentPage) provide(AddToToken, addTo) - // onUnmounted(() => { - // store.type = 1 - // }) + onUnmounted(() => { + store.isSearch = false + + }) + return () => (
{ label: form.name } layout.addBlock(data, addTo?.value) + globalToast.success('添加成功') } }} > diff --git a/src/layout/adder/useAdderPageStore.tsx b/src/layout/adder/useAdderPageStore.tsx index 3ecc817..9bfcbd1 100644 --- a/src/layout/adder/useAdderPageStore.tsx +++ b/src/layout/adder/useAdderPageStore.tsx @@ -50,6 +50,12 @@ export default defineStore('adderPage', () => { watch(selectType, (val) => { getApps(val) }) + watch(isSearch, () => { + if (!isSearch.value) { + getApps(selectType.value) + + } + }) const getApps = (_selectType: string) => { loading.value = true request('GET', `/api/app/hotApps?hotAppsId=${_selectType}`) diff --git a/src/layout/background/CustomWallpaper.tsx b/src/layout/background/CustomWallpaper.tsx index b6560d2..b695619 100644 --- a/src/layout/background/CustomWallpaper.tsx +++ b/src/layout/background/CustomWallpaper.tsx @@ -14,6 +14,7 @@ export default defineComponent(() => { const tempFile = ref(null) const layout = useLayoutStore() const tempBackground = ref('') + const type = ref('img') const handleDrop = (e: DragEvent) => { e.preventDefault() e.stopPropagation() @@ -22,14 +23,26 @@ export default defineComponent(() => { if (!file) return tempBackground.value = URL.createObjectURL(file) tempFile.value = file + + if (file.type.includes('image')) { + type.value = 'img' + } else { + type.value = 'video' + } } const showImg = computed(() => { if (tempBackground.value) { return tempBackground.value } if (backgroundStore.state.isCustom) { - return layout.background.video? layout.background.video: layout.background.image + if (layout.background.video) { + type.value = 'video' + return layout.background.video + } else { + return layout.background.image + } } + return '' }) return () => ( @@ -77,7 +90,7 @@ export default defineComponent(() => {
@@ -98,12 +111,18 @@ export default defineComponent(() => { { const file = e.target?.files?.[0] if (!file) return tempFile.value = file + if (file.type.includes('image')) { + type.value = 'img' + } else { + type.value = 'video' + } tempBackground.value = URL.createObjectURL(file) }} /> @@ -121,7 +140,6 @@ export default defineComponent(() => { useLayoutStore().changeBackground(res) backgroundStore.state.isCustom = true tempFile.value = null - tempBackground.value = '' message.success('应用成功') }) } diff --git a/src/layout/background/index.tsx b/src/layout/background/index.tsx index 1766224..c14ef7c 100644 --- a/src/layout/background/index.tsx +++ b/src/layout/background/index.tsx @@ -29,12 +29,14 @@ export const BgContent = defineComponent({ }} > {props.video ? ( -