feat:前端部分

This commit is contained in:
Leon
2025-12-26 22:49:46 +08:00
parent 328fae5f07
commit a0d6464d9d
5 changed files with 19 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
import { postJson } from './client' import { postJson } from './client'
import type { ListByFollowingResponse, ListLatestResponse, ListLikesCountResponse } from './types' import type { ListByFollowingResponse, ListByPopularityResponse, ListLatestResponse, ListLikesCountResponse } from './types'
export function listLatest(input: { limit: number; latest_time: number }) { export function listLatest(input: { limit: number; latest_time: number }) {
return postJson<ListLatestResponse>('/feed/listLatest', input) return postJson<ListLatestResponse>('/feed/listLatest', input)
@@ -14,6 +14,10 @@ export function listLikesCount(input: { limit: number; likes_count_before?: numb
return postJson<ListLikesCountResponse>('/feed/listLikesCount', body) return postJson<ListLikesCountResponse>('/feed/listLikesCount', body)
} }
export function listByPopularity(input: { limit: number; as_of: number; offset: number }) {
return postJson<ListByPopularityResponse>('/feed/listByPopularity', input)
}
export function listByFollowing(input: { limit: number; latest_time: number }) { export function listByFollowing(input: { limit: number; latest_time: number }) {
return postJson<ListByFollowingResponse>('/feed/listByFollowing', input, { authRequired: true }) return postJson<ListByFollowingResponse>('/feed/listByFollowing', input, { authRequired: true })
} }

View File

@@ -58,6 +58,16 @@ export type ListLikesCountResponse = {
has_more: boolean has_more: boolean
} }
export type ListByPopularityResponse = {
video_list: FeedVideoItem[]
as_of: number
next_offset: number
has_more: boolean
next_latest_popularity?: number
next_latest_before?: string
next_latest_id_before?: number
}
export type ListByFollowingResponse = { export type ListByFollowingResponse = {
video_list: FeedVideoItem[] video_list: FeedVideoItem[]
next_time: number next_time: number

View File

@@ -58,6 +58,7 @@ async function goSettings() {
<nav class="dy-nav"> <nav class="dy-nav">
<RouterLink class="dy-nav-link" to="/">推荐</RouterLink> <RouterLink class="dy-nav-link" to="/">推荐</RouterLink>
<RouterLink class="dy-nav-link" to="/hot">热榜</RouterLink>
<RouterLink class="dy-nav-link" to="/video">发布</RouterLink> <RouterLink class="dy-nav-link" to="/video">发布</RouterLink>
<RouterLink class="dy-nav-link" to="/account">账号</RouterLink> <RouterLink class="dy-nav-link" to="/account">账号</RouterLink>
<RouterLink class="dy-nav-link" to="/settings">设置</RouterLink> <RouterLink class="dy-nav-link" to="/settings">设置</RouterLink>

View File

@@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue' import HomeView from '../views/HomeView.vue'
import HotView from '../views/HotView.vue'
import VideoView from '../views/VideoView.vue' import VideoView from '../views/VideoView.vue'
import VideoDetailView from '../views/VideoDetailView.vue' import VideoDetailView from '../views/VideoDetailView.vue'
import AccountView from '../views/AccountView.vue' import AccountView from '../views/AccountView.vue'
@@ -14,6 +15,7 @@ const router = createRouter({
routes: [ routes: [
{ path: '/', name: 'home', component: HomeView }, { path: '/', name: 'home', component: HomeView },
{ path: '/feed', redirect: '/' }, { path: '/feed', redirect: '/' },
{ path: '/hot', name: 'hot', component: HotView },
{ path: '/video', name: 'video', component: VideoView }, { path: '/video', name: 'video', component: VideoView },
{ path: '/video/:id', name: 'video-detail', component: VideoDetailView, props: true }, { path: '/video/:id', name: 'video-detail', component: VideoDetailView, props: true },
{ path: '/account', name: 'account', component: AccountView }, { path: '/account', name: 'account', component: AccountView },

View File

@@ -441,7 +441,7 @@ onBeforeUnmount(() => {
<div class="tabs"> <div class="tabs">
<button class="tab" :class="{ on: tab === 'recommend' }" type="button" @click="tab = 'recommend'">推荐</button> <button class="tab" :class="{ on: tab === 'recommend' }" type="button" @click="tab = 'recommend'">推荐</button>
<button class="tab" :class="{ on: tab === 'following' }" type="button" @click="tab = 'following'">关注</button> <button class="tab" :class="{ on: tab === 'following' }" type="button" @click="tab = 'following'">关注</button>
<button class="tab" :class="{ on: tab === 'hot' }" type="button" @click="tab = 'hot'"></button> <button class="tab" :class="{ on: tab === 'hot' }" type="button" @click="tab = 'hot'">点赞</button>
<div class="tabs-right"> <div class="tabs-right">
<button class="chip" type="button" @click="toggleMute">{{ muted ? '静音' : '有声' }}</button> <button class="chip" type="button" @click="toggleMute">{{ muted ? '静音' : '有声' }}</button>