Browse Source

no message

BF-202210271038\Administrator 2 years ago
parent
commit
64b4959ce4

+ 46 - 0
App.vue

@@ -1,7 +1,35 @@
 <script>
+import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
+import {login} from "@/api/member";
+import tools from "@/common/js/tools";
+
 export default {
   onLaunch: function () {
     console.log("App Launch");
+   let bnbObj= tokenpocketBnb.getProvider()
+    bnbObj.on('accountsChanged',(accounts)=>{
+      if(accounts.length<=0){
+        uni.reLaunch({
+          'url':'pages/index/error?errorType=2'
+        })
+      }else {
+        uni.setStorageSync('babAddress',accounts[0])
+        uni.setStorageSync('token', '');
+        this.login(accounts[0])
+      }
+
+    })
+    bnbObj.on('chainChanged',(chainId)=>{
+      if(chainId!=='0x38'){
+        uni.reLaunch({
+          'url':'pages/index/error?errorType=5'
+        })
+      }else {
+        uni.reLaunch({
+          'url':'pages/index/index'
+        })
+      }
+    })
   },
   onShow: function () {
     console.log("App Show");
@@ -9,6 +37,24 @@ export default {
   onHide: function () {
     console.log("App Hide");
   },
+  methods:{
+    login(Address){
+      login({'address':Address}).then((res)=>{
+        if(res.code===1){
+          tools.setLoginInfo(res.data)
+          setTimeout(()=>{
+            uni.reLaunch({
+              url: '/pages/index/index'
+            })
+          },50)
+        }else {
+          uni.reLaunch({
+            url: 'pages/login/register?address='+Address
+          })
+        }
+      })
+    }
+  }
 };
 </script>
 

+ 2 - 2
common/wallet/tokenpocket-wallet/tokenpocket-bnb.js

@@ -21,9 +21,9 @@ tokenpocketBnb.getProvider= function (){
     if(!provider){
         provider = window.ethereum;
     }
+    // alert(provider.isConnected())
     if(!chainId){
         provider.request({method:'eth_chainId'}).then((ethChainId)=>{
-            console.log('ethChainId:'+ethChainId)
             if(ethChainId!=='0x38'){
                 uni.$emit('noBan',false)
             }else {
@@ -79,7 +79,7 @@ tokenpocketBnb.getBalance=async function (selectedAddress) {
     }
     return new Promise( (resolve, reject) => {
         try {
-            tokenpocketBnb.getProvider().request({ method: 'eth_getBalance',params:[selectedAddress]})
+            tokenpocketBnb.getProvider().request({ method: 'eth_getBalance',params:[selectedAddress,'latest']})
                 .then((balance)=>{
                     balance= ethers.utils.formatEther(balance.toString())
                     resolve(balance)

+ 11 - 16
index.html

@@ -1,23 +1,18 @@
 <!DOCTYPE html>
-<html lang="en">
-
+<html lang="zh-CN">
 <head>
-  <meta charset="UTF-8" />
-  <meta name="viewport"
-    content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
-  <meta name="viewport"
-    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
-    <title>BNBDAO</title>
-    <link rel="icon" href="/static/img/index/logo1.png">
-  <!--preload-links-->
-  <!--app-context-->
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="icon" href="<%= BASE_URL %>static/img/index/logo1.png">
+    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 </head>
-
 <body>
-  <div id="app">
-    <!--app-html-->
-  </div>
-  <script type="module" src="/main.js"></script>
+<noscript>
+    <strong>Please enable JavaScript to continue.</strong>
+</noscript>
+<div id="app"></div>
 </body>
+<script type="text/javascript">
 
+</script>
 </html>

+ 6 - 4
locale/en.json

@@ -16,12 +16,13 @@
   "index.index.invest.send_no": "failure",
   "index.index.invest.send_ok": "successful",
 
-  "index.index.top.one": "Use your NFTs as collateral",
+  "index.index.top.one": "BNB DAO is really a platform for us to create wealth. 100% smart contract +100% open and transparent +DAO autonomy is a good platform for you to earn tens of millions of dollars without leaving your home",
   "index.index.top.two": "to borrow ETH or deposit",
   "index.index.top.three": "your ETH and earn yields",
-  "index.index.top.four": "instantly!",
-  "index.index.top.five": "Running SAFE for 236 days. Read more in the",
-  "index.index.top.six": "Audit report!",
+  "index.index.top.four": "day!",
+  "index.index.top.cp": "Click the Copy invitation link",
+  "index.index.top.five": "The platform is running stably",
+  "index.index.top.six": "View Details!",
   "index.index.list.title": "My income and expenditure",
   "index.index.list.item.title": "Separation",
   "index.index.list.item.integral": "Integral",
@@ -43,5 +44,6 @@
   "index.error.errorMsg.noAddress": "Address information is Abnormal.!",
   "index.error.errorMsg.noInvite": "Invalid recommendation information!",
   "index.error.errorMsg.noInvest": "Service Exception!",
+  "index.error.errorMsg.noChainId": "Please select Binance Smart Link!",
   "index.text": "一觸即發"
 }

+ 6 - 4
locale/ko.json

@@ -16,12 +16,13 @@
   "index.index.invest.send_no": "실패",
   "index.index.invest.send_ok": "성공",
 
-  "index.index.top.one": "담보로 NFTs를 사용하세요",
+  "index.index.top.one": "bnb dao는 정말 우리로 하여금 부를 창조할 수 있는 플랫폼입니다. 100% 스마트 계약 +100% 공개 투명 + dao 자치는 지금 집 밖에 나가지 않고 천만 위안의 수익을 벌 수 있는 좋은 플랫폼입니다",
   "index.index.top.two": "ETH나 예금을 빌리는 것",
   "index.index.top.three": "ETH와 수익을 산출합니다",
-  "index.index.top.four": "즉시!",
-  "index.index.top.five": "236일 동안 안전하게 달리고 있습니다.에서 […] Read more > >",
-  "index.index.top.six": "감사 보고서!",
+  "index.index.top.four": "일!",
+  "index.index.top.cp": "초대장 링크 복사하기",
+  "index.index.top.five": "플랫폼은 이미 안정적으로 운영되고 있다",
+  "index.index.top.six": "상세한 상황을 조사하다.!",
   "index.index.list.title": "나의 수입과 지출 내역",
   "index.index.list.item.title": "플랫폼 수익",
   "index.index.list.item.integral": "포인트",
@@ -43,5 +44,6 @@
   "index.error.errorMsg.noAddress": "주소 정보 예외!",
   "index.error.errorMsg.noInvite": "추천 정보가 올바르지 않음!",
   "index.error.errorMsg.noInvest": "서비스 비정상!",
+  "index.error.errorMsg.noChainId": "바이콘 스마트 체인을선택하세요!",
   "index.text": "一觸即發"
 }

+ 8 - 6
locale/zh-Hans.json

@@ -16,12 +16,13 @@
 	"index.index.invest.send_no": "失败",
 	"index.index.invest.send_ok": "成功",
 
-	"index.index.top.one": "Use your NFTs as collateral",
-	"index.index.top.two": "to borrow ETH or deposit",
-	"index.index.top.three": "your ETH and earn yields",
-	"index.index.top.four": "instantly!",
-	"index.index.top.five": "Running SAFE for 236 days. Read more in the",
-	"index.index.top.six": "Audit report!",
+	"index.index.top.one": "BNB DAO  真正是一个让我们可以创造财富的平台,100%智能合约+100%公开透明+DAO 自治,是当下足不出户的你,正可以赚到千万收入的好平台",
+	"index.index.top.two": "100%智能合约+100%公开透明+DAO 自治",
+	"index.index.top.three": "是当下足不出户的你",
+	"index.index.top.four": "天!",
+	"index.index.top.cp": "点击复制邀请链接",
+	"index.index.top.five": "平台已稳定运行",
+	"index.index.top.six": "查看详情!",
 	"index.index.list.title": "我的收支明细",
 	"index.index.list.item.title": "平台分润",
 	"index.index.list.item.integral": "积分",
@@ -42,6 +43,7 @@
 	"index.error.errorMsg.noWallet": "请使用tokenpocket打开!",
 	"index.error.errorMsg.noAddress": "地址信息异常!",
 	"index.error.errorMsg.noInvite": "推荐信息无效!",
+	"index.error.errorMsg.noChainId": "请选择币安智能链!",
 	"index.error.errorMsg.noInvest": "服务异常!",
 	"index.text": "一觸即發"
 }

+ 5 - 3
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "wx-wap",
+    "name" : "BNBDAO",
     "appid" : "__UNI__9075D31",
     "description" : "",
     "versionName" : "1.0.13",
@@ -8,7 +8,7 @@
     /* 5+App特有相关 */
     "app-plus" : {
         "usingComponents" : true,
-        "nvueStyleCompiler" : "uni-app",
+        "nvueStyleCompiler" : "BNBDAO",
         "compilerVersion" : 3,
         "splashscreen" : {
             "alwaysShowBeforeRender" : true,
@@ -80,6 +80,8 @@
                     "secure" : false
                 }
             }
-        }
+        },
+        "title" : "BNBDAO",
+        "template" : ""
     }
 }

+ 2 - 2
pages/index/contract.vue

@@ -20,9 +20,9 @@
         </view>
       </view>
       <view class="data-but">
-        <button @click="setInvest">定金</button>
+        <button @click="setInvest">支付</button>
       </view>
-      <view class="data-button" @click="goToUrl(1)">
+      <view v-if="false" class="data-button" @click="goToUrl(1)">
         <image src="@/static/img/index/msg.svg"></image>
         <view>{{$t('index.contract.word')}}>></view>
       </view>

+ 4 - 3
pages/index/error.vue

@@ -33,6 +33,7 @@ export default {
           'noAddress',
           'noInvite',
           'noInvest',
+          'noChainId',
       ],
       errorType:0
     }
@@ -47,9 +48,9 @@ export default {
   },
   methods: {
     closeSys(){
-      let userAgent = navigator.userAgent;
-      if (userAgent.indexOf('Firefox') !== -1 || userAgent.indexOf('Chrome') !== -1) return window.location.href = 'about: blank';
-      return window.opener = null,window.open('about: blank', '_self'),window.close();
+      uni.navigateTo({
+        'url': 'pages/index/index'
+      })
     }
   }
 

+ 43 - 18
pages/index/index.vue

@@ -1,20 +1,25 @@
 <template>
   <view class="index-data">
     <view class="index-top">
-        <top-head></top-head>
+      <top-head></top-head>
       <view class="top-text">
-        <view class="text-item">{{$t('index.index.top.one')}}</view>
-        <view class="text-item">{{$t('index.index.top.two')}}</view>
-        <view class="text-item">{{$t('index.index.top.three')}}</view>
-        <view class="text-item">{{$t('index.index.top.four')}}</view>
+        {{ $t('index.index.top.one') }}
+        <!--        <view class="text-item">{{$t('index.index.top.one')}}</view>-->
+        <!--        <view class="text-item">{{$t('index.index.top.two')}}</view>-->
+        <!--        <view class="text-item">{{$t('index.index.top.three')}}</view>-->
+        <!--        <view class="text-item">{{$t('index.index.top.four')}}</view>-->
       </view>
       <view class="top-but">
-        <button @click="goToUrl(1)">{{$t('index.index.investment')}}</button>
+        <button @click="goToUrl(1)">{{ $t('index.index.investment') }}</button>
+      </view>
+      <view class="top-bottom">
+        <image class="bottom-img" src="@/static/img/index/cp.png" mode="aspectFill"></image>
+        <text class="bottom-text">{{ $t('index.index.top.cp') }}</text>
       </view>
       <view class="top-bottom">
         <image class="bottom-img" src="@/static/img/index/dagou.svg" mode="aspectFill"></image>
-        <text class="bottom-text">{{$t('index.index.top.five')}}</text>
-        <text class="bottom-text" @click="goToUrl(2)">{{$t('index.index.top.six')}}</text>
+        <text class="bottom-text">{{ $t('index.index.top.five') }}{{days}}{{$t('index.index.top.four')}}</text>
+        <text class="bottom-text" @click="goToUrl(2)">{{ $t('index.index.top.six') }}</text>
       </view>
     </view>
     <view class="index-list">
@@ -22,7 +27,7 @@
         <view class="title-img">
           <image src="@/static/img/index/bnb2.png" mode="aspectFill"></image>
         </view>
-        <view class="title-text">{{$t('index.index.list.title')}}({{total}})</view>
+        <view class="title-text">{{ $t('index.index.list.title') }}({{ total }})</view>
       </view>
       <division></division>
       <earning-list @setTotal="setTotal"></earning-list>
@@ -40,7 +45,7 @@ import TopHead from "@/pages/index/components/top-head";
 import EarningList from "@/pages/index/components/earning-list";
 
 export default {
-  components: {EarningList, TopHead,  Division},
+  components: {EarningList, TopHead, Division},
   data() {
     return {
       applicationLocale: '',
@@ -69,7 +74,8 @@ export default {
       },
       bnbNum: 0,
       babAddress: '',
-      total:0
+      total: 0,
+      days:365
 
     }
 
@@ -77,13 +83,23 @@ export default {
   watch: {},
   async onLoad(query) {
     this.getMyData()
+    this.handlerDateDurationCurrent()
   },
   mounted() {
 
   },
   methods: {
-    setTotal(total){
-      this.total=total
+    handlerDateDurationCurrent() {
+      let d1 = new Date('2021-11-12')
+      let d2 = new Date()
+
+      let cha = Math.abs(d2.getTime() - d1.getTime())
+      this.days = parseInt(cha / (24 * 60 * 60 * 1000))
+      // let hours = parseInt(cha % (24 * 60 * 60 * 1000) / (60 * 60 * 1000))
+      // let mins = parseInt(cha % (60 * 60 * 1000) / (60 * 1000))
+    },
+    setTotal(total) {
+      this.total = total
     },
     goToUrl(type) {
       switch (type) {
@@ -111,8 +127,8 @@ export default {
 
     getMyData() {
       this.babAddress = tokenpocketBnb.getAccounts()
-      let token=uni.getStorageSync('token')
-      if(token){
+      let token = uni.getStorageSync('token')
+      if (token) {
         getMemberInfo().then((res) => {
           if (res.code === 1) {
             this.memberData = res.data
@@ -128,12 +144,13 @@ export default {
 //@import "/static/css/common.css";
 .index-data {
   .index-top {
-    box-shadow: 0 0 24rpx 0 rgba(0,0,0,0.08);
+    box-shadow: 0 0 24rpx 0 rgba(0, 0, 0, 0.08);
     box-sizing: border-box;
     overflow: hidden;
     padding: 40rpx 0;
     width: 100%;
     background: linear-gradient(0deg, rgb(64, 74, 96) 0%, rgb(9, 21, 36) 100%);
+
     .top-head {
       display: flex;
       justify-content: space-between;
@@ -200,10 +217,14 @@ export default {
       clear: both;
       padding: 40rpx;
       margin-top: 40rpx;
+      color: #fff;
+      font-size: 36rpx;
+      font-weight: bold;
+      line-height: 36px;
 
       .text-item {
         color: #fff;
-        font-size: 50rpx;
+        font-size: 30rpx;
         font-weight: bold;
       }
     }
@@ -224,7 +245,7 @@ export default {
     }
 
     .top-bottom {
-      padding: 40rpx;
+      padding: 10rpx 40rpx 0 40rpx;
 
       .bottom-img {
         display: inline-block;
@@ -243,6 +264,10 @@ export default {
         text-decoration: underline;
       }
     }
+
+    .top-bottom:first-child {
+      padding: 40rpx 40rpx 0 40rpx;
+    }
   }
 
   .index-list {

BIN
static/img/index/cp.png