entertainment.vue 14 KB

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