feat: 页面结构的调整

This commit is contained in:
2026-04-29 12:31:50 +08:00
parent 3b0fb23a5c
commit 3d6fe2642c
9 changed files with 95 additions and 151 deletions

View File

@@ -1,24 +1,25 @@
<template>
<view>
<FindTabs
v-if="discoveryTabs.length > 0"
v-model="activeIndex"
:tabs="discoveryTabs"
@change="handleTabChange"
/>
<CardSwiper
v-if="discoveryCards.length > 0"
:list="discoveryCards"
@card-click="cardClick" />
<view class="flex flex-col h-full overflow-hidden min-height-0">
<view class="flex-shrink-0">
<FindTabs
v-if="discoveryTabs.length > 0"
v-model="activeIndex"
:tabs="discoveryTabs"
@change="handleTabChange"
/>
</view>
<QuickQuestions />
<scroll-view class="flex-full border-box min-height-0" scroll-y show-scrollbar="false">
<CardSwiper v-if="discoveryCards.length > 0" :list="discoveryCards" @card-click="cardClick" />
<QuickQuestions />
</scroll-view>
</view>
</template>
<script setup>
import { computed, onMounted, ref } from "vue";
import { onMounted, ref } from "vue";
import FindTabs from "./components/FindTabs/index.vue";
import CardSwiper from "./components/CardSwiper/index.vue";
import QuickQuestions from "./components/QuickQuestions/index.vue";
@@ -66,7 +67,6 @@ const discoveryCards = ref([
/// tabs 切换事件
const handleTabChange = ({ tab, idx }) => {
if (activeIndex.value === idx) return;
activeIndex.value = idx;
queryDiscoveryData(tab.id);
}
@@ -89,14 +89,14 @@ const queryTabsList = async () => {
discoveryTabs.value = tabList;
/// 查询是否有sceneId参数
const activeTab = discoveryTabs.value.find((tab) => {
return tab.id === sceneId;
});
const activeTabIndex = discoveryTabs.value.findIndex((tab) => tab.id === sceneId);
/// 如果有则优先展示对应tab数据没有则展示第一个tab数据
if (activeTab) {
if (activeTabIndex > -1) {
activeIndex.value = activeTabIndex;
queryDiscoveryData(sceneId);
} else {
activeIndex.value = 0;
queryDiscoveryData(discoveryTabs.value[0].id);
}
}
@@ -133,5 +133,4 @@ onMounted(() => {
<style lang="scss" scoped>
</style>