entertainment.vue 24 KB

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