feat(aigc): implement travel AIGC feature and clean up legacy assets

- Replace all local static AIGC assets with OSS hosted URLs to reduce bundle size
- Add travelAIGC command to ChatModel and update quick access menu to link to AIGC home
- Implement AIGC user consent flow with local storage persistence for compliance
- Refactor Discovery page layout, remove unused HeritageDiscoverySection component
- Update ChatTopNavBar to support dynamic navigation bar height based on system info
- Restructure ChatMainList layout for better discovery panel interaction
- Remove deprecated local asset files and clean up unused imports across codebase
This commit is contained in:
duanshuwen
2026-07-06 22:40:36 +08:00
parent bfda50e14a
commit 191ba48b9d
20 changed files with 268 additions and 383 deletions

View File

@@ -2,23 +2,17 @@
<view class="flex flex-col h-screen relative overflow-hidden">
<!-- 顶部自定义导航栏 -->
<view class="header absolute top-0 left-0 w-full z-10" :style="{ paddingTop: statusBarHeight + 'px' }">
<ChatTopNavBar ref="topNavBarRef" :mainPageDataModel="mainPageDataModel" @showDrawer="handleShowDrawer" />
<ChatTopNavBar ref="topNavBarRef" :mainPageDataModel="mainPageDataModel" :navHeight="navBarHeight"
@showDrawer="handleShowDrawer" />
</view>
<view class="home-hero relative flex-shrink-0">
<image class="home-hero-bg w-full block" :src="mainPageDataModel?.initPageImages?.backgroundImageUrl"
mode="aspectFill" />
<!-- <SpriteAnimator
v-if="homeSpriteStyle.ipLargeImage"
class="home-hero-sprite"
:src="homeSpriteStyle.ipLargeImage"
:frameWidth="homeSpriteStyle.frameWidth"
:frameHeight="homeSpriteStyle.frameHeight"
:totalFrames="homeSpriteStyle.totalFrames"
:columns="homeSpriteStyle.columns"
:displayWidth="homeSpriteStyle.displayWidth"
:fps="16"
/> -->
<SpriteAnimator v-if="homeSpriteStyle.ipLargeImage" class="home-hero-sprite" :src="homeSpriteStyle.ipLargeImage"
:frameWidth="homeSpriteStyle.frameWidth" :frameHeight="homeSpriteStyle.frameHeight"
:totalFrames="homeSpriteStyle.totalFrames" :columns="homeSpriteStyle.columns"
:displayWidth="homeSpriteStyle.displayWidth" :fps="16" />
<view class="home-tabs-layer absolute bottom-0 left-0 right-0 flex-full">
<view style="margin-bottom: -1px;">
<AiTabSwitch v-model="tabIndex" :list="tabList" @change="handleChange" />
@@ -26,16 +20,16 @@
</view>
</view>
<scroll-view v-show="tabIndex === 0" class="main-scroll-area flex flex-col flex-full overflow-hidden" scroll-y
@scroll="handleDiscoveryScroll"
@touchstart.capture="handleScrollAreaTouchStart" @touchstart="handleScrollAreaTouchStart"
@touchmove="handleScrollAreaTouchMove">
<view class="home-welcome-collapse" :class="{ 'is-collapsed': isHomeWelcomeCollapsed }">
<view v-show="tabIndex === 0" class="discovery-shell flex-full" @touchstart.capture="handleDiscoveryPanelTouchStart"
@touchstart="handleDiscoveryPanelTouchStart" @touchmove="handleDiscoveryPanelTouchMove">
<view class="home-welcome-panel">
<HomeWelcome class="flex-shrink-0" :mainPageDataModel="mainPageDataModel" />
</view>
<Discovery />
</scroll-view>
<view class="discovery-panel" :class="{ 'is-collapsed': isDiscoveryPanelCollapsed }">
<Discovery @content-scroll="handleDiscoveryContentScroll" />
</view>
</view>
<!-- 消息列表可滚动区域 -->
<scroll-view v-show="tabIndex === 1" class="main main-scroll-area flex-full overflow-hidden min-height-0" scroll-y
@@ -215,6 +209,7 @@ const emit = defineEmits(["showDrawer"]);
const appStore = useAppStore();
/// 导航栏相关
const statusBarHeight = ref(20);
const navBarHeight = ref(44);
/// 输入框组件引用
const inputAreaRef = ref(null);
const topNavBarRef = ref();
@@ -230,12 +225,11 @@ const isKeyboardShow = ref(false);
///(控制滚动位置)
const scrollTop = ref(99999);
const discoveryScrollTop = ref(0);
const lastDiscoveryScrollTop = ref(0);
const isHomeWelcomeCollapsed = ref(false);
const DISCOVERY_WELCOME_COLLAPSE_TOP = 12;
const DISCOVERY_WELCOME_EXPAND_TOP = 4;
const DISCOVERY_SCROLL_DELTA = 2;
const discoveryInnerScrollTop = ref(0);
const discoveryPanelTouchStartY = ref(0);
const isDiscoveryPanelCollapsed = ref(false);
const DISCOVERY_PANEL_EXPAND_TOP = 4;
const DISCOVERY_PANEL_TOUCH_DELTA = 16;
/// 会话列表
const chatMsgList = ref([]);
@@ -302,6 +296,9 @@ const homeSpriteStyle = computed(() => {
const handleChange = (i) => {
console.log("切换:", i);
if (i === 0) {
resetDiscoveryScrollState();
}
};
const handleShowDrawer = () => {
@@ -389,26 +386,45 @@ const handleScrollAreaTouchMove = () => {
hideKeyboardByScroll();
};
const resetDiscoveryScrollState = () => {
discoveryInnerScrollTop.value = 0;
discoveryPanelTouchStartY.value = 0;
isDiscoveryPanelCollapsed.value = false;
};
// 处理用户滚动事件
const handleDiscoveryScroll = (e) => {
if (Date.now() - lastScrollTouchAt < 1000) {
hideKeyboardByScroll();
}
const getTouchPointY = (e) => {
const touch = e?.touches?.[0] || e?.changedTouches?.[0];
return Number(touch?.clientY ?? touch?.pageY ?? 0);
};
const currentScrollTop = Number(e.detail?.scrollTop || 0);
const scrollDelta = currentScrollTop - lastDiscoveryScrollTop.value;
discoveryScrollTop.value = currentScrollTop;
const handleDiscoveryPanelTouchStart = (e) => {
handleScrollAreaTouchStart();
discoveryPanelTouchStartY.value = getTouchPointY(e);
};
if (currentScrollTop <= DISCOVERY_WELCOME_EXPAND_TOP) {
isHomeWelcomeCollapsed.value = false;
const handleDiscoveryPanelTouchMove = (e) => {
handleScrollAreaTouchMove();
const currentY = getTouchPointY(e);
if (!currentY || !discoveryPanelTouchStartY.value) return;
const touchDelta = currentY - discoveryPanelTouchStartY.value;
if (touchDelta < -DISCOVERY_PANEL_TOUCH_DELTA) {
isDiscoveryPanelCollapsed.value = true;
} else if (
currentScrollTop > DISCOVERY_WELCOME_COLLAPSE_TOP ||
scrollDelta > DISCOVERY_SCROLL_DELTA
touchDelta > DISCOVERY_PANEL_TOUCH_DELTA &&
discoveryInnerScrollTop.value <= DISCOVERY_PANEL_EXPAND_TOP
) {
isHomeWelcomeCollapsed.value = true;
isDiscoveryPanelCollapsed.value = false;
}
};
lastDiscoveryScrollTop.value = currentScrollTop;
const handleDiscoveryContentScroll = ({ scrollTop }) => {
discoveryInnerScrollTop.value = Number(scrollTop || 0);
if (discoveryInnerScrollTop.value > DISCOVERY_PANEL_TOUCH_DELTA) {
isDiscoveryPanelCollapsed.value = true;
}
};
const welcomeHeight = ref(0);
@@ -537,11 +553,19 @@ const addNoticeListener = () => {
/// =============生命周期函数↓================
onLoad(() => {
uni.getSystemInfo({
success: (res) => {
statusBarHeight.value = res.statusBarHeight || 20;
},
});
const systemInfo = uni.getSystemInfoSync();
const systemStatusBarHeight = systemInfo.statusBarHeight || 20;
statusBarHeight.value = systemStatusBarHeight;
navBarHeight.value = systemInfo.platform === "ios" ? 44 : 48;
if (typeof uni.getMenuButtonBoundingClientRect === "function") {
const menuButton = uni.getMenuButtonBoundingClientRect();
if (menuButton?.height && typeof menuButton.top === "number") {
statusBarHeight.value = Math.max(menuButton.top, systemStatusBarHeight);
navBarHeight.value = menuButton.height;
}
}
});
onReady(() => {