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.

516 lines
13 KiB

4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
  1. <template>
  2. <view class="main">
  3. <!-- 顶部状态栏占位 -->
  4. <view class="top" :style="{ height: iSMT + 'px' }"></view>
  5. <!-- 标题图标部分 -->
  6. <deepExploration_header
  7. ></deepExploration_header>
  8. <view class="search">
  9. <input
  10. v-model="stockName"
  11. class="searchInput"
  12. type="text"
  13. placeholder="请输入股票名称、股票代码"
  14. placeholder-style="color: #A6A6A6; font-size: 22rpx;"
  15. />
  16. <image
  17. @click="searchStock"
  18. class="seachIcon"
  19. src="/static/deepExploration-images/search.png"
  20. mode="aspectFill"
  21. ></image>
  22. </view>
  23. <!-- 四大功能模块 -->
  24. <view class="select">
  25. <view class="selectItem" @click="toMain('主力追踪')">
  26. <image
  27. class="img"
  28. src="/static/deepExploration-images/icon3.png"
  29. mode="aspectFill"
  30. ></image>
  31. <view class="txt">主力追踪</view>
  32. </view>
  33. <view class="selectItem" @click="toMain('主力雷达')">
  34. <image
  35. class="img"
  36. src="/static/deepExploration-images/icon2.png"
  37. mode="aspectFill"
  38. ></image>
  39. <view class="txt">主力雷达</view>
  40. </view>
  41. <view class="selectItem" @click="toMain('主力解码')">
  42. <image
  43. class="img"
  44. src="/static/deepExploration-images/icon1.png"
  45. mode="aspectFill"
  46. ></image>
  47. <view class="txt">主力解码</view>
  48. </view>
  49. <view class="selectItem" @click="toMain('主力资金流')">
  50. <image
  51. class="img"
  52. src="/static/deepExploration-images/icon4.png"
  53. mode="aspectFill"
  54. ></image>
  55. <view class="txt">主力资金流</view>
  56. </view>
  57. </view>
  58. <!-- 灰色间隔 -->
  59. <view class="gap"></view>
  60. <!-- 选股策略 -->
  61. <view class="stockSelection">
  62. <view class="stockSelection_top">
  63. <view class="txt">
  64. <text>选股策略</text>
  65. </view>
  66. <view class="viewAll" @click="viewAll">
  67. <text>查看全部</text>
  68. </view>
  69. </view>
  70. <view class="stockSelection_content">
  71. <view class="selectionItem">
  72. <view class="header">
  73. <view class="left">
  74. <image
  75. src="/static/deepExploration-images/plus.png"
  76. mode="aspectFill"
  77. ></image>
  78. <text>抄底卖顶</text>
  79. </view>
  80. <view class="right">
  81. <image
  82. src="/static/deepExploration-images/Americle.png"
  83. mode="aspectFill"
  84. ></image>
  85. <text>美股</text>
  86. </view>
  87. </view>
  88. <view class="content">
  89. <view class="contentTitle">
  90. <view class="contentTitle_name">股票名称</view>
  91. <view class="contentTitle_close">最新收盘价</view>
  92. <view class="contentTitle_price">选股价格</view>
  93. </view>
  94. <view class="contentItem">
  95. <view class="row" v-for="(item, index) in stockData" :key="index">
  96. <view class="nameItem">{{ item.name }}</view>
  97. <view class="closeItem">{{ item.close }}</view>
  98. <view class="priceItem">{{ item.select }}</view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="stockSelection_content">
  105. <view class="selectionItem">
  106. <view class="header">
  107. <view class="left">
  108. <image
  109. src="/static/deepExploration-images/plus.png"
  110. mode="aspectFill"
  111. ></image>
  112. <text>抄底卖顶</text>
  113. </view>
  114. <view class="right">
  115. <image
  116. src="/static/deepExploration-images/Americle.png"
  117. mode="aspectFill"
  118. ></image>
  119. <text>美股</text>
  120. </view>
  121. </view>
  122. <view class="content">
  123. <view class="contentTitle">
  124. <view class="contentTitle_name">股票名称</view>
  125. <view class="contentTitle_close">最新收盘价</view>
  126. <view class="contentTitle_price">选股价格</view>
  127. </view>
  128. <view class="contentItem">
  129. <view class="row" v-for="(item, index) in stockData" :key="index">
  130. <view class="nameItem">{{ item.name }}</view>
  131. <view class="closeItem">{{ item.close }}</view>
  132. <view class="priceItem">{{ item.select }}</view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <footerBar class="static-footer" :type="type"></footerBar>
  140. </view>
  141. </template>
  142. <script setup>
  143. import {
  144. ref,
  145. onMounted
  146. } from 'vue'
  147. import footerBar from '@/components/footerBar.vue'
  148. import deepExploration_header from '@/components/deepExploration_header.vue'
  149. import { stocSelectApi } from '@/api/deepExploration/deepExploration.js'
  150. const type = ref("deepExploration");
  151. const iSMT = ref(0);
  152. //查看全部选股策略
  153. const toMain = (val) => {
  154. if (val == "主力追踪") {
  155. uni.navigateTo({
  156. url: "/pages/deepExploration/MainForceActions?index=1",
  157. });
  158. } else if (val == "主力雷达") {
  159. uni.navigateTo({
  160. url: "/pages/deepExploration/MainForceActions?index=2",
  161. });
  162. } else if (val == "主力解码") {
  163. uni.navigateTo({
  164. url: "/pages/deepExploration/MainForceActions?index=3",
  165. });
  166. } else if (val == "主力资金流") {
  167. uni.navigateTo({
  168. url: "/pages/deepExploration/MainForceActions?index=4",
  169. });
  170. }
  171. };
  172. const stockName = ref("");
  173. //搜索股票
  174. const searchStock = () => {
  175. console.log("搜索参数:", stockName.value);
  176. uni.navigateTo({
  177. url: `/pages/deepExploration/MainForceActions?stockName=${stockName.value}`,
  178. });
  179. };
  180. //查看全部选股策略
  181. const viewAll = () => {
  182. uni.navigateTo({
  183. url: "/pages/deepExploration/stockSelectDetail",
  184. });
  185. };
  186. //选股策略数据
  187. const stockData = [
  188. {
  189. name: "(MKTW)MarketWise Inc",
  190. close: "$14.190",
  191. select: "$13.180",
  192. },
  193. {
  194. name: "(MTCH)Match Group Inc",
  195. close: "$32.120",
  196. select: "$28.120",
  197. },
  198. {
  199. name: "(MKTW)MarketWise Inc",
  200. close: "$14.190",
  201. select: "$13.180",
  202. },
  203. ];
  204. onMounted(() => {
  205. // 状态栏高度
  206. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  207. });
  208. //查看全部选股策略
  209. const viewAll = () => {
  210. uni.navigateTo({
  211. url: '/pages/deepExploration/stockSelectDetail'
  212. })
  213. }
  214. //选股策略数据
  215. const stockData = [{
  216. name: "(MKTW)MarketWise Inc",
  217. close: "$14.190",
  218. select: "$13.180"
  219. },
  220. {
  221. name: "(MTCH)Match Group Inc",
  222. close: "$32.120",
  223. select: "$28.120"
  224. },
  225. {
  226. name: "(MKTW)MarketWise Inc",
  227. close: "$14.190",
  228. select: "$13.180"
  229. }
  230. ];
  231. // 加载选股策略(接口)
  232. const loadStockSelection = async () => {
  233. try {
  234. const res = await stocSelectApi({
  235. language: 'cn'
  236. })
  237. console.log('选股策略接口响应:', res)
  238. const list = Array.isArray(res?.data?.list) ? res.data.list : (Array.isArray(res?.data) ? res.data : [])
  239. if (Array.isArray(list) && list.length) {
  240. stockData.value = list.map(item => ({
  241. name: item.name || item.stockName || item.code || '',
  242. close: item.close || item.lastClose || item.closePrice || '',
  243. select: item.select || item.selectPrice || item.price || ''
  244. }))
  245. } else {
  246. console.warn('选股策略接口返回空列表或结构不匹配')
  247. }
  248. } catch (e) {
  249. console.error('选股策略接口调用失败', e)
  250. uni.showToast({ title: '选股策略加载失败', icon: 'none' })
  251. }
  252. }
  253. onMounted(() => {
  254. // 状态栏高度
  255. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  256. // 调用接口填充数据
  257. loadStockSelection()
  258. })
  259. </script>
  260. <style scoped lang="scss">
  261. .main {
  262. width: 100%;
  263. height: 100vh;
  264. background-color: #fff;
  265. .search {
  266. position: relative;
  267. display: flex;
  268. align-items: center;
  269. background-color: #f3f3f3;
  270. width: calc(100% - 60rpx);
  271. height: 80rpx;
  272. border-radius: 50rpx;
  273. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  274. padding: 0 40rpx;
  275. margin: 15rpx 30rpx 0 30rpx;
  276. .seachIcon {
  277. position: absolute;
  278. right: 50rpx;
  279. width: 32rpx;
  280. height: 32rpx;
  281. }
  282. .searchInput {
  283. color: #111;
  284. }
  285. }
  286. .select {
  287. display: flex;
  288. padding: 60rpx 10rpx 30rpx 30rpx;
  289. gap: 70rpx;
  290. align-items: center;
  291. justify-content: center;
  292. .selectItem {
  293. .img {
  294. width: 80rpx;
  295. height: 80rpx;
  296. display: block;
  297. margin: 0 auto;
  298. }
  299. .txt {
  300. color: #6a6a6a;
  301. font-family: "PingFang SC";
  302. font-size: 11px;
  303. font-style: normal;
  304. font-weight: 400;
  305. line-height: 14.5px;
  306. margin-top: 13rpx;
  307. white-space: nowrap;
  308. }
  309. }
  310. }
  311. .gap {
  312. width: 100%;
  313. height: 15rpx;
  314. background-color: #f3f3f3;
  315. }
  316. .stockSelection {
  317. width: 100%;
  318. padding: 32rpx 15rpx;
  319. .stockSelection_top {
  320. display: flex;
  321. justify-content: space-between;
  322. .txt {
  323. color: #000000;
  324. font-family: "PingFang SC";
  325. font-size: 38rpx;
  326. font-style: normal;
  327. font-weight: 400;
  328. line-height: 50rpx;
  329. }
  330. .viewAll {
  331. background-color: #000000;
  332. border-radius: 10rpx;
  333. padding: 6rpx 20rpx;
  334. color: #ffffff;
  335. font-family: "PingFang SC";
  336. font-size: 10rpx;
  337. font-style: normal;
  338. font-weight: 100;
  339. line-height: 29rpx;
  340. height: 40rpx;
  341. }
  342. }
  343. .stockSelection_content {
  344. .selectionItem {
  345. background-color: #f3f3f3;
  346. padding: 30rpx 15rpx 17rpx 30rpx;
  347. border-radius: 30rpx;
  348. margin-top: 30rpx;
  349. .header {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. .left {
  354. display: flex;
  355. justify-content: space-between;
  356. align-items: center;
  357. image {
  358. display: flex;
  359. justify-content: center;
  360. align-items: center;
  361. width: 15rpx;
  362. height: 15rpx;
  363. }
  364. text {
  365. margin-left: 15rpx;
  366. color: #000000;
  367. font-family: "PingFang SC";
  368. font-size: 28rpx;
  369. font-style: normal;
  370. font-weight: 400;
  371. line-height: 18.5px;
  372. }
  373. }
  374. .right {
  375. display: flex;
  376. justify-content: space-between;
  377. align-items: center;
  378. border-radius: 15rpx;
  379. background-color: #ffffff;
  380. padding: 6rpx 20rpx;
  381. image {
  382. display: flex;
  383. justify-content: center;
  384. align-items: center;
  385. width: 40rpx;
  386. height: 26.5rpx;
  387. }
  388. text {
  389. margin-left: 10rpx;
  390. color: #6a6a6a;
  391. font-family: "PingFang SC";
  392. font-size: 18rpx;
  393. font-style: normal;
  394. font-weight: 400;
  395. line-height: 24rpx;
  396. }
  397. }
  398. }
  399. .content {
  400. .contentTitle {
  401. display: flex;
  402. color: #6a6a6a;
  403. font-family: "PingFang SC";
  404. font-size: 11px;
  405. font-style: normal;
  406. font-weight: 400;
  407. line-height: 14.5px;
  408. margin-top: 24rpx;
  409. margin-bottom: 20rpx;
  410. .contentTitle_name {
  411. width: 100rpx;
  412. }
  413. .contentTitle_close {
  414. width: 130rpx;
  415. margin-left: 260rpx;
  416. }
  417. .contentTitle_price {
  418. width: 120rpx;
  419. margin-left: 60rpx;
  420. }
  421. }
  422. .contentItem {
  423. .row {
  424. display: flex;
  425. box-shadow: 0 -2rpx 5rpx rgba(0, 0, 0, 0.05);
  426. padding: 10rpx 0;
  427. margin-bottom: 10rpx;
  428. .nameItem {
  429. width: 260rpx;
  430. white-space: nowrap;
  431. overflow: hidden;
  432. text-overflow: ellipsis;
  433. color: #000000;
  434. font-family: "PingFang SC";
  435. font-size: 13px;
  436. font-style: normal;
  437. font-weight: 400;
  438. line-height: 17.5px;
  439. }
  440. .closeItem {
  441. width: 120rpx;
  442. margin-left: 100rpx;
  443. color: #25ba5d;
  444. font-family: "PingFang SC";
  445. font-size: 13px;
  446. font-style: normal;
  447. font-weight: 400;
  448. line-height: 17.5px;
  449. }
  450. .priceItem {
  451. width: 120rpx;
  452. margin-left: 73rpx;
  453. color: #25ba5d;
  454. font-family: "PingFang SC";
  455. font-size: 13px;
  456. font-style: normal;
  457. font-weight: 400;
  458. line-height: 17.5px;
  459. }
  460. }
  461. }
  462. }
  463. }
  464. }
  465. }
  466. .static-footer {
  467. position: fixed;
  468. bottom: 0;
  469. }
  470. }
  471. * {
  472. box-sizing: border-box;
  473. }
  474. </style>