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.

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