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.

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