entertainment.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <template>
  2. <view class="all">
  3. <view class="">
  4. <view
  5. class="echart"
  6. id="mychart"
  7. style="width: 750rpx; height: 700rpx"></view>
  8. </view>
  9. <view class="center">
  10. <!-- 左 -->
  11. <view class="le">
  12. <view class="tit">
  13. <view class="ti1">{{$t('enter.u1')}}</view>
  14. <view class="ti2">({{$t('enter.u2')}})</view>
  15. </view>
  16. <view class="he">
  17. <view class="sh">
  18. <view class="he1">
  19. <view class="wen">1</view>
  20. </view>
  21. <view class="he1">
  22. <view class="wen">5</view>
  23. </view>
  24. <view class="he1">
  25. <view class="wen">10</view>
  26. </view>
  27. </view>
  28. <view class="sh">
  29. <view class="he1">
  30. <view class="wen">20</view>
  31. </view>
  32. <view class="he1">
  33. <view class="wen">50</view>
  34. </view>
  35. <view class="he1">
  36. <view class="wen">100</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="yi">
  41. <view class="">
  42. <image
  43. class="img"
  44. src="../../static/icon/le.png"
  45. mode=""></image>
  46. </view>
  47. <view class="">
  48. <view class="wz">TRX</view>
  49. </view>
  50. <view class="">
  51. <view class="qx">10203009期</view>
  52. </view>
  53. </view>
  54. <view class="shu">
  55. <view class="">0.064489</view>
  56. </view>
  57. </view>
  58. <!--右 -->
  59. <view class="ri">
  60. <view class="ti">
  61. <view class="t1">{{$t('enter.u3')}}</view>
  62. <view class="t2">60{{$t('enter.u19')}}</view>
  63. <view class="">
  64. <image
  65. class="ima"
  66. src="../../static/icon/jt.png"
  67. mode=""></image>
  68. </view>
  69. </view>
  70. <view class="dh">
  71. <view class="te">1</view>
  72. </view>
  73. <view class="btn">
  74. <view class="bt">
  75. <view class="btnle">
  76. <view class="ble">
  77. <image
  78. class="imag"
  79. src="../../static/icon/xia.png"
  80. mode=""></image>
  81. <view class="xia">{{$t('enter.u4')}}</view>
  82. </view>
  83. </view>
  84. <view class="btnri">
  85. <view class="ble">
  86. <image
  87. class="imag"
  88. src="../../static/icon/shang.png"
  89. mode=""></image>
  90. <view class="xia">{{$t('enter.u6')}}</view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="bt">
  95. <view class="btnle">
  96. <view class="ble">
  97. <view class="xia">{{$t('enter.u5')}}</view>
  98. </view>
  99. </view>
  100. <view class="btnri">
  101. <view class="ble">
  102. <view class="xia">{{$t('enter.u7')}}</view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="db">
  108. <view class="jl">{{$t('enter.u8')}}</view>
  109. <view class="sj">
  110. <view class="">00</view>
  111. </view>
  112. <view class="sj">
  113. <view class="">00</view>
  114. </view>
  115. <view class="sj">
  116. <view class="">52</view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="kb"></view>
  122. <view class="last">
  123. <view class="yi">
  124. <view class="dd">{{$t('enter.u9')}}</view>
  125. <view
  126. class="aa"
  127. @click="nav">
  128. <view class="ls">{{$t('enter.u10')}}</view>
  129. <view class="lb">
  130. <image
  131. class="lb"
  132. src="../../static/icon/jt.png"
  133. mode=""></image>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="bg">
  139. <view class="biaotou">
  140. <view class="biwe">{{$t('enter.u11')}}</view>
  141. <view class="biwe1">{{$t('enter.u12')}}</view>
  142. <view class="biwe2">{{$t('enter.u13')}}</view>
  143. <view class="biwe3">{{$t('enter.u14')}}</view>
  144. </view>
  145. </view>
  146. <view
  147. class="neirong"
  148. v-for="item in 3"
  149. :key="item">
  150. <view class="nr1">
  151. <view class="tr">TRX</view>
  152. <view class="wf">{{$t('enter.u20')}}</view>
  153. <view class="">
  154. <image
  155. class="zz"
  156. src="../../static/icon/shang.png"
  157. mode=""></image>
  158. </view>
  159. </view>
  160. <view class="nr2">23.5000</view>
  161. <view class="nr2">23.5000</view>
  162. <view class="fil">
  163. <view class="wanc">
  164. <view class="wc">{{$t('enter.u17')}}</view>
  165. </view>
  166. <view class="xiangq">
  167. <view class="xq">{{$t('enter.u18')}}</view>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="chz">
  172. <view class="ye">
  173. <view class="yue">{{$t('enter.u15')}}</view>
  174. <view class="yes">2955.3000U</view>
  175. </view>
  176. <view
  177. class="chong"
  178. @click="navC">
  179. <view class="quc">{{$t('enter.u16')}}</view>
  180. <view class="">
  181. <image
  182. class="choz"
  183. src="../../static/icon/jt.png"
  184. mode=""></image>
  185. </view>
  186. </view>
  187. </view>
  188. <view class="aaa"></view>
  189. <taber tab='entertainment'></taber>
  190. </view>
  191. </template>
  192. <script>
  193. import * as echarts from "echarts";
  194. import { getGame, SZlineData } from "@/api/game.js";
  195. import taber from "@/components/footer/footer.vue";
  196. export default {
  197. components: {
  198. taber
  199. },
  200. data() {
  201. return {
  202. data: [
  203. [20, 34, 10, 38], //今开、当前价格、最低价格、最高价
  204. [40, 35, 30, 50],
  205. [31, 38, 33, 44],
  206. [38, 15, 5, 42],
  207. [28, 20, 15, 40],
  208. [18, 15, 25, 52],
  209. [48, 15, 45, 12],
  210. [28, 20, 15, 40],
  211. [28, 20, 15, 40],
  212. [28, 20, 15, 40],
  213. ],
  214. include_function: {
  215. id: '',
  216. name: '',
  217. }
  218. };
  219. },
  220. onLoad() {
  221. // this.SZlineData()
  222. this.getGame();
  223. },
  224. mounted() {
  225. this.initEcharts();
  226. },
  227. methods: {
  228. async getGame() {
  229. try {
  230. const res = await getGame();
  231. this.include_function = res.data.game
  232. console.log('123',this.include_function);
  233. console.log("12312", res);
  234. } catch (error) {
  235. // console.error("请求出错", error);
  236. }
  237. },
  238. // async SZlineData() {
  239. // try {
  240. // const res = await SZlineData();
  241. // console.log('123', res);
  242. // // this.kline =
  243. // } catch (error) {
  244. // console.error('请求出错', error);
  245. // }
  246. // },
  247. // 均值计算
  248. calculateMA(dayCount, data) {
  249. const result = [];
  250. for (let i = 0, len = data.length; i < len; i++) {
  251. if (i < dayCount) {
  252. result.push("-");
  253. continue;
  254. }
  255. let sum = 0;
  256. for (let j = 0; j < dayCount; j++) {
  257. sum += data[i - j][1];
  258. }
  259. // 保留两位小数
  260. result.push((sum / dayCount).toFixed(2));
  261. }
  262. return result;
  263. },
  264. initEcharts() {
  265. const option = {
  266. tooltip: {},
  267. legend: {
  268. top: 30,
  269. data: ["MA5", "MA10", "MA20"],
  270. },
  271. xAxis: {
  272. data: [
  273. "2017-10-24",
  274. "2017-10-25",
  275. "2017-10-26",
  276. "2017-10-27",
  277. "2017-10-28",
  278. "2017-10-29",
  279. "2017-10-30",
  280. "2017-10-30",
  281. "2017-10-30",
  282. "2017-10-30",
  283. "2017-10-30",
  284. ],
  285. },
  286. yAxis: {},
  287. series: [
  288. {
  289. type: "candlestick",
  290. data: this.data,
  291. },
  292. {
  293. name: "MA5",
  294. type: "line",
  295. data: this.calculateMA(5, this.data),
  296. smooth: true,
  297. showSymbol: false,
  298. lineStyle: {
  299. // normal: {
  300. width: 1,
  301. // },
  302. },
  303. },
  304. {
  305. name: "MA10",
  306. type: "line",
  307. data: this.calculateMA(10, this.data),
  308. smooth: true,
  309. showSymbol: false,
  310. lineStyle: {
  311. // normal: {
  312. width: 1,
  313. // },
  314. },
  315. },
  316. {
  317. name: "MA20",
  318. type: "line",
  319. data: this.calculateMA(20, this.data),
  320. smooth: true,
  321. showSymbol: false,
  322. lineStyle: {
  323. // normal: {
  324. width: 1,
  325. // },
  326. },
  327. },
  328. ],
  329. };
  330. const myChart = echarts.init(
  331. document.getElementById("mychart")
  332. );
  333. myChart.setOption(option);
  334. //随着屏幕大小调节图表
  335. window.addEventListener("resize", () => {
  336. myChart.resize();
  337. });
  338. },
  339. // 页面逻辑
  340. nav() {
  341. uni.navigateTo({
  342. url: "/pages/history/history",
  343. });
  344. },
  345. navC() {
  346. uni.navigateTo({
  347. url: "/pages/recharge/recharge",
  348. });
  349. },
  350. },
  351. };
  352. </script>
  353. <style>
  354. .all {
  355. width: 750rpx;
  356. height: 100%;
  357. background-color: #000000;
  358. }
  359. .echart {
  360. background-color: #191a1f;
  361. }
  362. .center {
  363. width: 680rpx;
  364. height: 470rpx;
  365. margin-top: 30rpx;
  366. margin-left: 30rpx;
  367. display: flex;
  368. justify-content: space-between;
  369. }
  370. .tit {
  371. display: flex;
  372. justify-content: start;
  373. }
  374. .ti1 {
  375. height: 24rpx;
  376. font-size: 25rpx;
  377. font-weight: bold;
  378. color: #ffffff;
  379. }
  380. .ti2 {
  381. height: 24rpx;
  382. font-size: 22rpx;
  383. font-weight: bold;
  384. color: #999999;
  385. }
  386. .he1 {
  387. width: 83rpx;
  388. height: 83rpx;
  389. background: #fdaf41;
  390. border-radius: 10rpx;
  391. margin-top: 36rpx;
  392. margin-right: 21rpx;
  393. }
  394. .wen {
  395. height: 22rpx;
  396. font-size: 30rpx;
  397. font-weight: 800;
  398. color: #000000;
  399. line-height: 70rpx;
  400. text-align: center;
  401. }
  402. .sh {
  403. display: flex;
  404. justify-content: start;
  405. }
  406. .yi {
  407. display: flex;
  408. justify-content: start;
  409. margin-top: 53rpx;
  410. }
  411. .img {
  412. width: 41rpx;
  413. height: 42rpx;
  414. }
  415. .wz {
  416. height: 22rpx;
  417. font-size: 29rpx;
  418. font-weight: bold;
  419. color: #ffffff;
  420. margin-left: 7rpx;
  421. }
  422. .qx {
  423. height: 24rpx;
  424. font-size: 28rpx;
  425. font-weight: 500;
  426. color: #ffffff;
  427. margin-left: 10rpx;
  428. }
  429. .shu {
  430. height: 39rpx;
  431. font-size: 51rpx;
  432. font-weight: bold;
  433. color: #fdb242;
  434. }
  435. .ti {
  436. display: flex;
  437. justify-content: start;
  438. }
  439. .t1 {
  440. height: 24rpx;
  441. font-size: 26rpx;
  442. font-weight: bold;
  443. color: #ffffff;
  444. margin-left: 90rpx;
  445. }
  446. .t2 {
  447. height: 24rpx;
  448. font-size: 26rpx;
  449. font-weight: bold;
  450. color: #fdaf41;
  451. margin-left: 19rpx;
  452. }
  453. .ima {
  454. width: 16rpx;
  455. height: 10rpx;
  456. margin-left: 15rpx;
  457. }
  458. .dh {
  459. width: 322rpx;
  460. height: 83rpx;
  461. background: #efefef;
  462. border-radius: 10rpx;
  463. margin-top: 25rpx;
  464. }
  465. .te {
  466. text-align: center;
  467. height: 32rpx;
  468. font-size: 44rpx;
  469. font-weight: 800;
  470. color: #000000;
  471. line-height: 70rpx;
  472. }
  473. .btn {
  474. width: 322rpx;
  475. height: 160rpx;
  476. margin-top: 30rpx;
  477. }
  478. .bt {
  479. display: flex;
  480. justify-content: start;
  481. }
  482. .btnle {
  483. width: 157rpx;
  484. height: 72rpx;
  485. border: 1rpx solid;
  486. border-radius: 50rpx 0 0 50rpx;
  487. background-color: #df5660;
  488. margin-top: 10rpx;
  489. }
  490. .ble {
  491. display: flex;
  492. justify-content: center;
  493. }
  494. .imag {
  495. width: 32rpx;
  496. height: 20rpx;
  497. margin-top: 25rpx;
  498. }
  499. .xia {
  500. height: 25rpx;
  501. font-size: 28rpx;
  502. font-weight: 800;
  503. color: #ffffff;
  504. line-height: 70rpx;
  505. }
  506. .btnri {
  507. width: 157rpx;
  508. height: 72rpx;
  509. border: 1rpx solid;
  510. border-radius: 0 50rpx 50rpx 0;
  511. background-color: #5bb786;
  512. margin-left: 10rpx;
  513. margin-top: 10rpx;
  514. }
  515. .db {
  516. display: flex;
  517. justify-content: start;
  518. }
  519. .jl {
  520. height: 23rpx;
  521. font-size: 24rpx;
  522. font-weight: 400;
  523. color: #999999;
  524. margin-top: 45rpx;
  525. }
  526. .sj {
  527. width: 41rpx;
  528. height: 39rpx;
  529. background: #bfbfbf;
  530. border-radius: 3rpx;
  531. margin-left: 15rpx;
  532. margin-top: 42rpx;
  533. }
  534. .kb {
  535. width: 750rpx;
  536. height: 20rpx;
  537. background-color: #191a1f;
  538. }
  539. .last {
  540. width: 680rpx;
  541. height: 40rpx;
  542. background-color: #000000;
  543. display: flex;
  544. justify-content: start;
  545. margin-left: 32rpx;
  546. }
  547. .dd {
  548. height: 23rpx;
  549. font-size: 24rpx;
  550. font-weight: 800;
  551. color: #fff;
  552. line-height: 30rpx;
  553. }
  554. .aa {
  555. display: flex;
  556. justify-content: start;
  557. }
  558. .ls {
  559. height: 23rpx;
  560. font-size: 24rpx;
  561. font-weight: 800;
  562. color: #fff;
  563. line-height: 30rpx;
  564. margin-left: 460rpx;
  565. }
  566. .lb image {
  567. width: 14rpx;
  568. height: 20rpx;
  569. color: #fff;
  570. margin-left: 10rpx;
  571. }
  572. .bg {
  573. width: 680rpx;
  574. height: 120rpx;
  575. background-color: #000000;
  576. display: flex;
  577. justify-content: space-between;
  578. margin-left: 30rpx;
  579. margin-top: 30rpx;
  580. }
  581. .biaotou {
  582. display: flex;
  583. justify-content: center;
  584. margin-top: 40rpx;
  585. }
  586. .biwe {
  587. height: 27rpx;
  588. font-size: 28rpx;
  589. font-weight: 800;
  590. color: #fff;
  591. }
  592. .biwe1 {
  593. height: 27rpx;
  594. font-size: 28rpx;
  595. font-weight: 800;
  596. color: #fff;
  597. padding-left: 100rpx;
  598. }
  599. .biwe2 {
  600. height: 27rpx;
  601. font-size: 28rpx;
  602. font-weight: 800;
  603. color: #fff;
  604. padding-left: 90rpx;
  605. }
  606. .biwe3 {
  607. height: 27rpx;
  608. font-size: 28rpx;
  609. font-weight: 800;
  610. color: #fff;
  611. padding-left: 43rpx;
  612. }
  613. .neirong {
  614. display: flex;
  615. justify-content: start;
  616. width: 700rpx;
  617. height: 70rpx;
  618. margin-left: 32rpx;
  619. }
  620. .nr1 {
  621. display: flex;
  622. justify-content: start;
  623. }
  624. .tr {
  625. height: 21rpx;
  626. font-size: 28rpx;
  627. font-weight: 800;
  628. color: #ffffff;
  629. line-height: 30rpx;
  630. }
  631. .wf {
  632. height: 17rpx;
  633. font-size: 18rpx;
  634. font-weight: 800;
  635. color: #999999;
  636. line-height: 30rpx;
  637. margin-left: 8rpx;
  638. }
  639. .zz {
  640. width: 22rpx;
  641. height: 14rpx;
  642. color: #5bb786;
  643. margin-left: 8rpx;
  644. }
  645. .nr2 {
  646. height: 20rpx;
  647. font-size: 26rpx;
  648. font-weight: bold;
  649. color: #ffffff;
  650. line-height: 30rpx;
  651. margin-left: 45rpx;
  652. }
  653. .wanc {
  654. width: 111rpx;
  655. height: 31rpx;
  656. background: #25b287;
  657. border-radius: 16rpx;
  658. margin-left: 20rpx;
  659. }
  660. .wc {
  661. height: 16rpx;
  662. font-size: 16rpx;
  663. font-weight: bold;
  664. color: #ffffff;
  665. line-height: 30rpx;
  666. text-align: center;
  667. }
  668. .fil {
  669. display: flex;
  670. justify-content: start;
  671. }
  672. .xiangq {
  673. width: 103rpx;
  674. height: 31rpx;
  675. background: #01ebf6;
  676. border-radius: 16rpx;
  677. margin-left: 10rpx;
  678. }
  679. .xq {
  680. height: 16rpx;
  681. font-size: 16rpx;
  682. font-weight: bold;
  683. color: #000000;
  684. line-height: 30rpx;
  685. text-align: center;
  686. }
  687. .chz {
  688. width: 687rpx;
  689. height: 126rpx;
  690. background: #191a1f;
  691. border-radius: 20rpx;
  692. margin-left: 32rpx;
  693. margin-top: 40rpx;
  694. display: flex;
  695. justify-content: start;
  696. }
  697. .yue {
  698. height: 27rpx;
  699. font-size: 28rpx;
  700. font-weight: bold;
  701. color: #ffffff;
  702. margin-left: 31rpx;
  703. padding-top: 27rpx;
  704. }
  705. .yes {
  706. height: 27rpx;
  707. font-size: 35rpx;
  708. font-weight: bold;
  709. color: #fdaf41;
  710. margin-left: 32rpx;
  711. margin-top: 40rpx;
  712. }
  713. .chong {
  714. display: flex;
  715. justify-content: start;
  716. }
  717. .quc {
  718. height: 24rpx;
  719. font-size: 26rpx;
  720. font-weight: 500;
  721. color: #ffffff;
  722. margin-top: 51rpx;
  723. margin-left: 306rpx;
  724. }
  725. .choz {
  726. width: 22rpx;
  727. height: 14rpx;
  728. margin-top: 62rpx;
  729. }
  730. .aaa {
  731. width: 750rpx;
  732. height: 30rpx;
  733. background-color: #000000;
  734. }
  735. </style>