feat: add heritage discovery tab and AIGC consent dialog

- Add new HeritageDiscoverySection and HeritageQuickPrompts components for dedicated heritage discovery view
- Implement reusable AigcConsentDialog component for AI service user agreement prompts
- Update Discovery page to toggle between explore and heritage tab layouts
- Refactor legacy CardSwiper component into generic ExploreCards
- Adjust ChatMainList layout to include home hero sprite animation and restructure welcome section
- Refine NoticeMessage component styling and layout for better consistency
- Add build best practices guidance to AGENTS.md documentation
- Clean up minor config whitespace and formatting issues across files
This commit is contained in:
duanshuwen
2026-07-05 14:56:55 +08:00
parent 251f92bc1a
commit ca680ab41b
16 changed files with 1021 additions and 125 deletions

View File

@@ -0,0 +1,80 @@
<template>
<view class="explore-cards">
<scroll-view
class="explore-scroll"
scroll-x
show-scrollbar="false"
>
<view class="explore-track">
<view
v-for="(item, index) in normalizedList"
:key="getItemKey(item, index)"
class="explore-card"
:class="`is-${item.tone}`"
hover-class="is-pressed"
hover-stay-time="80"
@tap="handleCardTap(item.raw, index)"
>
<image
v-if="item.coverImage"
class="explore-card-image"
:src="item.coverImage"
mode="aspectFill"
/>
<view class="explore-card-gradient" />
<view class="explore-card-content">
<text class="explore-card-tag ellipsis-1">{{ item.tag }}</text>
<text class="explore-card-title ellipsis-1">{{ item.title }}</text>
<text v-if="item.subTitle" class="explore-card-desc ellipsis-1">
{{ item.subTitle }}
</text>
</view>
<view class="explore-card-arrow">
<text></text>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { computed } from "vue";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
});
const emit = defineEmits(["didSelectItem"]);
const FALLBACK_TAGS = ["MUST VISIT", "CULTURE", "ADVENTURE", "NIGHTLIFE"];
const TONES = ["default", "culture", "adventure", "nightlife"];
const normalizedList = computed(() =>
props.list.map((item, index) => ({
raw: item,
id: item.id ?? item.tabContentId,
title: item.title || "",
subTitle: item.subTitle || "",
tag: item.tag || FALLBACK_TAGS[index % FALLBACK_TAGS.length],
coverImage: item.coverImage || "",
tone: TONES[index % TONES.length],
}))
);
const getItemKey = (item, index) => item.id ?? item.title ?? index;
const handleCardTap = (item, index) => {
emit("didSelectItem", item, index);
};
</script>
<style scoped lang="scss">
@import "./styles/index.scss";
</style>

View File

@@ -0,0 +1,151 @@
.explore-cards {
width: 100%;
height: 356px;
overflow: hidden;
}
.explore-scroll {
width: 100%;
height: 356px;
white-space: nowrap;
}
.explore-track {
display: inline-flex;
flex-direction: row;
min-width: 100%;
height: 356px;
padding: 0 16px;
box-sizing: border-box;
}
.explore-card {
position: relative;
flex: 0 0 278px;
width: 278px;
height: 356px;
margin-right: 16px;
overflow: hidden;
border-radius: 28px;
background: #47b391;
color: #ffffff;
box-sizing: border-box;
transform: translateZ(0);
}
.explore-card:last-child {
margin-right: 0;
}
.explore-card.is-pressed {
opacity: 0.92;
}
.explore-card-image {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
}
.explore-card-gradient {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: linear-gradient(180deg, rgba(43, 107, 122, 0) 42%, rgba(71, 179, 145, 0.72) 74%, #47b391 100%);
}
.explore-card.is-culture {
background: #b98563;
}
.explore-card.is-culture .explore-card-gradient {
background: linear-gradient(180deg, rgba(87, 57, 37, 0.08) 36%, rgba(150, 93, 55, 0.62) 72%, #b98563 100%);
}
.explore-card.is-adventure {
background: #5b895f;
}
.explore-card.is-adventure .explore-card-gradient {
background: linear-gradient(180deg, rgba(30, 58, 47, 0) 36%, rgba(47, 97, 54, 0.74) 74%, #5b895f 100%);
}
.explore-card.is-nightlife {
background: #438694;
}
.explore-card.is-nightlife .explore-card-gradient {
background: linear-gradient(180deg, rgba(12, 47, 78, 0.04) 34%, rgba(28, 92, 111, 0.72) 74%, #438694 100%);
}
.explore-card-content {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 104px;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: 14px 58px 15px 16px;
border-top: 1px solid rgba(255, 255, 255, 0.3);
background: rgba(255, 255, 255, 0.15);
box-sizing: border-box;
}
.explore-card-tag {
display: block;
max-width: 100%;
margin-bottom: 9px;
color: rgba(255, 255, 255, 0.92);
font-size: 11px;
line-height: 13px;
font-weight: 700;
letter-spacing: 1.06px;
}
.explore-card-title {
display: block;
max-width: 100%;
margin-bottom: 4px;
color: #ffffff;
font-size: 22px;
line-height: 27px;
font-weight: 800;
}
.explore-card-desc {
display: block;
max-width: 100%;
color: rgba(255, 255, 255, 0.82);
font-size: 13px;
line-height: 18px;
}
.explore-card-arrow {
position: absolute;
right: 16px;
bottom: 35px;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: rgba(255, 255, 255, 0.92);
color: #2a3538;
box-shadow: 0 4px 6px rgba(44, 39, 32, 0.1);
}
.explore-card-arrow text {
font-size: 18px;
line-height: 18px;
font-weight: 900;
}

View File

@@ -0,0 +1,111 @@
<template>
<view class="heritage-section">
<view class="heritage-carousel">
<scroll-view
class="heritage-scroll"
scroll-x
show-scrollbar="false"
:scroll-left="carouselScrollLeft"
>
<view class="heritage-track">
<view
v-for="(item, index) in normalizedCards"
:key="getItemKey(item, index)"
class="heritage-card"
:class="{
'is-featured': index === 1,
'is-selected': index === 1,
}"
hover-class="is-pressed"
hover-stay-time="80"
@tap="handleCardTap(item.raw, index)"
>
<view class="heritage-image">
<image
v-if="item.coverImage"
class="heritage-cover"
:src="item.coverImage"
mode="aspectFill"
/>
<text class="heritage-badge">{{ item.badge }}</text>
</view>
<view class="heritage-copy">
<text class="heritage-tag ellipsis-1">{{ item.tag }}</text>
<text class="heritage-title ellipsis-1">{{ item.title }}</text>
<text class="heritage-desc ellipsis-1">{{ item.subTitle }}</text>
</view>
</view>
</view>
</scroll-view>
</view>
<HeritageQuickPrompts
:list="prompts"
@didSelectItem="handlePromptTap"
/>
</view>
</template>
<script setup>
import { computed, ref, watch } from "vue";
import HeritageQuickPrompts from "../HeritageQuickPrompts/index.vue";
const props = defineProps({
cards: {
type: Array,
default: () => [],
},
prompts: {
type: Array,
default: () => [],
},
});
const emit = defineEmits(["select-card", "select-prompt"]);
const carouselScrollLeft = ref(165);
watch(
() => props.cards.length,
(length) => {
const targetScrollLeft = length > 1 ? 165 : 0;
carouselScrollLeft.value = 0;
setTimeout(() => {
carouselScrollLeft.value = targetScrollLeft;
}, 0);
},
{ immediate: true }
);
const getBadgeText = (item) => {
const source = item.jumpDesc || item.tag || item.title || "";
return source.slice(0, 2) || "推荐";
};
const normalizedCards = computed(() =>
props.cards.map((item) => ({
raw: item,
id: item.id ?? item.tabContentId,
title: item.title || "",
subTitle: item.subTitle || "",
tag: item.tag || item.jumpDesc || "推荐",
badge: getBadgeText(item),
coverImage: item.coverImage || "",
}))
);
const getItemKey = (item, index) => item.id ?? item.title ?? index;
const handleCardTap = (item, index) => {
emit("select-card", item, index);
};
const handlePromptTap = (item, index) => {
emit("select-prompt", item, index);
};
</script>
<style scoped lang="scss">
@import "./styles/index.scss";
</style>

View File

@@ -0,0 +1,137 @@
.heritage-section {
width: 100%;
height: 386px;
overflow: hidden;
background: $theme-color-50;
}
.heritage-carousel,
.heritage-scroll {
width: 100%;
height: 268px;
overflow: hidden;
background: $theme-color-50;
}
.heritage-track {
display: inline-flex;
align-items: flex-start;
min-width: 100%;
height: 268px;
padding: 8px 69px 26px;
box-sizing: border-box;
}
.heritage-card {
flex: 0 0 189px;
width: 189px;
height: 227px;
margin-top: 5px;
margin-right: 14px;
display: flex;
flex-direction: column;
padding: 8px;
border-radius: 28px;
border: 1px solid #f1f5f9;
background: #ffffff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
box-sizing: border-box;
text-align: left;
}
.heritage-card:last-child {
margin-right: 0;
}
.heritage-card.is-featured {
flex-basis: 237px;
width: 237px;
height: 234px;
margin-top: 0;
}
.heritage-card.is-selected {
border-color: rgba(12, 205, 88, 0.55);
box-shadow: 0 8px 18px rgba(12, 205, 88, 0.12);
transform: translateY(-2px);
}
.heritage-card.is-pressed {
opacity: 0.92;
}
.heritage-image {
position: relative;
width: 100%;
height: 138px;
overflow: hidden;
border-radius: 20px;
background: #f1f5f9;
}
.heritage-card.is-featured .heritage-image {
height: 145px;
}
.heritage-cover {
width: 100%;
height: 100%;
display: block;
}
.heritage-badge {
position: absolute;
top: 8px;
right: 8px;
width: 34px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
background: rgba(255, 255, 255, 0.8);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
color: $theme-color-500;
font-size: 11px;
line-height: 16px;
font-weight: 900;
}
.heritage-copy {
min-width: 0;
margin-top: 8px;
padding: 0 8px;
}
.heritage-tag {
display: inline-flex;
max-width: 100%;
height: 18px;
align-items: center;
padding: 0 6px;
border-radius: 4px;
background: #fffbeb;
color: #d97706;
font-size: 9px;
line-height: 14px;
font-weight: 800;
}
.heritage-title {
display: block;
max-width: 100%;
margin: 4px 0;
color: #1e293b;
font-size: 16px;
line-height: 20px;
font-weight: 900;
}
.heritage-desc {
display: block;
max-width: 100%;
color: #94a3b8;
font-size: 10px;
line-height: 15px;
font-weight: 600;
}

View File

@@ -0,0 +1,56 @@
<template>
<scroll-view
class="prompt-strip"
scroll-x
show-scrollbar="false"
>
<view class="prompt-track">
<view
v-for="(item, index) in normalizedList"
:key="getItemKey(item, index)"
class="prompt-card"
hover-class="is-pressed"
hover-stay-time="80"
@tap="handleTap(item.raw, index)"
>
<view class="prompt-mark" />
<view class="prompt-copy">
<text class="prompt-title ellipsis-1">{{ item.title }}</text>
<text class="prompt-desc ellipsis-1">{{ item.subTitle }}</text>
</view>
</view>
</view>
</scroll-view>
</template>
<script setup>
import { computed } from "vue";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
});
const emit = defineEmits(["didSelectItem"]);
const normalizedList = computed(() =>
props.list.map((item) => ({
raw: item,
id: item.id ?? item.tabContentId,
title: item.title || "",
subTitle: item.subTitle || "",
}))
);
const getItemKey = (item, index) => item.id ?? item.title ?? index;
const handleTap = (item, index) => {
emit("didSelectItem", item, index);
};
</script>
<style scoped lang="scss">
@import "./styles/index.scss";
</style>

View File

@@ -0,0 +1,83 @@
.prompt-strip {
width: 100%;
height: 112px;
overflow-x: auto;
overflow-y: hidden;
background: $theme-color-50;
scrollbar-width: none;
}
.prompt-strip::-webkit-scrollbar {
display: none;
}
.prompt-track {
display: inline-flex;
align-items: flex-start;
min-width: 100%;
height: 112px;
padding: 4px 16px 12px;
box-sizing: border-box;
}
.prompt-card {
flex: 0 0 148px;
width: 148px;
height: 82px;
margin-right: 10px;
display: flex;
align-items: center;
padding: 14px 12px;
border-radius: 18px;
background: #ffffff;
color: #172033;
box-shadow: 0 3px 10px rgba(27, 58, 48, 0.05);
box-sizing: border-box;
text-align: left;
}
.prompt-card:last-child {
margin-right: 0;
}
.prompt-card.is-pressed {
opacity: 0.92;
}
.prompt-mark {
flex: 0 0 30px;
width: 30px;
height: 30px;
border-radius: 10px;
background:
radial-gradient(circle at 30% 30%, $theme-color-500 0 20%, transparent 22%),
radial-gradient(circle at 70% 30%, #f8c425 0 18%, transparent 20%),
radial-gradient(circle at 30% 70%, $theme-color-500 0 20%, transparent 22%),
radial-gradient(circle at 70% 70%, $theme-color-500 0 18%, transparent 20%),
#eefaf3;
}
.prompt-copy {
min-width: 0;
flex: 1;
margin-left: 8px;
}
.prompt-title {
display: block;
max-width: 100%;
color: #172033;
font-size: 14px;
line-height: 18px;
font-weight: 900;
}
.prompt-desc {
display: block;
max-width: 100%;
margin-top: 2px;
color: #8f9bad;
font-size: 11px;
line-height: 16px;
font-weight: 700;
}

View File

@@ -17,24 +17,34 @@
@touchmove="emitScrollTouch"
@scroll="emitScrollTouch"
>
<CardSwiper v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
<HeritageDiscoverySection
v-if="isHeritageTab"
:cards="discoveryCards"
:prompts="discoveryQuickQuestions"
@select-card="handleCardClick"
@select-prompt="handleQuickQuestionClick"
/>
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions" @didSelectItem="handleQuickQuestionClick" />
<template v-else>
<ExploreCards v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions" @didSelectItem="handleQuickQuestionClick" />
</template>
</scroll-view>
</view>
</template>
<script setup>
import { onMounted, ref } from "vue";
import { computed, onMounted, ref } from "vue";
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE, SWITCH_TO_COMPANION_TAB } from "@/constant/constant";
import { navigateTo } from "@/router";
import { getAccessToken } from "@/constant/token";
import FindTabs from "./components/FindTabs/index.vue";
import CardSwiper from "./components/CardSwiper/index.vue";
import ExploreCards from "./components/ExploreCards/index.vue";
import HeritageDiscoverySection from "./components/HeritageDiscoverySection/index.vue";
import QuickQuestions from "./components/QuickQuestions/index.vue";
import discoveryCover from "@/components/ImageSwiper/images/2025-07-12_180248.jpg";
import { homeTabsData, getNearbyTags, homeTabContentData, homeQuickQuestionData } from "../../request/api/MainPageDataApi";
import { useAppStore, useLocationStore } from "@/store";
@@ -51,6 +61,8 @@ const discoveryCards = ref([]);
const discoveryQuickQuestions = ref([]);
const emit = defineEmits(["scroll-touch-start", "scroll-touch"]);
const isHeritageTab = computed(() => discoveryTabs.value[activeIndex.value]?.label === "小七孔古桥");
const emitScrollTouchStart = () => {
emit("scroll-touch-start");
};