feat: aigc组件的数据结构调整

This commit is contained in:
2026-06-13 13:15:58 +08:00
parent 74cdf80b76
commit 771bc6391c

View File

@@ -4,24 +4,24 @@
<view class="w-vw"></view>
<view class="content flex flex-col m-4 border-box rounded-24">
<view class="flex flex-col p-6 border-box flex-items-center justify-center">
<image class="w-full rounded-20" :src="props.toolCall.componentNameParams.background" mode="widthFix" />
<image class="w-full rounded-20" :src="componentDataMap.background" mode="widthFix" />
<!-- 左上角标签 -->
<view class="tag">
<view class="dot"></view>
<text class="tag-text">{{ props.toolCall.componentNameParams.superscript }}</text>
<text class="tag-text">{{ componentDataMap.superscript }}</text>
</view>
<image class="g_title mt-20" :src="props.toolCall.componentNameParams.title" />
<image class="g_title mt-20" :src="componentDataMap.title" />
<text class="font-size-14 font-400 color-white my-12 text-center">
{{ props.toolCall.componentNameParams.description }}
{{ componentDataMap.description }}
</text>
<view class="w-full border-box px-12 pb-8 flex flex-row" @click="jumpClick">
<view class="btn-bg w-full border-box p-4 rounded-24 flex flex-row">
<view class="btn-bg-sub w-full border-box p-16 rounded-20 flex flex-row flex-items-center flex-justify-center color-white text-center font-size-18 font-800">
{{ props.toolCall.componentNameParams.buttonName }}
{{ componentDataMap.buttonName }}
</view>
</view>
</view>
@@ -46,6 +46,17 @@ const props = defineProps({
},
});
const componentDataMap = computed(() => {
return {
background: props.toolCall.componentNameParams?.background || props.toolCall.aigc?.background,
title: props.toolCall.componentNameParams?.title || props.toolCall.aigc?.title,
description: props.toolCall.componentNameParams?.description || props.toolCall.aigc?.description,
buttonName: props.toolCall.componentNameParams?.buttonName || props.toolCall.aigc?.buttonName,
superscript: props.toolCall.componentNameParams?.superscript || props.toolCall.aigc?.superscript,
jumpUrl: props.toolCall.componentNameParams?.jumpUrl || props.toolCall.aigc?.jumpUrl,
}
})
onMounted(() => {
nextTick(() => {
setTimeout(() => {
@@ -56,8 +67,8 @@ onMounted(() => {
const jumpClick = () => {
const token = getAccessToken();
if (props.toolCall.componentNameParams.jumpUrl) {
navigateTo(props.toolCall.componentNameParams.jumpUrl, { token: token });
if (componentDataMap.jumpUrl) {
navigateTo(componentDataMap.jumpUrl, { token: token });
}
};