You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

695 lines
17 KiB

4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
  1. <template>
  2. <view class="main">
  3. <!-- 顶部状态栏占位 -->
  4. <view class="top" :style="{height:iSMT+'px'}"></view>
  5. <deepExploration_header></deepExploration_header>
  6. <view class="search">
  7. <input v-model="searchName" class="searchInput" type="text" placeholder="请输入股票名称、股票代码"
  8. placeholder-style="color: #A6A6A6; font-size: 22rpx;" />
  9. <image @click="searchStock" class="seachIcon" src="/static/deepExploration-images/search.png"
  10. mode="aspectFill"></image>
  11. </view>
  12. <view class="content">
  13. <view class="select">
  14. <image class="img" :src="navItems[currentIndex].icon" mode=""></image>
  15. <view v-for="(item, index) in navItems" :key="index" class="selectItem"
  16. :class="{ active: currentIndex === index }" @click="handleModel(index)">
  17. <button class="btn"></button>
  18. </view>
  19. </view>
  20. <view class="graphAndTxt">
  21. <view class="graph">
  22. <view class="graph_header">
  23. <view class="left">{{stockCode}}</view>
  24. <view class="center">
  25. <text>{{stockName}}</text>
  26. </view>
  27. <view class="right">{{stockTime}}</view>
  28. </view>
  29. <view class="graph_data">
  30. <text>{{stockPrice}}</text>
  31. <text>{{stockAdd}}</text>
  32. <text>{{stockChange}}</text>
  33. </view>
  34. <view class="graph_content">
  35. <view class="charts-box">
  36. <!-- uCharts 蜡烛图组件 -->
  37. <qiun-data-charts type="candle" :opts="opts" :chartData="chartData" :disableScroll="true"
  38. :ontouch="true" :onzoom="true" :key="chartKey" />
  39. </view>
  40. </view>
  41. </view>
  42. <view class="txt">
  43. <view class="txtHeader">
  44. <image src="/static/deepExploration-images/plus.png" mode="aspectFill"></image>
  45. <text>{{navItems[currentIndex].name}}</text>
  46. </view>
  47. <view class="txtContent">
  48. <view v-if="loading" class="loading">加载中...</view>
  49. <rich-text :nodes="htmlContent"></rich-text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 底部切换栏 -->
  55. <footerBar class="static-footer" :type="type"></footerBar>
  56. </view>
  57. </template>
  58. <script setup>
  59. import {
  60. ref,
  61. onMounted,
  62. watch
  63. } from 'vue'
  64. import deepExploration_header from '@/components/deepExploration_header.vue'
  65. import footerBar from '@/components/footerBar.vue'
  66. import {
  67. onLoad
  68. } from '@dcloudio/uni-app'
  69. import {
  70. getModel1First,
  71. getModel1Second,
  72. getModel2First,
  73. getModel2Second,
  74. getModel3First,
  75. getModel3Second,
  76. getModel4First,
  77. getModel4Second,
  78. getModeldefault,
  79. getData
  80. } from '/api/deepExploration/deepExploration.js'
  81. import marked from 'marked'; // 引入 marked 库
  82. import hljs from 'highlight.js';
  83. import 'highlight.js/styles/atom-one-dark.css'; // 可替换为其他主题
  84. import {
  85. useDeepExplorationStore
  86. } from '@/stores/modules/deepExploration'
  87. const deepExplorationStore = useDeepExplorationStore()
  88. const historyData = ref({})
  89. watch(
  90. () => deepExplorationStore.deepExplorationInfo, // 监听的目标值(函数返回,避免响应式丢失)
  91. (newVal, oldVal) => {
  92. console.log('deepExplorationInfo 变化了:', newVal)
  93. historyData.value = {...newVal}
  94. console.log(historyData.value.wokeFlowData);
  95. //工作流数据
  96. const rawMarkdown = historyData.value.wokeFlowData.One.markdown;
  97. const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // 全局替换行首的###
  98. markdownContent.value = adaptedMarkdown;
  99. // markdownContent.value = res.data.markdown
  100. htmlContent.value = marked.parse(markdownContent.value);
  101. }, {
  102. deep: true
  103. } // 开启深度监听(对象内部属性变化也能触发)
  104. )
  105. // 响应式变量定义
  106. const type = ref('deepExploration')
  107. const iSMT = ref(0)
  108. const currentIndex = ref(0)
  109. const navItems = ref([{
  110. name: '主力追踪',
  111. icon: '/static/deepExploration-images/1.png'
  112. },
  113. {
  114. name: '主力雷达',
  115. icon: '/static/deepExploration-images/2.png'
  116. },
  117. {
  118. name: '主力解码',
  119. icon: '/static/deepExploration-images/3.png'
  120. },
  121. {
  122. name: '主力资金流',
  123. icon: '/static/deepExploration-images/4.png'
  124. },
  125. ])
  126. //搜索股票
  127. const searchStock = () => {
  128. htmlContent.value = ''
  129. console.log('搜索参数:', stockName.value, currentIndex.value);
  130. if (currentIndex.value >= 0 && currentIndex.value <= 3) {
  131. handleModels()
  132. } else {
  133. uni.showToast({
  134. title: '请选择模块',
  135. icon: 'none',
  136. duration: 2000
  137. })
  138. }
  139. }
  140. //点击四大模块
  141. const handleModel = async (index) => {
  142. htmlContent.value = ''
  143. currentIndex.value = index
  144. await handleModels()
  145. // await getServerData()
  146. }
  147. const stockName = ref('Tesla Inc.')
  148. const searchName = ref('')
  149. const stockCode = ref('TSLA')
  150. const language = ref('')
  151. const recordId = ref('')
  152. const parentId = ref('')
  153. const stockId = ref('')
  154. const market = ref('')
  155. const stockTime = ref('2025/10/24')
  156. const loading = ref(true);
  157. const error = ref('');
  158. const htmlContent = ref('');
  159. const markdownContent = ref('');
  160. const renderer = new marked.Renderer();
  161. renderer.heading = function(text, level) {
  162. return `<p>${text}</p>`;
  163. };
  164. // 初始化 marked 配置(支持代码高亮)
  165. marked.setOptions({
  166. highlight: (code, lang) => {
  167. if (lang && hljs.getLanguage(lang)) {
  168. return hljs.highlight(code, {
  169. language: lang
  170. }).value;
  171. }
  172. return hljs.highlightAuto(code).value;
  173. },
  174. renderer,
  175. breaks: true, // 换行转<br>
  176. gfm: true, // 支持GitHub flavored Markdown
  177. sanitize: false, // 保留HTML标签(如<span style>)
  178. });
  179. //获取模型数据
  180. const handleModels = async () => {
  181. try {
  182. // markdownContent.value = '\n## 📊 主力追踪分析:\n\n### 🕵️ 主力行为\n\t1. 📊 该股庄家中长期筹码成本价格为 360.249,短期资金成本价格为 412.577。该股筹码分散,当日筹码成本价格为 444.330。\n\t2. 🔍 近日没有出现主力集中吸筹。\n\t3. 📈 近期主力持仓比例大于散户持仓比例。 当日主力持仓增加。 当日散户持仓减少。\n\n### 📊 空间维度:\n\t- 📉 预测低一值: <font color=\"#13c2c2\">443.092</font> \n - 📈 预测高一值: <font color=\"#ff4d4f\">466.458</font>\n\t- 📉 预测低二值: <font color=\"#13c2c2\">447.354</font>\n\t- 📈 预测高二值: <font color=\"#ff4d4f\">462.514</font>\n\t<font color=\"#722ed1\">AI智能均线空头排列,当前卖盘小于买盘</font>\n\n### 综合作战\n\t\t\t<font color=\"#fa8c16\">当前股票处于安全区,牵牛绳为红色,出现蓝色推进K线。</font>\n\t\t\t<font color=\"#eb2f96\">该股整体趋势相对较强,个股正处于推进上涨的关键阶段。若当前持有该股票,建议继续持有,进行持续跟踪。若当前无该股票,建议持续跟踪,等待适当时机再进行介入。</font>\n\n---\n<font color=\"#8c8c8c\">*该内容由AI生成,仅供参考,投资有风险,请注意甄别。*</font>\n '
  183. // htmlContent.value = marked.parse(markdownContent.value);
  184. loading.value = true;
  185. if (searchName.value == '') {
  186. console.log('没有搜索', searchName.value);
  187. handleDefault()
  188. } else {
  189. console.log('搜索', searchName.value);
  190. const result = await getModel1First({
  191. content: searchName.value,
  192. language: "cn",
  193. marketList: "hk,cn,usa,my,sg,vi,in,gb",
  194. model: currentIndex.value + 1
  195. })
  196. console.log('result', result);
  197. if (result.code == 200) {
  198. stockCode.value = result.data.code
  199. // stockName.value = result.data.name
  200. recordId.value = result.data.recordId
  201. parentId.value = result.data.parentId
  202. stockId.value = result.data.stockId
  203. language.value = result.data.language
  204. market.value = result.data.market
  205. const res = await getModel1Second({
  206. language: language.value,
  207. recordId: recordId.value,
  208. parentId: parentId.value,
  209. stockId: stockId.value,
  210. token: 'pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q'
  211. })
  212. if (res.code == 200) {
  213. const rawMarkdown = res.data.markdown;
  214. const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // 全局替换行首的###
  215. markdownContent.value = adaptedMarkdown;
  216. // markdownContent.value = res.data.markdown
  217. htmlContent.value = marked.parse(markdownContent.value);
  218. }
  219. console.log('res', res);
  220. await getServerData()
  221. } else if (result.code == 400) {
  222. markdownContent.value = result.message;
  223. htmlContent.value = marked.parse(markdownContent.value);
  224. } else {
  225. return
  226. }
  227. }
  228. } catch {
  229. error.value = e.message || '加载失败,请重试';
  230. } finally {
  231. loading.value = false;
  232. }
  233. }
  234. const handleDefault = async () => {
  235. const result = await getModeldefault({
  236. token: "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
  237. model: currentIndex.value + 1
  238. })
  239. if (result.code == 200) {
  240. const rawMarkdown = result.data.markdown;
  241. const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // 全局替换行首的###
  242. markdownContent.value = adaptedMarkdown;
  243. htmlContent.value = marked.parse(markdownContent.value);
  244. } else {
  245. }
  246. }
  247. const stockPrice = ref('435.900')
  248. const stockAdd = ref('22.410')
  249. const stockChange = ref('5.120%')
  250. const chartKey = ref(0);
  251. const getServerData = async () => {
  252. const result = await getData({
  253. market: market.value || '',
  254. code: searchName.value || '',
  255. language: "cn",
  256. brainPrivilegeState: 1,
  257. marketList: "usa.sg.my.hk.cn.can.vi.th.in.gb"
  258. })
  259. console.log('k线数据', result);
  260. stockName.value = result.data.StockInformation.Name || 'Tesla Inc.'
  261. stockCode.value = result.data.StockInformation.Code || 'TSLA'
  262. stockTime.value = result.data.StockInformation.Time || '2025/10/29'
  263. stockChange.value = result.data.StockInformation.Zhang || '5.120%'
  264. stockAdd.value = result.data.StockInformation.ZhangFu || '22.410'
  265. if(result.data.chartData){
  266. chartData.value = {
  267. ...JSON.parse(JSON.stringify(result.data.chartData))
  268. }
  269. chartKey.value++;
  270. console.log('chartData', chartData.value);
  271. }
  272. }
  273. // 1. K线图配置
  274. const opts = ref({
  275. rotate: false,
  276. rotateLock: false,
  277. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
  278. padding: [15, 15, 0, 15],
  279. dataLabel: false,
  280. enableScroll: true,
  281. enableMarkLine: false,
  282. legend: {},
  283. xAxis: {
  284. labelCount: 4,
  285. itemCount: 30,
  286. disableGrid: true,
  287. gridColor: "#CCCCCC",
  288. gridType: "solid",
  289. dashLength: 4,
  290. scrollShow: false,
  291. scrollAlign: "left",
  292. scrollColor: "#A6A6A6",
  293. scrollBackgroundColor: "#EFEBEF",
  294. labelColor: "#8C8C8C",
  295. fontSize: 9
  296. },
  297. yAxis: {
  298. labelColor: "#8C8C8C",
  299. fontSize: 9
  300. },
  301. extra: {
  302. candle: {
  303. color: {
  304. upLine: "#f04864",
  305. upFill: "#f04864",
  306. downLine: "#2fc25b",
  307. downFill: "#2fc25b"
  308. },
  309. average: {
  310. show: false,
  311. name: ["MA5", "MA10", "MA30"],
  312. day: [5, 10, 20],
  313. color: ["#1890ff", "#2fc25b", "#facc14"]
  314. }
  315. },
  316. markLine: {
  317. type: "dash",
  318. dashLength: 5,
  319. data: [{
  320. value: 2150,
  321. lineColor: "#f04864",
  322. showLabel: false
  323. },
  324. {
  325. value: 2350,
  326. lineColor: "#f04864",
  327. showLabel: false
  328. }
  329. ]
  330. },
  331. tooltip: {
  332. showCategory: true
  333. }
  334. }
  335. })
  336. // 2. K线图数据(响应式定义)
  337. const chartData = ref({
  338. categories: [],
  339. series: [{
  340. name: '',
  341. data: []
  342. }]
  343. })
  344. //获取K线数据函数(直接定义,无需methods)
  345. // const getServerData1 = () => {
  346. // // 模拟服务器请求延时
  347. // setTimeout(() => {
  348. // const res = {
  349. // "categories": [
  350. // "2025/10/23",
  351. // "2025/10/24",
  352. // "2025/10/27"
  353. // ],
  354. // series: [{
  355. // "name": "贵州茅台",
  356. // "data": [
  357. // [
  358. // 1455.0,
  359. // 1468.8,
  360. // 1447.2,
  361. // 1467.98
  362. // ],
  363. // [
  364. // 1467.95,
  365. // 1478.88,
  366. // 1449.34,
  367. // 1450.0
  368. // ],
  369. // [
  370. // 1440.0,
  371. // 1452.49,
  372. // 1435.99,
  373. // 1440.41
  374. // ]
  375. // ],
  376. // }]
  377. // }
  378. // // 给响应式变量赋值(需修改.value)
  379. // chartData.value = JSON.parse(JSON.stringify(res))
  380. // }, 500)
  381. // }
  382. // 生命周期钩子:组件挂载后执行(替代onReady)
  383. onMounted(async() => {
  384. iSMT.value = uni.getSystemInfoSync().statusBarHeight
  385. await getServerData() // 调用数据获取函数
  386. await handleModels()
  387. })
  388. // 页面加载时执行
  389. onLoad((e) => {
  390. if (e.index) {
  391. currentIndex.value = e.index - 1
  392. console.log('模块:', currentIndex.value)
  393. }
  394. if (e.stockName) {
  395. searchName.value = e.stockName
  396. console.log('股票名称:', searchName.value)
  397. }
  398. })
  399. </script>
  400. <style scoped lang="scss">
  401. .main {
  402. width: 100%;
  403. min-height: 100vh;
  404. background-color: #fff;
  405. padding-bottom: 120rpx;
  406. .search {
  407. position: relative;
  408. display: flex;
  409. align-items: center;
  410. background-color: #F3F3F3;
  411. width: calc(100% - 60rpx);
  412. height: 80rpx;
  413. border-radius: 50rpx;
  414. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  415. padding: 0 40rpx;
  416. margin: 15rpx 30rpx 0 30rpx;
  417. .seachIcon {
  418. position: absolute;
  419. right: 50rpx;
  420. width: 32rpx;
  421. height: 32rpx;
  422. }
  423. .searchInput {
  424. color: #111;
  425. }
  426. }
  427. .content {
  428. margin-top: 30rpx;
  429. padding-top: 30rpx;
  430. background-color: rgb(248, 248, 248);
  431. .select {
  432. position: relative;
  433. margin-bottom: -5rpx;
  434. .img {
  435. width: 750rpx;
  436. height: 198rpx;
  437. }
  438. .selectItem {
  439. .btn {
  440. position: absolute;
  441. width: 120rpx;
  442. height: 150rpx;
  443. background-color: transparent;
  444. &::after {
  445. border: none;
  446. }
  447. }
  448. &:nth-of-type(1) .btn {
  449. top: 30rpx;
  450. left: 60rpx;
  451. }
  452. &:nth-of-type(2) .btn {
  453. top: 30rpx;
  454. left: 230rpx;
  455. }
  456. &:nth-of-type(3) .btn {
  457. top: 30rpx;
  458. left: 400rpx;
  459. }
  460. &:nth-of-type(4) .btn {
  461. top: 30rpx;
  462. left: 570rpx;
  463. }
  464. }
  465. }
  466. .graphAndTxt {
  467. background-color: #fff;
  468. border-radius: 50rpx 50rpx 0 0;
  469. padding: 68.6rpx 36.5rpx 0 36.5rpx;
  470. .graph {
  471. border: 1rpx solid #e2e2e2;
  472. border-radius: 30rpx 30rpx 0 0;
  473. .graph_header {
  474. padding: 32rpx 20.5rpx 0 24rpx;
  475. display: flex;
  476. align-items: center;
  477. .left {
  478. color: #333333;
  479. font-family: "PingFang SC";
  480. font-size: 15px;
  481. font-style: normal;
  482. font-weight: 400;
  483. line-height: 15px;
  484. }
  485. .center {
  486. margin-left: 155rpx;
  487. display: flex;
  488. align-items: center;
  489. text {
  490. width: 160rpx;
  491. height: 36rpx;
  492. padding-left: 10rpx;
  493. color: #000000;
  494. white-space: nowrap;
  495. overflow: hidden;
  496. text-overflow: ellipsis;
  497. text-align: center;
  498. font-family: "PingFang SC";
  499. font-size: 18px;
  500. font-style: normal;
  501. font-weight: 500;
  502. line-height: 18px;
  503. }
  504. }
  505. .right {
  506. margin-left: 60rpx;
  507. color: #6a6a6a;
  508. font-family: "PingFang SC";
  509. font-size: 13px;
  510. font-style: normal;
  511. font-weight: 400;
  512. line-height: 15px;
  513. }
  514. }
  515. .graph_data {
  516. display: flex;
  517. padding: 48rpx 24rpx;
  518. text {
  519. display: flex;
  520. color: #25ba5d;
  521. font-family: "PingFang SC";
  522. font-size: 17px;
  523. line-height: 17px;
  524. }
  525. text:nth-child(2) {
  526. margin-left: 120rpx;
  527. }
  528. text:nth-child(3) {
  529. margin-left: 150rpx;
  530. }
  531. }
  532. .graph_content {
  533. min-height: 500rpx;
  534. .charts-box {
  535. width: 100%;
  536. height: 100%;
  537. }
  538. }
  539. }
  540. .txt {
  541. background-color: #F3F3F3;
  542. margin-top: 48rpx;
  543. border-radius: 30rpx;
  544. .txtHeader {
  545. padding: 30rpx 24rpx;
  546. image {
  547. width: 20rpx;
  548. height: 20rpx;
  549. }
  550. text {
  551. background-color: #FFFFFF;
  552. color: #000000;
  553. padding: 0 22rpx;
  554. border-radius: 22rpx;
  555. font-size: 28rpx;
  556. font-weight: 400;
  557. line-height: 37rpx;
  558. }
  559. }
  560. .txtContent {
  561. min-height: 200rpx;
  562. padding: 20rpx 30rpx;
  563. margin-bottom: 100rpx;
  564. ::v-deep * {
  565. box-sizing: border-box;
  566. width: 100% !important; // 强制所有解析后的标签占满容器宽度
  567. white-space: normal !important; // 取消强制不换行
  568. word-wrap: break-word !important; // 长词/长数字自动换行
  569. }
  570. // 标题样式(确保换行)
  571. ::v-deep h2 {
  572. font-size: 32rpx;
  573. color: #333;
  574. margin: 25rpx 0 15rpx;
  575. line-height: 1.5;
  576. }
  577. // 段落样式(核心换行控制)
  578. ::v-deep p {
  579. font-size: 26rpx;
  580. color: #666;
  581. margin: 15rpx 0;
  582. line-height: 1.8; // 增加行高,提升可读性
  583. text-align: justify; // 两端对齐,避免单侧参差不齐
  584. }
  585. // 列表样式(纵向排列)
  586. ::v-deep ul,
  587. ::v-deep ol {
  588. margin: 15rpx 0 15rpx 30rpx;
  589. }
  590. ::v-deep li {
  591. margin: 10rpx 0;
  592. line-height: 1.6;
  593. }
  594. // 加载状态样式
  595. .loading {
  596. text-align: center;
  597. padding: 50rpx 0;
  598. color: #666;
  599. font-size: 26rpx;
  600. }
  601. }
  602. }
  603. }
  604. }
  605. .static-footer {
  606. position: fixed;
  607. bottom: 0;
  608. width: 100%;
  609. }
  610. }
  611. * {
  612. box-sizing: border-box;
  613. }
  614. </style>