123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <view class="head-box" :class="{'top-two':topType!==1}">
- <view class="top-head">
- <view class="head-item head-left" @click="goToUrl">
- <view class="left-img">
- <image src="@/static/img/index/logo1.png" mode="aspectFill"></image>
- </view>
- <view class="left-text">
- <view class="item-item">BNBDAO</view>
- <view class="item-item">WEB3 DATA</view>
- </view>
- </view>
- <view class="head-item head-right">
- <view class="right-img" @click.stop="setShowLang">
- <image src="@/static/img/index/yy.svg" mode="aspectFill"></image>
- </view>
- <view class="right-text">{{ babAddress }}</view>
- </view>
- </view>
- <view class="top-lang" :class="{'show-lang':showLang}">
- <view class="lang-item" v-for="langItem in langList" @click.stop="setLocaleLang(langItem.name)">
- {{ langItem.value }}
- </view>
- </view>
- </view>
- </template>
- <script>
- import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
- export default {
- name: "top-head",
- components: {},
- props: {
- topType:{
- default:1
- }
- },
- data() {
- return {
- langList: [
- {'name': 'zh-Hans', 'value': '简体中文'},
- {'name': 'en', 'value': 'English'},
- // { 'name': 'ja', 'value': '日本語' },
- {'name': 'ko', 'value': '한국어'}],
- babAddress: '',
- showLang:false
- }
- },
- watch: {
- 'babAddress':function (){
- this.$emit('setBabAddress',this.babAddress)
- }
- },
- async mounted() {
- this.applicationLocale = uni.getLocale();
- if(this.$Route.query==='/pages/index/index'){
- setTimeout(()=>{
- this.getBabAddress()
- },100)
- }else {
- await this.getBabAddress()
- }
- },
- methods: {
- async getBabAddress(){
- this.babAddress =await tokenpocketBnb.getAccounts()
- },
- goToUrl() {
- uni.navigateTo({
- 'url': 'pages/index/index'
- })
- },
- setLocaleLang(code) {
- uni.setLocale(code);
- this.$i18n.locale = code;
- this.applicationLocale = code;
- this.showLang = false
- },
- setShowLang() {
- this.showLang = !this.showLang
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .head-box {
- .top-head {
- display: flex;
- justify-content: space-between;
- height: 84rpx;
- padding-left: 20rpx;
- .head-item {
- display: flex;
- justify-content: left;
- }
- .head-left {
- .left-img {
- margin-top: 1rpx;
- image {
- width: 80rpx;
- height: 80rpx;
- }
- }
- .left-text {
- padding-top: 5px;
- margin-left: 10px;
- .item-item {
- font-size: 22rpx;
- color: #fff;
- }
- .item-item:nth-of-type(1) {
- font-size: 32rpx;
- font-weight: bold;
- }
- }
- }
- .head-right {
- justify-content: right;
- .right-img {
- width: 70rpx;
- height: 70rpx;
- image {
- width: 70rpx;
- height: 70rpx;
- }
- }
- .right-text {
- margin-left: 20rpx;
- height: 70rpx;
- line-height: 70rpx;
- width: 200rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- color: rgb(116, 132, 164);
- }
- }
- }
- .top-lang{
- border-radius: 0 0 0 20rpx;
- z-index: 1000;
- position: absolute;
- top:120rpx ;
- right: 0;
- width: 300rpx;
- transition: 0.5s ease;
- height: 0;
- overflow: hidden;
- background-color: rgba(0, 0, 0, 0.8);
- .lang-item{
- height: 100rpx;
- display: flex;
- align-items: center;
- color: #fff;
- font-size: 32rpx;
- padding-left: 40rpx;
- box-sizing: border-box;
- }
- }
- .show-lang{
- height: auto;
- transition: 0.5s ease;
- }
- }
- .top-two{
- z-index: 1000;
- background: #fff;
- top: 0;
- position: fixed;
- width: 100vw;
- padding: 20rpx 0;
- box-shadow: 0 0 24rpx 0 rgba(0,0,0,0.16);
- .item-item{
- color: #222 !important;
- }
- .right-text{
- color: rgb(0, 87, 255) !important;
- }
- }
- </style>
|