Browse Source

Merge branch 'cc-wap' of http://git.lcpcp.cc/root/bn-q-icon into cc-wap

# Conflicts:
#	pages/home/home-index.vue
DESKTOP-70VPDLK\Administrator 6 months ago
parent
commit
c4bbf6084b
4 changed files with 82 additions and 52 deletions
  1. 47 36
      App.vue
  2. 18 2
      pages/convert/convert-index.vue
  3. 14 11
      pages/home/home-index.vue
  4. 3 3
      pages/my/inner-page/all_profit.vue

+ 47 - 36
App.vue

@@ -6,30 +6,34 @@ import tools from "@/common/js/tools";
 export default {
   onLaunch: function () {
     console.log("App Launch");
-   let bnbObj= tokenpocketBnb.getProvider()
-    console.log(bnbObj)
-    bnbObj.on('accountsChanged',(accounts)=>{
-      if(accounts.length<=0){
-        uni.reLaunch({
-          'url':'pages/index/error?errorType=2'
-        })
-      }else {
-        uni.clearStorageSync()
-        this.login(accounts[0])
-      }
+    setTimeout(()=>{
+      let bnbObj= tokenpocketBnb.getProvider()
+      console.log(bnbObj)
+      bnbObj.on('accountsChanged',(accounts)=>{
+        console.log('监听成功')
+        if(accounts.length<=0){
+          uni.reLaunch({
+            'url':'pages/index/error?errorType=2'
+          })
+        }else {
+          uni.clearStorageSync()
+          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'
+          })
+        }
+      })
+    },5000)
 
-    })
-    bnbObj.on('chainChanged',(chainId)=>{
-      if(chainId!=='0x38'){
-        uni.reLaunch({
-          'url':'pages/index/error?errorType=5'
-        })
-      }else {
-        uni.reLaunch({
-          'url':'pages/index/index'
-        })
-      }
-    })
     uni.$on('noBan',()=>{
       console.log(this.$Route)
       if(this.$Route.path!=='/pages/index/error'){
@@ -42,25 +46,32 @@ export default {
   },
   onShow: function () {
     console.log("App Show");
+    uni.reLaunch({
+      url: '/pages/login/index'
+    })
   },
   onHide: function () {
+    uni.clearStorageSync()
     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
-          })
-        }
+      // 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
+      //     })
+      //   }
+      // })
+      uni.reLaunch({
+        url: '/pages/login/index'
       })
     }
   }

+ 18 - 2
pages/convert/convert-index.vue

@@ -31,6 +31,8 @@
 				address: '',
 				dealAddress: '',
 				change_num: 0,
+        max_num: 0,
+        userDealNum: 0,
 				list: [],
 				page: 1,
 			};
@@ -44,8 +46,10 @@
 					if (this.type === 2) {
 						this.toNum = this.formNUm * this.price
 					} else {
+            console.log(this.formNUm , this.price);
 						this.toNum = (this.formNUm / this.price).toFixed(6)
 					}
+          console.log('11111',	this.toNum)
 
 				}
 			}
@@ -62,6 +66,8 @@
 					if (res.code === 1) {
 						this.dealAddress = res.data.address
 						this.change_num = res.data.change_num
+						this.max_num = res.data.max_num
+						this.userDealNum = res.data.userDealNum
 					}
 				})
 			},
@@ -70,6 +76,10 @@
 					tools.error("兑换数量异常")
 					return
 				}
+        if(this.formNUm*1+this.userDealNum>this.max_num){
+          tools.error("兑换超限")
+          return
+        }
 				let data = ''
 				let transactionData = ''
 				let formHex = web3.utils.numberToHex(ethers.utils.parseEther(this.formNUm.toString()).toString());
@@ -100,8 +110,14 @@
 							if (res.code === 1) {
 								tools.success(res.msg)
 								this.toNum = ''
-								this.getTotalMoney()
-								this.getIconNum()
+								setTimeout(()=>{
+                  this.getTotalMoney()
+                  this.getIconNum()
+                  this.getAddress()
+                  this.page=1
+                  this.list=[]
+                  this.getDealList()
+                },50)
 							} else {
 								tools.error(res.msg)
 							}

+ 14 - 11
pages/home/home-index.vue

@@ -68,26 +68,27 @@
     },
 		methods: {
       async test(){
-        let price= await tokenpocketBnb.getPrice()
-        console.log('price:',price)
+        // this.pledgeTotal='1'
+        // let price= await tokenpocketBnb.getPrice()
+        // console.log('price:',price)
         //icon转账
         let data=''
         // 查询
         //查询开关
         //  data='0xdbf4453000000000000000000000000014a4ce7bfade4c897ae0d59fdfb7f8317dcdecb4000000000000000000000000241ff4db9141649ef142d297bd5623f6743fc16f'
-        // tokenpocketBnb.getProvider().request({method: 'eth_call',params:[{'to':'0xcc23DbFDA43a78B858CF8C492410243BDf5afF0e','data':data}, "latest"]}).then((balance)=>{
+        // tokenpocketBnb.getProvider().request({method: 'eth_call',params:[{'to':'0x7EC437314542acFAB189671b935ba56605483796','data':data}, "latest"]}).then((balance)=>{
         //   console.log('getTrading-----------------------',balance)
         // })
 
         // 查询系统地址
         //  data='0x7fce276d'
-        // tokenpocketBnb.getProvider().request({method: 'eth_call',params:[{'to':'0xcc23DbFDA43a78B858CF8C492410243BDf5afF0e','data':data}, "latest"]}).then((balance)=>{
+        // tokenpocketBnb.getProvider().request({method: 'eth_call',params:[{'to':'0x7EC437314542acFAB189671b935ba56605483796','data':data}, "latest"]}).then((balance)=>{
         //   console.log('0x7fce276d-----------------------',balance)
         // })
 
         // getSwapPair  是否是交易地址
-        // data='0x90cdd25a000000000000000000000000342e9f3b10a906a19ad8d6848c46d3461253956e'
-        // tokenpocketBnb.getProvider().request({method: 'eth_call',params:[{'to':'0xcc23DbFDA43a78B858CF8C492410243BDf5afF0e','data':data}, "latest"]}).then((balance)=>{
+        // data='0xd5afd0ac000000000000000000000000e113cfd2d4de965e73de6e217591793fa85b1de6'
+        // tokenpocketBnb.getProvider().request({method: 'eth_call',params:[{'to':'0x7EC437314542acFAB189671b935ba56605483796','data':data}, "latest"]}).then((balance)=>{
         //   console.log('getSwapPair-----------------------',balance)
         // })
         //
@@ -99,7 +100,7 @@
 
 
         // approve 授权测试
-        // data='0xa815c611000000000000000000000000342e9f3b10a906a19ad8d6848c46d3461253956e0000000000000000000000000000000000000000000000000000000000000000'
+        // data='0x8b09832d000000000000000000000000241ff4db9141649ef142d297bd5623f6743fc16f'
         // let  transactionData = await tokenpocketBnb.getContractTransaction(data, 0);
         // tokenpocketBnb.sendTransaction(transactionData).then(res => {
         //   console.log(res)
@@ -123,7 +124,7 @@
         //0xfe219D86FC55cd07441005fF647B9babAd12C36C
 
         //  approve 预授权
-        // data = '0xa815c611000000000000000000000000feec51d154fa70d16ddda291f0180417e58c6fbe0000000000000000000000000000000000000000000000000000000000000001'
+        // data = '0x095ea7b3000000000000000000000000b7f1c21c51a0f85704a13b981aa9075d9b1029620000000000000000000000000000000000000000000000056bc75e2d63100000'
         // let  transactionData = await tokenpocketBnb.getContractTransaction(data, 0);
         // tokenpocketBnb.sendTransaction(transactionData).then(res => {
         //   console.log(res)
@@ -227,10 +228,12 @@
 							'money': this.pledgeNUm,
 							'hash': res
 						}).then(res => {
-							if (res.code === 0) {
+							if (res.code === 1) {
 								this.pledgeNUm = ''
 								tools.success(res.msg)
-								this.getTotalMoney()
+								setTimeout(()=>{
+                  this.getTotalMoney()
+                },100)
 							} else {
 								tools.error(res.msg)
 							}
@@ -340,7 +343,7 @@
 						</view>
 					</view>
 					<view>
-						<input v-model="pledgeNUm" :placeholder="'输入要'+(listTab===1 ?'质押':'解压')+'的DAO数量'" type="number"
+						<input v-model="pledgeNUm" :placeholder="'输入要'+(listTab===1 ?'贡献':'赎回')+'的DAO数量'" type="number"
 							placeholder-class="fs-28"></input>
 					</view>
 				</view>

+ 3 - 3
pages/my/inner-page/all_profit.vue

@@ -63,8 +63,8 @@ import {getTotalMoney, getWaterList} from "@/api/money";
 			<view class="fs-28 fc-f mb-16">
 				总收益
 			</view>
-			<view class="fs-18 fc-f fw-b mb-16">
-				{{revenueTotal}}
+			<view class="fs-26 fc-f fw-b mb-16">
+				{{revenueTotal*1}}
 			</view>
 <!--			<view class="fs-28 fc-f text-align-center tx-box b-rad-20">-->
 <!--				提现-->
@@ -80,7 +80,7 @@ import {getTotalMoney, getWaterList} from "@/api/money";
 					<view class="fs-28 fw-b mb-16">
 						{{item.status_str}}
 					</view>
-					<view class="fs-12 fc-858585">
+					<view class="fs-20 fc-858585">
             {{item.created_date}}
 					</view>
 				</view>