|
|
|
@ -2,8 +2,9 @@
|
|
|
|
|
import { computed, nextTick, onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
|
|
|
|
|
import Masonry from 'masonry-layout'
|
|
|
|
|
import { useInfiniteScroll } from '@vueuse/core'
|
|
|
|
|
import { debounce, pickBy } from 'lodash-es'
|
|
|
|
|
import { debounce } from 'lodash-es'
|
|
|
|
|
import imagesloaded from 'imagesloaded'
|
|
|
|
|
import { useMessage } from 'naive-ui'
|
|
|
|
|
import PackageSettingsModal from './modal/PackageSettingsModal.vue'
|
|
|
|
|
import { timeOptions, viewOptions } from '@/config/home'
|
|
|
|
|
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'
|
|
|
|
@ -21,6 +22,7 @@ import { getImgUrl } from '@/utils/urlUtils'
|
|
|
|
|
|
|
|
|
|
const deviceHeight = ref(600)
|
|
|
|
|
let _masonry: null | Masonry = null
|
|
|
|
|
let _imagesload: any
|
|
|
|
|
const masonryRef = ref<ComponentRef>(null)
|
|
|
|
|
const el = ref<HTMLDivElement | null>(null)
|
|
|
|
|
const viewMode = ref('masonry')
|
|
|
|
@ -31,6 +33,7 @@ const pagination = reactive({
|
|
|
|
|
const configStore = useConfig()
|
|
|
|
|
const packageModalRef = ref(null)
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const message = useMessage()
|
|
|
|
|
|
|
|
|
|
async function computeListHeight() {
|
|
|
|
|
const headEl = document.querySelector('.wrapper-content')!
|
|
|
|
@ -62,7 +65,13 @@ const layout = debounce(() => {
|
|
|
|
|
stagger: 10,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
imagesloaded('.grid-item', () => {
|
|
|
|
|
_imagesload = imagesloaded('.grid-item')
|
|
|
|
|
|
|
|
|
|
_imagesload.on('always', (instance) => {
|
|
|
|
|
console.log('always')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_imagesload.on('done', (instance) => {
|
|
|
|
|
(_masonry as any).layout()
|
|
|
|
|
const scrollHeight = el.value!.scrollHeight
|
|
|
|
|
const clientHeight = el.value!.clientHeight
|
|
|
|
@ -70,6 +79,20 @@ const layout = debounce(() => {
|
|
|
|
|
el.value!.scrollTo({ top, behavior: 'instant' })
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_imagesload.on('fail', (instance) => {
|
|
|
|
|
message.error('图片错误')
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// imagesloaded('.grid-item', () => {
|
|
|
|
|
// (_masonry as any).layout()
|
|
|
|
|
// const scrollHeight = el.value!.scrollHeight
|
|
|
|
|
// const clientHeight = el.value!.clientHeight
|
|
|
|
|
// const top = scrollHeight - clientHeight - 20
|
|
|
|
|
// el.value!.scrollTo({ top, behavior: 'instant' })
|
|
|
|
|
// loading.value = false
|
|
|
|
|
// })
|
|
|
|
|
}, 300)
|
|
|
|
|
|
|
|
|
|
let canloadMore = true
|
|
|
|
@ -139,6 +162,7 @@ async function featchList() {
|
|
|
|
|
imgUrl: item.imgurl,
|
|
|
|
|
upname: item.upname,
|
|
|
|
|
ocrPictureclass: item.ocrPictureclass,
|
|
|
|
|
uphead: item.uphead,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -225,6 +249,9 @@ async function refreshHandler() {
|
|
|
|
|
const list = data.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
imgUrl: item.imgurl,
|
|
|
|
|
upname: item.upname,
|
|
|
|
|
ocrPictureclass: item.ocrPictureclass,
|
|
|
|
|
uphead: item.uphead,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|