top-head.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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: [
  40. {'name': 'zh-Hans', 'value': '简体中文'},
  41. {'name': 'en', 'value': 'English'},
  42. // { 'name': 'ja', 'value': '日本語' },
  43. {'name': 'ko', 'value': '한국어'}],
  44. babAddress: '',
  45. showLang:false
  46. }
  47. },
  48. watch: {},
  49. async mounted() {
  50. this.babAddress = tokenpocketBnb.getMyAddress()
  51. },
  52. methods: {
  53. setLocaleLang(code) {
  54. uni.setLocale(code);
  55. this.$i18n.locale = code;
  56. this.applicationLocale = code;
  57. this.showLang = false
  58. },
  59. setShowLang() {
  60. this.showLang = !this.showLang
  61. },
  62. }
  63. }
  64. </script>
  65. <style scoped lang="scss">
  66. .head-box {
  67. .top-head {
  68. display: flex;
  69. justify-content: space-between;
  70. height: 84rpx;
  71. padding-left: 20rpx;
  72. .head-item {
  73. display: flex;
  74. justify-content: left;
  75. }
  76. .head-left {
  77. .left-img {
  78. margin-top: 1rpx;
  79. image {
  80. width: 80rpx;
  81. height: 80rpx;
  82. }
  83. }
  84. .left-text {
  85. padding-top: 5px;
  86. margin-left: 10px;
  87. .item-item {
  88. font-size: 22rpx;
  89. color: #fff;
  90. }
  91. .item-item:nth-of-type(1) {
  92. font-size: 32rpx;
  93. font-weight: bold;
  94. }
  95. }
  96. }
  97. .head-right {
  98. justify-content: right;
  99. .right-img {
  100. width: 70rpx;
  101. height: 70rpx;
  102. image {
  103. width: 70rpx;
  104. height: 70rpx;
  105. }
  106. }
  107. .right-text {
  108. margin-left: 20rpx;
  109. height: 70rpx;
  110. line-height: 70rpx;
  111. width: 200rpx;
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. color: rgb(116, 132, 164);
  115. }
  116. }
  117. }
  118. .top-lang{
  119. border-radius: 0 0 0 20rpx;
  120. z-index: 1000;
  121. position: absolute;
  122. top:120rpx ;
  123. right: 0;
  124. width: 300rpx;
  125. transition: 0.5s ease;
  126. height: 0;
  127. overflow: hidden;
  128. background-color: rgba(0, 0, 0, 0.8);
  129. .lang-item{
  130. height: 100rpx;
  131. display: flex;
  132. align-items: center;
  133. color: #fff;
  134. font-size: 32rpx;
  135. padding-left: 40rpx;
  136. box-sizing: border-box;
  137. }
  138. }
  139. .show-lang{
  140. height: auto;
  141. transition: 0.5s ease;
  142. }
  143. }
  144. .top-two{
  145. .item-item{
  146. color: #222 !important;
  147. }
  148. .right-text{
  149. color: rgb(0, 87, 255) !important;
  150. }
  151. }
  152. </style>