entertainment.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. <template>
  2. <view class="all">
  3. <view class="padding-t-30"></view>
  4. <view class="tab">
  5. <view class="flex-start">
  6. <view class="tab-item " @click="changeTab(item,ind)" :class="{action:actionIndex==ind}"
  7. v-for="(item,ind) in gameList">
  8. {{item.name}}
  9. </view>
  10. </view>
  11. <l-echart class="top" ref="chart"></l-echart>
  12. </view>
  13. <view class="center flex">
  14. <!-- 左 -->
  15. <view class="le">
  16. <view class="tit flex-start">
  17. <view class="ti1">{{$t('enter.u1')}}</view>
  18. <view class="ti2">({{$t('enter.u2')}} {{history.base.max_bet*1}}U)</view>
  19. </view>
  20. <view class="he">
  21. <view class="numbox flex-start">
  22. <view class="he1 flex" @click="upOnBtnData.value=it" v-for="it in arMoneyList">
  23. <view class="wen">{{it}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="yi flex-start">
  28. <!-- <image class="img" src="../../static/icon/le.png" mode=""></image> -->
  29. <view class="wz padding-l-10">{{history.base.token}}</view>
  30. <view class="qx padding-l-10" v-if="history.next.id">{{history.next.no}}</view>
  31. </view>
  32. <view class="shu">
  33. {{KlineList.c*1}}
  34. </view>
  35. </view>
  36. <!--右 -->
  37. <view class="ri">
  38. <view class="ti flex-center">
  39. <view class="t1">{{$t('enter.u3')}}</view>
  40. <view class="t2 padding-l-10">{{history.base.timebar}}</view>
  41. </view>
  42. <view class="dh">
  43. <input class="input" :placeholder="'USDT'+$t('enter.a9')" type="number" v-model="upOnBtnData.value">
  44. </view>
  45. <view class="btn">
  46. <view class="bt flex">
  47. <view class="btnItem btnle" @click="onPayBet(2)">
  48. <image class="imag" src="../../static/icon/xia.png" mode=""></image>
  49. <text class="xia">{{$t('enter.u4')}}</text>
  50. </view>
  51. <view class="btnItem btnri" @click="onPayBet(1)">
  52. <image class="imag" src="../../static/icon/shang.png" mode=""></image>
  53. <text class="xia">{{$t('enter.u6')}}</text>
  54. </view>
  55. </view>
  56. <view class="bt flex">
  57. <view class="btnItem btnle" @click="onPayBet(3)">
  58. <view class="xia">{{$t('enter.u5')}}</view>
  59. </view>
  60. <view class="btnItem btnri" @click="onPayBet(4)">
  61. <view class="xia">{{$t('enter.u7')}}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="db flex">
  66. <view class="jl">{{$t('enter.u8')}}</view>
  67. <view class="sj">
  68. <text v-if="time.H<10">0</text>
  69. {{time.H}}
  70. </view>
  71. <view class="sj">
  72. <text v-if="time.M<10">0</text>
  73. {{time.M}}
  74. </view>
  75. <view class="sj">
  76. <text v-if="time.S<10">0</text>
  77. {{time.S}}
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="kb"></view>
  83. <view class="last">
  84. <view class="flex">
  85. <text>{{$t('enter.u9')}}</text>
  86. <view class="flex" @click="nav(`/pages/game/history?id=${history.base.id}`)">
  87. <text>{{$t('enter.u10')}}</text>
  88. <image class="lb" src="../../static/icon/jt.png" mode="scaleToFill"></image>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="bg">
  93. <view class="biaotou flex">
  94. <view class="biwe">{{$t('enter.u11')}}</view>
  95. <view class="biwe">{{$t('enter.u12')}}</view>
  96. <view class="biwe">{{$t('enter.u13')}}</view>
  97. <view class="biwe">{{$t('enter.u14')}}</view>
  98. </view>
  99. <view class="list flex" v-for="(item,ind) in betList.list" :key="ind">
  100. <view class="biwe flex-start">
  101. <view class="tr">{{history.base.token}}</view>
  102. <view class="nametip">{{history.base.timebar}}</view>
  103. <image v-if="item.bet==1" class="zz" src="../../static/icon/shang.png" mode="scaleToFill"></image>
  104. <image v-if="item.bet==2" class="zz" src="../../static/icon/xia.png" mode="scaleToFill"></image>
  105. <view v-if="item.bet==3" class="nametip red">{{$t('enter.u5')}}</view>
  106. <view v-if="item.bet==4" class="nametip green">{{$t('enter.u7')}}</view>
  107. </view>
  108. <view class="biwe">{{item.num*1}}</view>
  109. <view class="biwe">{{item.get-item.num}}</view>
  110. <view class="biwe flex-center">
  111. <view v-if="item.status==1" class="list-buttom success margin-r-10">
  112. {{$t('enter.u17')}}
  113. </view>
  114. <view class="list-buttom primary" @click="alertDetailOpen(item)">
  115. {{$t('enter.u18')}}
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="chz flex" @click="nav('/pages/user/money/recharge')">
  121. <view>
  122. <view class="yue padding-b-10">{{$t('enter.u15')}}</view>
  123. <view class="yes">{{userWallet}}U</view>
  124. </view>
  125. <view class="flex-start">
  126. <view class="quc">{{$t('enter.u16')}}</view>
  127. <image class="choz" src="../../static/icon/jt.png" mode="scaleToFill"></image>
  128. </view>
  129. </view>
  130. <uni-popup type="bottom" ref="popup" :mask-click="false" @maskClick='colsePayPassword'>
  131. <view class="page">
  132. <view>
  133. <view class="pay-title">
  134. <text>{{$t('enter.b3')}}</text>
  135. </view>
  136. <view class="pay-password" @click="onPayUp">
  137. <view class="list" v-for="item in 6">
  138. <text v-show="upOnBtnData.passwordArr.length >= item">●</text>
  139. </view>
  140. </view>
  141. <view class="hint">
  142. <text @click="nav('/pages/user/set/transaction')">忘记支付密码?</text>
  143. </view>
  144. </view>
  145. <cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo"
  146. :viewShow="true"></cc-defineKeyboard>
  147. </view>
  148. </uni-popup>
  149. <uni-popup type="center" ref="popupDetail">
  150. <view class="alert-detail">
  151. <view class="padding-c-30 padding-t-30 padding-b-30">
  152. <view class="flex">
  153. <view class="type">
  154. {{$t('gameList.a5')}}
  155. </view>
  156. <view class="num">
  157. {{getTime(alertDetail.ts)}}
  158. </view>
  159. </view>
  160. <view class="flex">
  161. <view class="type">
  162. open
  163. </view>
  164. <view class="num">
  165. {{alertDetail.o*1}}
  166. </view>
  167. </view>
  168. <view class="flex">
  169. <view class="type">
  170. close
  171. </view>
  172. <view class="num">
  173. {{alertDetail.c*1}}
  174. </view>
  175. </view>
  176. <view class="flex">
  177. <view class="type">
  178. lowest
  179. </view>
  180. <view class="num">
  181. {{alertDetail.l*1}}
  182. </view>
  183. </view>
  184. <view class="flex">
  185. <view class="type">
  186. highest
  187. </view>
  188. <view class="num">
  189. {{alertDetail.h*1}}
  190. </view>
  191. </view>
  192. </view>
  193. <button class="button" type="default" @click="$refs.popupDetail.close()"><text
  194. class="button-text">关闭</text></button>
  195. </view>
  196. </uni-popup>
  197. <taber tab='entertainment' v-if="!upOnBtnData.show"></taber>
  198. </view>
  199. </template>
  200. <script>
  201. import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
  202. import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
  203. import {
  204. getGame,
  205. gameKline,
  206. getGameList,
  207. gameWallet,
  208. gameBetList,
  209. gameBetIn
  210. } from "@/api/game.js";
  211. import {
  212. mapState,
  213. mapMutations
  214. } from 'vuex';
  215. import {
  216. saveUrl,
  217. interceptor
  218. } from '@/utils/loginUtils.js';
  219. import taber from "@/components/footer/footer.vue";
  220. import {
  221. getTime
  222. } from '@/utils/rocessor.js';
  223. import {
  224. clearInterval,
  225. setInterval
  226. } from 'timers';
  227. export default {
  228. components: {
  229. taber,
  230. LEchart
  231. },
  232. computed: {
  233. ...mapState("user", ["hasLogin"]),
  234. },
  235. data() {
  236. return {
  237. arMoneyList: [
  238. 1, 5, 10, 20, 50, 100
  239. ],
  240. actionIndex: 0,
  241. // 当前游戏列表
  242. gameList: [],
  243. // 游戏信息
  244. history: {
  245. list: [], //游戏进行记录
  246. page: 1,
  247. limit: 10,
  248. // 基础数据
  249. base: {},
  250. next: "",
  251. now: {}
  252. },
  253. time: {
  254. H: 0,
  255. M: 0,
  256. S: 0,
  257. // 保存倒计时对象
  258. t: ''
  259. },
  260. // 游戏押注记录
  261. betList: {
  262. list: [], //游戏进行记录
  263. page: 1,
  264. limit: 10,
  265. },
  266. userWallet: 0,
  267. // 当前最新K线数据
  268. KlineList: {
  269. c: ''
  270. },
  271. upOnBtnData: {
  272. // 是否显示底部导航栏
  273. show: false,
  274. type: '',
  275. // 当前输入的密码
  276. passwordArr: [],
  277. value: '',
  278. },
  279. // 弹窗数据像晴
  280. alertDetail: {
  281. },
  282. // 保存获取下次游戏对象
  283. getNextTimeObj: ''
  284. };
  285. },
  286. onLoad() {},
  287. onShow() {
  288. if (!this.hasLogin) {
  289. uni.showModal({
  290. title: this.$t('enter.c4'),
  291. content: this.$t('enter.b5'),
  292. success: (e) => {
  293. // 判断是否点击确认按钮
  294. if (e.confirm) {
  295. // 保存当前页面地址
  296. saveUrl()
  297. // 跳转页面
  298. interceptor()
  299. }
  300. }
  301. })
  302. return
  303. }
  304. this.getUserWallet();
  305. this.gameInit();
  306. },
  307. // 关闭循环
  308. onHide() {
  309. // 倒计时清理
  310. this.initData();
  311. },
  312. methods: {
  313. getTime,
  314. // 弹窗详情
  315. alertDetailOpen(item) {
  316. console.log(item);
  317. this.alertDetail = item.room.result_info;
  318. this.$refs.popupDetail.open();
  319. },
  320. // 倒计时清理
  321. initData() {
  322. const that = this
  323. // 关闭倒计时
  324. clearInterval(that.getNextTimeObj);
  325. clearInterval(that.time.t);
  326. // 清空倒计时对象
  327. that.getNextTimeObj = '';
  328. this.time = {
  329. H: 0,
  330. M: 0,
  331. S: 0,
  332. t: ''
  333. };
  334. },
  335. // 点击触发支付事件
  336. onPayBet(type) {
  337. if (!this.upOnBtnData.value) {
  338. uni.showToast({
  339. title: this.$t('enter.a9'),
  340. icon: "error"
  341. })
  342. return
  343. }
  344. if (!this.history.next) {
  345. uni.showModal({
  346. title: this.$t('enter.c4'),
  347. content: "活动未开启,请等待活动开启",
  348. showCancel: false,
  349. });
  350. return
  351. }
  352. this.upOnBtnData.type = type;
  353. this.openPayPassword();
  354. },
  355. // 打开支付弹窗
  356. openPayPassword() {
  357. this.upOnBtnData.show = true;
  358. this.$refs.popup.open();
  359. },
  360. // 关闭支付弹窗
  361. colsePayPassword() {
  362. this.upOnBtnData.show = false;
  363. this.$refs.popup.close();
  364. },
  365. KeyInfo(val) {
  366. console.log(val);
  367. let arr = this.upOnBtnData.passwordArr;
  368. if (val.index >= 6) {
  369. return;
  370. }
  371. // 判断是否输入的是删除键
  372. if (val.keyCode === 8) {
  373. // 删除最后一位
  374. arr.splice(val.index + 1, 1)
  375. }
  376. // 判断是否输入的是取消案件
  377. else if (val.keyCode == 190) {
  378. this.colsePayPassword();
  379. // 输入.无效
  380. } else {
  381. arr.push(val.key);
  382. }
  383. // 开始交易
  384. if (arr.length == 6) {
  385. this.colsePayPassword();
  386. this.gameBetIn();
  387. }
  388. },
  389. // 参与压住
  390. gameBetIn(type) {
  391. const that = this;
  392. const upData = {
  393. id: that.history.next.id,
  394. bet: that.upOnBtnData.type,
  395. num: that.upOnBtnData.value,
  396. trade_password: that.upOnBtnData.passwordArr.join("")
  397. };
  398. this.upOnBtnData.passwordArr = [];
  399. uni.showLoading({
  400. mask: true
  401. })
  402. that.upOnBtnData.value = '';
  403. gameBetIn(upData).then((res) => {
  404. uni.hideLoading()
  405. uni.showToast({
  406. title: res.msg
  407. });
  408. that.gameBetList();
  409. }).catch((res) => {
  410. uni.hideLoading();
  411. uni.showToast({
  412. title: res.msg
  413. });
  414. })
  415. },
  416. // 获取用户余额信息
  417. getUserWallet() {
  418. gameWallet().then((res) => {
  419. this.userWallet = +res.data.back.USDT.money.money
  420. })
  421. },
  422. // 开始倒计时
  423. async opTiem() {
  424. const that = this;
  425. try {
  426. console.log('kaishidaojishi');
  427. // 关闭循环
  428. // if (that.time.t) {
  429. // clearInterval(that.time.t);
  430. // }
  431. // 判斷是否有游戲信息并且有正在進行中游戏
  432. if (that.history.base.id && that.history.next) {
  433. console.log(that.history.base.id, that.history.next,
  434. 'that.history.base.id && that.history.next');
  435. that.time.t = setInterval(() => {
  436. that.getOutTime();
  437. }, 1000)
  438. }
  439. } catch (e) {
  440. console.log(e, '定时');
  441. }
  442. },
  443. // 获取倒计时时间
  444. getOutTime() {
  445. console.log('计算');
  446. const that = this;
  447. const da = (new Date()).getTime();
  448. const timenum = that.history.next.open_time * 1000 - da;
  449. console.log(timenum, that.history.next.open_time, da, '计算');
  450. if (timenum > 0) {
  451. that.time.H = Math.floor(timenum / 1000 / 60 / 60);
  452. that.time.S = Math.floor(timenum / 1000 % 60)
  453. that.time.M = Math.floor(timenum / 1000 / 60 % 60);
  454. }
  455. if (that.time.H == 0 && that.time.M == 0 && that.time.S == 0) {
  456. console.log('归0');
  457. clearInterval(that.time.t);
  458. // 延时调用防止数据重复加载
  459. setTimeout(() => {
  460. that.getGame(that.history.base.id)
  461. that.getGameKline();
  462. }, 2000)
  463. }
  464. },
  465. changeTab(item, ind) {
  466. const that = this;
  467. if (ind != this.actionIndex) {
  468. that.actionIndex = ind;
  469. // 清理倒计时
  470. that.initData();
  471. // 重新加载数据
  472. that.gameDataInit(item.id);
  473. }
  474. },
  475. // 初始化
  476. async gameInit() {
  477. // 获取游戏列表
  478. await this.getGameList();
  479. // 加载游戏数据
  480. this.gameDataInit(this.history.base.id || this.gameList[0].id)
  481. },
  482. // 加载游戏列表
  483. getGameList() {
  484. return getGameList().then((res) => {
  485. this.gameList = res.data.list;
  486. // console.log('1111111111',this.gameList);
  487. })
  488. },
  489. // 重新加载基础游戏信息
  490. async gameDataInit(id, reload = true) {
  491. // 获取基础信息
  492. await this.getGame(id);
  493. //获取K线
  494. this.getGameKline(reload);
  495. // 获取游戏压住记录
  496. this.gameBetList();
  497. },
  498. // 获取游戏压住记录
  499. gameBetList() {
  500. gameBetList({
  501. page: 1,
  502. limit: 10,
  503. id: this.history.base.id,
  504. }).then((res) => {
  505. this.betList.list = res.data.bet_log;
  506. })
  507. },
  508. // 获取游戏K线信息
  509. getGameKline(reload = true) {
  510. const that = this;
  511. gameKline({
  512. page: 1,
  513. limit: 60
  514. }, that.history.base.id).then((res) => {
  515. that.KlineList = res.data.list[0];
  516. let list = res.data.list.reverse();
  517. // x轴记录
  518. let xarr = [];
  519. // 打点数据
  520. let linearr = [];
  521. for (let i = 0; i < list.length; i++) {
  522. const ll = list[i];
  523. const time = new Date(+ll.ts);
  524. const addar = [+(+ll.o).toFixed(5), +(+ll.c).toFixed(5), +(+ll.l).toFixed(5), +(+ll.h)
  525. .toFixed(5)
  526. ];
  527. xarr.push(`${time.getHours()}:${time.getMinutes()}`)
  528. linearr.push(addar)
  529. }
  530. that.$nextTick(() => {
  531. // 判断是否要重载数据
  532. that.initKline({
  533. xarr,
  534. linearr
  535. }, reload)
  536. })
  537. })
  538. },
  539. // 获取当前项目信息
  540. getGame(id) {
  541. const that = this;
  542. return getGame({
  543. page: that.history.page,
  544. limit: that.history.limit
  545. }, id).then(({
  546. data
  547. }) => {
  548. that.history.list = data.list || [];
  549. that.history.base = data.game || {};
  550. that.history.next = data.next_game || '';
  551. that.history.now = data.now_game || '';
  552. // 是否不存在启动中的活动并判断防止重复调用创建倒计时
  553. if (!that.history.next && !that.getNextTimeObj) {
  554. that.getNextTimeObj = setInterval(() => {
  555. that.getGame(id)
  556. }, 1000)
  557. return
  558. }
  559. if (that.history.next && that.getNextTimeObj) {
  560. clearInterval(that.getNextTimeObj);
  561. // 清空倒计时对象
  562. that.getNextTimeObj = '';
  563. }
  564. // 判断是否有活动并且正在进行中
  565. if (that.history.next && !that.getNextTimeObj) {
  566. that.opTiem();
  567. }
  568. })
  569. },
  570. // 均值计算
  571. calculateMA(dayCount, data) {
  572. var result = [];
  573. for (var i = 0, len = data.linearr.length; i < len; i++) {
  574. if (i < dayCount) {
  575. result.push('-');
  576. continue;
  577. }
  578. var sum = 0;
  579. for (var j = 0; j < dayCount; j++) {
  580. sum += data.linearr[i - j][1];
  581. }
  582. result.push(+(sum / dayCount).toFixed(5));
  583. }
  584. return result;
  585. },
  586. // 重载K线
  587. async initKline(data, reload = true) {
  588. const that = this;
  589. try {
  590. const chart = await this.$refs.chart.init(echarts);
  591. if (reload) {
  592. const upColor = '#00da3c';
  593. const downColor = '#ec0000';
  594. chart.setOption(
  595. (this.option = {
  596. animation: false,
  597. legend: {
  598. top: 10,
  599. left: 10,
  600. data: ['MA5', 'MA10', 'MA20'],
  601. textStyle: {
  602. color: '#999999'
  603. }
  604. },
  605. tooltip: {
  606. trigger: 'axis',
  607. axisPointer: {
  608. type: 'cross'
  609. },
  610. borderWidth: 1,
  611. borderColor: '#ccc',
  612. padding: 10,
  613. textStyle: {
  614. color: '#000'
  615. },
  616. position: function(pos, params, el, elRect, size) {
  617. const obj = {
  618. top: 10
  619. };
  620. obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 40;
  621. return obj;
  622. }
  623. },
  624. dataZoom: [{
  625. type: 'inside',
  626. xAxisIndex: 0,
  627. start: 50,
  628. end: 100
  629. }],
  630. grid: [{
  631. left: 10,
  632. right: 55,
  633. bottom: 20,
  634. top: 45
  635. }],
  636. xAxis: [{
  637. type: 'category',
  638. data: data.xarr,
  639. axisLine: {
  640. onZero: false
  641. },
  642. splitLine: {
  643. show: false
  644. },
  645. min: 'dataMin',
  646. max: 'dataMax',
  647. axisPointer: {
  648. z: 100
  649. }
  650. }],
  651. yAxis: [{
  652. scale: true,
  653. splitNumber: 4,
  654. position: 'right',
  655. axisTick: {
  656. show: false
  657. },
  658. splitLine: {
  659. show: false,
  660. lineStyle: {
  661. color: '#e3e3e3'
  662. }
  663. },
  664. axisLabel: {
  665. inside: false,
  666. formatter: '{value}\n',
  667. color: '#999999'
  668. }
  669. }],
  670. series: [{
  671. name: that.history.base.token + '-USDT',
  672. type: 'candlestick',
  673. data: data.linearr,
  674. itemStyle: {
  675. color: upColor,
  676. color0: downColor,
  677. borderColor: undefined,
  678. borderColor0: undefined
  679. }
  680. },
  681. {
  682. name: "MA5",
  683. smooth: true,
  684. type: 'line',
  685. data: that.calculateMA(5, data),
  686. showSymbol: false,
  687. lineStyle: {
  688. width: 1
  689. }
  690. },
  691. {
  692. name: "MA10",
  693. smooth: true,
  694. type: 'line',
  695. data: that.calculateMA(10, data),
  696. showSymbol: false,
  697. lineStyle: {
  698. width: 1
  699. }
  700. },
  701. {
  702. name: "MA20",
  703. smooth: true,
  704. type: 'line',
  705. data: that.calculateMA(20, data),
  706. showSymbol: false,
  707. lineStyle: {
  708. width: 1
  709. }
  710. },
  711. ]
  712. }),
  713. true
  714. )
  715. } else {
  716. chart.setOption({
  717. xAxis: [{
  718. type: 'category',
  719. data: data.xarr,
  720. }],
  721. series: [{
  722. name: that.history.base.token + '-USDT',
  723. data: data.linearr,
  724. },
  725. {
  726. name: "MA5",
  727. data: that.calculateMA(5, data),
  728. },
  729. {
  730. name: "MA10",
  731. data: that.calculateMA(10, data),
  732. },
  733. {
  734. name: "MA20",
  735. data: that.calculateMA(20, data),
  736. },
  737. ]
  738. })
  739. }
  740. } catch (e) {
  741. console.log(e, 'cuowu');
  742. //TODO handle the exception
  743. }
  744. },
  745. // 页面跳转
  746. nav(url) {
  747. console.log('tz');
  748. if (!this.hasLogin) {
  749. uni.showModal({
  750. title: this.$t('enter.c4'),
  751. content: this.$t('enter.b5'),
  752. success: (e) => {
  753. // 判断是否点击确认按钮
  754. if (e.confirm) {
  755. // 保存当前页面地址
  756. saveUrl()
  757. // 跳转页面
  758. interceptor()
  759. }
  760. }
  761. })
  762. return
  763. }
  764. uni.navigateTo({
  765. url,
  766. fail(err) {
  767. console.log(err);
  768. }
  769. });
  770. },
  771. },
  772. };
  773. </script>
  774. <style lang="scss">
  775. .all {
  776. width: 750rpx;
  777. /* height: 2500rpx; */
  778. height: 100%;
  779. padding-top: var(--status-bar-height);
  780. padding-bottom: 30rpx;
  781. }
  782. $base: orangered; // 基础颜色
  783. .page {
  784. width: 100%;
  785. background-color: #FFFFFF;
  786. .pay-title {
  787. display: flex;
  788. align-items: center;
  789. justify-content: center;
  790. width: 100%;
  791. height: 200rpx;
  792. text {
  793. font-size: 28rpx;
  794. color: #555555;
  795. }
  796. }
  797. .pay-password {
  798. display: flex;
  799. align-items: center;
  800. width: 90%;
  801. height: 80rpx;
  802. margin: 20rpx auto;
  803. border: 2rpx solid $base;
  804. .list {
  805. display: flex;
  806. align-items: center;
  807. justify-content: center;
  808. width: 16.666%;
  809. height: 100%;
  810. border-right: 2rpx solid #EEEEEE;
  811. text {
  812. font-size: 32rpx;
  813. }
  814. }
  815. .list:nth-child(6) {
  816. border-right: none;
  817. }
  818. }
  819. .hint {
  820. display: flex;
  821. align-items: center;
  822. justify-content: center;
  823. width: 100%;
  824. height: 100rpx;
  825. text {
  826. font-size: 28rpx;
  827. color: $base;
  828. }
  829. }
  830. }
  831. .tab {
  832. padding: 30rpx 20rpx;
  833. margin: 0 30rpx;
  834. background-color: #191A1F;
  835. border-radius: 20px;
  836. .tab-item {
  837. color: #FFF;
  838. font-size: $font-sm;
  839. padding: 0 20rpx;
  840. padding-bottom: 10rpx;
  841. &.action {
  842. color: #F5A944;
  843. border-bottom: 1px solid #F5A944;
  844. }
  845. }
  846. .top {
  847. height: 530rpx;
  848. width: 100%;
  849. }
  850. }
  851. .center {
  852. padding: 30rpx;
  853. line-height: 1;
  854. align-items: flex-start;
  855. .le,
  856. .ri {
  857. width: 50%;
  858. }
  859. .le {
  860. .tit {
  861. font-weight: bold;
  862. .ti1 {
  863. font-size: 26rpx;
  864. color: #ffffff;
  865. }
  866. .ti2 {
  867. font-size: 22rpx;
  868. padding-left: 10rpx;
  869. color: #999999;
  870. }
  871. }
  872. .he {
  873. padding-top: 40rpx;
  874. .numbox {
  875. flex-wrap: wrap;
  876. .he1 {
  877. background: #fdaf41;
  878. border-radius: 10rpx;
  879. margin-bottom: 40rpx;
  880. margin-right: 20rpx;
  881. width: 84rpx;
  882. height: 84rpx;
  883. justify-content: center;
  884. .wen {
  885. font-size: 30rpx;
  886. font-weight: bold;
  887. color: #000000;
  888. }
  889. }
  890. }
  891. }
  892. .yi {
  893. color: #ffffff;
  894. font-size: $font-base;
  895. .img {
  896. width: 41rpx;
  897. height: 42rpx;
  898. }
  899. .wz {
  900. font-weight: bold;
  901. }
  902. }
  903. .shu {
  904. padding-top: 10rpx;
  905. font-size: 51rpx;
  906. font-weight: bold;
  907. color: #fdb242;
  908. }
  909. }
  910. .ri {
  911. .ti {
  912. font-size: 26rpx;
  913. font-weight: bold;
  914. .t1 {
  915. color: #ffffff;
  916. }
  917. .t2 {
  918. color: #fdaf41;
  919. }
  920. }
  921. .dh {
  922. width: 100%;
  923. padding: 20rpx 30rpx;
  924. margin-top: 30rpx;
  925. background: #efefef;
  926. border-radius: 10rpx;
  927. .te {
  928. font-size: 44rpx;
  929. font-weight: 800;
  930. color: #000000;
  931. }
  932. }
  933. .btn {
  934. padding-top: 30rpx;
  935. .bt {
  936. padding-bottom: 10rpx;
  937. .btnItem {
  938. width: 49%;
  939. height: 70rpx;
  940. line-height: 70rpx;
  941. text-align: center;
  942. .imag {
  943. width: 32rpx;
  944. height: 20rpx;
  945. }
  946. .xia {
  947. font-size: 28rpx;
  948. font-weight: 800;
  949. color: #ffffff;
  950. }
  951. }
  952. .btnle {
  953. border-radius: 50rpx 0 0 50rpx;
  954. background-color: #df5660;
  955. }
  956. .btnri {
  957. border-radius: 0 50rpx 50rpx 0;
  958. background-color: #5bb786;
  959. }
  960. }
  961. }
  962. .db {
  963. justify-content: flex-end;
  964. padding-top: 30rpx;
  965. .jl {
  966. font-size: 24rpx;
  967. font-weight: 400;
  968. color: #999999;
  969. }
  970. .sj {
  971. width: 40rpx;
  972. height: 40rpx;
  973. background: #bfbfbf;
  974. border-radius: 3rpx;
  975. text-align: center;
  976. line-height: 40rpx;
  977. margin-left: 10rpx;
  978. }
  979. }
  980. }
  981. }
  982. .kb {
  983. width: 750rpx;
  984. height: 20rpx;
  985. background-color: #191a1f;
  986. }
  987. .last {
  988. padding: 30rpx;
  989. line-height: 1;
  990. font-size: 24rpx;
  991. font-weight: 800;
  992. color: #fff;
  993. .lb {
  994. width: 14rpx;
  995. height: 20rpx;
  996. margin-left: 10rpx;
  997. }
  998. }
  999. .bg {
  1000. padding: 0 30rpx;
  1001. background-color: #000000;
  1002. color: #fff;
  1003. text-align: center;
  1004. font-size: 28rpx;
  1005. padding-bottom: 30rpx;
  1006. .biaotou {
  1007. font-weight: 800;
  1008. padding-bottom: 10rpx;
  1009. }
  1010. .biwe {
  1011. width: 25%;
  1012. .zz {
  1013. width: 22rpx;
  1014. height: 14rpx;
  1015. margin-left: 8rpx;
  1016. }
  1017. .nametip {
  1018. font-size: 18rpx;
  1019. color: #999999;
  1020. padding-left: 8rpx;
  1021. &.green {
  1022. color: #5bb786;
  1023. }
  1024. &.red {
  1025. color: #df5660;
  1026. }
  1027. }
  1028. }
  1029. .biwe:nth-child(1) {
  1030. flex-shrink: 0;
  1031. text-align: left;
  1032. align-items: flex-end;
  1033. }
  1034. .biwe:nth-child(4) {
  1035. flex-shrink: 0;
  1036. width: 200rpx;
  1037. }
  1038. .list {
  1039. font-weight: bold;
  1040. padding: 20rpx 0;
  1041. border-bottom: 1px solid rgba(43, 42, 38, 0.52);
  1042. }
  1043. .list-buttom {
  1044. width: 100rpx;
  1045. border-radius: 30rpx;
  1046. font-size: 16rpx;
  1047. padding: 10rpx 0;
  1048. &.success {
  1049. background: #25b287;
  1050. }
  1051. &.primary {
  1052. background: #01ebf6;
  1053. color: #000000;
  1054. }
  1055. }
  1056. }
  1057. .chz {
  1058. background: #191a1f;
  1059. border-radius: 20rpx;
  1060. margin: 0 30rpx;
  1061. color: #ffffff;
  1062. font-weight: bold;
  1063. padding: 20rpx 30rpx;
  1064. .yue {
  1065. font-size: 28rpx;
  1066. }
  1067. .yes {
  1068. color: #fdaf41;
  1069. }
  1070. .quc {
  1071. font-size: 26rpx;
  1072. font-weight: 500;
  1073. color: #ffffff;
  1074. }
  1075. .choz {
  1076. width: 22rpx;
  1077. height: 14rpx;
  1078. }
  1079. }
  1080. .alert-detail {
  1081. background-color: #FFF;
  1082. border-radius: 10rpx;
  1083. width: 500rpx;
  1084. .flex {
  1085. padding: 10rpx 0;
  1086. }
  1087. }
  1088. </style>