feat: update player

This commit is contained in:
yanghao05
2025-04-29 11:24:54 +08:00
parent ee21908887
commit c9740e6403
7 changed files with 81 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ export const postApi = {
return client.get(`/posts/${id}/play`);
},
show(id) {
return client.get(`/posts/${id}`);
return client.get(`/posts/${id}/show`);
},
mine({ page = 1, limit = 10 } = {}) {
return client.get('/posts/mine', {

View File

@@ -114,6 +114,11 @@ onUnmounted(() => {
<button @click="handleBack" class="text-gray-700">
<BsChevronLeft class="w-6 h-6" />
</button>
<template v-if="article">
<h1 class="text-lg font-semibold text-gray-800 ml-4">
{{ article.title }}
</h1>
</template>
</div>
<div class="flex-1">
@@ -125,6 +130,13 @@ onUnmounted(() => {
</video>
<div class="p-4">
<h1 class="text-2xl my-1.5">{{ article.title }}</h1>
<div class="py-2 flex items-center gap-2">
<span v-for="tag in article.tags" :key="tag"
class="px-1.5 py-0.5 text-xs bg-gray-100 text-gray-600 rounded">
<span class="mr-1">#</span>{{ tag }}
</span>
</div>
<p class="text-gray-600">{{ article.content }}</p>
</div>
</div>

View File

@@ -17,14 +17,14 @@ const fetchArticles = async () => {
if (loading.value) return
loading.value = true
try {
const response = await postApi.mine({
const { data } = await postApi.mine({
page: currentPage.value,
limit
})
if (response.data.data?.length === 0) {
if (data.items?.length === 0) {
hasMore.value = false
} else {
purchasedArticles.value.push(...response.data.data)
purchasedArticles.value.push(...data.items)
currentPage.value += 1
}
} catch (error) {