|
|
@@ -7,6 +7,7 @@ import { fetchSubjectConfigInfo } from '@/services/subject/info'
|
|
|
import type { SubjectCatalogResult } from '@/services/subject/catalog'
|
|
|
|
|
|
const activeCategory = ref<string>()
|
|
|
+const activeTab = ref<string>('knowledge')
|
|
|
const isLoading = ref(true)
|
|
|
const categories = ref<SubjectCatalogResult[]>([])
|
|
|
|
|
|
@@ -14,7 +15,7 @@ const cards = ref<SubjectKnowledgeCardResult[]>([])
|
|
|
async function getDataList() {
|
|
|
const res = await fetchSubjectConfigInfo({ id: '69afc7e048070409048c06b6' })
|
|
|
categories.value = res.catalogList || []
|
|
|
- handleSelect(categories.value[0].id as string)
|
|
|
+ handleSelect(res.id as string)
|
|
|
}
|
|
|
function handleSelect(subjectId: string) {
|
|
|
activeCategory.value = subjectId
|
|
|
@@ -46,15 +47,16 @@ onMounted(async () => {
|
|
|
<view class="cards-container">
|
|
|
<view class="header">
|
|
|
<view class="title-tabs">
|
|
|
- <view class="tab active">知识卡</view>
|
|
|
- <view class="tab">荣誉</view>
|
|
|
+ <view class="tab" :class="{ active: activeTab === 'knowledge' }" @tap="activeTab = 'knowledge'">知识卡
|
|
|
+ </view>
|
|
|
+ <view class="tab" :class="{ active: activeTab === 'honor' }" @tap="activeTab = 'honor'">荣誉</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<scroll-view direction="vertical" :show-scrollbar="false" class="cards">
|
|
|
<view class="grid grid-cols-5 gap-4">
|
|
|
<view class="card" v-for="card in cards" :key="card.id">
|
|
|
<image src="/static/home/21.png" class="w-full h-full" />
|
|
|
- <view class="card-title">{{ card.title }}</view>
|
|
|
+ <view class="card-title">{{ card.name }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|