entertainment.vue 24 KB

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