feat: 首页tab的调整

This commit is contained in:
2026-04-28 16:20:50 +08:00
parent d3ef285c6d
commit 47d2b5bb3f
7 changed files with 100 additions and 97 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -11,7 +11,7 @@
v-if="leftSelected || leftUnselected"
:src="modelValue === 0 ? (leftSelected || leftUnselected) : (leftUnselected || leftSelected)"
class="tab-image"
mode="aspectFill"
mode="scaleToFill"
/>
<text class="tab-text">探索发现</text>
</view>
@@ -27,7 +27,7 @@
v-if="rightSelected || rightUnselected"
:src="modelValue === 1 ? (rightSelected || rightUnselected) : (rightUnselected || rightSelected)"
class="tab-image"
mode="aspectFill"
mode="scaleToFill"
/>
<text class="tab-text">AI伴游</text>
<view
@@ -59,91 +59,6 @@ const handleSwitch = (i) => {
};
</script>
<style scoped>
.ai-tab-wrapper {
width: 100%;
background-color: #61d68b;
}
.tab-container {
position: relative;
width: 100%;
height: 50px;
display: flex;
overflow: hidden;
}
.tab-item {
position: relative;
flex: 1;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
}
.tab-item.active {
z-index: 10;
}
.tab-content {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.3s;
overflow: hidden;
}
.tab-text {
font-size: 18px;
font-weight: 500;
color: rgba(255, 255, 255, 0.65);
z-index: 20;
}
.tab-image {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
object-fit: cover;
z-index: 5;
}
.tab-item.active .tab-text {
color: #2e312f;
font-weight: bold;
}
.is-left {
margin-right: -24px;
}
.is-right {
margin-left: -24px;
}
.status-dot {
display: inline-block;
margin-left: 6px;
width: 6px;
height: 6px;
border-radius: 50%;
z-index: 22;
transform: translateY(-1px);
}
.status-dot--active {
background-color: #26d46c;
}
.status-dot--inactive {
background-color: rgba(255, 255, 255, 0.65);
border: 1px solid rgba(0, 0, 0, 0.08);
}
<style lang="scss" scoped>
@import "./styles/index.scss";
</style>

View File

@@ -0,0 +1,88 @@
.ai-tab-wrapper {
width: 100%;
}
.tab-container {
position: relative;
width: 100%;
height: 50px;
display: flex;
overflow: hidden;
}
.tab-item {
position: relative;
flex: 1;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
}
.tab-item.active {
z-index: 10;
}
.tab-content {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
line-height: 0;
transition: background 0.3s;
overflow: hidden;
}
.tab-text {
font-size: 18px;
font-weight: 500;
color: rgba(255, 255, 255, 0.65);
z-index: 20;
}
.tab-image {
position: absolute;
left: 0;
right: 0;
top: auto;
bottom: 0;
width: 100%;
height: 48px;
display: block;
vertical-align: bottom;
z-index: 5;
}
.tab-item.active .tab-text {
color: #2e312f;
font-weight: bold;
}
.is-left {
margin-right: -24px;
}
.is-right {
margin-left: -24px;
}
.status-dot {
display: inline-block;
margin-left: 6px;
width: 6px;
height: 6px;
border-radius: 50%;
z-index: 22;
transform: translateY(-1px);
}
.status-dot--active {
background-color: #26d46c;
}
.status-dot--inactive {
background-color: rgba(255, 255, 255, 0.65);
border: 1px solid rgba(0, 0, 0, 0.08);
}

View File

@@ -15,18 +15,17 @@
mode="widthFix"
/>
<view
class="absolute bottom-0 left-0 right-0 flex-full px-12 pt-12 pb-4"
class="absolute bottom-0 left-0 right-0 flex-full"
>
<HomeWelcome />
<view class="px-12 pt-12">
<HomeWelcome />
</view>
<view style="margin-bottom: -1px;">
<AiTabSwitch v-model="tabIndex" :list="tabList" @change="handleChange" />
</view>
</view>
</view>
<AiTabSwitch
v-model="tabIndex"
:list="['探索发现', 'AI伴游']"
@change="handleChange"
/>
<view class="tab-content">
<Discovery v-if="tabIndex === 0" />
<ChatMainList v-if="tabIndex === 1" />
@@ -46,6 +45,7 @@ import ChatMainList from "../ChatMain/ChatMainList/index.vue";
import Discovery from "../Discovery/index.vue";
const tabIndex = ref(0);
const tabList = ["探索发现", "AI伴游"];
const handleChange = (i) => {
console.log("切换:", i);