Merge remote-tracking branch 'origin/main'
# Conflicts: # src/components/detail/imageWatch.vue
This commit is contained in:
@@ -123,7 +123,7 @@ import emptyDuck from '@/components/public/empty-duck.vue'
|
||||
import choosingIdentity from '@/components/edit/choosingIdentity.vue'
|
||||
import backToTop from '@/components/public/backToTop.vue'
|
||||
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, nextTick } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, nextTick, pushScopeId } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { ElLoading, ElMessage } from 'element-plus'
|
||||
@@ -174,6 +174,7 @@ const init = () => {
|
||||
|
||||
if (!route.query['tab']) {
|
||||
if (data.count['publish'] > 0) tabState.value = 'publish'
|
||||
else if (data.count['fav'] == 0) tabState.value = 'publish'
|
||||
else tabState.value = 'fav'
|
||||
} else tabState.value = route.query['tab']
|
||||
|
||||
@@ -244,13 +245,14 @@ const getFavData = () => {
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
})
|
||||
proxy.$post("/tenement/pc/api/user/favList", {
|
||||
page: favData.value['page']
|
||||
page: favData.value['page'],
|
||||
limit:5
|
||||
}).then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data
|
||||
favData.value['page'] = data['page'] * data['limit'] >= data['count'] ? 0 : data['page'] + 1
|
||||
favData.value['list'] = favData.value['list'].concat(data['data'] || [])
|
||||
|
||||
favData.value['limit'] = data['limit']
|
||||
nextTick(() => {
|
||||
masonryInstance.reloadItems();
|
||||
masonryInstance.layout();
|
||||
@@ -277,6 +279,11 @@ let cancelCollection = data => {
|
||||
favData.value.list.splice(data['index'], 1)
|
||||
count.value['fav']--
|
||||
|
||||
if (favData.value.list.length == 0 && favData.value['page'] != 0) {
|
||||
favData.value['page'] = 1
|
||||
getFavData()
|
||||
} else refillData(data['index'])
|
||||
|
||||
nextTick(() => {
|
||||
masonryInstance.reloadItems();
|
||||
masonryInstance.layout();
|
||||
@@ -285,6 +292,24 @@ let cancelCollection = data => {
|
||||
})
|
||||
}
|
||||
|
||||
// 取消输出后重新补充一条数据
|
||||
const refillData = index => {
|
||||
if (favData.value['page'] == 0 || loading['visible'].value) return
|
||||
const page = favData.value['page'] - 1
|
||||
proxy.$post("/tenement/pc/api/user/favList", {
|
||||
page,
|
||||
limit: favData.value['limit']
|
||||
}).then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data['data'] || []
|
||||
favData.value['list'].push(data[data.length - 1])
|
||||
nextTick(() => {
|
||||
masonryInstance.reloadItems();
|
||||
masonryInstance.layout();
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 点击下架都修改状态
|
||||
const undercarriage = (index, status) => {
|
||||
stat.value['listing']--
|
||||
@@ -301,7 +326,7 @@ const handleDelete = (index, status) => {
|
||||
if (status == 0) stat.value['draft']--
|
||||
else if (status == 1) stat.value['listing']--
|
||||
else stat.value['offshelf']--
|
||||
count.value['publish'] --
|
||||
count.value['publish']--
|
||||
publishData.value['list'].splice(index, 1)
|
||||
nextTick(() => {
|
||||
masonryInstancepublish.reloadItems();
|
||||
|
||||
Reference in New Issue
Block a user