top-head.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="head-box" :class="{'top-two':topType!==1}">
  3. <view class="top-head">
  4. <view class="head-item head-left">
  5. <view class="left-img">
  6. <image src="@/static/img/index/logo1.png" mode="aspectFill"></image>
  7. </view>
  8. <view class="left-text">
  9. <view class="item-item">BNBDAO</view>
  10. <view class="item-item">WEB3 DATA</view>
  11. </view>
  12. </view>
  13. <view class="head-item head-right">
  14. <view class="right-img" @click.stop="setShowLang">
  15. <image src="@/static/img/index/yy.svg" mode="aspectFill"></image>
  16. </view>
  17. <view class="right-text">{{ babAddress }}</view>
  18. </view>
  19. </view>
  20. <view class="top-lang" :class="{'show-lang':showLang}">
  21. <view class="lang-item" v-for="langItem in langList" @click.stop="setLocaleLang(langItem.name)">
  22. {{ langItem.value }}
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  29. export default {
  30. name: "top-head",
  31. components: {},
  32. props: {
  33. topType:{
  34. default:1
  35. }
  36. },
  37. data() {
  38. return {
  39. langList: [{'name': 'zh-Hans', 'value': '简体中文'}, {'name': 'en', 'value': 'English'}, {
  40. 'name': 'ja',
  41. 'value': '日本語'
  42. }, {'name': 'ko', 'value': '한국어'}],
  43. babAddress: '',
  44. showLang:false
  45. }
  46. },
  47. watch: {},
  48. async mounted() {
  49. this.babAddress = tokenpocketBnb.getMyAddress()
  50. },
  51. methods: {
  52. setLocaleLang(code) {
  53. uni.setLocale(code);
  54. this.$i18n.locale = code;
  55. this.applicationLocale = code;
  56. this.showLang = false
  57. },
  58. setShowLang() {
  59. this.showLang = !this.showLang
  60. },
  61. }
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .head-box {
  66. .top-head {
  67. display: flex;
  68. justify-content: space-between;
  69. height: 84rpx;
  70. padding-left: 20rpx;
  71. .head-item {
  72. display: flex;
  73. justify-content: left;
  74. }
  75. .head-left {
  76. .left-img {
  77. margin-top: 1rpx;
  78. image {
  79. width: 80rpx;
  80. height: 80rpx;
  81. }
  82. }
  83. .left-text {
  84. padding-top: 5px;
  85. margin-left: 10px;
  86. .item-item {
  87. font-size: 22rpx;
  88. color: #fff;
  89. }
  90. .item-item:nth-of-type(1) {
  91. font-size: 32rpx;
  92. font-weight: bold;
  93. }
  94. }
  95. }
  96. .head-right {
  97. justify-content: right;
  98. .right-img {
  99. width: 70rpx;
  100. height: 70rpx;
  101. image {
  102. width: 70rpx;
  103. height: 70rpx;
  104. }
  105. }
  106. .right-text {
  107. margin-left: 20rpx;
  108. height: 70rpx;
  109. line-height: 70rpx;
  110. width: 200rpx;
  111. overflow: hidden;
  112. text-overflow: ellipsis;
  113. color: rgb(116, 132, 164);
  114. }
  115. }
  116. }
  117. .top-lang{
  118. border-radius: 0 0 0 20rpx;
  119. z-index: 1000;
  120. position: absolute;
  121. top:120rpx ;
  122. right: 0;
  123. width: 300rpx;
  124. transition: 0.5s ease;
  125. height: 0;
  126. overflow: hidden;
  127. background-color: rgba(0, 0, 0, 0.8);
  128. .lang-item{
  129. height: 100rpx;
  130. display: flex;
  131. align-items: center;
  132. color: #fff;
  133. font-size: 32rpx;
  134. padding-left: 40rpx;
  135. box-sizing: border-box;
  136. }
  137. }
  138. .show-lang{
  139. height: auto;
  140. transition: 0.5s ease;
  141. }
  142. }
  143. .top-two{
  144. .item-item{
  145. color: #222 !important;
  146. }
  147. .right-text{
  148. color: rgb(0, 87, 255) !important;
  149. }
  150. }
  151. </style>