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.

728 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. flex: 1;
  241. padding: 10px;
  242. width: 100%;
  243. box-sizing: border-box;
  244. overflow-x: hidden;
  245. }
  246. .section {
  247. margin-bottom: 15px;
  248. /* background-color: #f5f5f5; */
  249. background-color: #ffffff;
  250. border-radius: 8px;
  251. padding: 15px;
  252. }
  253. .section-header {
  254. display: flex;
  255. justify-content: space-between;
  256. align-items: center;
  257. margin-bottom: 15px;
  258. padding-bottom: 10px;
  259. }
  260. .section-title {
  261. font-size: 18px;
  262. font-weight: bold;
  263. color: #000000;
  264. }
  265. .section-title-text{
  266. font-size: 14px;
  267. }
  268. .text-gap{
  269. height: 10px;
  270. }
  271. .more-btn {
  272. font-size: 12px;
  273. font-weight: bold;
  274. color: #ffffff;
  275. background-color: #000000;
  276. padding: 4px 8px;
  277. border-radius: 4px;
  278. }
  279. /* 市场概览样式 */
  280. .market-header {
  281. display: flex;
  282. justify-content: space-between;
  283. align-items: center;
  284. padding: 10px 15px;
  285. background-color: #ffffff;
  286. margin-bottom: 10px;
  287. }
  288. .market-content {
  289. background-color: #f5f5f5;
  290. border-radius: 8px;
  291. padding: 15px;
  292. margin: 0 15px;
  293. }
  294. .market-image {
  295. margin-bottom: 15px;
  296. display: flex;
  297. justify-content: center;
  298. }
  299. .overview-image {
  300. width: 100%;
  301. border-radius: 8px;
  302. }
  303. .market-data {
  304. display: flex;
  305. flex-direction: column;
  306. gap: 10px;
  307. }
  308. /* 间隔样式 */
  309. .section-gap {
  310. height: 20px;
  311. }
  312. .market-item {
  313. display: flex;
  314. justify-content: space-between;
  315. padding: 8px 0;
  316. border-bottom: 1px solid #f0f0f0;
  317. }
  318. .down {
  319. color: #ff4d4f;
  320. }
  321. .up {
  322. color: #52c41a;
  323. }
  324. /* DeepMate样式 */
  325. .deepmate-container {
  326. background-color: #ffe6e6;
  327. border-radius: 10px;
  328. padding: 15px;
  329. margin: 0 15px;
  330. }
  331. .deepmate-header {
  332. margin-bottom: 10px;
  333. }
  334. .title-container {
  335. display: flex;
  336. align-items: center;
  337. justify-content: space-between;
  338. width: 100%;
  339. }
  340. .title-left {
  341. width: 50%;
  342. }
  343. .title-right {
  344. width: 50%;
  345. display: flex;
  346. justify-content: flex-end;
  347. }
  348. .deepmate-title {
  349. font-size: 18px;
  350. font-weight: bold;
  351. color: #ff4d4f;
  352. }
  353. .deepmate-icon {
  354. width: 60px;
  355. height: 60px;
  356. margin-left: 0;
  357. }
  358. .deepmate-subtitle {
  359. font-size: 12px;
  360. color: #666;
  361. margin-left: 5px;
  362. }
  363. .deepmate-hotspots {
  364. margin: 10px 0;
  365. }
  366. .hotspot-item {
  367. background-color: #f5f5f5;
  368. padding: 8px 12px;
  369. border-radius: 6px;
  370. margin-bottom: 8px;
  371. }
  372. .hotspot-item text {
  373. font-size: 14px;
  374. color: #333;
  375. }
  376. .deepmate-action {
  377. display: flex;
  378. justify-content: center;
  379. align-items: center;
  380. background-color: #ffffff;
  381. border-radius: 20px;
  382. padding: 10px;
  383. margin-top: 10px;
  384. }
  385. /* 欢迎部分样式 */
  386. .welcome-section {
  387. margin-bottom: 15px;
  388. padding: 0;
  389. }
  390. .welcome-swiper {
  391. width: 100%;
  392. height: 150px;
  393. border-radius: 0;
  394. overflow: hidden;
  395. }
  396. .deepmate-section {
  397. padding: 0;
  398. }
  399. .swiper-image {
  400. width: 100%;
  401. height: 100%;
  402. border-radius: 8px;
  403. object-fit: contain;
  404. }
  405. /* 深度探索样式 */
  406. .deep-exploration {
  407. margin-top: 15px;
  408. padding: 0; /* 移除内边距,让子容器自己控制 */
  409. }
  410. .section-header-container {
  411. margin-bottom: 10px;
  412. }
  413. .section-header {
  414. display: flex;
  415. justify-content: space-between;
  416. align-items: center;
  417. padding: 10px 15px;
  418. background-color: #ffffff;
  419. }
  420. .header-left {
  421. display: flex;
  422. align-items: center;
  423. }
  424. .header-right {
  425. display: flex;
  426. align-items: center;
  427. }
  428. .section-title {
  429. font-size: 16px;
  430. font-weight: bold;
  431. color: #333;
  432. }
  433. .more-btn {
  434. font-size: 12px;
  435. color: #ffffff;
  436. }
  437. .exploration-container {
  438. border-radius: 8px;
  439. overflow: hidden;
  440. }
  441. .exploration-content {
  442. display: flex;
  443. justify-content: space-between;
  444. padding: 15px;
  445. background-color: #f5f5f5;
  446. border-radius: 8px;
  447. }
  448. .exploration-item {
  449. display: flex;
  450. flex-direction: column;
  451. align-items: center;
  452. width: 22%;
  453. background-color: #ffffff;
  454. border-radius: 8px;
  455. padding: 10px 0;
  456. }
  457. .exploration-icon {
  458. width: 50px;
  459. height: 50px;
  460. margin-bottom: 8px;
  461. }
  462. .exploration-text {
  463. font-size: 12px;
  464. color: #333;
  465. }
  466. .icon-text {
  467. font-size: 12px;
  468. }
  469. /* 我的自选样式 */
  470. .my-selection {
  471. padding: 0; /* 移除内边距,让子容器自己控制 */
  472. }
  473. .stock-container {
  474. border-radius: 8px;
  475. overflow: hidden;
  476. background-color: #f5f5f5;
  477. padding: 15px;
  478. box-sizing: border-box;
  479. }
  480. .stock-list {
  481. display: flex;
  482. flex-direction: row;
  483. justify-content: center;
  484. background-color: #f8f8f8;
  485. border-radius: 8px;
  486. padding: 15px;
  487. gap: 10px; /* 添加卡片之间的间距 */
  488. }
  489. .stock-item {
  490. display: flex;
  491. flex-direction: column;
  492. justify-content: space-between;
  493. padding: 3px;
  494. background-color: #ffffff;
  495. border-radius: 8px;
  496. width: 30%;
  497. box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  498. will-change: transform;
  499. transform: translateZ(0);
  500. }
  501. .stock-info {
  502. display: flex;
  503. flex-direction: column;
  504. align-items: center;
  505. margin-bottom: 5px;
  506. }
  507. .stock-chart {
  508. display: flex;
  509. align-items: center;
  510. justify-content: center;
  511. }
  512. .name-container {
  513. display: flex;
  514. align-items: center;
  515. gap: 5px;
  516. }
  517. .stock-name {
  518. font-size: 12px;
  519. font-weight: bold;
  520. color: #333;
  521. }
  522. .stock-code-label {
  523. font-size: 12px;
  524. color: #666;
  525. background-color: #f5f5f5;
  526. padding: 0 4px;
  527. border-radius: 3px;
  528. }
  529. .stock-price {
  530. font-size: 12px;
  531. color: #666;
  532. }
  533. .price-container {
  534. display: flex;
  535. align-items: center;
  536. gap: 5px;
  537. }
  538. .stock-change {
  539. font-size: 12px;
  540. }
  541. .stock-up {
  542. color: #4cd964;
  543. }
  544. .stock-down {
  545. color: #ff3b30;
  546. }
  547. .chart-image {
  548. width: 100px;
  549. height: 40px;
  550. }
  551. /* 市场看点样式 */
  552. .highlights-title-container {
  553. background-color: #ffffff;
  554. margin-bottom: 10px;
  555. }
  556. .highlights-image-container {
  557. background-color: #f5f5f5;
  558. border-radius: 8px;
  559. padding: 10px;
  560. margin-bottom: 15px;
  561. }
  562. .highlights-image {
  563. width: 100%;
  564. height: 150px;
  565. border-radius: 4px;
  566. }
  567. /* 机构动向简报样式 */
  568. .institutional-reports {
  569. margin-top: 15px;
  570. background-color: #f8f8f8;
  571. border-radius: 8px;
  572. padding: 10px;
  573. }
  574. .section-title-container {
  575. position: relative;
  576. padding-left: 10px;
  577. margin-bottom: 5px;
  578. }
  579. .section-title-container:before {
  580. content: "";
  581. position: absolute;
  582. left: 0;
  583. top: 0;
  584. bottom: 0;
  585. width: 4px;
  586. background-color: #ff4d4f;
  587. border-radius: 2px;
  588. }
  589. .report-item {
  590. background-color: #ffffff;
  591. border-radius: 8px;
  592. padding: 10px;
  593. margin-bottom: 8px;
  594. }
  595. .report-stock {
  596. font-size: 14px;
  597. font-weight: bold;
  598. color: #e74c3c;
  599. margin-bottom: 5px;
  600. }
  601. .report-status {
  602. font-size: 12px;
  603. color: #333;
  604. }
  605. .view-more {
  606. text-align: center;
  607. color: #1890ff;
  608. font-size: 12px;
  609. padding: 5px;
  610. }
  611. /* 底部空间 */
  612. .bottom-space {
  613. height: 60px;
  614. }
  615. /* 免责声明样式 */
  616. .disclaimer-text {
  617. font-size: 8px;
  618. color: #999999;
  619. text-align: center;
  620. }
  621. /* 底部导航 */
  622. .static-footer {
  623. position: fixed;
  624. bottom: 0;
  625. width: 100%;
  626. }
  627. </style>