-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
394 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,39 @@ | ||
<script setup lang="ts"> | ||
const { data, execute } = await useFetch<Record<any, any>>("/api/common/image", { | ||
query: computed(() => | ||
useMainStore().easterEgg | ||
? { | ||
type: "dongman", | ||
} | ||
: undefined | ||
), | ||
query: computed(() => | ||
useMainStore().easterEgg | ||
? { | ||
type: "dongman", | ||
} | ||
: undefined | ||
), | ||
}); | ||
useIntervalFn(() => { | ||
execute(); | ||
execute(); | ||
}, 18000); | ||
</script> | ||
|
||
<template> | ||
<div | ||
pos="fixed left-0 top-0" | ||
w="full" | ||
h="100dvh" | ||
:style="{ | ||
background: `url(${data?.content}) center / cover fixed`, | ||
transition: 'all 16s steps(16) 1s', | ||
}" | ||
/> | ||
<client-only> | ||
<img | ||
:src="data?.content" pos="absolute" w="0" h="0" | ||
left="-100px" @load="useMainStore().globalLoading = false" | ||
/> | ||
</client-only> | ||
<div | ||
pos="fixed left-0 top-0" | ||
w="full" | ||
h="100dvh" | ||
:style="{ | ||
background: `url(${data?.content}) center / cover fixed`, | ||
transition: 'all 16s steps(16) 1s', | ||
}" | ||
/> | ||
<client-only> | ||
<img | ||
:src="data?.content" | ||
pos="absolute" | ||
w="0" | ||
h="0" | ||
left="-100px" | ||
@load="useMainStore().globalLoading = false" | ||
@error="useMainStore().globalLoading = false" | ||
/> | ||
</client-only> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { type DataType, type LoadMoreBaseOptions, useLoadMore } from "vue-request"; | ||
|
||
export default <T extends { total: number; list: any[]; page: number }>( | ||
service: (page: number) => Promise<T>, | ||
options?: LoadMoreBaseOptions<DataType> | ||
) => { | ||
const { | ||
dataList, | ||
noMore, | ||
loadingMore, | ||
data, | ||
refreshAsync: _refreshAsync, | ||
loading, | ||
loadMoreAsync: _loadMoreAsync, | ||
} = useLoadMore( | ||
async data => { | ||
const result = await service((data?.page || 0) + 1); | ||
return { | ||
list: result.list, | ||
total: result.total, | ||
page: result.page, | ||
}; | ||
}, | ||
{ | ||
isNoMore: data => !!data && data?.list?.length >= data.total, | ||
|
||
...options, | ||
} | ||
); | ||
|
||
const loadmoreStatus = computed(() => { | ||
if (loading.value || loadingMore.value) return "loading"; | ||
if (data.value && data.value.total == 0) return "empty"; | ||
if (noMore.value) return "nomore"; | ||
return "loadmore"; | ||
}); | ||
|
||
const refreshing = ref(false); | ||
const refreshAsync = async () => { | ||
refreshing.value = true; | ||
await _refreshAsync().finally(() => | ||
setTimeout(() => { | ||
refreshing.value = false; | ||
}, 200) | ||
); | ||
}; | ||
|
||
const loadMoreAsync = async () => { | ||
noMore.value || _loadMoreAsync(); | ||
}; | ||
|
||
return { | ||
dataList, | ||
loadmoreStatus, | ||
loadMoreAsync, | ||
reload: _refreshAsync, | ||
refreshAsync, | ||
refreshing, | ||
loading, | ||
loadingMore, | ||
data, | ||
noMore, | ||
}; | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import piniaPluginPersist from "@wsvaio/pinia-plugin-persist"; | ||
import { defineNuxtPlugin } from "#app"; | ||
import { setGlobalOptions } from "vue-request"; | ||
|
||
export default defineNuxtPlugin(nuxtApp => { | ||
setGlobalOptions({ | ||
pagination: { | ||
currentKey: "page", | ||
pageSizeKey: "pageSize", | ||
totalKey: "total", | ||
totalPageKey: "totalPage", | ||
}, | ||
}); | ||
}); |
Oops, something went wrong.