Browse Source

注册流程调整完成

BF-202210271038\Administrator 3 years ago
parent
commit
b226fb2af8

+ 17 - 11
common/router/router.js

@@ -15,22 +15,28 @@ router.beforeEach((to, from, next) => {
     let isWallet= tokenpocketBnb.isInstall()
     console.log('isWallet:'+isWallet)
     if(isWallet){
-        // let token = to.query.token;
-        // if (token) {
-        //     uni.setStorageSync('token',token);
-        // }
-        // 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);
+        }
+        console.log('inviteCode:'+inviteCode)
+        if (inviteCode) {
+            uni.setStorageSync('inviteCode',inviteCode);
+        }
+        const userToken = uni.getStorageSync('token')
+        console.log('userToken:'+userToken)
+        if(!userToken  ){
+            if(whiteList.indexOf(to.path)<0){
+                next('/pages/login/index');
+            }
+        }
         console.log('前置守卫to----------', to)
         next();
     }else {
         console.log(to.path)
         if(to.path!=='/pages/index/error'){
-            // next('/pages/index/error');
+            next('/pages/index/error?errorType=1');
         }
         console.log('验证失败执行到错误页面')
         //

+ 9 - 2
locale/zh-Hans.json

@@ -19,8 +19,6 @@
 	"index.index.invest.no_usdt": "USDT数量不足",
 	"index.index.invest.send_no": "失败",
 	"index.index.invest.send_ok": "成功",
-	"index.error.quit": "退出",
-	"index.error.errorMsg": "出错啦!",
 	"index.index.tab.one": "項目介紹",
 	"index.index.tab.two": "我的獎勵",
 	"index.index.my.title": "我的",
@@ -36,5 +34,14 @@
 	"index.index.list.item2": "詳情",
 	"index.index.list.item3": "數量",
 	"index.index.list.item4": "狀態",
+	"index.error.quit": "刷新",
+	"index.error.errorMsg": "出错啦!",
+
+	"index.error.errorMsg.noWallet": "请使用tokenpocket打开!",
+	"index.error.errorMsg.noAddress": "地址信息异常!",
+	"index.error.errorMsg.noInvite": "推荐信息无效!",
+
+	"index.index.register.inviteMsg": "请输入推荐码",
+
 	"index.text": "一觸即發"
 }

+ 0 - 2
main.js

@@ -2,8 +2,6 @@ import '.env.js'
 import App from './App'
 //引入语言包
 import messages from './locale/index'
-
-console.log(messages)
 let i18nConfig = {
 	locale: uni.getLocale(),
 	messages

+ 1 - 1
manifest.json

@@ -75,7 +75,7 @@
             "disableHostCheck" : true,
             "proxy" : {
                 "/api" : {
-                    "target" : "http://qc-api.test.cc",
+                    "target" : "http://bab-icon-api.localhost.com",
                     "changeOrigin" : true,
                     "secure" : false
                 }

+ 59 - 2
package-lock.json

@@ -477,6 +477,48 @@
         "@hapi/hoek": "^9.0.0"
       }
     },
+    "@intlify/core-base": {
+      "version": "9.2.2",
+      "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.2.2.tgz",
+      "integrity": "sha512-JjUpQtNfn+joMbrXvpR4hTF8iJQ2sEFzzK3KIESOx+f+uwIjgw20igOyaIdhfsVVBCds8ZM64MoeNSx+PHQMkA==",
+      "requires": {
+        "@intlify/devtools-if": "9.2.2",
+        "@intlify/message-compiler": "9.2.2",
+        "@intlify/shared": "9.2.2",
+        "@intlify/vue-devtools": "9.2.2"
+      }
+    },
+    "@intlify/devtools-if": {
+      "version": "9.2.2",
+      "resolved": "https://registry.npmjs.org/@intlify/devtools-if/-/devtools-if-9.2.2.tgz",
+      "integrity": "sha512-4ttr/FNO29w+kBbU7HZ/U0Lzuh2cRDhP8UlWOtV9ERcjHzuyXVZmjyleESK6eVP60tGC9QtQW9yZE+JeRhDHkg==",
+      "requires": {
+        "@intlify/shared": "9.2.2"
+      }
+    },
+    "@intlify/message-compiler": {
+      "version": "9.2.2",
+      "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.2.2.tgz",
+      "integrity": "sha512-IUrQW7byAKN2fMBe8z6sK6riG1pue95e5jfokn8hA5Q3Bqy4MBJ5lJAofUsawQJYHeoPJ7svMDyBaVJ4d0GTtA==",
+      "requires": {
+        "@intlify/shared": "9.2.2",
+        "source-map": "0.6.1"
+      }
+    },
+    "@intlify/shared": {
+      "version": "9.2.2",
+      "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.2.2.tgz",
+      "integrity": "sha512-wRwTpsslgZS5HNyM7uDQYZtxnbI12aGiBZURX3BTR9RFIKKRWpllTsgzHWvj3HKm3Y2Sh5LPC1r0PDCKEhVn9Q=="
+    },
+    "@intlify/vue-devtools": {
+      "version": "9.2.2",
+      "resolved": "https://registry.npmjs.org/@intlify/vue-devtools/-/vue-devtools-9.2.2.tgz",
+      "integrity": "sha512-+dUyqyCHWHb/UcvY1MlIpO87munedm3Gn6E9WWYdWrMuYLcoIoOEVDWSS8xSwtlPU+kA+MEQTP6Q1iI/ocusJg==",
+      "requires": {
+        "@intlify/core-base": "9.2.2",
+        "@intlify/shared": "9.2.2"
+      }
+    },
     "@sideway/address": {
       "version": "4.1.4",
       "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
@@ -521,6 +563,11 @@
         "source-map": "^0.6.1"
       }
     },
+    "@vue/devtools-api": {
+      "version": "6.4.5",
+      "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.4.5.tgz",
+      "integrity": "sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ=="
+    },
     "@web3-onboard/common": {
       "version": "2.2.3",
       "resolved": "https://registry.npmjs.org/@web3-onboard/common/-/common-2.2.3.tgz",
@@ -1386,8 +1433,7 @@
     "source-map": {
       "version": "0.6.1",
       "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
-      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
-      "dev": true
+      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
     },
     "source-map-js": {
       "version": "1.0.2",
@@ -1485,6 +1531,17 @@
         "csstype": "^3.1.0"
       }
     },
+    "vue-i18n": {
+      "version": "9.2.2",
+      "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.2.2.tgz",
+      "integrity": "sha512-yswpwtj89rTBhegUAv9Mu37LNznyu3NpyLQmozF3i1hYOhwpG8RjcjIFIIfnu+2MDZJGSZPXaKWvnQA71Yv9TQ==",
+      "requires": {
+        "@intlify/core-base": "9.2.2",
+        "@intlify/shared": "9.2.2",
+        "@intlify/vue-devtools": "9.2.2",
+        "@vue/devtools-api": "^6.2.1"
+      }
+    },
     "vue-waterfall-easy": {
       "version": "2.4.4",
       "resolved": "https://registry.npmjs.org/vue-waterfall-easy/-/vue-waterfall-easy-2.4.4.tgz",

+ 2 - 1
package.json

@@ -7,7 +7,8 @@
     "tronweb": "^4.4.0",
     "uni-read-pages": "^1.0.5",
     "uni-simple-router": "^2.0.7",
-    "uploading-oss": "^1.0.3"
+    "uploading-oss": "^1.0.3",
+    "vue-i18n": "^9.2.2"
   },
   "devDependencies": {
     "@types/html5plus": "^1.0.2",

+ 12 - 5
pages/index/error.vue

@@ -6,9 +6,12 @@
           &#xe678;
         </text>
       </view>
-      <view class="error-text">
+      <view class="error-text" v-if="!errorType">
         {{$t('index.error.errorMsg')}}~~
       </view>
+      <view class="error-text" v-else>
+        {{$t('index.error.errorMsg'+errorKey[errorType])}}~~
+      </view>
       <view class="error-but">
         <button @click="closeSys">{{$t('index.error.quit')}}</button>
       </view>
@@ -24,12 +27,16 @@ export default {
   components: {},
   data() {
     return {
-      errorMsg:'出错啦'
+      errorKey:[
+          'errorMsg',
+          'noWallet',
+      ],
+      errorType:0
     }
   },
   onLoad(query) {
-    if(query.errorMsg!==undefined){
-      this.errorMsg=decodeURI(query.errorMsg);
+    if(query.errorType!==undefined){
+        this.errorType=query.errorType
     }
   },
   mounted() {
@@ -84,4 +91,4 @@ export default {
 
 }
 
-</style>
+</style>

+ 11 - 8
pages/index/index.vue

@@ -3,8 +3,10 @@
     <view class="index-top">
       <view class="top-head">
         <view class="head-item head-left">
-          <view class="left-img"><image src="@/static/img/index/logo.gif" mode="aspectFill"></image></view>
-          <view class="left-text">bn.dao</view>
+          <view class="left-img">
+            <image src="@/static/img/index/logo.gif" mode="aspectFill"></image>
+          </view>
+          <view class="left-text">bnb.dao</view>
         </view>
         <view class="head-item head-right">
           <view class="right-img" @click.stop="setShowLang"><image src="@/static/img/index/lang-img.png" mode="aspectFill"></image></view>
@@ -152,7 +154,7 @@ export default {
 <style lang="scss" scoped>
 .index-data {
   min-height: 100vh;
-  background: #6d1cb9;
+  background: rgb(21, 26, 47);
   position: relative;
   .index-top{
     z-index: 100;
@@ -182,7 +184,7 @@ export default {
         }
         .left-text{
           font-weight: 600;
-          color: #ffe347;
+          color: #734ce2;
           font-size: 30rpx;
           line-height: 60rpx;
           margin-left: 10rpx;
@@ -199,7 +201,8 @@ export default {
           }
         }
         .right-text{
-          background: #ffe347;
+          background: linear-gradient(to right, rgb(115, 76, 226), rgb(96, 107, 251));
+          color: #fff;
           border-radius:52rpx;
           font-size: 24rpx;
           width: 208rpx;
@@ -354,8 +357,8 @@ export default {
           text-align: center;
         }
         .share-copy{
-          background-color: #e2bd17;
-          color: #000;
+          background: linear-gradient(to right, rgb(115, 76, 226), rgb(96, 107, 251));
+          color: #fff;
           font-size: 26rpx;
           text-align: center;
         }
@@ -525,7 +528,7 @@ export default {
       color: #fff;
     }
     .button-item:nth-of-type(1){
-      color: #e2bd17;
+      color: rgb(115, 76, 226);
     }
 
   }

+ 6 - 10
pages/login/index.vue

@@ -28,20 +28,16 @@
         console.log('--------------dssadsa')
         tokenpocketBnb.getAccounts().then(async (Address) => {
           console.log('Address:' + Address)
-          let data = await tokenpocketBnb.getTransactionData('0xFbb82E21F36D67FCb1b8aAade20C2b0a9F5aC6d2', 0.0001)
-          tokenpocketBnb.sendTransaction(data)
-          console.log(data)
+          // let data = await tokenpocketBnb.getTransactionData('0xFbb82E21F36D67FCb1b8aAade20C2b0a9F5aC6d2', 0.0001)
+          // tokenpocketBnb.sendTransaction(data)
+          // console.log(data)
           if (Address) {
-            // tokenpocketBnb.getBalance().then((balance)=>{
-            //    console.log('balance:'+balance)
-            //  })
-
-            // this.login(Address)
+            this.login(Address)
           } else {
-            // tools.toError('信息获取失败!')
+            tools.toError(this.$t('index.error.errorMsg.noAddress'))
           }
         }).catch((e)=>{
-          // tools.toError('信息获取失败!')
+          tools.toError(this.$t('index.error.errorMsg.noAddress'))
         })
       },
       login(Address){

+ 60 - 36
pages/login/register.vue

@@ -2,12 +2,14 @@
   <view class="register-box">
     <view class="register-logo"></view>
     <header class="header">
-      <image class="hd-logo" src="/static/img/icon/logow.png?=1" mode="aspectFill" />
+      <image class="hd-logo" src="/static/img/icon/logow.png?=1" mode="aspectFill"/>
     </header>
-      <view class="register-from">
-          <view class="from-input"><input v-model="inviteCode" placeholder="请输入推荐码"></view>
-          <view class="from-but"><button @click="register">确定</button></view>
+    <view class="register-from">
+      <view class="from-input"><input v-model="inviteCode" :placeholder="$t('index.index.affirm')"></view>
+      <view class="from-but">
+        <button @click="register">{{$t('index.index.affirm')}}</button>
       </view>
+    </view>
   </view>
 </template>
 <script>
@@ -20,15 +22,19 @@ export default {
   components: {},
   data() {
     return {
-      address:'',
-      inviteCode:'',
-      isAjax:false
+      address: '',
+      inviteCode: '',
+      isAjax: false
     }
   },
   onLoad(query) {
-    if(query.address!==undefined){
-      this.address=query.address
-    }else {
+    if (query.address !== undefined) {
+      this.address = query.address
+      let inviteCode = uni.getStorageSync('inviteCode');
+      if (inviteCode) {
+        this.inviteCode = inviteCode
+      }
+    } else {
       tools.leftClick()
     }
   },
@@ -36,29 +42,29 @@ export default {
 
   },
   methods: {
-    register(){
-      if(this.inviteCode===''){
-        tools.error('请输入推荐码')
+    register() {
+      if (this.inviteCode === '') {
+        tools.error(this.$t('index.error.errorMsg.noInvite'))
         return;
       }
-      if(this.isAjax){
+      if (this.isAjax) {
         return;
       }
-      this.isAjax=true
-      register({'inviteCode':this.inviteCode,'address':this.address}).then((res)=>{
-        if(res.code){
+      this.isAjax = true
+      register({'inviteCode': this.inviteCode, 'address': this.address}).then((res) => {
+        if (res.code) {
           tools.setLoginInfo(res.data)
-          setTimeout(()=>{
+          setTimeout(() => {
             uni.reLaunch({
               url: '/pages/index/index'
             })
-          },50)
-        }else {
+          }, 50)
+        } else {
           tools.error(res.msg)
-          this.isAjax=false
+          this.isAjax = false
         }
-      }).catch((e)=>{
-        this.isAjax=false
+      }).catch((e) => {
+        this.isAjax = false
       })
     }
   }
@@ -67,7 +73,7 @@ export default {
 </script>
 
 <style scoped lang="scss">
-.register-box{
+.register-box {
   width: 100vw;
   height: 100vh;
   max-height: 100vh;
@@ -76,24 +82,39 @@ export default {
   background-position: center center;
   background-size: cover;
   //padding-top: 400rpx;
-  .register-logo{
+  .register-logo {
     height: 100rpx;
   }
-  .header{
-    position: fixed; left: 0; top: 0; width: 100%; height: 54px;  background: #131E30; z-index: 10; overflow: hidden;
-    .hd-logo{ display: block; max-width: 52%; height: 34px; margin: 10px auto;}
+
+  .header {
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 54px;
+    background: #131E30;
+    z-index: 10;
+    overflow: hidden;
+
+    .hd-logo {
+      display: block;
+      max-width: 52%;
+      height: 34px;
+      margin: 10px auto;
+    }
   }
 
-  .register-from{
+  .register-from {
     border-radius: 20rpx;
-    width:calc(100vw - 214rpx);
+    width: calc(100vw - 214rpx);
     margin: auto;
     height: 300rpx;
     background: #131E30;
     padding: 80rpx 64rpx 0 64rpx;
-    .from-input{
 
-      input{
+    .from-input {
+
+      input {
         border-radius: 6rpx;
         height: 100rpx;
         border: 2rpx solid #3e526b;
@@ -102,13 +123,16 @@ export default {
         line-height: 100rpx;
         text-align: center;
       }
-      input::placeholder{
+
+      input::placeholder {
 
       }
     }
-    .from-but{
+
+    .from-but {
       margin-top: 40rpx;
-      button{
+
+      button {
         height: 82rpx;
         line-height: 82rpx;
         border: 2rpx solid #146AF0;
@@ -120,4 +144,4 @@ export default {
   }
 }
 
-</style>
+</style>

BIN
static/img/index/crown-img.png


BIN
static/img/index/lang-img.png


BIN
static/img/index/my-img.png