BF-202210271038\Administrator пре 3 година
родитељ
комит
694a6cec3b

+ 13 - 18
common/router/router.js

@@ -12,27 +12,22 @@ const router = createRouter({
 const whiteList = ['/','/pages/index/error','/pages/login/register','/pages/login/index','/pages/index/index']
 
 router.beforeEach((to, from, next) => {
-    let isWallet= tokenpocketBnb.getProvider()
     if(to.path!=='/pages/index/error'){
-        if(isWallet){
-            let token = to.query.token;
-            let inviteCode = to.query.inviteCode;
-            if (token) {
-                uni.setStorageSync('token',token);
-            }
-            if (inviteCode) {
-                uni.setStorageSync('inviteCode',inviteCode);
-            }
-            const userToken = uni.getStorageSync('token')
-            if(!userToken  ){
-                if(whiteList.indexOf(to.path)<0){
-                    next('/pages/login/index');
-                }
+        let token = to.query.token;
+        let inviteCode = to.query.inviteCode;
+        if (token) {
+            uni.setStorageSync('token',token);
+        }
+        if (inviteCode) {
+            uni.setStorageSync('inviteCode',inviteCode);
+        }
+        const userToken = uni.getStorageSync('token')
+        if(!userToken  ){
+            if(whiteList.indexOf(to.path)<0){
+                next('/pages/login/index');
             }
-            next();
-        }else {
-            next('/pages/index/error?errorType=1');
         }
+        next();
     }else {
         next();
     }

+ 2 - 2
components/en-utils/en-blank/en-blank.vue

@@ -60,7 +60,7 @@
   @import url("../../static/css/en-common.css") ;
 	.blank-page {
 		width: 100%;
-		padding-top: 200rpx;
+		padding-top: 100rpx;
 		z-index: 2;
 		display: flex;
 		flex-direction: column;
@@ -73,7 +73,7 @@
 		width: 100%;
 		.iconfont{
 
-		  font-size: 160rpx;
+		  font-size: 130rpx;
       color: #AAAAAA;
 		}
 	}

+ 6 - 6
pages.json

@@ -4,37 +4,37 @@
 		{
 			"path": "pages/index/index",
 			"style": {
-				"navigationBarTitleText": "%title.index%"
+				"navigationBarTitleText": "BNBDAO"
 			}
 		},
 		{
 			"path": "pages/index/contract",
 			"style": {
-				"navigationBarTitleText": "%title.contract%"
+				"navigationBarTitleText": "BNBDAO"
 			}
 		},
 		{
 			"path": "pages/index/intro",
 			"style": {
-				"navigationBarTitleText": "%title.intro%"
+				"navigationBarTitleText": "BNBDAO"
 			}
 		},
 		{
 			"path": "pages/login/index",
 			"style": {
-				"navigationBarTitleText": "%title.login.index%"
+				"navigationBarTitleText": "BNBDAO"
 			}
 		},
 		{
 			"path": "pages/login/register",
 			"style": {
-				"navigationBarTitleText": "%title.login.register%"
+				"navigationBarTitleText": "BNBDAO"
 			}
 		},
 		{
 			"path": "pages/index/error",
 			"style": {
-				"navigationBarTitleText": "%title.index.error%"
+				"navigationBarTitleText": "BNBDAO"
 			}
 		}
 	],

+ 15 - 3
pages/index/components/top-head.vue

@@ -47,13 +47,25 @@ export default {
       showLang:false
     }
   },
-  watch: {},
+  watch: {
+    'babAddress':function (){
+      this.$emit('setBabAddress',this.babAddress)
+    }
+  },
   async mounted() {
     this.applicationLocale = uni.getLocale();
-    this.babAddress =await tokenpocketBnb.getAccounts()
-
+    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'

+ 14 - 4
pages/index/index.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="index-data">
     <view class="index-top">
-      <top-head></top-head>
+      <top-head @setBabAddress="setBabAddress"></top-head>
       <view class="top-text">
         {{ $t('index.index.top.one') }}
         <!--        <view class="text-item">{{$t('index.index.top.one')}}</view>-->
@@ -12,7 +12,7 @@
       <view class="top-but">
         <button @click="goToUrl(1)">{{ $t('index.index.investment') }}</button>
       </view>
-      <view class="top-bottom">
+      <view class="top-bottom" @click="setClipboardData">
         <image class="bottom-img" src="@/static/img/index/cp.png" mode="aspectFill"></image>
         <text class="bottom-text">{{ $t('index.index.top.cp') }}</text>
       </view>
@@ -38,7 +38,6 @@
 
 </template>
 <script>
-import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
 import {getMemberInfo} from "@/api/member";
 import Division from "@/pages/index/components/division";
 import TopHead from "@/pages/index/components/top-head";
@@ -89,6 +88,18 @@ export default {
 
   },
   methods: {
+    setClipboardData(){
+      console.log(window.location)
+      uni.setClipboardData({
+        data: window.origin+'/#/pages/index/index?inviteCode'+this.babAddress,
+        success: function () {
+          console.log('success');
+        }
+      });
+    },
+    setBabAddress(babAddress){
+      this.babAddress=babAddress
+    },
     handlerDateDurationCurrent() {
       let d1 = new Date('2021-11-12')
       let d2 = new Date()
@@ -126,7 +137,6 @@ export default {
 
 
     getMyData() {
-      this.babAddress = tokenpocketBnb.getAccounts()
       let token = uni.getStorageSync('token')
       if (token) {
         getMemberInfo().then((res) => {

+ 7 - 2
pages/login/register.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="register-box">
+  <view class="register-box" v-if="shouPage">
     <top-head :top-type="1"></top-head>
     <view class="contract-data">
       <view class="data-input">
@@ -40,7 +40,8 @@ export default {
     return {
       address: '',
       inviteCode: '',
-      isAjax: false
+      isAjax: false,
+      shouPage:false
     }
   },
   onLoad(query) {
@@ -50,6 +51,8 @@ export default {
       if (inviteCode) {
         this.inviteCode = inviteCode
         this.register()
+      }else {
+        this.shouPage=true
       }
     } else {
       tools.leftClick()
@@ -70,6 +73,7 @@ export default {
     },
     register() {
       if (this.inviteCode === '') {
+        this.shouPage=true
         tools.error(this.$t('index.error.errorMsg.noInvite'))
         return;
       }
@@ -88,6 +92,7 @@ export default {
         } else {
           tools.error(res.msg)
           this.isAjax = false
+          this.shouPage=true
         }
       }).catch((e) => {
         this.isAjax = false

BIN
static/img/index/logo.gif