diff --git a/src/api/deepNine.js b/src/api/deepNine.js index 15e1363..0159318 100644 --- a/src/api/deepNine.js +++ b/src/api/deepNine.js @@ -1,7 +1,7 @@ import request from "../utils/request"; const APIurl = import.meta.env.VITE_APP_API_BASE_URL; - +const cozeAPIurl = import.meta.env.VITE_APP_API_BASE_CAZE_URL; // 9.26深度九数据接口 start export const getNineTurnsAPI = function (headers, params) { @@ -14,3 +14,40 @@ export const getNineTurnsAPI = function (headers, params) { }; // 9.26深度九数据接口 end + +// 10.1深度九工作流接口 start +// deepNine1 +export const deepNineFirstAPI = function (params) { + return request({ + url: `${cozeAPIurl}/api/workflow/depthNineFirst`, + method: "POST", + data: params, + }); +}; +// deepNine21 +export const deepNineSecondOneAPI = function (params) { + return request({ + url: `${cozeAPIurl}/api/workflow/depthNineSecondOne`, + method: "POST", + data: params, + }); +}; +// deepNine22 +export const deepNineSecondTwoAPI = function (params) { + return request({ + url: `${cozeAPIurl}/api/workflow/depthNineSecondTwo`, + method: "POST", + data: params, + }); +}; +// deepNine23 +export const deepNineSecondThreeAPI = function (params) { + return request({ + url: `${cozeAPIurl}/api/workflow/depthNineSecondThree`, + method: "POST", + data: params, + }); +}; + + +// 10.1深度九工作流接口 end \ No newline at end of file diff --git a/src/views/AIchat.vue b/src/views/AIchat.vue index 9b8c326..d0bcdf6 100644 --- a/src/views/AIchat.vue +++ b/src/views/AIchat.vue @@ -4465,7 +4465,7 @@ const scrollToTop = () => { }; // 添加渲染所有K线图的方法 -function renderAllKlineCharts() { +async function renderAllKlineCharts() { console.log("重新渲染所有K线图"); // 查找所有K线消息 @@ -4477,6 +4477,7 @@ function renderAllKlineCharts() { // 确保DOM已经渲染 const container = document.getElementById(containerId); + await nextTick(); if (container) { // 渲染图表 KlineCanvsEcharts(containerId); diff --git a/src/views/deepNine.vue b/src/views/deepNine.vue index 4d915df..3960ec2 100644 --- a/src/views/deepNine.vue +++ b/src/views/deepNine.vue @@ -11,7 +11,13 @@ import { dbqbSecondFourAPI, dataListAPI, } from "../api/AIxiaocaishen"; -import { getNineTurnsAPI } from "../api/deepNine"; +import { + getNineTurnsAPI, + deepNineFirstAPI, + deepNineSecondOneAPI, + deepNineSecondTwoAPI, + deepNineSecondThreeAPI, +} from "../api/deepNine"; import { useUserStore } from "../store/userPessionCode"; import { useDeepNineStore } from "../store/deepNine"; import { useDeepNineAudioStore } from "../store/deepNineAudio"; @@ -351,7 +357,14 @@ renderer.del = function (text) { }; // 定义自定义事件 -const emit = defineEmits(["updateMessage", "sendMessage", "enableInput"]); +const emit = defineEmits([ + "updateMessage", + "sendMessage", + "enableInput", + "ensureAIchat", + "scrollToBottom", + "showCount", +]); // 音频播放方法 const playAudio = (url) => { @@ -579,7 +592,6 @@ const playAudioSequence = (audioUrls) => { }; // 重写togglePlayPause方法以支持音频序列控制 - const originalTogglePlayPause = audioStore.togglePlayPause; audioStore.togglePlayPause = () => { console.log("音频控制按钮被点击 11111111111"); console.log("当前播放状态:", audioStore.isPlaying); @@ -684,8 +696,6 @@ const createTypingEffect = (message, content, speed) => { apiStatus.two.isEnd = true; } else if (message.isEnd == "3") { apiStatus.three.isEnd = true; - } else if (message.isEnd == "4") { - apiStatus.four.isEnd = true; } } if (message.error) { @@ -702,8 +712,6 @@ const createTypingEffect = (message, content, speed) => { apiStatus.two.isError = true; } else if (message.error == "3") { apiStatus.three.isError = true; - } else if (message.error == "4") { - apiStatus.four.isError = true; } } if (message.end) { @@ -746,39 +754,7 @@ const createTypingEffect = (message, content, speed) => { processNextElement(); // 开始处理 } else { if (message.kline) { - if (message.klineType == 1) { - console.log("六色罗盘消息已添加到聊天列表"); - - // 在渲染完成后初始化图表 - nextTick(() => { - console.log("nextTick开始 - 准备渲染图表"); - console.log("消息列表:", chatStore.messages); - - // 寻找最新添加的K线消息索引 - let klineIndex = -1; - for (let i = 0; i < chatStore.messages.length; i++) { - if (chatStore.messages[i].messageId === message.messageId) { - klineIndex = i; - break; - } - } - - console.log("找到的K线消息索引:", klineIndex); - - if (klineIndex !== -1) { - const containerId = `kline-container-${klineIndex}`; - console.log("图表容器ID:", containerId); - - // 确保DOM已经渲染完成 - setTimeout(() => { - console.log("延时执行,确保DOM已渲染"); - KlineCanvsEcharts(containerId); - }, 100); // 短暂延时确保DOM已渲染 - } else { - console.warn("未找到K线消息"); - } - }); - } else { + if (message.klineType == 2) { console.log("K线消息已添加到聊天列表"); // 在渲染完成后初始化图表 @@ -818,8 +794,6 @@ const createTypingEffect = (message, content, speed) => { apiStatus.two.isEnd = true; } else if (message.isEnd == "3") { apiStatus.three.isEnd = true; - } else if (message.isEnd == "4") { - apiStatus.four.isEnd = true; } } if (message.error) { @@ -836,8 +810,6 @@ const createTypingEffect = (message, content, speed) => { apiStatus.two.isError = true; } else if (message.error == "3") { apiStatus.three.isError = true; - } else if (message.error == "4") { - apiStatus.four.isError = true; } } // 延时1秒后resolve @@ -852,8 +824,6 @@ const createTypingEffect = (message, content, speed) => { apiStatus.two.isEnd = true; } else if (message.isEnd == "3") { apiStatus.three.isEnd = true; - } else if (message.isEnd == "4") { - apiStatus.four.isEnd = true; } } if (message.error) { @@ -870,8 +840,6 @@ const createTypingEffect = (message, content, speed) => { apiStatus.two.isError = true; } else if (message.error == "3") { apiStatus.three.isError = true; - } else if (message.error == "4") { - apiStatus.four.isError = true; } } // 延时1秒后resolve @@ -915,7 +883,7 @@ async function showThinkingProcess(stockName = null) { class: "ing", type: "ing", flag: true, - content: "夺宝奇兵大模型正在思考", + content: "深度九大模型正在思考", gif: thinkingGif, nowrap: true, }); @@ -944,13 +912,13 @@ async function showThinkingProcess(stockName = null) { await new Promise((resolve) => setTimeout(resolve, 1500)); chatStore.messages.pop(); - // 第三步:生成具体股票的全景作战报告 + // 第三步:生成具体股票的深度共振分析图谱 const thinkingMessage3 = reactive({ sender: "ai", class: "ing", type: "ing", flag: true, - content: `正在生成${stockName}全景作战报告`, + content: `正在生成${stockName}深度共振分析图谱`, gif: generateGif, nowrap: true, }); @@ -1091,7 +1059,7 @@ watch( // 第一阶段,意图识别 try { // 调用工作流获取回复 - const result = await dbqbFirstAPI(params1); + const result = await deepNineFirstAPI(params1); codeData.value = result.data; console.log(codeData.value, "codeData"); // 根据意图识别结果判断 @@ -1211,7 +1179,7 @@ watch( try { const env = import.meta.env.VITE_ENV; - const result9 = await getNineTurnsAPI( + const result20 = await getNineTurnsAPI( { token: env == "development" || env == "test" @@ -1222,48 +1190,19 @@ watch( market: codeData.value.market, language: "cn", code: codeData.value.code, - } ); - const result20 = await dataListAPI({ - token: - env == "development" || env == "test" - ? "8Csj5VVX1UbIb4C3oxrnbZi0+fEeMx8pywnIlrmTm45Cb/EllzWACLto9J9+fCFsfdgBOvKvyY94FvqlvM0" - : "8nkj4QBV1RPIb4CzoRTnbZi0+fEeMx8pywnIlrmTxdwROKkuwWqAWu9orpkpeXVqL98DPfeonNYpHv+mucA", - market: codeData.value.market, - code: codeData.value.code, - language: "cn", //t.value.suoxie, - brainPrivilegeState: 1, - swordPrivilegeState: 1, - stockForecastPrivilegeState: 1, - spaceForecastPrivilegeState: 1, - aibullPrivilegeState: 1, - aigoldBullPrivilegeState: 1, - airadarPrivilegeState: 1, - // marketList: 1, - // brainPrivilegeState: userStore.brainPerssion, - // swordPrivilegeState: userStore.swordPerssion, - // stockForecastPrivilegeState: userStore.pricePerssion, - // spaceForecastPrivilegeState: userStore.timePerssion, - // aibullPrivilegeState: userStore.aibullPerssion, - // aigoldBullPrivilegeState: userStore.aiGnbullPerssion, - // airadarPrivilegeState: userStore.airadarPerssion, - marketList: "usa,sg,my,hk,cn,can,vi,th,in,gb", - }); - // 添加空值检查防止访问null对象的属性 - const HomePage = result20.data?.HomePage || null; - const AIGoldBull = result20.data?.AIGoldBull || null; - - const isLiuSe = HomePage ? true : false; - const isAIGoldBull = - AIGoldBull && - AIGoldBull.DNC && - AIGoldBull.FCX && - AIGoldBull.JN && - AIGoldBull.KLine20 && - AIGoldBull.QSXH + const nineTurns = result20.data ? result20.data : null; + + const isNineTurns = + nineTurns && + nineTurns.DXT && + nineTurns.JZJG && + nineTurns.KLine20 && + nineTurns.StockInformation && + nineTurns.ZJQS ? true : false; @@ -1305,176 +1244,6 @@ watch( }, }; - // 音频播放队列管理已移到全局作用域 - - // 重写audioStore的togglePlayPause方法以支持队列播放控制 - const originalTogglePlayPause = audioStore.togglePlayPause; - // audioStore.togglePlayPause = () => { - // console.log("主页音频控制按钮被点击22222222222222"); - // console.log( - // "当前音频状态 - isPlaying:", - // audioStore.isPlaying, - // "isPaused:", - // audioStore.isPaused - // ); - // console.log("当前音频实例:", audioStore.soundInstance); - // console.log( - // "队列播放状态 - isPlayingAudio:", - // isPlayingAudio.value, - // "队列长度:", - // audioQueue.value.length - // ); - // console.log( - // "当前播放索引:", - // currentPlayIndex, - // "是否所有音频播放完成:", - // currentPlayIndex >= audioQueue.value.length - // ); - - // // 检查是否所有音频都播放完成,如果是则重新开始 - // if ( - // audioStore.soundInstance && - // currentPlayIndex < audioQueue.value.length && - // isPlayingAudio.value - // ) { - // if (audioStore.isPlaying) { - // // 暂停当前音频 - // console.log("暂停当前音频"); - // audioStore.soundInstance.pause(); - // } else if ( - // audioStore.isPaused && - // audioStore.playbackPosition > 0 - // ) { - // // 从暂停位置继续播放 - // console.log( - // "从暂停位置继续播放音频,位置:", - // audioStore.playbackPosition - // ); - // audioStore.soundInstance.seek(audioStore.playbackPosition); - // audioStore.soundInstance.play(); - // } else { - // // 重新开始播放 - // console.log("重新开始播放音频"); - // audioStore.soundInstance.play(); - // } - // } else { - // console.log("没有音频实例,检查是否需要重新播放队列"); - // console.log("重新播放条件检查:", { - // isPlayingAudio: isPlayingAudio.value, - // queueLength: audioQueue.value.length, - // currentPlayIndex: currentPlayIndex, - // condition1: audioQueue.value.length === 0, - // condition2: currentPlayIndex >= audioQueue.value.length, - // finalCondition: - // !isPlayingAudio.value && - // (audioQueue.value.length === 0 || - // currentPlayIndex >= audioQueue.value.length), - // }); - // // 没有音频实例时,检查是否所有音频都播放完成 - // if ( - // !isPlayingAudio.value && - // (audioQueue.value.length === 0 || - // currentPlayIndex >= audioQueue.value.length) - // ) { - // console.log("所有音频播放完成,重新构建队列从第一个开始播放"); - // // 重新构建音频队列,按顺序添加所有音频(不自动播放) - // const audioItems = []; - // if (audioPreloadStatus.one.url) { - // audioItems.push({ - // url: audioPreloadStatus.one.url, - // name: "API1-第一个", - // order: 1, - // }); - // } - // if (audioPreloadStatus.two.url) { - // audioItems.push({ - // url: audioPreloadStatus.two.url, - // name: "API2-第二个", - // order: 2, - // }); - // } - // if (audioPreloadStatus.three.url) { - // audioItems.push({ - // url: audioPreloadStatus.three.url, - // name: "API3-第三个", - // order: 3, - // }); - // } - // if (audioPreloadStatus.four.url) { - // audioItems.push({ - // url: audioPreloadStatus.four.url, - // name: "API4-第四个", - // order: 4, - // }); - // } - - // // 按顺序排序并添加到队列 - // audioItems.sort((a, b) => a.order - b.order); - // audioQueue.value = audioItems; - - // console.log( - // "队列重建完成,队列内容:", - // audioQueue.value.map((item) => item.name) - // ); - // console.log("开始从第一个音频播放"); - - // // 重置播放状态并开始播放第一个音频 - // if (audioQueue.value.length > 0) { - // // 完全重置所有播放相关状态 - // isPlayingAudio.value = false; - // isCallingPlayNext = false; - // currentPlayIndex = 0; // 重置播放索引到第一个音频 - // audioStore.isPlaying = false; - // audioStore.isPaused = false; - // audioStore.playbackPosition = 0; - // audioStore.nowSound = null; - // audioStore.soundInstance = null; - - // console.log("🔄 状态完全重置完成,准备从第一个音频开始播放"); - - // console.log("✅ 完全重置播放状态,准备播放第一个音频"); - // console.log("重置后状态检查:", { - // isPlayingAudio: isPlayingAudio.value, - // isCallingPlayNext: isCallingPlayNext, - // currentPlayIndex: currentPlayIndex, - // audioStoreIsPlaying: audioStore.isPlaying, - // queueLength: audioQueue.value.length, - // }); - - // setTimeout(() => { - // console.log("🚀 延迟后开始播放第一个音频"); - // console.log("播放前最终状态检查:", { - // currentPlayIndex: currentPlayIndex, - // queueLength: audioQueue.value.length, - // queueItems: audioQueue.value.map( - // (item, index) => `${index}: ${item.name}` - // ), - // isPlayingAudio: isPlayingAudio.value, - // isCallingPlayNext: isCallingPlayNext, - // audioStoreIsPlaying: audioStore.isPlaying, - // audioStoreInstance: !!audioStore.soundInstance, - // }); - // console.log( - // "🎯 即将调用 playNextAudio,期望播放:", - // audioQueue.value[currentPlayIndex]?.name || "无音频" - // ); - // playNextAudio(); - // }, 200); - // } - // } else if (!isPlayingAudio.value && audioQueue.value.length > 0) { - // console.log("队列中还有音频,继续播放"); - // playNextAudio(); - // } else { - // console.log( - // "无法播放 - isPlayingAudio:", - // isPlayingAudio.value, - // "队列长度:", - // audioQueue.value.length - // ); - // } - // } - // }; - // 预加载音频函数 const preloadAudio = (url, apiKey) => { if (!url || !audioStore.isVoiceEnabled) { @@ -1554,7 +1323,7 @@ watch( sender: "ai", class: "title1", type: "title1", - content: codeData.value.name + "全景作战报告", + content: codeData.value.name + "深度共振分析图谱", date: result21.data.date, }, "", @@ -1563,14 +1332,6 @@ watch( chatStore.firstAPICall = false; console.log("历史记录可以点击"); - // chatStore.messages.push({ - // sender: "ai", - // class: "title1", - // type: "title1", - // content: codeData.value.name + "全景作战报告", - // date: moment().format("MM/DD/YYYY"), - // }); - // 添加股票信息框 const pc1 = marked( result21.data.name + @@ -1598,50 +1359,27 @@ watch( content: "", isTyping: true, }); - // chatStore.messages.push(aiMessage1); - - // let index1 = 0; - // const typingInterval1 = setInterval(() => { - // if (index1 < ac1.length) { - // aiMessage1.content += ac1.charAt(index1); - // index1++; - // } else { - // clearInterval(typingInterval1); - // aiMessage1.isTyping = false; - // } - // }, 50); // 调整速度为50ms/字符 addTypingTask(aiMessage1, ["", ac1], 130); - // chatStore.messages.push({ - // sender: "ai", - // class: "content1", - // type: "content1", - // content: ac1, - // }); - - // 度牛尺K线图 + // 九转结构K线图 if ( - AIGoldBull && - AIGoldBull.DNC && - AIGoldBull.FCX && - AIGoldBull.JN && - AIGoldBull.KLine20 && - AIGoldBull.QSXH + nineTurns && + nineTurns.DXT && + nineTurns.JZJG && + nineTurns.KLine20 && + nineTurns.StockInformation && + nineTurns.ZJQS ) { - const AIGoldBullData = JSON.parse( - JSON.stringify(toRaw(AIGoldBull)) - ); - const HomePageData = JSON.parse( - JSON.stringify(toRaw(HomePage)) + const nineTurnsData = JSON.parse( + JSON.stringify(toRaw(nineTurns)) ); console.log("处理 K 线数据 - 开始"); - console.log("AIGoldBullData", AIGoldBullData); - console.log("HomePageData", HomePageData); + console.log("nineTurnsData", nineTurnsData); const Kline20 = { - name: HomePageData.StockInformation.Name, - Kline: AIGoldBullData, + name: nineTurnsData.StockInformation.Name, + Kline: nineTurnsData, }; // 打印K线数据结构 @@ -1653,23 +1391,11 @@ watch( hasValidData.value = true; console.log("hasValidData设置为:", hasValidData.value); - // chatStore.messages.pop(); - // 先推送K线图消息 const klineMessageId2 = `kline-${Date.now() + 1}`; console.log("生成K线消息ID:", klineMessageId2); - // chatStore.messages.push({ - // sender: "ai", - // class: "content2", - // type: "content2", - // kline: true, - // chartData: Kline20, - // messageId: klineMessageId2, - // hasValidData: true, // 添加hasValidData标志 - // klineType: 2, - // }); - + // 添加九转结构图表 addTypingTask( { sender: "ai", @@ -1680,44 +1406,64 @@ watch( messageId: klineMessageId2, hasValidData: true, // 添加hasValidData标志 klineType: 2, - error: apiStatus.two.error ? "2" : "", - isEnd: "1", }, "", 50 ); - // console.log("K线消息已添加到聊天列表"); - - // // 在渲染完成后初始化图表 - // nextTick(() => { - // console.log("nextTick开始 - 准备渲染图表"); - // console.log("消息列表:", chatStore.messages); - - // // 寻找最新添加的K线消息索引 - // let klineIndex = -1; - // for (let i = 0; i < chatStore.messages.length; i++) { - // if (chatStore.messages[i].messageId === klineMessageId2) { - // klineIndex = i; - // break; - // } - // } - - // console.log("找到的K线消息索引:", klineIndex); - - // if (klineIndex !== -1) { - // const containerId = `kline-container-${klineIndex}`; - // console.log("图表容器ID:", containerId); - - // // 确保DOM已经渲染完成 - // setTimeout(() => { - // console.log("延时执行,确保DOM已渲染"); - // KlineCanvsEcharts(containerId); - // }, 100); // 短暂延时确保DOM已渲染 - // } else { - // console.warn("未找到K线消息"); - // } - // }); + // 添加标题-数据分析时代下的认知变现 + addTypingTask( + { + sender: "ai", + class: "title2", + type: "title2", + content: "", + }, + "", + 50 + ); + + // 添加图片-数据分析时代下的认知变现 + addTypingTask( + { + sender: "ai", + class: "content3", + type: "img1", + content: + "https://d31zlh4on95l9h.cloudfront.net/images/b6d2a6921202253d7bc07345fdde0876.png", + }, + "", + 50 + ); + + // 添加标题-结构框架分析 + addTypingTask( + { + sender: "ai", + class: "title3", + type: "title3", + content: + "https://d31zlh4on95l9h.cloudfront.net/images/9ab9d76b6906eb914fa1842dbcd56841.png", + }, + "", + 50 + ); + + // 添加内容框1 + const ac2 = `
${result21.data.jgkjfx}
`; + + // 先推送初始消息 + const aiMessage2 = reactive({ + sender: "ai", + class: "content3", + type: "content3", + content: "", + isTyping: true, + error: apiStatus.two.error ? "2" : "", + isEnd: "1", + }); + + addTypingTask(aiMessage2, ["", ac2], 130); } } else { chatStore.messages.push({ @@ -1761,39 +1507,37 @@ watch( } // 在这里添加TwoAPI成功后需要执行的代码 - // 添加标题2 + // 添加标题-资金动向监控 addTypingTask( { sender: "ai", - class: "title2", - type: "title2", - content: "", + class: "title3", + type: "title3", + content: + " https://d31zlh4on95l9h.cloudfront.net/images/f95c44f83b3e3c52e88964631c199060.png", }, "", 50 ); - // chatStore.messages.push({ - // sender: "ai", - // class: "title2", - // type: "title2", - // content: "", - // }); - // 添加内容框1 - const pc2 = marked(result22.data.hxjzpg); - console.log(pc2, "pc2"); - const ac2 = pc2.replace(katexRegex, (match, formula) => { - try { - return katex.renderToString(formula, { - throwOnError: false, - }); - } catch (error) { - console.error("KaTeX 渲染错误:", error); - return match; - } - }); - + const ac31 = result22.data.DXTSC; + const ac32 = result22.data.DXTSC2; + const ac33 = result22.data.ZJQSSC1; + const ac3 = `${result23.data.DXTSC}
${result23.data.DXTSC2}
${result23.data.ZJQSSC1}
`; + const ac3Arr=[]; + if(ac31!=""){ + ac3Arr.push("") + ac3Arr.push(`${ac31}
`); + } + if(ac32!=""){ + ac3Arr.push("") + ac3Arr.push(`${ac32}
`); + } + if(ac33!=""){ + ac3Arr.push("") + ac3Arr.push(`${ac33}
`); + } // 先推送初始消息 - const aiMessage2 = reactive({ + const aiMessage3 = reactive({ sender: "ai", class: "content3", type: "content3", @@ -1802,28 +1546,8 @@ watch( error: apiStatus.three.error ? "3" : "", isEnd: "2", }); - // chatStore.messages.push(aiMessage2); - - // let index2 = 0; - // const typingInterval2 = setInterval(() => { - // if (index2 < ac2.length) { - // aiMessage2.content += ac2.charAt(index2); - // index2++; - // } else { - // clearInterval(typingInterval2); - // aiMessage2.isTyping = false; - // } - // }, 50); // 调整速度为50ms/字符 - addTypingTask(aiMessage2, ["", ac2], 130); - - // chatStore.messages.push({ - // sender: "ai", - // class: "content3", - // type: "content3", - // content: ac2, - // }); + addTypingTask(aiMessage3, ac3Arr, 200); } else { - console.log("1111111111111111111"); if ( apiStatus.one.isEnd && apiStatus.two.error && @@ -1875,236 +1599,21 @@ watch( } // 在这里添加ThreeAPI成功后需要执行的代码 - // 添加标题3-2 - addTypingTask( - { - sender: "ai", - class: "title3", - type: "title3", - content: title2, - }, - "", - 50 - ); - // chatStore.messages.push({ - // sender: "ai", - // class: "title3", - // type: "title3", - // content: title2, - // }); - // 添加内容框2 - // const pc3 = marked(result23.data.zhuli1+'\n'+result23.data.zhuli2+'\n'+result23.data.zhuli3); - // const ac3 = pc3.replace( - // katexRegex, - // (match, formula) => { - // try { - // return katex.renderToString(formula, { throwOnError: false }); - // } catch (error) { - // console.error("KaTeX 渲染错误:", error); - // return match; - // } - // } - // ); - const ac31 = `【主力行为】
`; - const ac32 = `${result23.data.zhuli1}
${result23.data.zhuli2}
${result23.data.zhuli3}
`; - const ac3 = `【主力行为】
${result23.data.zhuli1}
${result23.data.zhuli2}
${result23.data.zhuli3}
`; - - // 先推送初始消息 - const aiMessage3 = reactive({ - sender: "ai", - class: "content3", - type: "content3", - content: "", - isTyping: true, - }); - // chatStore.messages.push(aiMessage3); - - // let index3 = 0; - // const typingInterval3 = setInterval(() => { - // if (index3 < ac3.length) { - // aiMessage3.content += ac3.charAt(index3); - // index3++; - // } else { - // clearInterval(typingInterval3); - // aiMessage3.isTyping = false; - - // } - // }, 50); // 调整速度为50ms/字符 - addTypingTask(aiMessage3, [ac31, ac32], 200); - - // chatStore.messages.push({ - // sender: "ai", - // class: "content3", - // type: "content3", - // content: ac3, - // }); - // 添加标题3-3 + // 添加标题-策略共振决策模型 addTypingTask( { sender: "ai", class: "title3", type: "title3", - content: title3, + content: + "https://d31zlh4on95l9h.cloudfront.net/images/ce71f75008422ed70e88b1ae0bc4d550.png", }, "", 50 ); - // chatStore.messages.push({ - // sender: "ai", - // class: "title3", - // type: "title3", - // content: title3, - // }); - // 添加内容框3 - const arr = result23.data.kongjian.split(","); - const kongjian = `【空间维度】
${arr[0]},${arr[1]}
${arr[2]},${arr[3]}
`; - const shijian = `【时间维度】
${result23.data.shijian}
`; - const nengliang = `【能量维度】
${result23.data.nengliang}
`; - const ac4 = kongjian + shijian + nengliang; - - const ac41 = `【空间维度】
`; - const ac42 = `${arr[0]},${arr[1]}`; - const ac43 = `
`; - const ac44 = `${arr[2]},${arr[3]}
`; - const ac45 = `【时间维度】
`; - const ac46 = `${result23.data.shijian}
`; - const ac47 = `【能量维度】
`; - const ac48 = `${result23.data.nengliang}
`; - - // const pc4 = marked( - // kongjian + - // "\n" + - // result23.data.shijian + - // "\n" + - // result23.data.nengliang - // ); - // const ac4 = pc4.replace(katexRegex, (match, formula) => { - // try { - // return katex.renderToString(formula, { throwOnError: false }); - // } catch (error) { - // console.error("KaTeX 渲染错误:", error); - // return match; - // } - // }); - - // 先推送初始消息 - const aiMessage4 = reactive({ - sender: "ai", - class: "content3", - type: "content3", - content: "", - isTyping: true, - error: apiStatus.four.error ? "4" : "", - isEnd: "3", - }); - // chatStore.messages.push(aiMessage4); - - // let index4 = 0; - // const typingInterval4 = setInterval(() => { - // if (index4 < ac4.length) { - // aiMessage4.content += ac4.charAt(index4); - // index4++; - // } else { - // clearInterval(typingInterval4); - // aiMessage4.isTyping = false; - - // } - // }, 50); // 调整速度为50ms/字符 - addTypingTask( - aiMessage4, - [ac41, ac42, ac43, ac44, ac45, ac46, ac47, ac48], - 200 - ); - - // chatStore.messages.push({ - // sender: "ai", - // class: "content3", - // type: "content3", - // content: ac4, - // }); - } else { - if ( - apiStatus.two.isEnd && - apiStatus.three.error && - !apiStatus.three.isError - ) { - apiStatus.three.isError = true; - chatStore.messages.push({ - class: "ing", - type: "ing", - flag: false, - content: "系统正在为您努力加载中,请稍后再试", - }); - chatStore.isLoading = false; - chatStore.chatInput = false; - emit("enableInput"); - } - } - } - - // 检查FourAPI(需要ThreeAPI已执行) - if ( - apiStatus.three.executed && - apiStatus.four.completed && - !apiStatus.four.executed - ) { - if (apiStatus.four.result) { - apiStatus.four.executed = true; - console.log("执行FourAPI代码:", apiStatus.four.result); - - // 将第四个音频添加到播放队列(确保顺序:API4) - if (audioPreloadStatus.four.url) { - chatStore.messages[chatStore.inputUserIndex].audioArray.push( - audioPreloadStatus.four.url - ); - if (chatStore.currentUserIndex == chatStore.inputUserIndex) { - addToAudioQueue(audioPreloadStatus.four.url, "API4-第四个"); - } else { - chatStore.messages[ - chatStore.inputUserIndex - ].audioStatus = false; - } - console.log( - "音频队列:添加API4音频,当前队列长度:", - audioQueue.value.length - ); - } - // 在这里添加FourAPI成功后需要执行的代码 - // 添加标题3-4 - addTypingTask( - { - sender: "ai", - class: "title3", - type: "title3", - content: title4, - }, - "", - 50 - ); - // chatStore.messages.push({ - // sender: "ai", - // class: "title3", - // type: "title3", - // content: title4, - // }); // 添加内容框4 - const cftj = `【触发条件】
${result24.data.cftl}
`; - const gfzl = `【攻防指令】
${result24.data.gfzl}
`; - const ac5 = cftj + gfzl; - const ac51 = `【触发条件】
`; - const ac52 = `${result24.data.cftl}
`; - const ac53 = `【攻防指令】
`; - const ac54 = `${result24.data.gfzl}
`; - // const pc5 = marked(result24.data.cftl + "/n" + result24.data.gfzl); - // const ac5 = pc5.replace(katexRegex, (match, formula) => { - // try { - // return katex.renderToString(formula, { throwOnError: false }); - // } catch (error) { - // console.error("KaTeX 渲染错误:", error); - // return match; - // } - // }); + const ac5 = `${result23.data.ZJQSSC2}
`; // 先推送初始消息 const aiMessage5 = reactive({ @@ -2114,27 +1623,7 @@ watch( content: "", isTyping: true, }); - // chatStore.messages.push(aiMessage5); - - // let index5 = 0; - // const typingInterval5 = setInterval(() => { - // if (index5 < ac5.length) { - // aiMessage5.content += ac5.charAt(index5); - // index5++; - // } else { - // clearInterval(typingInterval5); - // aiMessage5.isTyping = false; - - // } - // }, 50); // 调整速度为50ms/字符 - addTypingTask(aiMessage5, [ac51, ac52, ac53, ac54], 240); - - // chatStore.messages.push({ - // sender: "ai", - // class: "content3", - // type: "content3", - // content: ac5, - // }); + addTypingTask(aiMessage5, ["", ac5], 240); const ac6 = "该内容由AI生成,请注意甄别"; // 先推送初始消息 @@ -2146,34 +1635,14 @@ watch( isTyping: true, end: true, }); - // chatStore.messages.push(aiMessage6); - - // let index6 = 0; - // const typingInterval6 = setInterval(() => { - // if (index6 < ac6.length) { - // aiMessage6.content += ac6.charAt(index6); - // index6++; - // } else { - // clearInterval(typingInterval6); - // aiMessage6.isTyping = false; - - // } - // }, 50); // 调整速度为50ms/字符 addTypingTask(aiMessage6, ["", ac6], 210); - // chatStore.isLoading = false; - // chatStore.messages.push({ - // sender: "ai", - // class: "mianze", - // type: "mianze", - // content: "内容由AI生成,请注意甄别", - // }); } else { if ( - apiStatus.three.isEnd && - apiStatus.four.error && - !apiStatus.four.isError + apiStatus.two.isEnd && + apiStatus.three.error && + !apiStatus.three.isError ) { - apiStatus.four.isError = true; + apiStatus.three.isError = true; chatStore.messages.push({ class: "ing", type: "ing", @@ -2191,9 +1660,7 @@ watch( if ( apiStatus.one.completed && apiStatus.two.completed && - apiStatus.three.completed && - apiStatus.four.completed && - apiStatus.four.executed + apiStatus.three.completed ) { console.log("所有API已完成,开始收集预加载的音频URL"); // 收集所有预加载的音频URL @@ -2240,7 +1707,7 @@ watch( const handleOneAPI = async () => { try { - result21 = await dbqbSecondOneAPI(params2); + result21 = await deepNineSecondOneAPI(params2); if (result21.code == 400) { throw new Error("API返回错误码400,请求失败"); } @@ -2250,8 +1717,8 @@ watch( apiStatus.one.result = result21; // 预加载第一个接口的音频 - if (result21?.data?.url) { - await preloadAudio(result21.data.url.trim(), "one"); + if (result21?.data?.link) { + await preloadAudio(result21.data.link.trim(), "one"); } else { audioPreloadStatus.one.loaded = true; } @@ -2270,7 +1737,7 @@ watch( const handleTwoAPI = async () => { try { - result22 = await dbqbSecondTwoAPI(params2); + result22 = await deepNineSecondTwoAPI(params2); if (result22.code == 400) { throw new Error("API返回错误码400,请求失败"); } @@ -2280,8 +1747,8 @@ watch( apiStatus.two.result = result22; // 预加载第二个接口的音频 - if (result22?.data?.url) { - await preloadAudio(result22.data.url.trim(), "two"); + if (result22?.data?.link) { + await preloadAudio(result22.data.link.trim(), "two"); } else { audioPreloadStatus.two.loaded = true; } @@ -2299,7 +1766,7 @@ watch( const handleThreeAPI = async () => { try { - result23 = await dbqbSecondThreeAPI(params2); + result23 = await deepNineSecondThreeAPI(params2); if (result23.code == 400) { throw new Error("API返回错误码400,请求失败"); } @@ -2311,8 +1778,12 @@ watch( apiStatus.three.result = result23; // 预加载第三个接口的音频 - if (result23?.data?.url) { - await preloadAudio(result23.data.url.trim(), "three"); + if (result23?.data?.link1) { + await preloadAudio(result23.data.link1.trim(), "three"); + if (result23.data.link2 != "") { + await preloadAudio(result23.data.link2.trim(), "four"); + } + await preloadAudio(result23.data.link3.trim(), "five"); } else { audioPreloadStatus.three.loaded = true; } @@ -2328,40 +1799,10 @@ watch( } }; - const handleFourAPI = async () => { - try { - result24 = await dbqbSecondFourAPI(params2); - if (result24.code == 400) { - throw new Error("API返回错误码400,请求失败"); - } - console.log("FourAPI成功返回:", result24); - - apiStatus.four.completed = true; - apiStatus.four.result = result24; - - // 预加载第四个接口的音频 - if (result24?.data?.url) { - await preloadAudio(result24.data.url.trim(), "four"); - } else { - audioPreloadStatus.four.loaded = true; - } - - // 检查是否可以执行 - checkAndExecuteInOrder(); - } catch (error) { - console.error("FourAPI失败:", error); - apiStatus.four.completed = true; - apiStatus.four.error = error; - audioPreloadStatus.four.loaded = true; - checkAndExecuteInOrder(); - } - }; - - if (isLiuSe && isAIGoldBull) { + if (isNineTurns) { handleOneAPI(); handleTwoAPI(); handleThreeAPI(); - handleFourAPI(); } else { chatStore.messages.pop(); chatStore.messages.push({ @@ -2456,13 +1897,6 @@ watch( isError: false, isEnd: false, }; - apiStatus.four = { - completed: false, - result: null, - error: null, - isError: false, - isEnd: false, - }; // 🔧 新增:重置数据有效性标志 hasValidData.value = false; @@ -2514,7 +1948,7 @@ watch( sender: "ai", class: "title1", type: "title1", - content: clickRecord.value.stockName + "全景作战报告", + content: clickRecord.value.stockName + "深度共振分析图谱", date: clickRecord.value.wokeFlowData.One.date, }); @@ -2533,26 +1967,23 @@ watch( content: pc1, }); - const HomePage = clickRecord.value.stockData.HomePage; - const AIGoldBull = clickRecord.value.stockData.AIGoldBull; + const nineTurns = clickRecord.value.stockData.nineTurns; // 度牛尺K线图 if ( - AIGoldBull && - AIGoldBull.DNC && - AIGoldBull.FCX && - AIGoldBull.JN && - AIGoldBull.KLine20 && - AIGoldBull.QSXH + nineTurns && + nineTurns.DXT && + nineTurns.JZJG && + nineTurns.KLine20 && + nineTurns.StockInformation && + nineTurns.ZJQS ) { - const AIGoldBullData = JSON.parse(JSON.stringify(toRaw(AIGoldBull))); - const HomePageData = JSON.parse(JSON.stringify(toRaw(HomePage))); + const nineTurnsData = JSON.parse(JSON.stringify(toRaw(nineTurns))); console.log("处理 K 线数据 - 开始"); - console.log("AIGoldBullData", AIGoldBullData); - console.log("HomePageData", HomePageData); + console.log("nineTurnsData", nineTurnsData); const Kline20 = { - name: HomePageData.StockInformation.Name, - Kline: AIGoldBullData, + name: nineTurnsData.StockInformation.Name, + Kline: nineTurnsData, }; // 打印K线数据结构 @@ -2717,17 +2148,6 @@ function KlineCanvsEcharts(containerId) { let klineMessageIndex = -1; let klineData = null; - // 查找最近的 K线 消息 - // for (let i = messages.length - 1; i >= 0; i--) { - // console.log('KLine渲染: 检查消息:', messages[i]); - // if (messages[i].type === 'kline' && messages[i].chartData) { - // klineMessageIndex = i; - // klineData = messages[i].chartData; - // console.log('KLine渲染: 找到K线消息索引:', klineMessageIndex); - // console.log('KLine渲染: 找到K线数据:', klineData); - // break; - // } - // } klineMessageIndex = containerId.split("-")[2]; // console.log("KLine渲染: 找到K线消息索引:", klineMessageIndex); if ( @@ -2747,136 +2167,7 @@ function KlineCanvsEcharts(containerId) { isMobile ? "移动设备" : isTablet ? "平板设备" : "桌面设备" ); - if (messages[klineMessageIndex].klineType == 1) { - if (!klineData) { - // console.warn("六色罗盘渲染: 数据无效 - 在chatStore中找不到有效的K线数据"); - return; - } - - // 获取容器元素 - const container = document.getElementById(containerId); - if (!container) { - // console.error("六色罗盘渲染: 找不到容器元素:", containerId); - return; - } - - // 创建图表实例 - // console.log("六色罗盘渲染: 创建图表实例"); - - try { - // 如果已有实例,先销毁 - if (chartInstancesMap[containerId]) { - // console.log("六色罗盘渲染: 销毁已有图表实例"); - chartInstancesMap[containerId].dispose(); - delete chartInstancesMap[containerId]; - } - - // 使用普通变量存储实例 - chartInstancesMap[containerId] = echarts.init(container); - // console.log("六色罗盘渲染: 图表实例创建成功"); - } catch (error) { - // console.error("六色罗盘渲染: 图表实例创建失败:", error); - return; - } - - const name = ref("六色罗盘"); - const size = ref(16); - // PC版字体大小 - if (window.innerWidth > 768) { - size.value = 25; - } - - KlineOption = { - tooltip: { - show: !1, - }, - series: [ - { - name: "\u4eea\u8868\u76d8", - type: "gauge", - center: ["50%", "50%"], - radius: window.innerWidth > 768 ? "90%" : "70%", - startAngle: 140, - endAngle: -140, - min: 0, - max: 6, - precision: 0, - splitNumber: 30, // 分成30份 - axisLine: { - show: !0, - lineStyle: { - color: [ - [0.17, "#FC4407"], - [0.33, "#FDC404"], - [0.5, "#2D8FFD"], - [0.67, "#87CCE7"], - [0.83, "#C1F478"], - [1, "#8FEB8D"], - ], - width: 20, - }, - }, - axisTick: { - show: !0, - splitNumber: 9, - length: 8, - lineStyle: { - color: "#eee", - width: 1, - type: "solid", - }, - }, - axisLabel: { - show: true, - formatter: function (v) {}, - textStyle: { - color: "auto", - }, - }, - // 中途切割 - splitLine: { - show: !0, - length: 20, - lineStyle: { - color: "#eee", - width: 2, - type: "solid", - }, - }, - pointer: { - length: "80%", - width: 8, - color: "auto", - }, - title: { - show: !0, - offsetCenter: ["-65%", -10], - textStyle: { - color: "#333", - fontSize: 15, - }, - }, - detail: { - show: !0, - backgroundColor: "rgba(0,0,0,0)", - borderWidth: 0, - borderColor: "#ccc", - width: 100, - height: 40, - offsetCenter: ["-90%", 0], // name位置 - formatter: function () { - return name.value; - }, - textStyle: { - color: "auto", - fontSize: size.value, // 字体尺寸 - }, - }, - data: [{ value: klineData }], - }, - ], - }; - } else if (messages[klineMessageIndex].klineType == 2) { + if (messages[klineMessageIndex].klineType == 2) { if (!klineData || !klineData.Kline) { // console.warn("KLine渲染: 数据无效 - 在chatStore中找不到有效的K线数据"); return; @@ -2907,582 +2198,346 @@ function KlineCanvsEcharts(containerId) { return; } - const data = klineData.Kline; - // console.log("KLine渲染: Kline数据", data); + const nineTurns = klineData.Kline; + console.log("KLine渲染: Kline数据", nineTurns); - // 切割数据方法 - const splitData = (a) => { - // console.log("KLine渲染: 开始数据切割"); - const categoryData = []; + // 拿到相应的数据 + const splitData = (b) => { + const a = JSON.parse(JSON.stringify(b)); + let categoryData = []; let values = []; for (let i = 0; i < a.length; i++) { - categoryData.push(a[i][0]); - values.push([a[i][1], a[i][2], a[i][3], a[i][4]]); + categoryData.push(a[i].splice(0, 1)[0]); + values.push(a[i]); } - // console.log("KLine渲染: 日期数据点数量", categoryData.length); - // console.log("KLine渲染: 值数据点数量", values.length); - return { categoryData, values }; + return { + categoryData, + values, + }; }; + function vwToPx(vw) { + return (window.innerWidth * vw) / 100; + } - // 给配置项 - // console.log("KLine渲染: 开始配置图表选项"); - - const arr1 = []; - const arr2 = []; - const arr3 = []; - const arr4 = []; - const changeColorKline = (QSXH, KLine20) => { - if (QSXH) { - QSXH.map((item) => { - KLine20.map((kline_item) => { - if (item[1] == 1 && item[0] == kline_item[0]) { - arr1.push(kline_item); - arr2.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr3.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr4.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - } - if (item[1] == 2 && item[0] == kline_item[0]) { - arr2.push(kline_item); - arr1.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr3.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr4.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - } - if (item[1] == 3 && item[0] == kline_item[0]) { - arr3.push(kline_item); - arr2.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr1.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr4.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - } - if (item[1] == 4 && item[0] == kline_item[0]) { - arr4.push(kline_item); - arr2.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr3.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - arr1.push([ - kline_item[0], - null, - null, - null, - null, - null, - null, - null, - ]); - } - }); - }); - } - }; - console.log(arr1, arr2, arr3, arr4); - changeColorKline(data.QSXH, data.KLine20); - var dealData = splitData(data.KLine20); - var dealData1 = splitData(arr1); - var dealData2 = splitData(arr2); - var dealData3 = splitData(arr3); - var dealData4 = splitData(arr4); - var dealGnBullData = data.JN; - function processMAData(data) { - let processedData = []; - data.forEach((item, idx) => { - processedData.push({ - date: item[0], - value: item[1], - type: item[2], - }); - }); - // 当某一种type只存在一天,设置另一种type透明 - let singleTypeRed = [{ min: 0, max: 0, color: "#000" }]; - let singleTypeYellow = [{ min: 0, max: 0, color: "#000" }]; - let singleTypeGreen = [{ min: 0, max: 0, color: "#000" }]; - for (let i = 1; i < processedData.length; i++) { - if (processedData[i].type !== processedData[i - 1].type) { - if ( - i == processedData.length - 1 || - (processedData[i].type !== processedData[i + 1].type && - processedData[i - 1].type === processedData[i + 1].type) - ) { - if (processedData[i - 1].type === 0) { - singleTypeGreen.push({ - min: i - 1, - max: i, - color: "rgba(0,0,0,0)", - }); - } else if (processedData[i - 1].type === 1) { - singleTypeRed.push({ - min: i - 1, - max: i, - color: "rgba(0,0,0,0)", - }); - } else if (processedData[i - 1].type === 2) { - singleTypeYellow.push({ - min: i - 1, - max: i, - color: "rgba(0,0,0,0)", - }); - } - } - } - if (processedData[i].type !== processedData[i - 1].type) { - if (processedData[i].type == 0) { - processedData[i - 1].isTransitionGreen = 1; - } else if (processedData[i].type == 1) { - processedData[i - 1].isTransitionRed = 1; - } else if (processedData[i].type == 2) { - processedData[i - 1].isTransitionYellow = 1; + // k线的数据 + var dealData = splitData(nineTurns.KLine20); + + var markPointData = []; + const getNineNum = (KLine20, JZJG) => { + JZJG.forEach((item, index) => { + let low = KLine20[index][3]; + let high = KLine20[index][4]; + if (item[1] != -1) { + if (item[1] == 9) { + markPointData.push({ + name: "low", + coord: [index, low], + itemStyle: { + normal: { + color: "rgba(0,0,0,0)", // 标记点透明 + }, + }, + label: { + normal: { + show: true, + position: "bottom", + formatter: `${item[1]}`, + textStyle: { + color: "green", + fontSize: window.innerWidth > 769 ? 12 : 9, + textBorderColor: "#FFFFFF", + textBorderWidth: 2, + fontWeight: "bold", + }, + }, + }, + }); + } else { + markPointData.push({ + name: "low", + coord: [index, low], + itemStyle: { + normal: { + color: "rgba(0,0,0,0)", // 标记点透明 + }, + }, + label: { + normal: { + show: true, + position: "bottom", + formatter: `${item[1]}`, + textStyle: { + color: "green", + fontSize: window.innerWidth > 769 ? 18 : 15, + textBorderColor: "#FFFFFF", + textBorderWidth: 2, + fontWeight: "bold", + }, + }, + }, + }); } - // // 创建过渡点,使用前一个点的值 - // processedData[i - 1].isTransition = true } - } - let greenData = []; - let redData = []; - let yellowData = []; - - processedData.forEach((item, idx) => { - const point = [item.date, item.value]; - - if (item.type === 0) { - greenData.push(point); - redData.push([item.date, "-"]); - yellowData.push([item.date, "-"]); - - // if (item.isTransition) { - // redData[redData.length - 1] = [processedData[idx].date, processedData[idx].value] - // yellowData[yellowData.length - 1] = [processedData[idx].date, processedData[idx].value] - // } - if (item.isTransitionGreen) { - greenData[greenData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } else if (item.isTransitionRed) { - redData[redData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } else if (item.isTransitionYellow) { - yellowData[yellowData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } - } else if (item.type === 1) { - redData.push(point); - greenData.push([item.date, "-"]); - yellowData.push([item.date, "-"]); - - // if (item.isTransition) { - // greenData[greenData.length - 1] = [processedData[idx].date, processedData[idx].value] - // yellowData[yellowData.length - 1] = [processedData[idx].date, processedData[idx].value] - // } - if (item.isTransitionGreen) { - greenData[greenData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } else if (item.isTransitionRed) { - redData[redData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } else if (item.isTransitionYellow) { - yellowData[yellowData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } - } else if (item.type === 2) { - redData.push([item.date, "-"]); - greenData.push([item.date, "-"]); - yellowData.push(point); - - // if (item.isTransition) { - // greenData[greenData.length - 1] = [processedData[idx].date, processedData[idx].value] - // redData[redData.length - 1] = [processedData[idx].date, processedData[idx].value] - // } - if (item.isTransitionGreen) { - greenData[greenData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } else if (item.isTransitionRed) { - redData[redData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; - } else if (item.isTransitionYellow) { - yellowData[yellowData.length - 1] = [ - processedData[idx].date, - processedData[idx].value, - ]; + if (item[2] != -1) { + if (item[2] == 9) { + markPointData.push({ + name: "high", + coord: [index, high], + itemStyle: { + normal: { + color: "rgba(0,0,0,0)", // 标记点透明 + }, + }, + label: { + normal: { + show: true, + position: "top", + formatter: `${item[2]}`, + textStyle: { + color: "#0099FF", + fontSize: window.innerWidth > 769 ? 18 : 15, + textBorderColor: "#FFFFFF", + textBorderWidth: 2, + fontWeight: "bold", + }, + }, + }, + }); + } else { + markPointData.push({ + name: "high", + coord: [index, high], + itemStyle: { + normal: { + color: "rgba(0,0,0,0)", // 标记点透明 + }, + }, + label: { + normal: { + show: true, + position: "top", + formatter: `${item[2]}`, + textStyle: { + color: "#0099FF", + fontSize: window.innerWidth > 769 ? 12 : 9, + textBorderColor: "#FFFFFF", + textBorderWidth: 2, + fontWeight: "bold", + }, + }, + }, + }); } } }); + }; + getNineNum(nineTurns.KLine20, nineTurns.JZJG); + // console.log("markPointData", markPointData); + + var arrRange = []; + var arrSwing = []; + var arrDXTBar = []; + var arrInvisibleBar = []; + var markPointDXT = []; + var arr5DXTBar = []; + var arr6DXTBar = []; + var arr7DXTBar = []; + var DXTmin = 0; + var DXTmax = 100; + const getDXT = (DXT) => { + DXT.forEach((item, index) => { + arrRange.push(item[1]); + arrSwing.push(item[2]); + if (item[2] > 0) { + arrDXTBar.push(item[2] * 2); + arrInvisibleBar.push(50); + DXTmax = Math.max(DXTmax, item[2] * 2 + 50); + } else { + arrDXTBar.push(-item[2] * 2); + arrInvisibleBar.push(item[2] * 2 + 50); + } - return { - greenData: greenData, - redData: redData, - yellowData: yellowData, - singleTypeGreen: singleTypeGreen, - singleTypeRed: singleTypeRed, - singleTypeYellow: singleTypeYellow, - }; - } - const maData = processMAData(data.FCX); - const maDuchiData = processMAData(data.DNC); - if (data.FCX[0][1] == "-1") { - maData.greenData = []; - maData.redData = []; - maData.yellowData = []; - } - const processBarData = (data) => { - const barData = []; - const markPointData = []; - data.forEach((item) => { - let color; - switch (item[4]) { - case 1: - color = "#13E113"; - break; - case 2: - color = "#FF0E00"; - break; - case 3: - color = "#0000FE"; - break; - case 4: - color = "#1397FF"; - break; + if (item[5] == 1) { + arr5DXTBar.push(100); + } else { + arr5DXTBar.push(0); + } + if (item[6] == 1) { + arr6DXTBar.push(70); + } else { + arr6DXTBar.push(0); + } + if (item[7] == 1) { + arr7DXTBar.push(40); + } else { + arr7DXTBar.push(0); } - barData.push({ - value: item[5], - itemStyle: { - normal: { - color: color, - }, - }, - }); - if (item[1] === 1) { - markPointData.push({ - coord: [item[0], item[5]], - symbol: - "image://https://d31zlh4on95l9h.cloudfront.net/images/5iujb101000d5si3v3hr7w2vg0h43z1u.png", - symbolSize: [30, 30], + if (item[8] == 1) { + markPointDXT.push({ + name: "DTX-8", + coord: [index, 30], + symbol: "triangle", // 三角形符号 + symbolSize: 10, // 符号大小 + symbolRotate: 0, // 向上的三角形(0度) + itemStyle: { + normal: { + color: "#FFFF00", // 标记点透明 + borderColor: "#000000", // 边框颜色 + borderWidth: 1, + }, + }, label: { normal: { - color: "rgba(0, 0, 0, 0)", + show: false, }, }, }); } - if (item[2] === 1) { - markPointData.push({ - coord: [item[0], item[5] / 2], - symbol: - "image://https://d31zlh4on95l9h.cloudfront.net/images/5iujaz01000d5si016bxdf6vh0377d2h.png", - symbolSize: [30, 30], + if (item[9] == 1) { + markPointDXT.push({ + name: "DTX-9", + coord: [index, 20], + symbolSize: 7, // 正方形大小 + itemStyle: { + normal: { + color: "red", // 标记点透明 + // borderColor: "#000000", // 边框颜色 + // borderWidth: 1, + }, + }, label: { normal: { - color: "rgba(0, 0, 0, 0)", + show: false, }, }, }); } - if (item[3] === 1) { - markPointData.push({ - coord: [item[0], 0], - symbol: - "image://https://d31zlh4on95l9h.cloudfront.net/images/5iujb001000d5shzls0tmd4vs0e5tdrw.png", - symbolSize: [30, 30], + if (item[10] == 1) { + markPointDXT.push({ + name: "DTX-10", + coord: [index, 15], + symbol: "rect", // 设置为正方形 + symbolSize: 7, // 正方形大小 + itemStyle: { + normal: { + color: "grey", // 标记点透明 + // borderColor: "#000000", // 边框颜色 + // borderWidth: 1, + }, + }, label: { normal: { - color: "rgba(0, 0, 0, 0)", + show: false, }, }, }); } }); - return { barData, markPointData }; }; - const { barData, markPointData } = processBarData(dealGnBullData); + getDXT(nineTurns.DXT); + + var arrBlue = []; + var arrRed = []; + var arrWhite = []; + var arrYellow = []; + const getZJQS = (ZJQS) => { + ZJQS.forEach((item, index) => { + arrBlue.push(item[1]); + arrRed.push(item[2]); + arrWhite.push(item[3]); + arrYellow.push(item[4]); + }); + }; + getZJQS(nineTurns.ZJQS); + // console.log("arrBlue", arrBlue); + // console.log("arrRed", arrRed); + // console.log("arrWhite", arrWhite); + // console.log("arrYellow", arrYellow); KlineOption = { - legend: [ - { - textStyle: { - color: "black", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - width: "100%", - top: window.innerWidth > 768 ? "5%" : "4%", - left: "center", - itemGap: window.innerWidth > 768 ? 20 : 10, - itemWidth: 10, - itemHeight: 10, - data: [ - { - name: "进攻K线", - itemStyle: { - color: "rgb(255,0,0)", - }, - }, - { - name: "防守K线", - itemStyle: { - color: "red", - }, - }, - { - name: "推进K线", - itemStyle: { - color: "orange", - }, - }, - { - name: "撤退K线", - itemStyle: { - color: "rgb(84,252,252)", - }, - }, - ], - }, - { - textStyle: { - color: "black", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - orient: "horizontal", - top: window.innerWidth > 768 ? "8%" : "7%", - width: "100%", - left: "center", - itemGap: 15, - data: [ - { - name: "{green|━}{red|━} " + "牵牛绳", - icon: "none", - textStyle: { - rich: { - green: { - color: "green", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - red: { - color: "red", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - }, - }, - }, - { - name: "龙线", - }, - { - name: "虫线", - }, - ], - }, - { - textStyle: { - color: "black", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - orient: "horizontal", - top: window.innerWidth > 768 ? "62%" : "60%", - width: "100%", - left: "center", - itemGap: 15, - data: [ - { - name: "{green|━}{red|━} " + "度牛尺", - icon: "none", - textStyle: { - rich: { - green: { - color: "green", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - red: { - color: "red", - fontSize: window.innerWidth > 768 ? 12 : 9, - }, - }, - }, - }, - ], - }, - ], + // 手放上去显示的内容 tooltip: { + position: function (point, params) { + if (params[0].seriesIndex == 1) { + return window.innerWidth > 768 ? ["12%", "42%"] : ["18%", "40%"]; + } + }, + // 调用接口之后方法 formatter: function (a, b, d) { if (a[0].seriesIndex == 0) { - const KlineTag = ref([]); + const KlineTag = ref([]); // 判断几根K线 const AIBullTag = ref([]); + + // 找到第一个满足条件的数据 KlineTag.value = a.find((item) => item.data[1])?.data || []; + + // 找到第一个满足条件的非 '-' 数据 AIBullTag.value = a.slice(4).find((item) => item.data[1] !== "-")?.data || []; - // console.log(AIBullTag.value) - return ( a[0].name + "