entertainment.vue 23 KB

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