index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="flex topBox">
  3. <view class="userInfo flex_item">
  4. <view class="flex_item user">
  5. <image class="userIcon" src="/static/img/img01.png"></image>
  6. <view class="userId">{{address}}</view>
  7. </view>
  8. <view class="ch" @click="selectLang">{{value}}</view>
  9. </view>
  10. <view class="navTab flex">
  11. <view class="navItem flex_item" v-for="item,index in list" :key="index"
  12. :class="{ atcive: currTab == index }" @click="navTo(item.url,index)">
  13. <!-- <image class="icon" :src="item.icon" mode="widthFix"></image> -->
  14. <view class="name">{{item.name}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. mapState,
  22. mapActions,
  23. mapMutations
  24. } from "vuex";
  25. export default {
  26. props:["currTab","address"],
  27. data() {
  28. return {
  29. show: false,
  30. list:[]
  31. }
  32. },
  33. mounted() {
  34. this.init()
  35. },
  36. computed: {
  37. ...mapState({
  38. langList: "langList",
  39. lang: "lang",
  40. }),
  41. ...mapState('user', ['userInfo']),
  42. value() {
  43. const value = this.langList.find((item) => {
  44. console.log(this.lang, item.value);
  45. return item.value == this.lang
  46. }).value;
  47. return value
  48. }
  49. },
  50. methods: {
  51. ...mapActions({
  52. setLang: "setLang",
  53. }),
  54. init(){
  55. this.list = [{
  56. name:'Home',
  57. icon:'/static/img/img14.png',
  58. url:'/pages/pc/index'
  59. },{
  60. name:'BF swap',
  61. icon:'/static/img/img15.png',
  62. url:'/pages/pc/404'
  63. },{
  64. name:this.$t('indexs.i2'),
  65. icon:'/static/img/img16.png',
  66. url:'/pages/pc/supermarket'
  67. },{
  68. name:this.$t('indexs.i3'),
  69. icon:'/static/img/img17.png',
  70. url:'/pages/pc/404'
  71. },{
  72. name:this.$t('indexs.i4'),
  73. icon:'/static/img/img19.png',
  74. url:'/pages/pc/diagram'
  75. },{
  76. name:this.$t('indexs.i7'),
  77. icon:'/static/img/img25.png',
  78. url:'/pages/pc/404'
  79. },
  80. {
  81. name:this.$t('indexs.i5'),
  82. icon:'/static/img/img18.png',
  83. url:'https://t.me/Benfolds_cn'
  84. }]
  85. },
  86. //切换语言
  87. selectLang() {
  88. let value = ''
  89. if(this.value == 'cn'){
  90. value = 0
  91. }else{
  92. value = 1
  93. }
  94. this.setLang(this.langList[value].value);
  95. this.init();
  96. },
  97. navTo(url,index){
  98. if(index == 6){
  99. window.open(url)
  100. }else{
  101. if (url == "/pages/pc/404") {
  102. let url = '/pages/pc/404?index='+ index
  103. uni.navigateTo({
  104. url,
  105. fail() {
  106. uni.switchTab({
  107. url,
  108. });
  109. },
  110. });
  111. } else {
  112. uni.navigateTo({
  113. url,
  114. fail() {
  115. uni.switchTab({
  116. url,
  117. });
  118. },
  119. });
  120. }
  121. }
  122. },
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. page{
  128. min-width: 1800px;
  129. }
  130. .topBox{
  131. border-bottom: 1rpx solid #4F5256;
  132. padding: 10px 30px;
  133. position: fixed;
  134. width: 100%;
  135. background: #080401;
  136. z-index: 99;
  137. .userInfo{
  138. color: #FFD515;
  139. min-width: 400px;
  140. .ch{
  141. border: 4rpx solid #FFD515;
  142. border-radius: 7rpx;
  143. font-size: 21rpx;
  144. padding: 4rpx 4rpx;
  145. margin-left: 30rpx;
  146. cursor: pointer;
  147. }
  148. .user{
  149. width: 83%;
  150. background: #2B2929;
  151. border-radius: 10rpx;
  152. padding: 12rpx 15rpx;
  153. .userIcon{
  154. width: 34rpx;
  155. height: 34rpx;
  156. margin-right: 10rpx;
  157. }
  158. .userId{
  159. width: calc(100% - 34rpx);
  160. font-size: 25rpx;
  161. }
  162. }
  163. }
  164. .navTab{
  165. min-width: 1000px;
  166. .navItem{
  167. font-size: 32rpx;
  168. color: #FFFFFF;
  169. padding: 25rpx 30rpx;
  170. margin-bottom: 20rpx;
  171. cursor: pointer;
  172. .icon{
  173. width: 44rpx;
  174. height: 43rpx;
  175. }
  176. .name{
  177. padding-left: 29rpx;
  178. }
  179. }
  180. .atcive{
  181. box-shadow: -4rpx -4rpx 13rpx 0rpx rgba(168,168,206,0.13), 4rpx 4rpx 7rpx 3rpx rgba(0,0,0,0.4);
  182. border-radius: 10rpx;
  183. color: #FFCC12 !important;
  184. }
  185. }
  186. }
  187. </style>