feat: add discovery tool cards, refactor AiTabSwitch and update client configs
- Update xiaoqi client configuration: adjust clientId, sync appid across config files and switch to production build by setting developVersion to false - Refactor AiTabSwitch component to use background images instead of inline image tags, clean up redundant SCSS styles and replace tab icon assets - Add three new Discovery page tool components: audio guide, map guide and photo generator cards - Clean up unused code in Discovery page and ChatMainList component, remove unused scroll view and computed property - Fix regex pattern and formatting issues in update-appid.js script - Comment out unused SpriteAnimator component in ChatMainList
This commit is contained in:
@@ -1,43 +1,26 @@
|
||||
<template>
|
||||
<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"
|
||||
/>
|
||||
<FindTabs v-if="discoveryTabs.length > 0" v-model="activeIndex" :tabs="discoveryTabs" @change="handleTabChange" />
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="discovery-scroll flex-full border-box min-height-0"
|
||||
scroll-y
|
||||
show-scrollbar="false"
|
||||
@touchstart="emitScrollTouchStart"
|
||||
@touchmove="emitScrollTouch"
|
||||
@scroll="emitScrollTouch"
|
||||
>
|
||||
<HeritageDiscoverySection
|
||||
v-if="isHeritageTab"
|
||||
:cards="discoveryCards"
|
||||
:prompts="discoveryQuickQuestions"
|
||||
@select-card="handleCardClick"
|
||||
@select-prompt="handleQuickQuestionClick"
|
||||
/>
|
||||
<HeritageDiscoverySection :cards="discoveryCards" :prompts="discoveryQuickQuestions" @select-card="handleCardClick"
|
||||
@select-prompt="handleQuickQuestionClick" />
|
||||
|
||||
<template v-else>
|
||||
<ExploreCards v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
|
||||
<ExploreCards v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
|
||||
|
||||
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions" @didSelectItem="handleQuickQuestionClick" />
|
||||
</template>
|
||||
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions"
|
||||
@didSelectItem="handleQuickQuestionClick" />
|
||||
|
||||
</scroll-view>
|
||||
<DiscoveryPhotoToolCard @didSelectItem="handleToolCardClick" @didSelectOption="handleToolOptionClick" />
|
||||
<DiscoveryAudioToolCard @didSelectItem="handleToolCardClick" />
|
||||
<DiscoveryGuideMapToolCard @didSelectItem="handleToolCardClick" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE, SWITCH_TO_COMPANION_TAB } from "@/constant/constant";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE } from "@/constant/constant";
|
||||
import { navigateTo } from "@/router";
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
|
||||
@@ -45,6 +28,9 @@ import FindTabs from "./components/FindTabs/index.vue";
|
||||
import ExploreCards from "./components/ExploreCards/index.vue";
|
||||
import HeritageDiscoverySection from "./components/HeritageDiscoverySection/index.vue";
|
||||
import QuickQuestions from "./components/QuickQuestions/index.vue";
|
||||
import DiscoveryPhotoToolCard from "./components/DiscoveryPhotoToolCard/index.vue";
|
||||
import DiscoveryAudioToolCard from "./components/DiscoveryAudioToolCard/index.vue";
|
||||
import DiscoveryGuideMapToolCard from "./components/DiscoveryGuideMapToolCard/index.vue";
|
||||
|
||||
import { homeTabsData, getNearbyTags, homeTabContentData, homeQuickQuestionData } from "../../request/api/MainPageDataApi";
|
||||
import { useAppStore, useLocationStore } from "@/store";
|
||||
@@ -52,7 +38,7 @@ import { JumpType } from "../../model/ChatModel";
|
||||
|
||||
const appStore = useAppStore();
|
||||
const locationStore = useLocationStore();
|
||||
/// 从个渠道获取如二维码
|
||||
/// 从个渠道获取如二维码
|
||||
const sceneId = appStore.sceneId || "";
|
||||
|
||||
const activeIndex = ref(0);
|
||||
@@ -61,15 +47,6 @@ 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");
|
||||
};
|
||||
|
||||
const emitScrollTouch = () => {
|
||||
emit("scroll-touch");
|
||||
};
|
||||
|
||||
/// tabs 切换事件
|
||||
const handleTabChange = ({ tab, idx }) => {
|
||||
@@ -131,7 +108,7 @@ const queryQuickQuestionData = async (tabId) => {
|
||||
}
|
||||
|
||||
/// 统一处理接口返回数据结构
|
||||
const configDataList = (data) => {
|
||||
const configDataList = (data) => {
|
||||
return data.map((item) => ({
|
||||
id: item.id,
|
||||
title: item.tabContent.mainTitle,
|
||||
@@ -155,6 +132,20 @@ const handleQuickQuestionClick = (item) => {
|
||||
handleClick(item);
|
||||
};
|
||||
|
||||
const handleToolCardClick = (item) => {
|
||||
if (item?.jumpType !== undefined) {
|
||||
handleClick(item);
|
||||
}
|
||||
};
|
||||
|
||||
const handleToolOptionClick = (option, parentItem) => {
|
||||
if (option?.jumpType !== undefined) {
|
||||
handleClick(option);
|
||||
} else {
|
||||
handleToolCardClick(parentItem);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClick = async (item) => {
|
||||
console.log(`执行点击事件: ${item.jumpType},参数:${JSON.stringify(item.jumpContent)}`);
|
||||
/// 商品
|
||||
@@ -183,7 +174,7 @@ const handleClick = async (item) => {
|
||||
/// 获取位置信息
|
||||
const getLocation = () => {
|
||||
/// 已经有sceneId了,说明之前已经获取过位置信息了,就不需要再获取一次了
|
||||
if (sceneId) return;
|
||||
if (sceneId) return;
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
@@ -215,11 +206,4 @@ onMounted(() => {
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.discovery-scroll {
|
||||
flex-basis: 0;
|
||||
height: 0;
|
||||
min-height: 0;
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user