|
@@ -1,38 +1,27 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view class="page">
|
|
<view class="page">
|
|
|
- <!-- 顶部导航栏 -->
|
|
|
|
|
- <view class="nav-bar">
|
|
|
|
|
- <view class="nav-content">
|
|
|
|
|
- <text class="logo">AI有声书</text>
|
|
|
|
|
- <view class="nav-right">
|
|
|
|
|
- <view class="search-icon" @click="goToSearch">
|
|
|
|
|
- <text>🔍</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view @click="handleUserClick">
|
|
|
|
|
- <image v-if="userStore.userInfo?.avatar" :src="userStore.userInfo.avatar" class="avatar" mode="aspectFill" :lazy-load="true" />
|
|
|
|
|
- <view v-else class="avatar-placeholder">
|
|
|
|
|
- <text class="avatar-text">登</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <!-- 搜索栏 -->
|
|
|
|
|
+ <view class="search-bar" @click="goToSearch">
|
|
|
|
|
+ <text class="search-icon">🔍</text>
|
|
|
|
|
+ <text class="search-placeholder">搜索有声书...</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 分类标签栏 -->
|
|
<!-- 分类标签栏 -->
|
|
|
- <scroll-view scroll-x class="category-bar">
|
|
|
|
|
- <view class="category-list">
|
|
|
|
|
- <view
|
|
|
|
|
- v-for="cat in categories"
|
|
|
|
|
- :key="cat.id"
|
|
|
|
|
- class="category-item"
|
|
|
|
|
- :class="{ active: selectedCategory === cat.id }"
|
|
|
|
|
- @click="selectCategory(cat.id)"
|
|
|
|
|
- >
|
|
|
|
|
- <text>{{ cat.icon }}</text>
|
|
|
|
|
- <text class="category-name">{{ cat.name }}</text>
|
|
|
|
|
|
|
+ <view class="category-bar">
|
|
|
|
|
+ <scroll-view class="category-scroll" scroll-x="true" :show-scrollbar="false">
|
|
|
|
|
+ <view class="category-list">
|
|
|
|
|
+ <view
|
|
|
|
|
+ v-for="cat in categories"
|
|
|
|
|
+ :key="cat.id"
|
|
|
|
|
+ class="category-item"
|
|
|
|
|
+ :class="{ active: selectedCategory === cat.id }"
|
|
|
|
|
+ @click="selectCategory(cat.id)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <text class="category-name">{{ cat.name }}</text>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
- </scroll-view>
|
|
|
|
|
|
|
+ </scroll-view>
|
|
|
|
|
+ </view>
|
|
|
|
|
|
|
|
<!-- 骨架屏加载状态 -->
|
|
<!-- 骨架屏加载状态 -->
|
|
|
<scroll-view scroll-y class="audio-list" @scrolltolower="loadMore" v-if="loading && audioList.length === 0">
|
|
<scroll-view scroll-y class="audio-list" @scrolltolower="loadMore" v-if="loading && audioList.length === 0">
|
|
@@ -132,15 +121,14 @@ const hasMore = ref(true);
|
|
|
interface Category {
|
|
interface Category {
|
|
|
id: number;
|
|
id: number;
|
|
|
name: string;
|
|
name: string;
|
|
|
- icon: string;
|
|
|
|
|
}
|
|
}
|
|
|
const categories = ref<Category[]>([
|
|
const categories = ref<Category[]>([
|
|
|
- { id: 1, name: '全部', icon: '🎵' },
|
|
|
|
|
- { id: 2, name: '故事', icon: '📖' },
|
|
|
|
|
- { id: 3, name: '小说', icon: '📚' },
|
|
|
|
|
- { id: 4, name: '儿童', icon: '👶' },
|
|
|
|
|
- { id: 5, name: '知识', icon: '💡' },
|
|
|
|
|
- { id: 6, name: '娱乐', icon: '🎮' },
|
|
|
|
|
|
|
+ { id: 1, name: '推荐' },
|
|
|
|
|
+ { id: 2, name: '故事' },
|
|
|
|
|
+ { id: 3, name: '小说' },
|
|
|
|
|
+ { id: 4, name: '儿童' },
|
|
|
|
|
+ { id: 5, name: '知识' },
|
|
|
|
|
+ { id: 6, name: '娱乐' },
|
|
|
]);
|
|
]);
|
|
|
const selectedCategory = ref(1);
|
|
const selectedCategory = ref(1);
|
|
|
|
|
|
|
@@ -254,106 +242,94 @@ onShow(() => {
|
|
|
padding-bottom: 180rpx;
|
|
padding-bottom: 180rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.nav-bar {
|
|
|
|
|
|
|
+.search-bar {
|
|
|
position: fixed;
|
|
position: fixed;
|
|
|
top: 0;
|
|
top: 0;
|
|
|
left: 0;
|
|
left: 0;
|
|
|
right: 0;
|
|
right: 0;
|
|
|
- height: 88rpx;
|
|
|
|
|
- background: #ffffff;
|
|
|
|
|
|
|
+ height: 100rpx;
|
|
|
|
|
+ padding-top: env(safe-area-inset-top);
|
|
|
|
|
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ padding-left: 24rpx;
|
|
|
|
|
+ padding-right: 24rpx;
|
|
|
z-index: 100;
|
|
z-index: 100;
|
|
|
- padding-top: 44rpx;
|
|
|
|
|
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.nav-content {
|
|
|
|
|
|
|
+.search-bar-inner {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ height: 64rpx;
|
|
|
|
|
+ background: rgba(255, 255, 255, 0.2);
|
|
|
|
|
+ border-radius: 32rpx;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
|
|
- padding: 0 32rpx;
|
|
|
|
|
- height: 88rpx;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.logo {
|
|
|
|
|
- font-size: 36rpx;
|
|
|
|
|
- font-weight: 600;
|
|
|
|
|
- color: #4f46e5;
|
|
|
|
|
|
|
+ padding: 0 24rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.nav-right {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- gap: 24rpx;
|
|
|
|
|
|
|
+.search-bar .search-icon {
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ margin-right: 12rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.search-icon {
|
|
|
|
|
- width: 56rpx;
|
|
|
|
|
- height: 56rpx;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
|
|
+.search-bar .search-placeholder {
|
|
|
|
|
+ font-size: 26rpx;
|
|
|
|
|
+ color: rgba(255, 255, 255, 0.8);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.category-bar {
|
|
.category-bar {
|
|
|
- position: sticky;
|
|
|
|
|
- top: 88rpx;
|
|
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ top: 100rpx;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ right: 0;
|
|
|
background: #ffffff;
|
|
background: #ffffff;
|
|
|
- padding: 16rpx 0;
|
|
|
|
|
- white-space: nowrap;
|
|
|
|
|
z-index: 99;
|
|
z-index: 99;
|
|
|
|
|
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.category-scroll {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.category-list {
|
|
.category-list {
|
|
|
- display: flex;
|
|
|
|
|
|
|
+ display: inline-flex;
|
|
|
gap: 16rpx;
|
|
gap: 16rpx;
|
|
|
- padding: 0 24rpx;
|
|
|
|
|
|
|
+ padding: 16rpx 24rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.category-item {
|
|
.category-item {
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- gap: 6rpx;
|
|
|
|
|
- padding: 12rpx 24rpx;
|
|
|
|
|
- background: #f5f5f5;
|
|
|
|
|
- border-radius: 32rpx;
|
|
|
|
|
- font-size: 26rpx;
|
|
|
|
|
- color: #6b7280;
|
|
|
|
|
|
|
+ padding: 12rpx 32rpx;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ color: #666;
|
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
|
|
|
+ position: relative;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.category-item.active {
|
|
.category-item.active {
|
|
|
- background: #4f46e5;
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
|
|
+ color: #4f46e5;
|
|
|
|
|
+ font-weight: 600;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.category-name {
|
|
|
|
|
- font-size: 26rpx;
|
|
|
|
|
|
|
+.category-item.active::after {
|
|
|
|
|
+ content: '';
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ bottom: 0;
|
|
|
|
|
+ left: 50%;
|
|
|
|
|
+ transform: translateX(-50%);
|
|
|
|
|
+ width: 40rpx;
|
|
|
|
|
+ height: 6rpx;
|
|
|
|
|
+ background: #4f46e5;
|
|
|
|
|
+ border-radius: 3rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.avatar {
|
|
|
|
|
- width: 56rpx;
|
|
|
|
|
- height: 56rpx;
|
|
|
|
|
- border-radius: 50%;
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-.avatar-placeholder {
|
|
|
|
|
- width: 56rpx;
|
|
|
|
|
- height: 56rpx;
|
|
|
|
|
- border-radius: 50%;
|
|
|
|
|
- background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-.avatar-text {
|
|
|
|
|
- font-size: 24rpx;
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
.audio-list {
|
|
.audio-list {
|
|
|
- padding-top: 132rpx;
|
|
|
|
|
- height: calc(100vh - 140rpx);
|
|
|
|
|
|
|
+ padding-top: 160rpx;
|
|
|
|
|
+ height: calc(100vh - 160rpx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.empty {
|
|
.empty {
|