fix: 活动选作品仅展示已发布作品
WorkSelector 请求 /public/works 增加 status=published,空状态提示优化 Made-with: Cursor
This commit is contained in:
parent
eff55b6f7b
commit
872cd22bcc
@ -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 }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user