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.

726 lines
15 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="main">
  3. <!-- 顶部状态栏占位 -->
  4. <view class="top" :style="{height:iSMT+'px'}"></view>
  5. <!-- 头部导航 -->
  6. <view class="header">
  7. <view class="headphone-icon">
  8. <image src="https://d31zlh4on95l9h.cloudfront.net/images/bef2edba6cc0c85671fde07cfab5270d.png" class="header-icon-image"></image>
  9. </view>
  10. <view class="title">DeepChart</view>
  11. <view class="notification-icon">
  12. <image src="https://d31zlh4on95l9h.cloudfront.net/images/2554c84b91712d2a6cb6b00380e63bac.png" class="header-icon-image"></image>
  13. </view>
  14. </view>
  15. <!-- 内容区域 - 使用滚动视图 -->
  16. <scroll-view scroll-y class="content-container">
  17. <!-- 1. 今日市场概览 -->
  18. <market-overview></market-overview>
  19. <!-- 间隔 -->
  20. <view class="section-gap"></view>
  21. <!-- 新增欢迎部分 -->
  22. <view class="section welcome-section">
  23. <!-- 轮播图 -->
  24. <swiper class="welcome-swiper" circular autoplay interval="3000" duration="500" indicator-dots indicator-active-color="#4080ff">
  25. <swiper-item v-for="(item, index) in 5" :key="index">
  26. <image class="swiper-image" src="https://d31zlh4on95l9h.cloudfront.net/images/e4272cc034fa2a3d1ca588ef84e51ab0.png" mode="aspectFill"></image>
  27. </swiper-item>
  28. </swiper>
  29. </view>
  30. <!-- 2. DeepMate -->
  31. <view class="section deepmate-section">
  32. <DeepMate />
  33. </view>
  34. <!-- 3. 深度探索 -->
  35. <view class="section deep-exploration">
  36. <!-- 上部分标题和查看更多按钮 -->
  37. <view class="section-header-container">
  38. <view class="section-header">
  39. <view class="header-left">
  40. <text class="section-title">深度探索</text>
  41. </view>
  42. <view class="header-right">
  43. <text class="more-btn" @click="goToDeepExploration">查看更多</text>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 下部分四个图标 -->
  48. <view class="exploration-container">
  49. <view class="exploration-content">
  50. <view class="exploration-item">
  51. <image class="exploration-icon" src="https://d31zlh4on95l9h.cloudfront.net/images/199472b0ee90a1c897f7c87b85accd84.png" mode="aspectFit" lazy-load="true"></image>
  52. <text class="exploration-text">主力追踪</text>
  53. </view>
  54. <view class="exploration-item">
  55. <image class="exploration-icon" src="https://d31zlh4on95l9h.cloudfront.net/images/c25ca5e176efc961dabfa5d0d1b486b0.png" mode="aspectFit" lazy-load="true"></image>
  56. <text class="exploration-text">主力资达</text>
  57. </view>
  58. <view class="exploration-item">
  59. <image class="exploration-icon" src="https://d31zlh4on95l9h.cloudfront.net/images/c064d7066dc8129a7df7b052762f82cf.png" mode="aspectFit" lazy-load="true"></image>
  60. <text class="exploration-text">主力解码</text>
  61. </view>
  62. <view class="exploration-item">
  63. <image class="exploration-icon" src="https://d31zlh4on95l9h.cloudfront.net/images/9d69cceee9c515911477078af6f68d88.png" mode="aspectFit" lazy-load="true"></image>
  64. <text class="exploration-text">主力资金流</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 4. 我的自选 -->
  70. <view class="section my-selection">
  71. <!-- 上部分标题和查看更多按钮 -->
  72. <view class="section-header-container">
  73. <view class="section-header">
  74. <text class="section-title">我的自选</text>
  75. <text class="more-btn" @click="goToMarketSituation">添加自选股</text>
  76. </view>
  77. </view>
  78. <!-- 下部分股票列表 -->
  79. <view class="stock-container">
  80. <view class="stock-list">
  81. <view class="stock-item" v-for="(item, index) in myStocks" :key="item.code">
  82. <view class="stock-info">
  83. <view class="name-container">
  84. <text class="stock-name">{{item.name}}</text>
  85. <text class="stock-code-label">{{item.code}}</text>
  86. </view>
  87. <view class="price-container">
  88. <text class="stock-price">{{item.price}}</text>
  89. <text class="stock-change" :class="{'stock-up': item.change > 0, 'stock-down': item.change < 0}">{{item.change > 0 ? '+' : ''}}{{item.change}}%</text>
  90. </view>
  91. </view>
  92. <view class="stock-chart">
  93. <image :src="item.chartImg" mode="aspectFit" class="chart-image"></image>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 机构动向简报数据 -->
  98. <view class="institutional-reports">
  99. <view class="section-title-container">
  100. <text class="section-title-text">机构动向简报</text>
  101. </view>
  102. <view class="text-gap"></view>
  103. <view class="report-item" v-for="(report, index) in institutionalReports" :key="index">
  104. <view class="report-stock">{{report.stock}}</view>
  105. <view class="report-status">{{report.status}}</view>
  106. </view>
  107. <view class="view-more">
  108. <view><text>查看更多 >></text></view>
  109. <view><text class="disclaimer-text">免责声明以上数据由AI生成不作为最终投资建议决策需独立</text></view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <!-- 5. 今日市场看点 -->
  115. <view class="section-header highlights-title-container">
  116. <text class="section-title">今日市场核心看点</text>
  117. </view>
  118. <view class="highlights-image-container">
  119. <image src="https://d31zlh4on95l9h.cloudfront.net/images/8d5365af968402a18cedb120c09460b0.png" mode="aspectFit" class="highlights-image"></image>
  120. </view>
  121. <!-- 底部空间 - 为底部导航腾出空间 -->
  122. <view class="bottom-space"></view>
  123. </scroll-view>
  124. <!-- 底部导航 -->
  125. <footerBar class="static-footer" :type="type"></footerBar>
  126. </view>
  127. </template>
  128. <script>
  129. import footerBar from '../../components/footerBar.vue'
  130. import MarketOverview from '../../components/MarketOverview.vue'
  131. import DeepMate from '../../components/DeepMate.vue'
  132. export default {
  133. components: {
  134. footerBar,
  135. MarketOverview,
  136. DeepMate
  137. },
  138. data() {
  139. return {
  140. type: 'home',
  141. iSMT: 0,
  142. // 深度探索数据
  143. explorationItems: [
  144. { title: '主力追踪', icon: '/static/c1.png' },
  145. { title: '主力资金', icon: '/static/c2.png' },
  146. { title: '主力解码', icon: '/static/c3.png' },
  147. { title: '主力资金流', icon: '/static/c4.png' }
  148. ],
  149. // 我的自选股票数据
  150. myStocks: [
  151. { name: '特斯拉', code: 'TSLA', price: '482.00', change: 2.80, chartImg: '/static/c5.png' },
  152. { name: '英伟达', code: 'NVDA', price: '189.800', change: -2.92, chartImg: '/static/c6.png' },
  153. { name: '苹果', code: 'AAPL', price: '256.430', change: 2.60, chartImg: '/static/c7.png' }
  154. ],
  155. // 机构动向简报数据
  156. institutionalReports: [
  157. { stock: '特斯拉', status: '当前市场多头资金占比,且多头资金持续流入。' },
  158. { stock: '英伟达', status: '当前市场多头资金占比,且多头资金持续流入。' },
  159. { stock: '苹果', status: '当前市场多头资金占比,且多头资金持续流入。' }
  160. ],
  161. // 防抖定时器
  162. debounceTimer: null
  163. }
  164. },
  165. // Vue 2生命周期方法
  166. mounted() {
  167. // 状态栏高度
  168. this.iSMT = uni.getSystemInfoSync().statusBarHeight;
  169. // 预加载图片资源
  170. this.myStocks.forEach(stock => {
  171. // 使用uni.getImageInfo替代Image对象
  172. uni.getImageInfo({
  173. src: stock.chartImg,
  174. success: function(res) {
  175. // 图片加载成功
  176. console.log('图片预加载成功:', stock.name)
  177. },
  178. fail: function(err) {
  179. console.log('图片预加载失败:', err)
  180. }
  181. })
  182. })
  183. },
  184. methods: {
  185. goToDeepExploration() {
  186. // 跳转到深度探索页面
  187. uni.navigateTo({
  188. url: '/pages/home/deepExploration'
  189. });
  190. },
  191. goToMarketSituation() {
  192. // 跳转到行情页面
  193. uni.navigateTo({
  194. url: '/pages/home/marketSituation'
  195. });
  196. },
  197. // 防抖函数
  198. debounce(fn, delay = 300) {
  199. if (this.debounceTimer) clearTimeout(this.debounceTimer)
  200. this.debounceTimer = setTimeout(() => {
  201. fn()
  202. this.debounceTimer = null
  203. }, delay)
  204. }
  205. }
  206. }
  207. </script>
  208. <style scoped>
  209. .main {
  210. display: flex;
  211. flex-direction: column;
  212. height: 100vh;
  213. background-color: #ffffff;
  214. }
  215. .header {
  216. display: flex;
  217. justify-content: space-between;
  218. align-items: center;
  219. padding: 10px 15px;
  220. background-color: #ffffff;
  221. }
  222. .title {
  223. font-size: 22px;
  224. font-weight: bold;
  225. text-align: center;
  226. flex: 1;
  227. }
  228. .headphone-icon, .notification-icon {
  229. width: 40px;
  230. display: flex;
  231. align-items: center;
  232. justify-content: center;
  233. }
  234. .header-icon-image {
  235. width: 24px;
  236. height: 24px;
  237. object-fit: contain;
  238. }
  239. .content-container {
  240. padding: 20rpx;
  241. width: 100%;
  242. box-sizing: border-box;
  243. overflow-x: hidden;
  244. }
  245. .section {
  246. margin-bottom: 15px;
  247. /* background-color: #f5f5f5; */
  248. background-color: #ffffff;
  249. border-radius: 8px;
  250. padding: 15px;
  251. }
  252. .section-header {
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. margin-bottom: 15px;
  257. padding-bottom: 10px;
  258. }
  259. .section-title {
  260. font-size: 18px;
  261. font-weight: bold;
  262. color: #000000;
  263. }
  264. .section-title-text{
  265. font-size: 14px;
  266. }
  267. .text-gap{
  268. height: 10px;
  269. }
  270. .more-btn {
  271. font-size: 12px;
  272. font-weight: bold;
  273. color: #ffffff;
  274. background-color: #000000;
  275. padding: 4px 8px;
  276. border-radius: 4px;
  277. }
  278. /* 市场概览样式 */
  279. .market-header {
  280. display: flex;
  281. justify-content: space-between;
  282. align-items: center;
  283. padding: 10px 15px;
  284. background-color: #ffffff;
  285. margin-bottom: 10px;
  286. }
  287. .market-content {
  288. background-color: #f5f5f5;
  289. border-radius: 8px;
  290. padding: 15px;
  291. margin: 0 15px;
  292. }
  293. .market-image {
  294. margin-bottom: 15px;
  295. display: flex;
  296. justify-content: center;
  297. }
  298. .overview-image {
  299. width: 100%;
  300. border-radius: 8px;
  301. }
  302. .market-data {
  303. display: flex;
  304. flex-direction: column;
  305. gap: 10px;
  306. }
  307. /* 间隔样式 */
  308. .section-gap {
  309. height: 20px;
  310. }
  311. .market-item {
  312. display: flex;
  313. justify-content: space-between;
  314. padding: 8px 0;
  315. border-bottom: 1px solid #f0f0f0;
  316. }
  317. .down {
  318. color: #ff4d4f;
  319. }
  320. .up {
  321. color: #52c41a;
  322. }
  323. /* DeepMate样式 */
  324. .deepmate-container {
  325. background-color: #ffe6e6;
  326. border-radius: 10px;
  327. padding: 15px;
  328. margin: 0 15px;
  329. }
  330. .deepmate-header {
  331. margin-bottom: 10px;
  332. }
  333. .title-container {
  334. display: flex;
  335. align-items: center;
  336. justify-content: space-between;
  337. width: 100%;
  338. }
  339. .title-left {
  340. width: 50%;
  341. }
  342. .title-right {
  343. width: 50%;
  344. display: flex;
  345. justify-content: flex-end;
  346. }
  347. .deepmate-title {
  348. font-size: 18px;
  349. font-weight: bold;
  350. color: #ff4d4f;
  351. }
  352. .deepmate-icon {
  353. width: 60px;
  354. height: 60px;
  355. margin-left: 0;
  356. }
  357. .deepmate-subtitle {
  358. font-size: 12px;
  359. color: #666;
  360. margin-left: 5px;
  361. }
  362. .deepmate-hotspots {
  363. margin: 10px 0;
  364. }
  365. .hotspot-item {
  366. background-color: #f5f5f5;
  367. padding: 8px 12px;
  368. border-radius: 6px;
  369. margin-bottom: 8px;
  370. }
  371. .hotspot-item text {
  372. font-size: 14px;
  373. color: #333;
  374. }
  375. .deepmate-action {
  376. display: flex;
  377. justify-content: center;
  378. align-items: center;
  379. background-color: #ffffff;
  380. border-radius: 20px;
  381. padding: 10px;
  382. margin-top: 10px;
  383. }
  384. /* 欢迎部分样式 */
  385. .welcome-section {
  386. margin-bottom: 15px;
  387. padding: 0;
  388. }
  389. .welcome-swiper {
  390. width: 100%;
  391. height: 150px;
  392. border-radius: 0;
  393. overflow: hidden;
  394. }
  395. .deepmate-section {
  396. padding: 0;
  397. }
  398. .swiper-image {
  399. width: 100%;
  400. height: 100%;
  401. border-radius: 8px;
  402. object-fit: contain;
  403. }
  404. /* 深度探索样式 */
  405. .deep-exploration {
  406. margin-top: 15px;
  407. padding: 0; /* 移除内边距,让子容器自己控制 */
  408. }
  409. .section-header-container {
  410. margin-bottom: 10px;
  411. }
  412. .section-header {
  413. display: flex;
  414. justify-content: space-between;
  415. align-items: center;
  416. padding: 10px 15px;
  417. background-color: #ffffff;
  418. }
  419. .header-left {
  420. display: flex;
  421. align-items: center;
  422. }
  423. .header-right {
  424. display: flex;
  425. align-items: center;
  426. }
  427. .section-title {
  428. font-size: 16px;
  429. font-weight: bold;
  430. color: #333;
  431. }
  432. .more-btn {
  433. font-size: 12px;
  434. color: #ffffff;
  435. }
  436. .exploration-container {
  437. border-radius: 8px;
  438. overflow: hidden;
  439. }
  440. .exploration-content {
  441. display: flex;
  442. justify-content: space-between;
  443. padding: 15px;
  444. background-color: #f5f5f5;
  445. border-radius: 8px;
  446. }
  447. .exploration-item {
  448. display: flex;
  449. flex-direction: column;
  450. align-items: center;
  451. width: 22%;
  452. background-color: #ffffff;
  453. border-radius: 8px;
  454. padding: 10px 0;
  455. }
  456. .exploration-icon {
  457. width: 50px;
  458. height: 50px;
  459. margin-bottom: 8px;
  460. }
  461. .exploration-text {
  462. font-size: 12px;
  463. color: #333;
  464. }
  465. .icon-text {
  466. font-size: 12px;
  467. }
  468. /* 我的自选样式 */
  469. .my-selection {
  470. padding: 0; /* 移除内边距,让子容器自己控制 */
  471. }
  472. .stock-container {
  473. border-radius: 8px;
  474. overflow: hidden;
  475. background-color: #f5f5f5;
  476. padding: 15px;
  477. box-sizing: border-box;
  478. }
  479. .stock-list {
  480. display: flex;
  481. flex-direction: row;
  482. justify-content: center;
  483. background-color: #f8f8f8;
  484. border-radius: 8px;
  485. padding: 15px;
  486. gap: 10px; /* 添加卡片之间的间距 */
  487. }
  488. .stock-item {
  489. display: flex;
  490. flex-direction: column;
  491. justify-content: space-between;
  492. padding: 3px;
  493. background-color: #ffffff;
  494. border-radius: 8px;
  495. width: 30%;
  496. box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  497. will-change: transform;
  498. transform: translateZ(0);
  499. }
  500. .stock-info {
  501. display: flex;
  502. flex-direction: column;
  503. align-items: center;
  504. margin-bottom: 5px;
  505. }
  506. .stock-chart {
  507. display: flex;
  508. align-items: center;
  509. justify-content: center;
  510. }
  511. .name-container {
  512. display: flex;
  513. align-items: center;
  514. gap: 5px;
  515. }
  516. .stock-name {
  517. font-size: 12px;
  518. font-weight: bold;
  519. color: #333;
  520. }
  521. .stock-code-label {
  522. font-size: 12px;
  523. color: #666;
  524. background-color: #f5f5f5;
  525. padding: 0 4px;
  526. border-radius: 3px;
  527. }
  528. .stock-price {
  529. font-size: 12px;
  530. color: #666;
  531. }
  532. .price-container {
  533. display: flex;
  534. align-items: center;
  535. gap: 5px;
  536. }
  537. .stock-change {
  538. font-size: 12px;
  539. }
  540. .stock-up {
  541. color: #4cd964;
  542. }
  543. .stock-down {
  544. color: #ff3b30;
  545. }
  546. .chart-image {
  547. width: 100px;
  548. height: 40px;
  549. }
  550. /* 市场看点样式 */
  551. .highlights-title-container {
  552. background-color: #ffffff;
  553. margin-bottom: 10px;
  554. }
  555. .highlights-image-container {
  556. background-color: #f5f5f5;
  557. border-radius: 8px;
  558. padding: 10px;
  559. margin-bottom: 15px;
  560. }
  561. .highlights-image {
  562. width: 100%;
  563. height: 150px;
  564. border-radius: 4px;
  565. }
  566. /* 机构动向简报样式 */
  567. .institutional-reports {
  568. margin-top: 15px;
  569. background-color: #f8f8f8;
  570. border-radius: 8px;
  571. padding: 10px;
  572. }
  573. .section-title-container {
  574. position: relative;
  575. padding-left: 10px;
  576. margin-bottom: 5px;
  577. }
  578. .section-title-container:before {
  579. content: "";
  580. position: absolute;
  581. left: 0;
  582. top: 0;
  583. bottom: 0;
  584. width: 4px;
  585. background-color: #ff4d4f;
  586. border-radius: 2px;
  587. }
  588. .report-item {
  589. background-color: #ffffff;
  590. border-radius: 8px;
  591. padding: 10px;
  592. margin-bottom: 8px;
  593. }
  594. .report-stock {
  595. font-size: 14px;
  596. font-weight: bold;
  597. color: #e74c3c;
  598. margin-bottom: 5px;
  599. }
  600. .report-status {
  601. font-size: 12px;
  602. color: #333;
  603. }
  604. .view-more {
  605. text-align: center;
  606. color: #1890ff;
  607. font-size: 12px;
  608. padding: 5px;
  609. }
  610. /* 底部空间 */
  611. .bottom-space {
  612. height: 60px;
  613. }
  614. /* 免责声明样式 */
  615. .disclaimer-text {
  616. font-size: 8px;
  617. color: #999999;
  618. text-align: center;
  619. }
  620. /* 底部导航 */
  621. .static-footer {
  622. position: fixed;
  623. bottom: 0;
  624. width: 100%;
  625. }
  626. </style>