feat: 增加问卷调查组件
This commit is contained in:
31
src/components/SurveyQuestionnaire/index.vue
Normal file
31
src/components/SurveyQuestionnaire/index.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<view class="survey-questionnaire">
|
||||
<view class="w-full bg-white border-box border-ff overflow-hidden rounded-20">
|
||||
<view class="border-box w-vw flex flex-items-center flex-justify-between bg-EEF8FF">
|
||||
<text class="font-size-18 font-500 color-171717 text-left ml-12">
|
||||
调查问卷
|
||||
</text>
|
||||
<image class="w-102 h-72" src="./sq_edit.png" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
<image class="w-full" src="./sq_banner.png" mode="widthFix" />
|
||||
|
||||
<view class="h-44 m-12 rounded-50 bg-button color-white flex flex-items-center flex-justify-center"
|
||||
@click="handleCall">
|
||||
前往填写
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
const handleCall = () => {
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style
|
||||
BIN
src/components/SurveyQuestionnaire/sq_banner.png
Normal file
BIN
src/components/SurveyQuestionnaire/sq_banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 664 KiB |
BIN
src/components/SurveyQuestionnaire/sq_edit.png
Normal file
BIN
src/components/SurveyQuestionnaire/sq_edit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -21,6 +21,8 @@ export const CompName = {
|
||||
pictureAndCommodityCard: "pictureAndCommodityCard",
|
||||
// 输入车牌卡片
|
||||
enterLicensePlateCard: "enterLicensePlateCard",
|
||||
// 调查问卷卡片
|
||||
callSurveyQuestionnaire: "callSurveyQuestionnaire",
|
||||
};
|
||||
|
||||
/// 发送的指令类型
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
<AddCarCrad v-else-if="
|
||||
item.toolCall.componentName === CompName.enterLicensePlateCard
|
||||
" :toolCall="item.toolCall" />
|
||||
<SurveyQuestionnaire v-else-if="
|
||||
item.toolCall.componentName === CompName.callSurveyQuestionnaire
|
||||
" :toolCall="item.toolCall" />
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
@@ -99,6 +102,7 @@ import DetailCardCompontent from "../../module/DetailCardCompontent/index.vue";
|
||||
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
||||
import Feedback from "@/components/Feedback/index.vue";
|
||||
import AddCarCrad from "@/components/AddCarCrad/index.vue";
|
||||
import SurveyQuestionnaire from "@/components/SurveyQuestionnaire/index.vue";
|
||||
import { mainPageData } from "@/request/api/MainPageDataApi";
|
||||
import {
|
||||
conversationMsgList,
|
||||
@@ -658,31 +662,31 @@ const sendWebSocketMessage = async (messageType, messageContent, options = {}) =
|
||||
try {
|
||||
const raw = webSocketManager.sendMessage(args);
|
||||
// 兼容可能返回同步布尔或 Promise 的实现
|
||||
const result = await Promise.resolve(raw);
|
||||
if (result) {
|
||||
console.log(`WebSocket消息已发送 [类型:${messageType}]:`, args);
|
||||
return true;
|
||||
}
|
||||
const result = await Promise.resolve(raw);
|
||||
if (result) {
|
||||
console.log(`WebSocket消息已发送 [类型:${messageType}]:`, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 若返回 false,消息可能已经被 manager 入队并触发连接流程。
|
||||
// 在这种情况下避免立即当作失败处理,而是等待短暂时间以观察连接是否建立并由 manager 发送队列。
|
||||
console.warn('webSocketManager.sendMessage 返回 false,等待连接或队列发送...', { attempt, args });
|
||||
const waitForConnectMs = typeof options.waitForConnectMs === 'number' ? options.waitForConnectMs : 5000;
|
||||
if (webSocketManager && typeof webSocketManager.isConnected === 'function' && !webSocketManager.isConnected()) {
|
||||
const startTs = Date.now();
|
||||
while (Date.now() - startTs < waitForConnectMs) {
|
||||
await sleep(200);
|
||||
if (webSocketManager.isConnected()) {
|
||||
// 给 manager 一点时间处理队列并发送
|
||||
await sleep(150);
|
||||
console.log('检测到 manager 已连接,假定队列消息已发送', args);
|
||||
return true;
|
||||
}
|
||||
// 若返回 false,消息可能已经被 manager 入队并触发连接流程。
|
||||
// 在这种情况下避免立即当作失败处理,而是等待短暂时间以观察连接是否建立并由 manager 发送队列。
|
||||
console.warn('webSocketManager.sendMessage 返回 false,等待连接或队列发送...', { attempt, args });
|
||||
const waitForConnectMs = typeof options.waitForConnectMs === 'number' ? options.waitForConnectMs : 5000;
|
||||
if (webSocketManager && typeof webSocketManager.isConnected === 'function' && !webSocketManager.isConnected()) {
|
||||
const startTs = Date.now();
|
||||
while (Date.now() - startTs < waitForConnectMs) {
|
||||
await sleep(200);
|
||||
if (webSocketManager.isConnected()) {
|
||||
// 给 manager 一点时间处理队列并发送
|
||||
await sleep(150);
|
||||
console.log('检测到 manager 已连接,假定队列消息已发送', args);
|
||||
return true;
|
||||
}
|
||||
console.warn('等待 manager 建连超时,进入重试逻辑', { waitForConnectMs, args });
|
||||
} else {
|
||||
console.warn('sendMessage 返回 false 但 manager 看起来已连接或不可用,继续重试', { args });
|
||||
}
|
||||
console.warn('等待 manager 建连超时,进入重试逻辑', { waitForConnectMs, args });
|
||||
} else {
|
||||
console.warn('sendMessage 返回 false 但 manager 看起来已连接或不可用,继续重试', { args });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('发送WebSocket消息异常:', error, args);
|
||||
}
|
||||
@@ -802,11 +806,11 @@ const stopRequest = async () => {
|
||||
}
|
||||
|
||||
if (chatMsgList.value[aiMsgIndex] &&
|
||||
chatMsgList.value[aiMsgIndex].msgType === MessageRole.AI) {
|
||||
chatMsgList.value[aiMsgIndex].msgType === MessageRole.AI) {
|
||||
chatMsgList.value[aiMsgIndex].isLoading = false;
|
||||
if (chatMsgList.value[aiMsgIndex].msg &&
|
||||
chatMsgList.value[aiMsgIndex].msg.trim() &&
|
||||
!chatMsgList.value[aiMsgIndex].msg.startsWith("加载中")) {
|
||||
chatMsgList.value[aiMsgIndex].msg.trim() &&
|
||||
!chatMsgList.value[aiMsgIndex].msg.startsWith("加载中")) {
|
||||
// 保留已显示内容
|
||||
} else {
|
||||
chatMsgList.value[aiMsgIndex].msg = "请求已停止";
|
||||
|
||||
@@ -21,3 +21,7 @@
|
||||
.h-24 {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.h72 {
|
||||
height: 72px;
|
||||
}
|
||||
@@ -22,6 +22,12 @@
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.w-80 {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.w-102 {
|
||||
width: 102px;
|
||||
}
|
||||
Reference in New Issue
Block a user