|
|
@ -1,4 +1,13 @@
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
|
|
import { useInfiniteScroll } from '@vueuse/core'
|
|
|
|
|
|
|
|
import imagesloaded from 'imagesloaded'
|
|
|
|
|
|
|
|
import { debounce } from 'lodash-es'
|
|
|
|
|
|
|
|
import Masonry from 'masonry-layout'
|
|
|
|
|
|
|
|
import { useMessage } from 'naive-ui'
|
|
|
|
|
|
|
|
import { computed, nextTick, onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
|
|
|
|
|
|
|
|
import GeneratePackageModal from './modal/GeneratePackageModal.vue'
|
|
|
|
|
|
|
|
import PackageSettingsModal from './modal/PackageSettingsModal.vue'
|
|
|
|
|
|
|
|
import LoginSuccessModal from './modal/LoginSuccessModal.vue'
|
|
|
|
import { getPictureList, oneClickCheck } from '@/api/home/main'
|
|
|
|
import { getPictureList, oneClickCheck } from '@/api/home/main'
|
|
|
|
import img1 from '@/assets/images/1.jpg'
|
|
|
|
import img1 from '@/assets/images/1.jpg'
|
|
|
|
import img2 from '@/assets/images/2.jpg'
|
|
|
|
import img2 from '@/assets/images/2.jpg'
|
|
|
@ -13,14 +22,6 @@ import { hideDownload } from '@/utils/image'
|
|
|
|
import { randomInt } from '@/utils/index'
|
|
|
|
import { randomInt } from '@/utils/index'
|
|
|
|
import emitter from '@/utils/mitt'
|
|
|
|
import emitter from '@/utils/mitt'
|
|
|
|
import { getImgUrl } from '@/utils/urlUtils'
|
|
|
|
import { getImgUrl } from '@/utils/urlUtils'
|
|
|
|
import { useInfiniteScroll } from '@vueuse/core'
|
|
|
|
|
|
|
|
import imagesloaded from 'imagesloaded'
|
|
|
|
|
|
|
|
import { debounce } from 'lodash-es'
|
|
|
|
|
|
|
|
import Masonry from 'masonry-layout'
|
|
|
|
|
|
|
|
import { useMessage } from 'naive-ui'
|
|
|
|
|
|
|
|
import { computed, nextTick, onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
|
|
|
|
|
|
|
|
import GeneratePackageModal from './modal/GeneratePackageModal.vue'
|
|
|
|
|
|
|
|
import PackageSettingsModal from './modal/PackageSettingsModal.vue'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deviceHeight = ref(600)
|
|
|
|
const deviceHeight = ref(600)
|
|
|
|
let _masonry: null | Masonry = null
|
|
|
|
let _masonry: null | Masonry = null
|
|
|
@ -29,7 +30,7 @@ const masonryRef = ref<ComponentRef>(null)
|
|
|
|
const el = ref<HTMLDivElement | null>(null)
|
|
|
|
const el = ref<HTMLDivElement | null>(null)
|
|
|
|
const viewMode = ref('masonry')
|
|
|
|
const viewMode = ref('masonry')
|
|
|
|
const pagination = reactive({
|
|
|
|
const pagination = reactive({
|
|
|
|
pageNo: 1,
|
|
|
|
pageNo: 0,
|
|
|
|
pageSize: 30,
|
|
|
|
pageSize: 30,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const configStore = useConfig()
|
|
|
|
const configStore = useConfig()
|
|
|
@ -153,13 +154,13 @@ async function featchList() {
|
|
|
|
search_history: 0,
|
|
|
|
search_history: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pagination.pageNo += 1
|
|
|
|
const result = await getPictureList({ ...pagination, ...contentParams })
|
|
|
|
const result = await getPictureList({ ...pagination, ...contentParams })
|
|
|
|
// TODO:测试数据
|
|
|
|
// TODO:测试数据
|
|
|
|
// result.data = Array.from({ length: 30 })
|
|
|
|
// result.data = Array.from({ length: 30 })
|
|
|
|
// result.pageCount = 1
|
|
|
|
// result.pageCount = 1
|
|
|
|
const { data, pageCount } = result
|
|
|
|
const { data, pageCount } = result
|
|
|
|
pagination.pageNo += 1
|
|
|
|
canloadMore = pageCount >= pagination.pageNo && pageCount > 0
|
|
|
|
canloadMore = pageCount >= pagination.pageNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const list = data.map((item) => {
|
|
|
|
const list = data.map((item) => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -173,6 +174,7 @@ async function featchList() {
|
|
|
|
return list
|
|
|
|
return list
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
catch (error) {
|
|
|
|
|
|
|
|
canloadMore = false
|
|
|
|
return []
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -185,10 +187,10 @@ async function loadMore() {
|
|
|
|
listData.value.push(...more)
|
|
|
|
listData.value.push(...more)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
// onBeforeMount(async () => {
|
|
|
|
const list = await featchList()
|
|
|
|
// const list = await featchList()
|
|
|
|
listData.value = list
|
|
|
|
// listData.value = list
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
const gridHeight = computed(() => {
|
|
|
|
const gridHeight = computed(() => {
|
|
|
|
return viewMode.value !== 'masonry' ? '145px' : ''
|
|
|
|
return viewMode.value !== 'masonry' ? '145px' : ''
|
|
|
@ -199,9 +201,9 @@ async function oneCheck() {
|
|
|
|
modal.showModal()
|
|
|
|
modal.showModal()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function showLoginSuccessModal(){
|
|
|
|
async function showLoginSuccessModal() {
|
|
|
|
const modal = LoginSuccessModalRef.value as any
|
|
|
|
const modal = LoginSuccessModalRef.value as any
|
|
|
|
modal.showModal()
|
|
|
|
// modal.showModal()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function commitHandler(settingParam) {
|
|
|
|
async function commitHandler(settingParam) {
|
|
|
|