|
@ -396,6 +396,8 @@ import moment from "moment"; |
|
|
import { ElMessage } from "element-plus"; |
|
|
import { ElMessage } from "element-plus"; |
|
|
import { useChatStore } from "../../store/chat"; |
|
|
import { useChatStore } from "../../store/chat"; |
|
|
const chatStore = useChatStore(); |
|
|
const chatStore = useChatStore(); |
|
|
|
|
|
import { useDataStore } from "@/store/dataList.js"; |
|
|
|
|
|
const dataStore = useDataStore(); |
|
|
import { useRouter } from "vue-router"; |
|
|
import { useRouter } from "vue-router"; |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
|
|
|
|
|
|
@ -405,12 +407,8 @@ const props = defineProps({ |
|
|
type: String, |
|
|
type: String, |
|
|
default: "AIchat", // 'AIchat' 或 'AiEmotion' |
|
|
default: "AIchat", // 'AIchat' 或 'AiEmotion' |
|
|
}, |
|
|
}, |
|
|
isMobile: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const isMobile = ref(null); |
|
|
// Emits |
|
|
// Emits |
|
|
const emit = defineEmits([ |
|
|
const emit = defineEmits([ |
|
|
"selectRecord", |
|
|
"selectRecord", |
|
@ -440,7 +438,7 @@ const dialogWidth = ref("500px"); // 对话框动态宽度 |
|
|
|
|
|
|
|
|
// 计算属性:根据移动端状态动态设置对话框宽度 |
|
|
// 计算属性:根据移动端状态动态设置对话框宽度 |
|
|
const computedDialogWidth = computed(() => { |
|
|
const computedDialogWidth = computed(() => { |
|
|
if (props.isMobile) { |
|
|
|
|
|
|
|
|
if (isMobile.value) { |
|
|
return "70%"; // 移动端使用百分比宽度 |
|
|
return "70%"; // 移动端使用百分比宽度 |
|
|
} |
|
|
} |
|
|
return dialogWidth.value; // 桌面端使用固定宽度 |
|
|
return dialogWidth.value; // 桌面端使用固定宽度 |
|
@ -485,20 +483,15 @@ const getHistoryList = async (params) => { |
|
|
// "emotionTirstFlag", |
|
|
// "emotionTirstFlag", |
|
|
// emotionTirstFlag |
|
|
// emotionTirstFlag |
|
|
// ); |
|
|
// ); |
|
|
const userAgent = navigator.userAgent; |
|
|
|
|
|
const isMobile = |
|
|
|
|
|
!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( |
|
|
|
|
|
userAgent |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (chatFirstFlag && params.model == 1 && result.data.length != 0) { |
|
|
if (chatFirstFlag && params.model == 1 && result.data.length != 0) { |
|
|
if (isMobile) { |
|
|
|
|
|
|
|
|
if (!isMobile.value) { |
|
|
chatStore.aiChatCall = true; |
|
|
chatStore.aiChatCall = true; |
|
|
} |
|
|
} |
|
|
chatFirstFlag = false; |
|
|
chatFirstFlag = false; |
|
|
} |
|
|
} |
|
|
if (emotionTirstFlag && params.model == 2 && result.data.length != 0) { |
|
|
if (emotionTirstFlag && params.model == 2 && result.data.length != 0) { |
|
|
if (isMobile) { |
|
|
|
|
|
|
|
|
if (!isMobile.value) { |
|
|
chatStore.aiEmotionCall = true; |
|
|
chatStore.aiEmotionCall = true; |
|
|
} |
|
|
} |
|
|
emotionTirstFlag = false; |
|
|
emotionTirstFlag = false; |
|
@ -506,13 +499,17 @@ const getHistoryList = async (params) => { |
|
|
|
|
|
|
|
|
// 只在首次加载时根据chatStore状态设置折叠状态,避免搜索后自动弹出历史记录 |
|
|
// 只在首次加载时根据chatStore状态设置折叠状态,避免搜索后自动弹出历史记录 |
|
|
|
|
|
|
|
|
if (isMobile) { |
|
|
|
|
|
|
|
|
if (isMobile.value) { |
|
|
|
|
|
console.log("移动设备默认关闭"); |
|
|
isCollapsed.value = true; |
|
|
isCollapsed.value = true; |
|
|
} else { |
|
|
} else { |
|
|
if (props.currentType == "AIchat" && chatFirstFlag) { |
|
|
|
|
|
|
|
|
console.log("pc设备进行判断"); |
|
|
|
|
|
if (props.currentType == "AIchat") { |
|
|
isCollapsed.value = !chatStore.aiChatCall; |
|
|
isCollapsed.value = !chatStore.aiChatCall; |
|
|
} else if (props.currentType == "AiEmotion" && emotionTirstFlag) { |
|
|
|
|
|
|
|
|
console.log("夺宝奇兵页面", isCollapsed.value); |
|
|
|
|
|
} else if (props.currentType == "AiEmotion") { |
|
|
isCollapsed.value = !chatStore.aiEmotionCall; |
|
|
isCollapsed.value = !chatStore.aiEmotionCall; |
|
|
|
|
|
console.log("情绪大模型页面", isCollapsed.value); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 非首次调用时保持当前折叠状态不变 |
|
|
// 非首次调用时保持当前折叠状态不变 |
|
@ -674,7 +671,7 @@ const selectRecord = async (record) => { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if (result && result.data) { |
|
|
if (result && result.data) { |
|
|
if (props.isMobile) { |
|
|
|
|
|
|
|
|
if (isMobile.value) { |
|
|
// 如果手机,收起历史记录 |
|
|
// 如果手机,收起历史记录 |
|
|
isCollapsed.value = true; |
|
|
isCollapsed.value = true; |
|
|
if (props.currentType == "AIchat") { |
|
|
if (props.currentType == "AIchat") { |
|
@ -683,6 +680,7 @@ const selectRecord = async (record) => { |
|
|
chatStore.aiEmotionCall = false; |
|
|
chatStore.aiEmotionCall = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
dataStore.isFeedback = false; |
|
|
historyData.value = result.data; |
|
|
historyData.value = result.data; |
|
|
chatStore.dbqbClickRecord = historyData.value; |
|
|
chatStore.dbqbClickRecord = historyData.value; |
|
|
// 构造股票数据对象,保持与现有结构一致 |
|
|
// 构造股票数据对象,保持与现有结构一致 |
|
@ -782,6 +780,12 @@ defineExpose({ |
|
|
|
|
|
|
|
|
// 生命周期 |
|
|
// 生命周期 |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
|
|
|
const userAgent = navigator.userAgent; |
|
|
|
|
|
isMobile.value = |
|
|
|
|
|
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( |
|
|
|
|
|
userAgent |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
getHistoryList({ |
|
|
getHistoryList({ |
|
|
model: props.currentType == "AIchat" ? 1 : 2, |
|
|
model: props.currentType == "AIchat" ? 1 : 2, |
|
|
token: localStorage.getItem("localToken"), |
|
|
token: localStorage.getItem("localToken"), |
|
|