Merge branch 'order-729'

合并order-729分支代码
This commit is contained in:
duanshuwen
2025-08-10 19:55:49 +08:00
24 changed files with 1668 additions and 94 deletions

View File

@@ -57,6 +57,12 @@
item.toolCall.componentName === CompName.createWorkOrderCard
"
/>
<DetailCardCompontent
v-else-if="
item.toolCall.componentName === ''
"
:toolCall="item.toolCall"
/>
</template>
<template #footer>
@@ -140,6 +146,7 @@ import ActivityListComponent from "../module/banner/ActivityListComponent.vue";
import RecommendPostsComponent from "../module/recommend/RecommendPostsComponent.vue";
import AttachListComponent from "../module/attach/AttachListComponent.vue";
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
import DetailCardCompontent from "../module/detail/DetailCardCompontent.vue";
import { mainPageData } from "@/request/api/MainPageDataApi";
import {
conversationMsgList,
@@ -344,12 +351,12 @@ const initWebSocket = () => {
// 错误回调
onError: (error) => {
isSessionActive.value = false;
console.error("WebSocket错误:", error);
},
// 消息回调
onMessage: (data) => {
console.log("onMessage:", data);
handleWebSocketMessage(data);
},
@@ -368,12 +375,16 @@ const initWebSocket = () => {
// 处理WebSocket消息
const handleWebSocketMessage = (data) => {
if(loadingTimer) {
clearInterval(loadingTimer);
loadingTimer = null;
}
const aiMsgIndex = chatMsgList.value.length - 1;
if (!chatMsgList.value[aiMsgIndex] || aiMsgIndex < 0) {
return;
}
console.log("处理WebSocket消息:", data);
//console.log("处理WebSocket消息:", data);
// 确保消息内容是字符串类型
if (data.content && typeof data.content !== "string") {
@@ -405,6 +416,15 @@ const handleWebSocketMessage = (data) => {
return;
}
const msg = chatMsgList.value[aiMsgIndex].msg;
console.log('全量消息内容:', msg)
if (!msg || msg === '加载中.' || msg.startsWith('加载中')) {
chatMsgList.value[aiMsgIndex].msg = '未获取到内容,请重试';
if(data.toolCall) {
chatMsgList.value[aiMsgIndex].msg = '';
}
}
// 处理toolCall
if (data.toolCall) {
chatMsgList.value[aiMsgIndex].toolCall = data.toolCall;
@@ -444,7 +464,7 @@ const initTypewriterManager = () => {
// 双重保险,确保滚动生效
setTimeout(() => {
scrollTop.value = 99999 + Math.random();
}, 5);
}, 20);
});
},
// 内容更新时的回调
@@ -492,7 +512,7 @@ const addNoticeListener = () => {
if (value && value.length > 0) {
commonType = "Command.quickBooking";
sendMessage(value, true);
scrollToBottom();
setTimeoutScrollToBottom();
}
});
};
@@ -564,8 +584,6 @@ const sendMessage = (message, isInstruct = false) => {
// 通用WebSocket消息发送函数
const sendWebSocketMessage = (messageType, messageContent, options = {}) => {
console.error("WebSocket未连接");
const args = {
conversationId: conversationId.value,
agentId: agentId.value,
@@ -589,7 +607,6 @@ const sendWebSocketMessage = (messageType, messageContent, options = {}) => {
const sendChat = (message, isInstruct = false) => {
if (!webSocketManager || !webSocketManager.isConnected()) {
console.error("WebSocket未连接");
return;
}

View File

@@ -30,7 +30,7 @@ const handleClick = (item) => {
}
onMounted(() => {
tags.value = props.question.split('&').filter(tag => tag.trim() !== '')
tags.value = props.question.split(/[&|;]/).filter(tag => tag.trim() !== '')
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)

View File

@@ -0,0 +1,35 @@
<template>
<view class="container">
<template v-if="toolCall.picture && toolCall.picture.length > 0">
<ModuleTitle :title="图片详情" />
<ImageSwiper :images="toolCall.picture" />
</template>
<template v-if="toolCall.commodityList">
<DetailCardGoodsContentList :commodityList="toolCall.commodityList" />
</template>
</view>
</template>
<script setup>
import { defineProps } from 'vue'
import ModuleTitle from '@/components/ModuleTitle/index.vue'
import ImageSwiper from '@/components/ImageSwiper/index.vue'
import DetailCardGoodsContentList from './DetailCardGoodsContentList.vue'
const props = defineProps({
toolCall: {
type: Object,
default: {}
}
})
</script>
<style scoped lang="scss">
.container {
width: 100%;
}
</style>

View File

@@ -0,0 +1,198 @@
<template>
<view class="container">
<ModuleTitle title="相关商品" />
<view class="container-scroll">
<view class="mk-card-item" v-for="(item, index) in commodityList" :key="`${item.commodityId}-${index}`">
<image class="card-img" :src="item.commodityPhoto" mode="aspectFill" />
<view class="card-content">
<view class="card-title-column">
<text class="card-title">{{ item.commodityName }}</text>
<view class="card-tags" v-for="(tag) in item.commodityTradeRuleList" :key="tag">
<text class="card-tag">{{ tag }}</text>
</view>
</view>
<template v-for="(serviceItem, index) in item.commodityServices" :key="serviceItem.serviceTitle">
<view v-if="index < 3" class="card-desc">· {{ serviceItem.serviceTitle }}</view>
</template>
<view class="card-bottom-row">
<view class="card-price-row">
<text class="card-price-fu"></text>
<text class="card-price">{{ item.specificationPrice }}</text>
<text class="card-unit">/</text>
</view>
<text class="card-btn" @click="placeOrderHandle(item)">下单</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import ModuleTitle from '@/components/ModuleTitle/index.vue'
import { defineProps } from 'vue'
const props = defineProps({
commodityList: {
type: Array,
default: []
}
})
/// 去下单
const placeOrderHandle = (item) => {
uni.navigateTo({
url: `/pages/goods/index?commodityId=${item.commodityId}`,
})
}
</script>
<style lang="scss" scoped>
.container {
margin-bottom: 8px 0;
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
overflow-y: hidden;
margin: 4px 0;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.mk-card-item {
position: relative;
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
// height: 244px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
padding-bottom: 12px;
.card-badge {
position: absolute;
top: 8px;
left: 8px;
background: #ffe7b2;
color: #b97a00;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
z-index: 2;
}
.card-img {
width: 188px;
height: 114px;
border-radius: 10px;
object-fit: cover; /* 确保图片不变形,保持比例裁剪 */
flex-shrink: 0; /* 防止图片被压缩 */
}
.card-content {
box-sizing: border-box;
padding: 10px 12px 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: start;
width: 100%;
flex: 1; /* 让内容区域占据剩余空间 */
overflow: hidden; /* 防止内容溢出 */
}
.card-title-column {
display: flex;
align-items: start;
flex-direction: column;
width: 100%;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #222;
width: 100%;
/* 限制标题最多显示两行 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.4;
max-height: 2.8em; /* 2行的高度 */
}
.card-tags {
display: flex;
flex-direction: row;
align-items: start;
padding: 6px 0;
}
.card-tag {
background: #f5f5f5;
color: #ff6600;
font-size: 12px;
border-radius: 4px;
padding: 0 6px;
margin-left: 2px;
}
.card-desc {
font-size: 13px;
color: #888;
margin-top: 2px;
}
.card-bottom-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
width: 100%;
}
.card-price-row {
.card-price-fu {
color: #ff6600;
font-size: 11px;
font-weight: normal;
}
.card-price {
color: #ff6600;
font-size: 16px;
font-weight: bold;
}
.card-unit {
font-size: 11px;
color: #888;
font-weight: normal;
margin-left: 2px;
}
}
.card-btn {
background: #ff6600;
color: #fff;
font-size: 15px;
border-radius: 20px;
padding: 0 18px;
height: 32px;
line-height: 32px;
}
}
}
}
</style>

View File

@@ -21,13 +21,14 @@
themeDTOList.value = res.data.themeDTOList
nextTick(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 300)
});
}
}
onMounted(() => {
console.log('=============')
loadDiscoveryCradComponent()
})

View File

@@ -32,7 +32,8 @@
</script>
<style lang="scss" scoped>
.container {
.container {
width: 100%;
}
.container-scroll {