feat: 首页tab的调整
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 28 KiB |
@@ -11,7 +11,7 @@
|
|||||||
v-if="leftSelected || leftUnselected"
|
v-if="leftSelected || leftUnselected"
|
||||||
:src="modelValue === 0 ? (leftSelected || leftUnselected) : (leftUnselected || leftSelected)"
|
:src="modelValue === 0 ? (leftSelected || leftUnselected) : (leftUnselected || leftSelected)"
|
||||||
class="tab-image"
|
class="tab-image"
|
||||||
mode="aspectFill"
|
mode="scaleToFill"
|
||||||
/>
|
/>
|
||||||
<text class="tab-text">探索发现</text>
|
<text class="tab-text">探索发现</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
v-if="rightSelected || rightUnselected"
|
v-if="rightSelected || rightUnselected"
|
||||||
:src="modelValue === 1 ? (rightSelected || rightUnselected) : (rightUnselected || rightSelected)"
|
:src="modelValue === 1 ? (rightSelected || rightUnselected) : (rightUnselected || rightSelected)"
|
||||||
class="tab-image"
|
class="tab-image"
|
||||||
mode="aspectFill"
|
mode="scaleToFill"
|
||||||
/>
|
/>
|
||||||
<text class="tab-text">AI伴游</text>
|
<text class="tab-text">AI伴游</text>
|
||||||
<view
|
<view
|
||||||
@@ -59,91 +59,6 @@ const handleSwitch = (i) => {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.ai-tab-wrapper {
|
@import "./styles/index.scss";
|
||||||
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>
|
</style>
|
||||||
|
|||||||
88
src/components/AiTabSwitch/styles/index.scss
Normal 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);
|
||||||
|
}
|
||||||
@@ -15,18 +15,17 @@
|
|||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
<view
|
<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>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<AiTabSwitch
|
|
||||||
v-model="tabIndex"
|
|
||||||
:list="['探索发现', 'AI伴游']"
|
|
||||||
@change="handleChange"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<view class="tab-content">
|
<view class="tab-content">
|
||||||
<Discovery v-if="tabIndex === 0" />
|
<Discovery v-if="tabIndex === 0" />
|
||||||
<ChatMainList v-if="tabIndex === 1" />
|
<ChatMainList v-if="tabIndex === 1" />
|
||||||
@@ -46,6 +45,7 @@ import ChatMainList from "../ChatMain/ChatMainList/index.vue";
|
|||||||
import Discovery from "../Discovery/index.vue";
|
import Discovery from "../Discovery/index.vue";
|
||||||
|
|
||||||
const tabIndex = ref(0);
|
const tabIndex = ref(0);
|
||||||
|
const tabList = ["探索发现", "AI伴游"];
|
||||||
|
|
||||||
const handleChange = (i) => {
|
const handleChange = (i) => {
|
||||||
console.log("切换:", i);
|
console.log("切换:", i);
|
||||||
|
|||||||