top-head.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="head-box" :class="{'top-two':topType!==1}">
  3. <view class="top-head">
  4. <view class="head-item head-left" @click="goToUrl">
  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. goToUrl() {
  54. uni.navigateTo({
  55. 'url': 'pages/index/index'
  56. })
  57. },
  58. setLocaleLang(code) {
  59. uni.setLocale(code);
  60. this.$i18n.locale = code;
  61. this.applicationLocale = code;
  62. this.showLang = false
  63. },
  64. setShowLang() {
  65. this.showLang = !this.showLang
  66. },
  67. }
  68. }
  69. </script>
  70. <style scoped lang="scss">
  71. .head-box {
  72. .top-head {
  73. display: flex;
  74. justify-content: space-between;
  75. height: 84rpx;
  76. padding-left: 20rpx;
  77. .head-item {
  78. display: flex;
  79. justify-content: left;
  80. }
  81. .head-left {
  82. .left-img {
  83. margin-top: 1rpx;
  84. image {
  85. width: 80rpx;
  86. height: 80rpx;
  87. }
  88. }
  89. .left-text {
  90. padding-top: 5px;
  91. margin-left: 10px;
  92. .item-item {
  93. font-size: 22rpx;
  94. color: #fff;
  95. }
  96. .item-item:nth-of-type(1) {
  97. font-size: 32rpx;
  98. font-weight: bold;
  99. }
  100. }
  101. }
  102. .head-right {
  103. justify-content: right;
  104. .right-img {
  105. width: 70rpx;
  106. height: 70rpx;
  107. image {
  108. width: 70rpx;
  109. height: 70rpx;
  110. }
  111. }
  112. .right-text {
  113. margin-left: 20rpx;
  114. height: 70rpx;
  115. line-height: 70rpx;
  116. width: 200rpx;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. color: rgb(116, 132, 164);
  120. }
  121. }
  122. }
  123. .top-lang{
  124. border-radius: 0 0 0 20rpx;
  125. z-index: 1000;
  126. position: absolute;
  127. top:120rpx ;
  128. right: 0;
  129. width: 300rpx;
  130. transition: 0.5s ease;
  131. height: 0;
  132. overflow: hidden;
  133. background-color: rgba(0, 0, 0, 0.8);
  134. .lang-item{
  135. height: 100rpx;
  136. display: flex;
  137. align-items: center;
  138. color: #fff;
  139. font-size: 32rpx;
  140. padding-left: 40rpx;
  141. box-sizing: border-box;
  142. }
  143. }
  144. .show-lang{
  145. height: auto;
  146. transition: 0.5s ease;
  147. }
  148. }
  149. .top-two{
  150. .item-item{
  151. color: #222 !important;
  152. }
  153. .right-text{
  154. color: rgb(0, 87, 255) !important;
  155. }
  156. }
  157. </style>