entertainment.vue 24 KB

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