fix: 活动选作品仅展示已发布作品

WorkSelector 请求 /public/works 增加 status=published,空状态提示优化

Made-with: Cursor
This commit is contained in:
zhonghua 2026-04-15 11:04:54 +08:00
parent eff55b6f7b
commit 872cd22bcc

View File

@ -11,7 +11,7 @@
<div v-if="loading" style="text-align: center; padding: 40px"><a-spin /></div>
<div v-else-if="works.length === 0" style="text-align: center; padding: 40px">
<a-empty description="作品库中没有可提交的作品">
<a-empty description="暂无已发布作品,请先在作品库将作品上架后再报名">
<a-button type="primary" shape="round" @click="goCreate">
去创作
</a-button>
@ -48,7 +48,7 @@
</template>
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { ref, watch } from 'vue'
import { PictureOutlined, CheckCircleFilled } from '@ant-design/icons-vue'
import { publicUserWorksApi, type UserWork } from '@/api/public'
import { useRouter } from 'vue-router'
@ -67,9 +67,13 @@ const selectedWork = ref<UserWork | null>(null)
const fetchWorks = async () => {
loading.value = true
try {
// 稿
const res = await publicUserWorksApi.list({ page: 1, pageSize: 100 })
works.value = res.list.filter((w) => w.status !== 'rejected' && w.status !== 'taken_down')
//
const res = await publicUserWorksApi.list({
page: 1,
pageSize: 100,
status: 'published',
})
works.value = res.list
} catch { /* */ }
finally { loading.value = false }
}