From 722d4064f44b9a5b4bbc42b5a12aff2b458355c5 Mon Sep 17 00:00:00 2001
From: vee <897831508@qq.com>
Date: Sun, 14 Nov 2021 02:50:52 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages.json | 12 +-
pages/menu/collection/index.vue | 7 +
pages/menu/sendToken/transfer2/index.vue | 384 ++++++++++++-----------
pages/menu/token/btc/index.css | 2 +-
pages/menu/token/btc/index.vue | 7 +
pages/menu/token/btc/index2.vue | 10 +-
pages/menu/wallet/index.css | 12 +-
pages/menu/wallet/index.vue | 192 +++++++-----
utils/TronUtil.js | 8 +-
utils/WalletUtil.js | 2 +-
10 files changed, 357 insertions(+), 279 deletions(-)
diff --git a/pages.json b/pages.json
index a443720..1d840d6 100644
--- a/pages.json
+++ b/pages.json
@@ -30,7 +30,8 @@
{
"path": "pages/menu/token/btc/index",
"style": {
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
},
@@ -66,7 +67,8 @@
{
"path": "pages/menu/collection/index",
"style": {
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
},
@@ -289,7 +291,8 @@
{
"path": "pages/menu/token/btc/index2",
"style": {
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
},
@@ -300,7 +303,8 @@
{
"path": "pages/menu/wallet/index",
"style": {
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
},
{
diff --git a/pages/menu/collection/index.vue b/pages/menu/collection/index.vue
index 330cfd5..d049a13 100644
--- a/pages/menu/collection/index.vue
+++ b/pages/menu/collection/index.vue
@@ -95,6 +95,13 @@
this.getCollection();
+ },
+ onPullDownRefresh() {
+ console.log('refresh');
+ this.getCollection();
+ setTimeout(function() {
+ uni.stopPullDownRefresh();
+ }, 500);
},
methods: {
showMsg(item,index){
diff --git a/pages/menu/sendToken/transfer2/index.vue b/pages/menu/sendToken/transfer2/index.vue
index 8ee42f5..9a70d63 100644
--- a/pages/menu/sendToken/transfer2/index.vue
+++ b/pages/menu/sendToken/transfer2/index.vue
@@ -8,91 +8,96 @@
@click="chooseImage()">
-
-
- Collection address
-
-
-
-
-
-
-
-
- Amount of Money
- ALL
-
-
-
-
-
+
+
+ Collection address
+
+
+
+
+
+
-
-
-
+
+
+
+
-
- Next step
-
-
-
-
-
-
-
- Payment details
+
+ Next step
+
+
+
-
-
-
- {{toValue}}
- {{info.coinList[0].name2}}
+
+
+
+ Payment details
-
-
- Payment information
- {{info.coinList[0].name2}} transfer
+
+
+
+
+ {{toValue}}
+ {{info.coinList[0].name2}}
-
- Collection address
- {{toAddress}}
-
-
- Payment address
- {{info.address}}
+
+
+ Payment information
+ {{info.coinList[0].name2}} transfer
+
+
+ Collection address
+ {{toAddress}}
+
+
+ Payment address
+ {{info.address}}
+
+
+
+
+ Next step
-
-
-
- Next step
-
-
-
-
-
-
- Password
-
-
-
-
-
- Next step
+
+
+
+
+ Password
+
+
+
+
+
+
+ Next step
+
+
+
+
+
+
-
-
-
-
-
-
-
+
@@ -103,135 +108,160 @@
export default {
data() {
return {
- btntype:false,
- addValue:'',
- info:{},
- toAddress:'',
- toValue:null,
- show:false,
- show2:false,
- value: '',
- type: 'password',
- passwordIcon: true,
- border: true,
+ btntype: false,
+ addValue: '',
+ info: {},
+ toAddress: '',
+ toValue: null,
+ show: false,
+ show2: false,
+ value: '',
+ type: 'password',
+ passwordIcon: true,
+ border: true,
}
},
methods: {
- toNext(){
- this.show=false;
- this.show2=true;
+ toNext() {
+ this.show = false;
+ this.show2 = true;
},
- back(){
- this.show2=false;
- this.show=true
+ back() {
+ this.show2 = false;
+ this.show = true
},
- btnco(){
- if(this.value.length==0){
- this.btntype=false;
- return;
+ btnco() {
+ if (this.value.length == 0) {
+ this.btntype = false;
+ return;
}
- this.btntype=true;
- },
- toAll(){
- this.toValue=this.info.balance
+ this.btntype = true;
},
- succ(a,b){
- console.log(a,4545)
- console.log(b,45646)
+ toAll() {
+ this.toValue = this.info.balance
},
- next(){
- if(this.toAddress==''){
- uni.showToast({
- title: 'Transfer receiving address cannot be blank',
- icon: 'none',
- duration: 1500
- })
- return
- }
- if(this.toValue==null){
- uni.showToast({
- title: 'Please enter the transfer amount',
- icon: 'none',
- duration: 1500
- })
- return
- }
- if(this.toValue<=0){
- uni.showToast({
- title: 'The transfer amount cannot be less than or equal to zero',
- icon: 'none',
- duration: 1500
- })
- return
- }
- this.show=true;
-
+ succ(a, b) {
+ console.log(a, 4545)
+ console.log(b, 45646)
},
- confirm(){
- if(this.value!=this.info.password){
- uni.showToast({
- title: 'Password error',
- icon: 'none',
- duration: 1500
- })
+ next() {
+ if (this.toAddress == '') {
+ uni.showToast({
+ title: 'Transfer receiving address cannot be blank',
+ icon: 'none',
+ duration: 1500
+ })
return
- }
- if(this.info.coinList[0].xname=='Ethereum'){
- this.$EthUtil.transaction(this.info.address,this.toAddress,this.toValue,this.info.privateKey).then((res) => {
- console.log(res,'钱包')
- this.show2=false;
- uni.reLaunch({
- url:'../transfer2/index'
+ }
+ if (this.toValue == null) {
+ uni.showToast({
+ title: 'Please enter the transfer amount',
+ icon: 'none',
+ duration: 1500
})
- }).catch(err => {
- console.log(err)
- })
-
+ return
}
- if(this.info.coinList[0].xname=='TRON'){
- this.$TronUtil.sendTransaction(this.info.address,this.info.privateKey,this.toAddress,this.toValue,).then((res) => {
+ if (this.toValue <= 0) {
uni.showToast({
- title: 'Successfully',
- icon: 'success',
+ title: 'The transfer amount cannot be less than or equal to zero',
+ icon: 'none',
duration: 1500
})
- this.show2=false;
- uni.reLaunch({
- url:'../transfer2/index'
+ return
+ }
+ this.show = true;
+
+ },
+ confirm() {
+ if (this.value != this.info.password) {
+ uni.showToast({
+ title: 'Password error',
+ icon: 'none',
+ duration: 1500
})
- }).catch(err => {
- uni.showToast({
- title: err,
- icon: 'none',
- duration: 1500
- })
- })
-
+ return
+ }
+ if (this.info.coinList[0].xname == 'Ethereum') {
+ this.$EthUtil.transaction(this.info.address, this.toAddress, this.toValue, this.info.privateKey).then((
+ res) => {
+ console.log(res, '钱包')
+ this.show2 = false;
+ uni.reLaunch({
+ url: '../transfer2/index'
+ })
+ }).catch(err => {
+ console.log(err)
+ })
+
+ }
+ if (this.info.coinList[0].xname == 'TRON') {
+ if (!this.contractAddress) {
+ this.$TronUtil.sendTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue, )
+ .then((res) => {
+ uni.showToast({
+ title: 'Successfully',
+ icon: 'success',
+ duration: 2000
+ })
+ this.show2 = false;
+ uni.reLaunch({
+ url: '/pages/menu/wallet/index'
+ })
+ }).catch(err => {
+ uni.showToast({
+ title: err,
+ icon: 'none',
+ duration: 2000
+ })
+ })
+ }else{
+ this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue,'',this.contractAddress )
+ .then((res) => {
+ uni.showToast({
+ title: 'Successfully',
+ icon: 'success',
+ duration: 2000
+ })
+ this.show2 = false;
+ uni.reLaunch({
+ url: '/pages/menu/wallet/index'
+ })
+ }).catch(err => {
+ console.log(err)
+ uni.showToast({
+ title: err,
+ icon: 'none',
+ duration: 2000
+ })
+ })
+ }
+
+
}
},
- goAddress(){
+ goAddress() {
uni.navigateTo({
- url:'../address/index'
+ url: '../address/index'
})
},
- // 唤醒摄像头
- chooseImage() {
- var _this = this
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'], //从相册选择、摄像头
- success: function(res) {
- _this.imgShow = res.tempFilePaths[0]
- }
- });
- // ass()
- },
+ // 唤醒摄像头
+ chooseImage() {
+ var _this = this
+ uni.chooseImage({
+ count: 1, //默认9
+ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+ sourceType: ['album', 'camera'], //从相册选择、摄像头
+ success: function(res) {
+ _this.imgShow = res.tempFilePaths[0]
+ }
+ });
+ // ass()
+ },
},
onLoad(option) {
- const item = JSON.parse(option.item);
- this.info=item;
- this.addValue=this.info.coinList[0].xname+' Address'
+ this.contractAddress = option.contractAddress;
+ this.info = uni.getStorageSync('wallet');
+ this.addValue = this.info.coinList[0].xname + ' Address'
}
};
diff --git a/pages/menu/token/btc/index.css b/pages/menu/token/btc/index.css
index 17a76ac..b9bb5f4 100644
--- a/pages/menu/token/btc/index.css
+++ b/pages/menu/token/btc/index.css
@@ -5,7 +5,7 @@
right: 30rpx;
}
.big_title{
- font-size: 48rpx;
+ font-size: 36rpx;
}
.main .money_con{
diff --git a/pages/menu/token/btc/index.vue b/pages/menu/token/btc/index.vue
index 5e438e0..29df91e 100644
--- a/pages/menu/token/btc/index.vue
+++ b/pages/menu/token/btc/index.vue
@@ -232,6 +232,13 @@
console.log(this.infoWallet,1111)
this.getWalletInfo()
},
+ onPullDownRefresh() {
+ console.log('refresh');
+ this.getWalletInfo();
+ setTimeout(function() {
+ uni.stopPullDownRefresh();
+ }, 500);
+ },
onReachBottom() {
this.pageSize += 5;
this.getWalletInfo()
diff --git a/pages/menu/token/btc/index2.vue b/pages/menu/token/btc/index2.vue
index 9c8613a..922815b 100644
--- a/pages/menu/token/btc/index2.vue
+++ b/pages/menu/token/btc/index2.vue
@@ -144,7 +144,7 @@
goSend() {
let itemm = JSON.stringify(this.infoWallet)
uni.navigateTo({
- url: '/pages/menu/sendToken/transfer2/index?item=' + itemm
+ url: '/pages/menu/sendToken/transfer2/index?contractAddress=' + this.contractAddress
})
},
goReceive() {
@@ -222,8 +222,16 @@
this.xname=this.infoWallet.coinList[index].xname
this.balance=this.infoWallet.coinList[index].balance
this.xbalance=this.infoWallet.coinList[index].balancePrice
+ this.contractAddress=this.infoWallet.coinList[index].contractAddress
this.getWalletInfo()
},
+ onPullDownRefresh() {
+ console.log('refresh');
+ this.getWalletInfo();
+ setTimeout(function() {
+ uni.stopPullDownRefresh();
+ }, 500);
+ },
onReachBottom() {
this.pageSize += 5;
this.getWalletInfo()
diff --git a/pages/menu/wallet/index.css b/pages/menu/wallet/index.css
index cebf734..384afdf 100644
--- a/pages/menu/wallet/index.css
+++ b/pages/menu/wallet/index.css
@@ -12,7 +12,7 @@
right: 30rpx;
}
.big_title{
- font-size: 48rpx;
+ font-size: 36rpx;
}
.main{
padding: 0 26rpx;
@@ -64,7 +64,7 @@
margin-top:40rpx;
}
.textcon3{
- color: #D6CAF7;
+ color: #FFFFFF;
font-size: 28rpx;
margin-top:40rpx;
}
@@ -109,20 +109,20 @@
margin-right: 20rpx;
}
.bot_con .item .left .textcon .text1{
- font-size: 36rpx;
+ font-size: 30rpx;
}
.bot_con .item .left .textcon .text2{
- font-size: 28rpx;
+ font-size: 24rpx;
color: #B0BBD5;
}
.bot_con .item .rig{
text-align: right;
}
.bot_con .item .rig .text1{
- font-size: 36rpx;
+ font-size: 32rpx;
}
.bot_con .item .rig .text2{
- font-size: 28rpx;
+ font-size: 24rpx;
color: #B0BBD5;
}
.opc{
diff --git a/pages/menu/wallet/index.vue b/pages/menu/wallet/index.vue
index 7ae6ff4..72bfbf7 100644
--- a/pages/menu/wallet/index.vue
+++ b/pages/menu/wallet/index.vue
@@ -10,14 +10,20 @@
-
-
-
-
+
+
+
+
{{this.userObj.name}}
-
-
+
+
$ {{!userObj.balancePrice?0.00:userObj.balancePrice}}
@@ -35,35 +41,37 @@
Assets
-
+
+
-
-
-
-
-
-
- {{item.name}}
+
+
+
+
+
+
+ {{item.name}}
+
+
+ {{item.xname}}
+
-
- {{item.xname}}
-
-
-
-
-
- {{item.balance}}
-
-
- ≈ $ {{item.balancePrice}}
-
- ≈ $ 0.00
+
+
+ {{item.balance}}
+
+
+ ≈ $ {{item.balancePrice}}
+
+
+ ≈ $ 0.00
+
-
-
+
@@ -83,81 +91,91 @@
return {
eth: '',
trc: 'Hello',
- walletInfo:{},
- userObj:{},
- userObj2:{},
- showMoney1:true,
- showMoney2:false,
- btcBalance:0,
+ walletInfo: {},
+ userObj: {},
+ userObj2: {},
+ showMoney1: true,
+ showMoney2: false,
+ btcBalance: 0,
}
},
-
+
onLoad() {
this.setStorage();
-
- if(uni.getStorageSync('wallet')){
- this.userObj=uni.getStorageSync('wallet');
- this.userObj2=uni.getStorageSync('wallet');
-
-
+ this.$walletUtil.updateBalance();
+ if (uni.getStorageSync('wallet')) {
+ this.userObj = uni.getStorageSync('wallet');
+ this.userObj2 = uni.getStorageSync('wallet');
+
+
this.updateData();
- this.userObj.address = this.userObj.address.substring(0, 6)+'...'+this.userObj.address.substring(25,this.userObj.address.length);
+ this.userObj.address = this.userObj.address.substring(0, 6) + '...' + this.userObj.address.substring(25,
+ this.userObj.address.length);
}
-
-
- },
- methods: {
- updateData(){
- let thar=this;
- setTimeout(
- function(){
-
- thar.userObj=uni.getStorageSync('wallet');
- thar.userObj2=uni.getStorageSync('wallet');
- thar.userObj.address = thar.userObj.ellipsisAddress;
- thar.updateData();
- },200);
-
+
+
},
- goOther(){
- console.log(this.userObj2,8888)
- let item = JSON.stringify(this.userObj2)
- uni.navigateTo({
- url:'otherCoin/index?type='+item
- })
+
+ onPullDownRefresh() {
+ console.log('refresh');
+ this.$walletUtil.updateBalance();
+ setTimeout(function() {
+ uni.stopPullDownRefresh();
+ }, 500);
},
- showMoney(){
- this.showMoney1=false
- this.showMoney2=true
+ methods: {
+ updateData() {
+ let thar = this;
+ setTimeout(
+ function() {
+
+ thar.userObj = uni.getStorageSync('wallet');
+ thar.userObj2 = uni.getStorageSync('wallet');
+ thar.userObj.address = thar.userObj.ellipsisAddress;
+ thar.updateData();
+ }, 200);
+
+ },
+ goOther() {
+ console.log(this.userObj2, 8888)
+ let item = JSON.stringify(this.userObj2)
+ uni.navigateTo({
+ url: 'otherCoin/index?type=' + item
+ })
},
- showMoney22(){
- this.showMoney1=true
- this.showMoney2=false
+ showMoney() {
+ this.showMoney1 = false
+ this.showMoney2 = true
+ },
+ showMoney22() {
+ this.showMoney1 = true
+ this.showMoney2 = false
},
setStorage() {
this.walletInfo = uni.getStorageSync('walletInfo');
- this.userObj=this.walletInfo.BTC[0]
- this.userObj.address = this.userObj.address.substring(0, 6)+'...'+this.userObj.address.substring(25,this.userObj.address.length);
+ this.userObj = this.walletInfo.BTC[0]
+ this.userObj.address = this.userObj.address.substring(0, 6) + '...' + this.userObj.address.substring(25,
+ this.userObj.address.length);
console.log(this.walletInfo.BTC[0])
},
- goTrans(itemm,index) {
- console.log(index,444)
- let item = JSON.stringify(this.userObj2)
- console.log(item,454545)
- if(index==0){
+ goTrans(itemm, index) {
+ console.log(index, 444)
+ let item = JSON.stringify(this.userObj2)
+ console.log(item, 454545)
+ if (index == 0) {
uni.navigateTo({
- url:'/pages/menu/token/btc/index?item='+item
- })
- }else{
+ url: '/pages/menu/token/btc/index?item=' + item
+ })
+ } else {
// 代币页面
- uni.setStorageSync('otherCoin',index)
+ uni.setStorageSync('otherCoin', index)
uni.navigateTo({
- url:'/pages/menu/token/btc/index2'
- })
+ url: '/pages/menu/token/btc/index2'
+ })
}
-
- },
-
+
+ },
+
// 唤醒摄像头
chooseImage() {
var _this = this
@@ -177,7 +195,7 @@
url: './cwallet/index'
})
}
- }
+ }
};