entertainment.vue 14 KB

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