feat: 字段的调整和问卷跳转的处理
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
<script setup>
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
import { defineProps } from "vue";
|
||||
import { navigateTo } from "../../router";
|
||||
|
||||
const props = defineProps({
|
||||
toolCall: {
|
||||
@@ -31,11 +32,7 @@ const props = defineProps({
|
||||
|
||||
const handleCall = () => {
|
||||
const token = getAccessToken();
|
||||
const url = `${props.toolCall.componentName}?token=${token}`;
|
||||
console.log(url);
|
||||
uni.navigateTo({
|
||||
url: `/pages/webview/index?url=${encodeURIComponent(url)}`,
|
||||
});
|
||||
navigateTo(props.toolCall.data, { token: token });
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ const mainPageDataModel = ref({});
|
||||
// 会话进行中标志
|
||||
const isSessionActive = ref(false);
|
||||
/// 指令
|
||||
let commonType = "";
|
||||
let messageCommonType = "";
|
||||
|
||||
// WebSocket 相关
|
||||
let webSocketManager = null;
|
||||
@@ -238,7 +238,7 @@ const handleReplyText = (text) => {
|
||||
const handleReplyInstruct = async (item) => {
|
||||
await checkToken();
|
||||
|
||||
commonType = item.type;
|
||||
messageCommonType = item.type;
|
||||
// 重置消息状态,准备接收新的AI回复
|
||||
resetMessageState();
|
||||
sendMessage(item.title, true);
|
||||
@@ -734,7 +734,7 @@ const sendChat = async (message, isInstruct = false) => {
|
||||
}
|
||||
|
||||
const messageType = isInstruct ? 1 : 0;
|
||||
const messageContent = isInstruct ? commonType : message;
|
||||
const messageContent = isInstruct ? messageCommonType : message;
|
||||
// 生成 messageId 并保存到当前会话变量(stopRequest 可能使用)
|
||||
currentSessionMessageId = IdUtils.generateMessageId();
|
||||
|
||||
|
||||
@@ -2,16 +2,9 @@
|
||||
<view class="container">
|
||||
<ModuleTitle :title="recommendTheme.themeName" />
|
||||
<view class="container-scroll">
|
||||
<view
|
||||
v-for="(item, index) in recommendTheme.recommendPostsList"
|
||||
:key="index"
|
||||
>
|
||||
<view v-for="(item, index) in recommendTheme.recommendPostsList" :key="index">
|
||||
<view class="mk-card-item" @click="sendReply(item)">
|
||||
<image
|
||||
class="card-img"
|
||||
:src="item.coverPhoto"
|
||||
mode="widthFix"
|
||||
></image>
|
||||
<image class="card-img" :src="item.coverPhoto" mode="widthFix"></image>
|
||||
<text class="card-text">{{ item.topic }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -20,7 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constant/constant";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE } from "@/constant/constant";
|
||||
import { defineProps } from "vue";
|
||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||
|
||||
@@ -32,7 +25,12 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const sendReply = (item) => {
|
||||
const topic = item.userInputContent || item.topic.replace(/^#/, "");
|
||||
if (item.userInputContentType && item.userInputContentType === '1') {
|
||||
const commonItem = { type: item.userInputContent, title: item.topic }
|
||||
uni.$emit(SEND_MESSAGE_COMMAND_TYPE, commonItem);
|
||||
return;
|
||||
}
|
||||
const topic = item.topic.replace(/^#/, "");
|
||||
uni.$emit(SEND_MESSAGE_CONTENT_TEXT, topic);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -3,29 +3,18 @@
|
||||
<ModuleTitle :title="recommendTheme.themeName" />
|
||||
|
||||
<view class="container-scroll font-size-0 scroll-x whitespace-nowrap">
|
||||
<view
|
||||
class="card-item bg-white inline-block rounded-20 mr-8"
|
||||
v-for="(item, index) in recommendTheme.recommendPostsList"
|
||||
:key="index"
|
||||
@click="sendReply(item)"
|
||||
>
|
||||
<view class="card-item bg-white inline-block rounded-20 mr-8"
|
||||
v-for="(item, index) in recommendTheme.recommendPostsList" :key="index" @click="sendReply(item)">
|
||||
<view class="m-4 relative">
|
||||
<image
|
||||
class="card-img rounded-16 relative z-10"
|
||||
:src="item.coverPhoto"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<image class="card-img rounded-16 relative z-10" :src="item.coverPhoto" mode="aspectFill" />
|
||||
|
||||
<view class="shadow absolute rounded-16"></view>
|
||||
</view>
|
||||
|
||||
<view class="card-text border-box">
|
||||
<view class="color-171717 font-size-14 line-height-20 ellipsis-1">
|
||||
<view class="font-size-11 color-99A0AE ellipsis-1">
|
||||
{{ item.topic }}
|
||||
</view>
|
||||
<view class="font-size-11 color-99A0AE">
|
||||
{{ item.userInputContent }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -34,7 +23,7 @@
|
||||
|
||||
<script setup>
|
||||
import { defineProps } from "vue";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constant/constant";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT, SEND_MESSAGE_COMMAND_TYPE } from "@/constant/constant";
|
||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -45,7 +34,12 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const sendReply = (item) => {
|
||||
const topic = item.userInputContent || item.topic.replace(/^#/, "");
|
||||
if (item.userInputContentType && item.userInputContentType === '1') {
|
||||
const commonItem = { type: item.userInputContent, title: item.topic }
|
||||
uni.$emit(SEND_MESSAGE_COMMAND_TYPE, commonItem);
|
||||
return;
|
||||
}
|
||||
const topic = item.topic.replace(/^#/, "");
|
||||
uni.$emit(SEND_MESSAGE_CONTENT_TEXT, topic);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@ export function navigateTo(url, args) {
|
||||
// 如果有额外参数,拼接到URL后面
|
||||
const paramString = objectToUrlParams(args);
|
||||
if (paramString) {
|
||||
if (targetUrl.contains("?")) {
|
||||
if (typeof targetUrl === "string" && targetUrl.includes("?")) {
|
||||
targetUrl += "&";
|
||||
} else {
|
||||
targetUrl += "?";
|
||||
|
||||
Reference in New Issue
Block a user