Merge pull request 'feat: 修改选择条件问题' (#269) from fix/updatesyspic into test

Reviewed-on: #269
pull/272/head
yaoshuli 1 year ago
commit 17d2a65f8a

@ -261,11 +261,12 @@ export async function getPictureList(params: any): Promise<any> {
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
})
const { data: { records, pages, total } } = res
const { data: { records, pages, total, current } } = res
return {
pageCount: pages,
data: records,
total,
current,
}
}

@ -61,6 +61,7 @@ const deviceHeight = ref(600)
// let _imagesload: any
// const masonryRef = ref<ComponentRef>(null)
const el = ref<HTMLDivElement | null>(null)
const waterfallRef = ref(null)
const viewMode = ref('masonry')
const pagination = reactive({
pageNo: 0,
@ -145,16 +146,16 @@ useInfiniteScroll(
)
onBeforeMount(async () => {
const more = await featchList()
more.forEach((item) => {
item.calHeight = 182 * item.high / item.wide
})
listData.value = more
const tmore = await featchList()
tmore.forEach((item) => {
item.calHeight = 182 * item.high / item.wide
})
listData.value = listData.value.concat(tmore)
// const more = await featchList()
// more.forEach((item) => {
// item.calHeight = 182 * item.high / item.wide
// })
// listData.value = more
// const tmore = await featchList()
// tmore.forEach((item) => {
// item.calHeight = 182 * item.high / item.wide
// })
// listData.value = listData.value.concat(tmore)
const screenWidth = window.screen.width
if (screenWidth > 1920 && screenWidth <= 2560)
cols.value = 11
@ -218,6 +219,16 @@ watch(
},
)
watch(
() => configStore.getAsideValue,
async (newVal, oldVal) => {
if (newVal) {
reset()
loadMore()
}
},
)
async function featchList(userSearchId?: string) {
loading.value = true
try {
@ -235,6 +246,7 @@ async function featchList(userSearchId?: string) {
pageCount: 0,
data: [],
total: 0,
current: 1,
}
const sortObj: any = {} // rao start
if (sortBy.orderbyvalue == 'pictureResult')
@ -266,12 +278,14 @@ async function featchList(userSearchId?: string) {
upUserName: searchValue,
})
}
const { data, pageCount, total } = result
const { data, pageCount, total, current } = result
pagination.pageNo = current
totalCount.value = total
canloadMore = pageCount >= pagination.pageNo && pageCount > 0
const list = data.map((item) => {
return {
id: item.id,
calHeight: 0,
imgUrl: item.imgurl,
thumburl: item.serverThumbnailUrl,
@ -306,8 +320,22 @@ async function loadMore() {
item.calHeight = 182 * item.high / item.wide
})
// listData.value.push(...more)
listData.value = listData.value.concat(more)
console.log('listData.value出来了', listData.value)
if (pagination.pageNo == 1) {
listData.value = []
listData.value = listData.value.concat(more)
console.log('listData.value出来了', listData.value)
waterfallRef.value?.resize()
}
else {
// setTimeout(() => {
// const height = el.value?.scrollHeight - 1000
// console.log('listData.valueheight', height)
// el.value?.scrollTo({ top: height, behavior: 'smooth' })
// }, 50)
listData.value = listData.value.concat(more)
console.log('listData.value出来了', listData.value)
waterfallRef.value?.mix()
}
}
const gridHeight = computed(() => {
@ -498,34 +526,34 @@ watch(
{ deep: true },
)
function reset() {
function reset(val?) {
pagination.pageNo = 0
pagination.pageSize = 30
listData.value = []
listData.value.length = 0
loading.value = false
canloadMore = true
filterId = null
// layout()
}
async function refreshHandler(filtersearchId?: any) {
reset()
reset(true)
if (filtersearchId)
filterId = filtersearchId
nextTick(() => {
setTimeout(() => {
useInfiniteScroll(
el as any,
() => {
loadMore()
},
{ distance: 10, canLoadMore: () => canloadMore },
)
}, 300)
})
loadMore(true)
// nextTick(() => {
// setTimeout(() => {
// useInfiniteScroll(
// el as any,
// () => {
// loadMore()
// },
// { distance: 10, canLoadMore: () => canloadMore },
// )
// }, 300)
// })
}
function getAvatar(url: string): string {
@ -750,225 +778,225 @@ defineExpose({
<span style="color: #507afd; font-weight: 500">{{ totalCount }}</span> </span>
</div>
<n-spin :show="loading">
<div v-if="viewMode != 'masonry'" ref="el" class="scroll" :style="listStyle">
<div class="grid" :style="{ 'grid-template-columns': `repeat(${cols}, 182px)` }">
<div
v-for="(item, index) in listData"
:key="item.calHeight"
:style="{ height: `${gridHeight}px` }"
class="grid-item"
<!-- <n-spin :show="loading"> -->
<div v-if="viewMode != 'masonry'" ref="el" class="scroll" :style="listStyle">
<div class="grid" :style="{ 'grid-template-columns': `repeat(${cols}, 182px)` }">
<div
v-for="(item, index) in listData"
:key="item.id"
:style="{ height: `${gridHeight}px` }"
class="grid-item"
>
<img
:key="item.id"
v-lazy="item.thumburl"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:style="{ height: `${viewMode === 'masonry' ? `${item.calHeight}px` : `${gridHeight - 25}px`}` }"
class="img"
alt="加载错误"
>
<img
:key="item.thumburl"
v-lazy="item.thumburl"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:style="{ height: `${viewMode === 'masonry' ? `${item.calHeight}px` : `${gridHeight - 25}px`}` }"
class="img"
alt="加载错误"
>
<n-image
ref="imageRef"
:key="item.imgUrl"
class="img"
:img-props="{
onClick: ($event) => {
hideDownload($event);
showClose = true;
},
}"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:preview-src="item.imgUrl"
:src="item.thumburl"
:fallback-src="bgLoadingImg"
:style="{ backgroundImage: `url(${loading ? bgLoadingImg : 'none'})` }"
style="display: none"
/>
<img
v-if="item.states == 3"
class="tag-status"
src="@/assets/images/task/tag-pass.png"
alt=""
>
<img
v-if="item.states == 5"
class="tag-status"
src="@/assets/images/task/tag-not-pass.png"
alt=""
>
<div v-if="item.similar != -1" class="percent">
<SvgIcon size="42" :name="item.similar == 100 ? 'error_tag' : 'tag'" />
<div class="val">
{{ `${item.similar}%` }}
</div>
</div>
<div v-if="isAllowDownload" class="glass">
<SvgIcon
size="16"
name="download"
style="margin-top: -6px; cursor: pointer"
@click="downloadImage(item)"
/>
<n-image
ref="imageRef"
:key="item.imgUrl"
class="img"
:img-props="{
onClick: ($event) => {
hideDownload($event);
showClose = true;
},
}"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:preview-src="item.imgUrl"
:src="item.thumburl"
:fallback-src="bgLoadingImg"
:style="{ backgroundImage: `url(${loading ? bgLoadingImg : 'none'})` }"
style="display: none"
/>
<img
v-if="item.states == 3"
class="tag-status"
src="@/assets/images/task/tag-pass.png"
alt=""
>
<img
v-if="item.states == 5"
class="tag-status"
src="@/assets/images/task/tag-not-pass.png"
alt=""
>
<div v-if="item.similar != -1" class="percent">
<SvgIcon size="42" :name="item.similar == 100 ? 'error_tag' : 'tag'" />
<div class="val">
{{ `${item.similar}%` }}
</div>
</div>
<div v-if="isAllowDownload" class="glass">
<SvgIcon
size="16"
name="download"
style="margin-top: -6px; cursor: pointer"
@click="downloadImage(item)"
/>
</div>
<div class="info">
<div class="footer">
<div class="img-name">
<n-tooltip trigger="hover">
<template #trigger>
<span>{{ item.imgName }}</span>
</template>
<span
style="font-size: 12px; margin-top: 4px; margin-bottom: 16px"
>{{ item.imgName }}</span>
</n-tooltip>
</div>
<div
class="icon-wrap"
@click="
($event) => {
previewHandler(index, $event);
hideDownload($event);
}
"
>
<SvgIcon
size="13"
name="magnifying-2"
style="cursor: pointer; color: #898481"
/>
</div>
<div class="info">
<div class="footer">
<div class="img-name">
<n-tooltip trigger="hover">
<template #trigger>
<span>{{ item.imgName }}</span>
</template>
<span
style="font-size: 12px; margin-top: 4px; margin-bottom: 16px"
>{{ item.imgName }}</span>
</n-tooltip>
</div>
<div class="left">
<n-avatar
:src="(item.uphead && getAvatar(item.uphead)) || defaultAvatar"
class="avatar"
round
<div
class="icon-wrap"
@click="
($event) => {
previewHandler(index, $event);
hideDownload($event);
}
"
>
<SvgIcon
size="13"
name="magnifying-2"
style="cursor: pointer; color: #898481"
/>
<span>{{ item.upname }}</span>
</div>
</div>
<div class="left">
<n-avatar
:src="(item.uphead && getAvatar(item.uphead)) || defaultAvatar"
class="avatar"
round
/>
<span>{{ item.upname }}</span>
</div>
</div>
</div>
</div>
<div v-if="viewMode === 'masonry'" ref="el" class="scroll" :style="listStyle">
<waterfall :col="cols" :data="listData" :gutter-width="10" @finish="finish">
<div
v-for="(item, index) in listData"
:key="item.calHeight"
class="grid-item"
</div>
<div v-if="viewMode === 'masonry'" ref="el" class="scroll" :style="listStyle">
<waterfall ref="waterfallRef" :col="cols" :data="listData" :gutter-width="10" @finish="finish">
<div
v-for="(item, index) in listData"
:key="item.id"
class="grid-item"
>
<img
:key="item.id"
v-lazy="item.thumburl"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:style="{ height: `${item.calHeight}px` }"
class="img"
alt="加载错误"
>
<img
:key="item.thumburl"
v-lazy="item.thumburl"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:style="{ height: `${item.calHeight}px` }"
class="img"
alt="加载错误"
>
<n-image
ref="imageRef"
:key="item.imgUrl"
class="img"
:img-props="{
onClick: ($event) => {
hideDownload($event);
showClose = true;
},
}"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:preview-src="item.imgUrl"
:src="item.thumburl"
:fallback-src="bgLoadingImg"
:style="{ backgroundImage: `url(${loading ? bgLoadingImg : 'none'})` }"
style="display: none"
/>
<img
v-if="item.states == 3"
class="tag-status"
src="@/assets/images/task/tag-pass.png"
alt=""
>
<img
v-if="item.states == 5"
class="tag-status"
src="@/assets/images/task/tag-not-pass.png"
alt=""
>
<div v-if="item.similar != -1" class="percent">
<SvgIcon size="42" :name="item.similar == 100 ? 'error_tag' : 'tag'" />
<div class="val">
{{ `${item.similar}%` }}
</div>
</div>
<div v-if="isAllowDownload" class="glass">
<SvgIcon
size="16"
name="download"
style="margin-top: -6px; cursor: pointer"
@click="downloadImage(item)"
/>
<n-image
ref="imageRef"
:key="item.imgUrl"
class="img"
:img-props="{
onClick: ($event) => {
hideDownload($event);
showClose = true;
},
}"
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion',
}"
:preview-src="item.imgUrl"
:src="item.thumburl"
:fallback-src="bgLoadingImg"
:style="{ backgroundImage: `url(${loading ? bgLoadingImg : 'none'})` }"
style="display: none"
/>
<img
v-if="item.states == 3"
class="tag-status"
src="@/assets/images/task/tag-pass.png"
alt=""
>
<img
v-if="item.states == 5"
class="tag-status"
src="@/assets/images/task/tag-not-pass.png"
alt=""
>
<div v-if="item.similar != -1" class="percent">
<SvgIcon size="42" :name="item.similar == 100 ? 'error_tag' : 'tag'" />
<div class="val">
{{ `${item.similar}%` }}
</div>
</div>
<div v-if="isAllowDownload" class="glass">
<SvgIcon
size="16"
name="download"
style="margin-top: -6px; cursor: pointer"
@click="downloadImage(item)"
/>
</div>
<div class="info">
<div class="footer">
<div class="img-name">
<n-tooltip trigger="hover">
<template #trigger>
<span>{{ item.imgName }}</span>
</template>
<span
style="font-size: 12px; margin-top: 4px; margin-bottom: 16px"
>{{ item.imgName }}</span>
</n-tooltip>
</div>
<div
class="icon-wrap"
@click="
($event) => {
previewHandler(index, $event);
hideDownload($event);
}
"
>
<SvgIcon
size="13"
name="magnifying-2"
style="cursor: pointer; color: #898481"
/>
</div>
<div class="info">
<div class="footer">
<div class="img-name">
<n-tooltip trigger="hover">
<template #trigger>
<span>{{ item.imgName }}</span>
</template>
<span
style="font-size: 12px; margin-top: 4px; margin-bottom: 16px"
>{{ item.imgName }}</span>
</n-tooltip>
</div>
<div class="left">
<n-avatar
:src="(item.uphead && getAvatar(item.uphead)) || defaultAvatar"
class="avatar"
round
<div
class="icon-wrap"
@click="
($event) => {
previewHandler(index, $event);
hideDownload($event);
}
"
>
<SvgIcon
size="13"
name="magnifying-2"
style="cursor: pointer; color: #898481"
/>
<span>{{ item.upname }}</span>
</div>
</div>
<div class="left">
<n-avatar
:src="(item.uphead && getAvatar(item.uphead)) || defaultAvatar"
class="avatar"
round
/>
<span>{{ item.upname }}</span>
</div>
</div>
</waterfall>
</div>
</n-spin>
</div>
</waterfall>
</div>
<!-- </n-spin> -->
</div>
<PackageSettingsModal ref="packageModalRef" @commit="commitHandler" />
<GeneratePackageModal ref="generateModalRef" />

Loading…
Cancel
Save