Merge pull request 'fix/suspiciousSort' (#107) from fix/suspiciousSort into test

Reviewed-on: #107
pull/108/head
yaoshuli 1 year ago
commit 4787f2dd21

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import Masonry from 'masonry-layout' import Masonry from 'masonry-layout'
import { useDialog, useMessage } from 'naive-ui' import { useDialog, useMessage } from 'naive-ui'
import { computed, onBeforeMount, onMounted, onUpdated, reactive, ref, unref, watch } from 'vue' import { computed, nextTick, onBeforeMount, onMounted, onUpdated, reactive, ref, unref, watch } from 'vue'
import { dubiousfilelist, removeFiles } from '@/api/task/task' import { dubiousfilelist, removeFiles } from '@/api/task/task'
import { viewOptions } from '@/config/home' import { viewOptions } from '@/config/home'
@ -22,7 +22,13 @@ const cardStyle = {
const message = useMessage() const message = useMessage()
const timeRange = ref('') const timeRange = ref('')
const similarRange = ref('')
const batch = ref(false) const batch = ref(false)
let filterId = null;
let sortObj: any = {
orderByUptime: 'desc'
};
const timeOptions = [{ const timeOptions = [{
label: '升序', label: '升序',
value: 'asc', value: 'asc',
@ -30,6 +36,14 @@ const timeOptions = [{
label: '降序', label: '降序',
value: 'desc', value: 'desc',
}] }]
// const similarOptions = [{
// label: '',
// value: 'asc',
// }, {
// label: '',
// value: 'desc',
// }]
const timeLabel = computed(() => { const timeLabel = computed(() => {
const item = timeOptions.find((option) => { const item = timeOptions.find((option) => {
return option.value === timeRange.value return option.value === timeRange.value
@ -104,7 +118,8 @@ useInfiniteScroll(
async function featchList() { async function featchList() {
loading = true loading = true
try { try {
const result = await dubiousfilelist({ ...pagination, orderbyname: timeRange.value }) // const result = await dubiousfilelist({ ...pagination, orderbyname: timeRange.value })
const result = await dubiousfilelist({ ...pagination, ...sortObj })
// TODO // TODO
// result.data = Array.from({ length: 30 }) // result.data = Array.from({ length: 30 })
result.pageCount = 1 result.pageCount = 1
@ -209,7 +224,18 @@ function upHandler(event: MouseEvent) {
} }
const gridHeight = computed(() => { const gridHeight = computed(() => {
return viewMode.value !== 'masonry' ? '157px' : '' // return viewMode.value !== 'masonry' ? '157px' : ''
let height = "";
if (viewMode.value === "masonry") {
height = "";
} else if (viewMode.value === "horizontalVersion") {
height = "145px";
} else if (viewMode.value === "verticalVersion") {
height = "300px";
} else if (viewMode.value === "3:4") {
height = "240px";
}
return height;
}) })
function addListeners() { function addListeners() {
@ -247,7 +273,23 @@ async function showModal() {
layout() layout()
} }
async function onChange() { async function onChange(val) {
console.log("val------------------------", val);
sortObj = {
// orderbyname: val,
orderByUptime: val
}
pagination.pageNo = 1
const list = await featchList()
listData.value = list
}
async function onChangeView(val) {
console.log("val------------------------", val);
sortObj = {
// orderbyname: val,
orderBySimilarity: val
}
pagination.pageNo = 1 pagination.pageNo = 1
const list = await featchList() const list = await featchList()
listData.value = list listData.value = list
@ -388,11 +430,30 @@ function doAudit(param: any) {
function reloadList() { function reloadList() {
refreshHandler() refreshHandler()
} }
async function refreshHandler() { async function refreshHandler(filtersearchId?: any) {
reset() // rao start
const list = await featchList() // reset()
listData.value = list // const list = await featchList()
layout() // listData.value = list
// layout()
// rao end
reset();
if (filtersearchId) {
filterId = filtersearchId;
}
nextTick(() => {
setTimeout(() => {
useInfiniteScroll(
el as any,
() => {
loadMore();
},
{ distance: 10, canLoadMore: () => canloadMore }
);
}, 300);
});
} }
</script> </script>
@ -421,6 +482,12 @@ async function refreshHandler() {
<SvgIcon class="wrapper-content-form-dropdown-gap" name="arrow-botton" size="14" /> <SvgIcon class="wrapper-content-form-dropdown-gap" name="arrow-botton" size="14" />
</div> </div>
</n-popselect> </n-popselect>
<n-popselect v-model:value="similarRange" :options="timeOptions" trigger="click" @change="onChangeView">
<div class="wrapper-content-form-dropdown">
<span>相似度排序</span>
<SvgIcon class="wrapper-content-form-dropdown-gap" name="arrow-botton" size="14" />
</div>
</n-popselect>
<n-popselect v-model:value="viewMode" :options="viewOptions" trigger="click"> <n-popselect v-model:value="viewMode" :options="viewOptions" trigger="click">
<div class="wrapper-form-dropdown"> <div class="wrapper-form-dropdown">
<span>视图模式</span> <span>视图模式</span>
@ -460,8 +527,13 @@ async function refreshHandler() {
<div v-for="(item, index) in listData" :key="item.pictureId" :data-id="item.pictureId" <div v-for="(item, index) in listData" :key="item.pictureId" :data-id="item.pictureId"
:class="{ 'grid-item-selected': isSelected(item.pictureId) }" :style="{ height: gridHeight }" :class="{ 'grid-item-selected': isSelected(item.pictureId) }" :style="{ height: gridHeight }"
class="grid-item"> class="grid-item">
<n-image :src="item.imgUrl" class="img " <n-image
:class="{ 'img-fit': viewMode === 'horizontalVersion', 'img-full': viewMode === '3:4' || viewMode === 'verticalVersion' }" /> :src="item.imgUrl"
class="img "
:class="{
'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion' }"
/>
<n-checkbox v-if="batch && item.historyStates === 1" v-model:checked="item.checked" <n-checkbox v-if="batch && item.historyStates === 1" v-model:checked="item.checked"
style="position:absolute;left:20px;top:20px" @click.prevent style="position:absolute;left:20px;top:20px" @click.prevent
@update:checked="onCheckChange($event, item)" /> @update:checked="onCheckChange($event, item)" />
@ -549,7 +621,9 @@ async function refreshHandler() {
} }
.img { .img {
border-radius: 8px; border-radius: 7px;
display: block;
height: calc(100%);
} }
.wrapper { .wrapper {

Loading…
Cancel
Save