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.

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