gameNav.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div>
  3. <!-- 桌面 -->
  4. <div class="game-top-nav">
  5. <div class="top-nav-container">
  6. <div class="left-side">
  7. <a class="logo-link" target="_blank" href="https://www.eosget.io/">
  8. <img class="logo" src="../../assets/dice-logo.png" alt="">
  9. <span class="game-title">EOS GET</span>
  10. </a>
  11. <div class="game-link">
  12. <a :href="diceUrl" class="link-item">
  13. <i class="sicbo-icon"></i>SICBO
  14. </a>
  15. <!-- <a :href="boxUrl" class="link-item">
  16. <i class="box-icon"></i>BOX
  17. </a> -->
  18. <a class="link-item current">
  19. <i class="k3-icon"></i>K3
  20. </a>
  21. <a :href="baccaratUrl" class="link-item">
  22. <i class="baccarat-icon"></i>BACCARAT
  23. </a>
  24. </div>
  25. </div>
  26. <div class="right-side">
  27. <a class="doughnut-link" v-if="account.name && doughnutData.cpu !== null" target="_blank" :href="`https://eospark.com/MainNet/account/${account.name}`">
  28. <div class="nav-doughnut">
  29. <doughnut
  30. :chart-data="doughnutData.cpu"
  31. :width="46"
  32. :height="46">
  33. </doughnut>
  34. <span>{{doughnutData.cpu.showText}}</span>
  35. <em>CPU</em>
  36. </div>
  37. </a>
  38. <a target="_blank" v-if="$i18n.locale == 'zh'" href="https://t.me/eosgetdice" class="nav-icon help-icon"></a>
  39. <a target="_blank" v-else href="https://t.me/eosgetsicboen" class="nav-icon help-icon"></a>
  40. <a href="javascript:" @click="lotteryShow = true" class="game-router-link">{{$t('nav.nav5')}}</a>
  41. <a href="javascript:" @click="showVip" class="game-router-link">VIP</a>
  42. <a class="game-router-link" href="https://dice.eosget.io/#/bonus">{{$t('nav.nav2')}}</a>
  43. <a class="game-router-link" href="https://dice.eosget.io/#/reward/k3">{{$t('nav.nav3')}}</a>
  44. <a class="game-router-link" target="_blank" :href="$i18n.locale == 'zh' ? `https://dice.eosget.io/whitePaper/whitePaper_zh.pdf` : `https://dice.eosget.io/whitePaper/whitePaper_en.pdf`">{{$t('nav.nav4')}}</a>
  45. <div class="lang">
  46. <template v-if="lang == 'zh'">
  47. <img src="../../assets/zh-logo.png" alt="" class="flag">
  48. <span>中文</span>
  49. </template>
  50. <template v-if="lang == 'en'">
  51. <img src="../../assets/en-logo.png" alt="" class="flag">
  52. <span>ENG</span>
  53. </template>
  54. <template v-if="lang == 'kr'">
  55. <img src="../../assets/kr-logo.png" alt="" class="flag">
  56. <span>한글</span>
  57. </template>
  58. <i class="arrow-down"></i>
  59. <div class="lang-change">
  60. <div class="lang-item" @click="changeLocale(item)" v-for="(item, key) in langArr" :key="key">
  61. <i class="zh-logo" :class="`${item}-logo`"></i>
  62. <template v-if="item == 'zh'">中文</template>
  63. <template v-if="item == 'en'">ENG</template>
  64. <template v-if="item == 'kr'">한글</template>
  65. </div>
  66. </div>
  67. </div>
  68. <new-work v-if="account.name"></new-work>
  69. <div class="login-btn" @click="doScatterLogin" v-if="account == 'NO_LOGINING' || account == ''"><i class="login-circle"></i>{{$t('header.login')}}</div>
  70. <div class="login-user-name" v-else>
  71. {{account.name}}<i class="arrow-down"></i>
  72. <span class="loginout-btn" @click="doScatterLoginOut">{{$t('header.loginOut')}}</span>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- 手机 -->
  78. <div class="game-moblie-nav">
  79. <i class="moblie-nav-icon nav-icon" @click="mobNavShow = true"></i>
  80. <i class="moblie-nav-close nav-icon" v-show="mobNavShow" @click="mobNavShow = false"></i>
  81. <div class="game-select-list">
  82. <div class="title" @click="gameListShow = !gameListShow">
  83. <img src="./img/k3-logo.png" alt="" class="k3-logo">
  84. <i class="white-arrow-down"></i>
  85. </div>
  86. <transition name="msgbox-fade">
  87. <div class="game-list" v-show="gameListShow">
  88. <a :href="diceUrl" class="select-list-item">
  89. <img src="./img/sicbo-logo.png" alt="" class="sicbo-logo">
  90. </a>
  91. <!-- <a :href="boxUrl" class="select-list-item">
  92. <img src="./img/box-logo.png" alt="" class="box-logo">
  93. </a> -->
  94. <a :href="baccaratUrl" class="select-list-item">
  95. <img src="./img/baccarat-logo.png" alt="" class="baccarat-logo">
  96. </a>
  97. </div>
  98. </transition>
  99. </div>
  100. <div class="login-btn" @click="doScatterLogin" v-if="account == 'NO_LOGINING' || account == ''"><i class="login-circle"></i>{{$t('header.login')}}</div>
  101. <div class="login-user-name" v-else>
  102. <span @click.stop="logoutShow = !logoutShow">{{account.name}}<i class="arrow-down"></i></span>
  103. <span class="loginout-btn" v-if="logoutShow">
  104. <em @click="doScatterLoginOut">{{$t('header.loginOut')}}</em>
  105. </span>
  106. </div>
  107. <transition name="msgbox-fade">
  108. <div class="nav-list" v-show="mobNavShow">
  109. <a href="https://www.eosget.io/" class="list-item">
  110. <img src="../../assets/dice-logo.png" class="eos-get-icon">EOS GET
  111. </a>
  112. <a href="javascript:" @click="lotteryShow = true" class="list-item">
  113. {{$t('nav.nav5')}}
  114. </a>
  115. <a href="javascript:" @click="showVip" class="list-item">
  116. VIP
  117. </a>
  118. <a href="https://dice.eosget.io/#/bonus" class="list-item">
  119. {{$t('nav.nav2')}}
  120. </a>
  121. <a href="https://dice.eosget.io/#/reward/k3" class="list-item">
  122. {{$t('nav.nav3')}}
  123. </a>
  124. <a :href="$i18n.locale == 'zh' ? `https://dice.eosget.io/whitePaper/whitePaper_zh.pdf` : `https://dice.eosget.io/whitePaper/whitePaper_en.pdf`" class="list-item">
  125. {{$t('nav.nav4')}}
  126. </a>
  127. <div class="list-item" :class="{'current' : item == lang}" @click="changeLocale(item)" v-for="(item, key) in langArr" :key="key">
  128. <i class="zh-logo" :class="`${item}-logo`"></i>
  129. <template v-if="item == 'zh'"><img src="../../assets/zh-logo.png" alt="" class="flag">中文</template>
  130. <template v-if="item == 'en'"><img src="../../assets/en-logo.png" alt="" class="flag">ENG</template>
  131. <template v-if="item == 'kr'"><img src="../../assets/kr-logo.png" alt="" class="flag">한글</template>
  132. </div>
  133. <div class="list-item">
  134. <img class="tel-icon" src="./img/tel-icon.png" alt="">
  135. </div>
  136. </div>
  137. </transition>
  138. </div>
  139. <!-- 幸运抽奖 -->
  140. <mod-lottery v-if="lotteryShow" @visible:lottery="lotteryShow = false"></mod-lottery>
  141. </div>
  142. </template>
  143. <script>
  144. import { getLanguage, Cookie } from '../../util/util.js'
  145. import { mapState, mapActions } from 'vuex'
  146. import modLottery from './lottery'
  147. export default {
  148. name: 'gameNav',
  149. data () {
  150. return {
  151. lang: '',
  152. langArr: ['zh', 'en', 'kr'],
  153. isMoblie: /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent),
  154. refreshTimer: null, // 数据刷新计时器
  155. refreshInterval: 3000, // 默认数据刷新间隔为3秒
  156. doughnutData: {
  157. cpu: null,
  158. net: null
  159. },
  160. mobNavShow: false,
  161. lotteryShow: false,
  162. logoutShow: false,
  163. gameListShow: false
  164. }
  165. },
  166. components: {
  167. doughnut: () => import('./doughnut'),
  168. newWork: () => import('./newWork'),
  169. modLottery
  170. },
  171. computed: {
  172. ...mapState({
  173. account: state => state.account,
  174. limit: state => state.limit,
  175. invitee: state => state.invitee
  176. }),
  177. diceUrl: function () {
  178. return this.invitee
  179. ? `https://dice.eosget.io/?a=${this.invitee}`
  180. : 'https://dice.eosget.io/'
  181. },
  182. boxUrl: function () {
  183. return this.invitee
  184. ? `https://box.eosget.io/?a=${this.invitee}`
  185. : 'https://box.eosget.io/'
  186. },
  187. k3Url: function () {
  188. return this.invitee
  189. ? `https://k3.eosget.io/?a=${this.invitee}`
  190. : 'https://k3.eosget.io/'
  191. },
  192. baccaratUrl: function () {
  193. return this.invitee
  194. ? `https://baccarat.eosget.io/?a=${this.invitee}`
  195. : 'https://baccarat.eosget.io/'
  196. }
  197. },
  198. watch: {
  199. limit (obj) {
  200. if (obj.cpu && obj.net) {
  201. this.initDoughnut(obj.cpu.toFixed(2), obj.net.toFixed(2))
  202. }
  203. }
  204. },
  205. methods: {
  206. ...mapActions([
  207. 'doScatterLogin',
  208. 'doScatterLoginOut',
  209. 'getUserEOS',
  210. 'getUserGT'
  211. ]),
  212. changeLocale (lang) {
  213. this.$i18n.locale = lang
  214. Cookie.setLangCookie('eosget_lang', lang)
  215. this.lang = lang
  216. document.title = this.$t('pageTitle')
  217. },
  218. /**
  219. * 设置用户CPU、NET 使用率数据
  220. */
  221. initDoughnut (cpu, net) {
  222. let color = ['#39cd6d', '#ff3434']
  223. cpu = cpu * 100
  224. if (cpu < 80) {
  225. this.doughnutData.cpu = null
  226. return
  227. }
  228. net = net * 100
  229. this.doughnutData.cpu = {
  230. datasets: [{
  231. data: cpu > 100 ? [100, 0] : [cpu, 100 - cpu],
  232. backgroundColor: [cpu >= 80 ? color[1] : color[0], '#e5e9f2'],
  233. borderWidth: 0
  234. }],
  235. labels: ['Point', 'Other'],
  236. showText: cpu.toFixed(0) + '%'
  237. }
  238. },
  239. showVip () {
  240. this.$showVip()
  241. }
  242. },
  243. created () {
  244. document.body.addEventListener('click', (e) => {
  245. if (this.logoutShow) {
  246. this.logoutShow = false
  247. }
  248. })
  249. this.lang = Cookie.getCookie('eosget_lang') || getLanguage()
  250. }
  251. }
  252. </script>
  253. <style lang="scss">
  254. @import './gameNav.scss';
  255. @import './gameNavMoblie.scss';
  256. </style>