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.

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