Browse Source

修改

master
vee 4 years ago
parent
commit
484cb32467
  1. 101
      pages/menu/sendToken/enPassword/index.vue
  2. 9
      pages/menu/sendToken/index.vue
  3. 266
      pages/menu/sendToken/transfer/index.vue
  4. 7
      pages/menu/setting/index.vue
  5. 46
      pages/menu/token/btc/index.css
  6. 2
      pages/menu/token/btc/index.vue
  7. 47
      pages/menu/transction/detail/index.vue
  8. 2
      pages/menu/wallet/cwallet/index.css
  9. 32
      pages/menu/wallet/index.vue
  10. 8
      pages/menu/wallet/mwallet/index.css
  11. 10
      utils/EthUtil.js
  12. 7
      utils/TronUtil.js
  13. 25
      utils/WalletUtil.js

101
pages/menu/sendToken/enPassword/index.vue

@ -34,8 +34,7 @@
info: false,
transInfoPass: {
},
wallet: {}
}
}
},
@ -46,91 +45,79 @@
this.info = false;
}
},
finish2(e) {
if (this.wallet.password != e) {
this.info = true;
return;
} else {
this.info = false;
}
//
// trx
if (this.wallet.type == 'TRX') {
// trx
if (!this.contractAddress) {
this.$TronUtil.sendTransaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey, this
.transInfoPass.toAddress, this.transInfoPass.amount)
.then((res) => {
console.log(res, 111)
transaction() {
if (this.transInfoPass.type === 'ETH') {
this.$EthUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.contractAddress,
function(hash, err) {
if (!err) {
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 2000
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
setTimeout(() => {
that.fingerSuccess = false;
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}).catch(err => {
}, 1000)
} else {
console.log(err, 'cuowu')
uni.showToast({
title: err,
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 2000
duration: 1500
})
}
})
} else {
// trx
this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this
.toValue, '', this.contractAddress)
} else if (this.transInfoPass.type === 'TRX') {
this.$TronUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.remark, this.transInfoPass.contractAddress)
.then((res) => {
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 2000
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
this.show2 = false;
setTimeout(() => {
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}, 1000)
}).catch(err => {
console.log(err)
console.log(err, 'cuowu')
uni.showToast({
title: err,
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 2000
duration: 1500
})
})
}
}
if (this.wallet.type == 'ETH') {
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)
})
}
},
finish2(e) {
if (this.transInfoPass.password != e) {
this.info = true;
return;
} else {
this.info = false;
this.transaction();
}
},
},
onLoad() {
//
this.transInfoPass = uni.getStorageSync('transInfoPass')
//
this.wallet = uni.getStorageSync('wallet')
uni.removeStorageSync('transInfoPass')
console.log(this.transInfoPass, 2222)
console.log(this.wallet, 2222)
}
};
</script>

9
pages/menu/sendToken/index.vue

@ -10,9 +10,10 @@
{{addressInfo.name}} Receiving address
</view>
<view class="code_con">
<tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit" :background="background"
:foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval" :loadMake="loadMake"
:showLoading="showLoading" :loadingText="loadingText" :icon="icon" class="test" />
<tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit"
:background="background" :foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval"
:loadMake="loadMake" :showLoading="showLoading" :loadingText="loadingText" :icon="icon"
class="test" />
</view>
<view class="text1">
Scan the QR code to transfer to the asset
@ -113,7 +114,5 @@
</style>
<style>
@import './index.css';
</style>

266
pages/menu/sendToken/transfer/index.vue

@ -27,7 +27,7 @@
<view class="inputcon">
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="Please enter the recipient address" class="input1"
v-model="recipientAddress" />
v-model="transInfoPass.toAddress" />
<image src="../../../../static/tongyonh/Frame330.png" mode="aspectFit" class="img1"></image>
</view>
</view>
@ -44,15 +44,16 @@
{{coin.name}}
</view>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="0.0000000" class="input3" v-model="transAmount" />
placeholder="0.0000000" class="input3" v-model="transInfoPass.amount" />
</view>
<text></text>
<view class="inputc flex">
<view class="textt">
USD
</view>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="0.0000000" class="input3" />
<input type="text" value="" disabled="disabled"
placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="0.0000000"
class="input3" />
</view>
</view>
<view class="top flex bottom">
@ -74,7 +75,7 @@
</view>
<view class="inputcon">
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="Please enter a note (off-chain)" class="input1" />
placeholder="Please enter a note (off-chain)" v-model="transInfoPass.remark" class="input1" />
</view>
</view>
@ -114,7 +115,7 @@
Amount
</view>
<view class="text1">
{{transAmount}} {{coin.name}}
{{transInfoPass.amount}} {{coin.name}}
</view>
</view>
<view class="item">
@ -122,7 +123,7 @@
Send address
</view>
<view class="text2">
{{coin.address}}
{{transInfoPass.fromAddress}}
</view>
</view>
<view class="item">
@ -130,7 +131,7 @@
Receiving address
</view>
<view class="text2">
{{recipientAddress}}
{{transInfoPass.toAddress}}
</view>
</view>
<view class="item">
@ -156,7 +157,7 @@
</view>
</view>
<u-mask z-index="10" :show="show"></u-mask>
<u-mask z-index="10" :show="show" @click="cancelAll"></u-mask>
<!-- <u-mask z-index="1000" :show="show2" @click="show2 = false"></u-mask> -->
<view class="zhiwen_con" v-if="showFinger">
<view class="tiao" @click="cancel">
@ -170,7 +171,7 @@
Touch the fingerprint sensor
</view>
<view class="flex con">
<view class="textt1" @click="goPassword" v-if="!passShow">
<view class="textt1" @click="goPassword">
Use Password
</view>
<view class="textt2" @click="cancel">
@ -213,14 +214,14 @@
<view class="text1 green">
Fingerprint recognized.
</view>
<!-- <view class="flex con">
<view class="flex con">
<view class="textt1">
Use Password
</view>
<view class="textt2">
Confirm
</view>
</view> -->
</view>
</view>
</view>
@ -249,9 +250,6 @@
show2: false,
showFinger: false,
showBottom: false,
addressInfo: {},
recipientAddress: '',
transAmount: '',
fingerSuccess: false,
fingerFail: false,
// 使
@ -259,13 +257,82 @@
//
transInfoPass: {
fromAddress: '',
toAddress: "",
toAddress: '1',
privateKey: '',
amount: '',
amount: '1',
remark:'1',
contractAddress:'',
password:''
}
}
},
methods: {
transaction() {
let that=this;
if (this.coin.type === 'ETH') {
this.$EthUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.contractAddress,
function(hash, err) {
if (!err) {
console.log(2222211111)
that.showFinger = false
that.showBottom = false;
that.fingerSuccess = true;
uni.showToast({
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
setTimeout(() => {
that.fingerSuccess = false;
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}, 1000)
} else {
console.log(err, 'cuowu')
that.showFinger = false;
that.showBottom = true;
uni.showToast({
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 1500
})
}
})
} else if (this.coin.type === 'TRX') {
this.$TronUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.remark, this.transInfoPass.contractAddress)
.then((res) => {
console.log(1212121212121212)
that.showFinger = false
that.showBottom = false;
that.fingerSuccess = true;
uni.showToast({
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
setTimeout(() => {
that.fingerSuccess = false;
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}, 1000)
}).catch(err => {
console.log(err, 'cuowu')
that.showFinger = false;
that.showBottom = true;
uni.showToast({
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 1500
})
})
}
},
cancelAll() {
this.show = false;
this.showBottom = false;
@ -284,13 +351,20 @@
//
goPassword() {
this.printCancel();
this.show = false;
this.showBottom=false;
console.log(111)
uni.setStorageSync('transInfoPass', this.transInfoPass)
uni.navigateTo({
url: '/pages/menu/sendToken/enPassword/index'
})
},
//
confirmTo(type) {
if(!this.passShow){
this.goPassword();
}else{
console.log('点击提交')
if (type == 'try') {
this.fingerFail = false;
}
@ -298,15 +372,11 @@
this.show = true
this.showFinger = true
this.showBottom = false;
//
this.transInfoPass.fromAddress = this.addressInfo.address;
this.transInfoPass.toAddress = this.recipientAddress;
this.transInfoPass.privateKey = this.addressInfo.privateKey;
this.transInfoPass.amount = this.transAmount;
console.log(this.transInfoPass, 444)
//
uni.setStorageSync('transInfoPass', this.transInfoPass)
this.fingerprint();
}
},
back() {
@ -316,12 +386,12 @@
},
//
forAll() {
this.transAmount = this.coin.balance
this.transInfoPass.amount = this.coin.balance
},
//
Confirm() {
//
if (this.transAmount == '') {
if (this.transInfoPass.amount == '') {
uni.showToast({
title: 'Please enter the transfer amount',
icon: 'none',
@ -329,7 +399,7 @@
})
return
}
if (this.recipientAddress == '') {
if (this.transInfoPass.toAddress == '') {
uni.showToast({
title: 'Please enter the receiving address',
icon: 'none',
@ -337,7 +407,7 @@
})
return
}
if (this.transAmount == '' < 0) {
if (Number(this.transInfoPass.amount) == '' < 0) {
uni.showToast({
title: 'The entered amount cannot be less than 0',
icon: 'none',
@ -345,7 +415,7 @@
})
return
}
if( this.transAmount>this.coin.balance){
if (Number(this.transInfoPass.amount) > this.coin.balance) {
uni.showToast({
title: 'Sorry, your credit is running low',
icon: 'none',
@ -360,7 +430,7 @@
printCancel() {
this.showFinger = false;
console.log(this.showFinger, 4444)
plus.fingerprint.cancel();
//plus.fingerprint.cancel();
console.log(this.showFinger, 4444)
},
@ -412,126 +482,8 @@
// #ifdef APP-PLUS
plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //Android
console.log(that.transInfoPass,5656)
console.log(that.addressInfo,56556656)
if (that.addressInfo.type == 'TRX') {
console.log(that.addressInfo.type,11111)
console.log(that.transInfoPass,2222)
// if (!this.contractAddress) {
//
that.$TronUtil.sendTransaction(that.transInfoPass.fromAddress,that.transInfoPass.privateKey,that.transInfoPass.toAddress,that.transInfoPass.amount )
.then((res) => {
console.log(1212121212121212)
that.showFinger = false
that.showBottom = false;
that.fingerSuccess = true;
uni.showToast({
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
setTimeout(()=>{
that.fingerSuccess = false;
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
},1000)
}).catch(err => {
console.log(err,'cuowu')
that.showFinger=false;
that.showBottom=true;
uni.showToast({
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 1500
})
})
// }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
// })
// })
// }
}
if (that.addressInfo.type == 'ETH') {
console.log(that.addressInfo.type,11111)
console.log(that.transInfoPass,2222)
// if (!this.contractAddress) {
//
that.$EthUtil.transaction(that.transInfoPass.fromAddress,that.transInfoPass.privateKey,that.transInfoPass.toAddress,that.transInfoPass.amount )
.then((res) => {
console.log(2222211111)
that.showFinger = false
that.showBottom = false;
that.fingerSuccess = true;
uni.showToast({
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
setTimeout(()=>{
that.fingerSuccess = false;
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
},1000)
}).catch(err => {
console.log(err,'cuowu')
that.showFinger=false;
that.showBottom=true;
uni.showToast({
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 1500
})
})
// }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
// })
// })
// }
}
that.transaction()
}, function(e) {
switch (e.code) {
@ -609,14 +561,16 @@
}
},
onLoad() {
//
if(uni.getStorageSync('myTransAddress')){
this.recipientAddress=uni.getStorageSync('myTransAddress').address
//
uni.removeStorageSync('myTransAddress')
}
this.coin = uni.getStorageSync('coin')
//
this.transInfoPass.fromAddress=this.coin.address;
this.transInfoPass.privateKey=this.coin.privateKey;
this.transInfoPass.password=this.coin.password;
this.transInfoPass.contractAddress=this.coin.contractAddress
this.transInfoPass.type=this.coin.type;
console.log(this.transInfoPass,'指纹')
if (uni.getStorageSync('fingerPass')) {
this.passShow = uni.getStorageSync('fingerPass')
}

7
pages/menu/setting/index.vue

@ -5,12 +5,7 @@
</navigation>
<view class="main">
<view class="main_con">
<view class="item flex">
<view class="text1">
Payment password
</view>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view>
<view class="item flex">
<view class="text1">
Fingerprint password

46
pages/menu/token/btc/index.css

@ -4,6 +4,7 @@
position: absolute;
right: 30rpx;
}
.big_title {
font-size: 36rpx;
}
@ -19,52 +20,62 @@
padding: 40rpx 50rpx;
border-radius: 24rpx;
}
.textcon1 {
display: flex;
align-items: center;
justify-content: space-between;
line-height: 56rpx;
}
.textcon1 .text1 {
color: #fff;
font-size: 56rpx;
}
.textcon1 .text1 .text2 {
color: #fff;
font-size: 32rpx;
}
.textcon1 .img1 {
width: 100rpx;
height: 110rpx;
}
.textcon1 .v1{
}
.textcon1 .v1 {}
.textcon1 .v1 .t1 {
color: #fff;
font-size: 32rpx;
}
.textcon1 .v1 .t2 {
color: #fff;
font-size: 24rpx;
}
.textcon1 .v2 {
margin-right: 100rpx;
}
.select_con {
width: 100%;
padding-bottom: 260rpx;
}
.select_con .select {
margin: 0 12px;
border-radius: 30rpx;
background-color: #fff;
box-shadow: 0 0 30px #EBEEF1;
}
/deep/ .u-tabs {
border-bottom: 2rpx solid #F6F8FD;
border-radius: 30rpx 30rpx 0 0;
}
.select_con .item1 {
display: flex;
justify-content: space-between;
@ -74,40 +85,48 @@
padding-left: 40rpx;
padding-right: 24rpx;
}
.select_con .item1 .lef_con {
display: flex;
align-items: center;
}
.select_con .item1 .lef_con .img1 {
width: 48rpx;
height: 48rpx;
}
.select_con .item1 .lef_con .textcon {
margin-left: 24rpx;
}
.select_con .item1 .lef_con .textcon .text1 {
font-size: 32rpx;
font-size: 26rpx;
}
.select_con .item1 .lef_con .textcon .text2 {
font-size: 24rpx;
font-size: 22rpx;
color: #999;
}
.select_con .item1 .rig_con .text1 {
font-size: 32rpx;
font-size: 24rpx;
}
.select_con .item1 .rig_con .img1 {
width: 28rpx;
height: 20rpx;
float: right;
margin-top: 20rpx;
}
.select_con .item1 .rig_con .img2 {
width: 28rpx;
height: 40rpx;
float: right;
margin-top: 20rpx;
}
.btnconn {
position: fixed;
bottom: 0;
@ -117,9 +136,10 @@
display: flex;
justify-content: space-between;
}
.btnconn .btn {
width: 334rpx;
line-height: 96rpx;
width: 306rpx;
line-height: 78rpx;
border-radius: 30rpx;
border: 2rpx solid #5B53FF;
text-align: center;
@ -127,13 +147,15 @@
align-items: center;
color: #5B53FF;
justify-content: center;
font-size: 34rpx;
font-size: 28rpx;
position: relative;
}
.active {
color: #fff !important;
background-color: #5B53FF;
}
.btnconn .btn .img1 {
width: 48rpx;
height: 48rpx;
@ -141,13 +163,14 @@
}
.arrow-up-left {
width: 48rpx;
height: 48rpx;
width: 44rpx;
height: 44rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 68rpx;
}
.btn13 {
margin-left: 40rpx;
}
@ -160,6 +183,7 @@
position: relative;
border-radius: 24rpx;
}
.main .money_con2 {
margin-top: 32rpx;
background-image: linear-gradient(to right, #FF820C, #FFB606);
@ -168,6 +192,7 @@
position: relative;
border-radius: 24rpx;
}
.main .money_con3 {
margin-top: 32rpx;
background-image: linear-gradient(to right, #B6162A, #F96D7D);
@ -180,6 +205,7 @@
.select_con .item1 .rig_con .text1 text {
margin-left: 10rpx;
}
/deep/ .u-empty {
padding: 30px !important;
}

2
pages/menu/token/btc/index.vue

@ -45,7 +45,7 @@
<view class="select_con">
<view class="select">
<u-tabs height="120" bar-width="172" active-color="#6F69FF" inactive-color="#A3AED0" :list="list"
<u-tabs height="120" bar-width="172" active-font="13" inactive-font="13" active-color="#6F69FF" inactive-color="#A3AED0" :list="list"
:is-scroll="false" :current="current" @change="change"></u-tabs>
<u-empty text="No content" mode="list" v-if="showInfo"></u-empty>

47
pages/menu/transction/detail/index.vue

@ -46,36 +46,37 @@
</view>
<view class="text2">
{{info.txid}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img" @click="show = true"></image>
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"
@click="copyTextMethod(info.txid)"></image>
</view>
</view>
<view class="item">
<view class="text1">
Send address
<text v-if="info.type=='out'"> (others)</text>
<text v-if="isIn"> (others)</text>
<text v-else>(me)</text>
</view>
<view class="text2">
{{info.from}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
<image @click="copyTextMethod(info.from)" src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view>
</view>
<view class="item">
<view class="text1">
Receiving address
<text v-if="info.type=='in'">(me)</text>
<text v-if="isIn">(me)</text>
<text v-else>(others)</text>
</view>
<view class="text2">
{{info.to}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
<image @click="copyTextMethod(info.to)" src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view>
</view>
</view>
<view class="item goto">
Go to your browser for more information
</view>
<view class="sett" v-if="show">
<!-- <view class="sett" v-if="show">
<view class="top">
<view class="item">
Copy address
@ -87,7 +88,7 @@
<view class="cancel" @click="show = false">
Cancel
</view>
</view>
</view> -->
</view>
<u-mask :show="show" z-index="10"></u-mask>
@ -111,13 +112,45 @@
return {
show: false,
info: {},
isIn:true,
toTop: false,
}
},
methods: {
copyTextMethod(text) {
console.log(text)
// #ifdef H5
this.$copyText(text).then(res => {
// Copy address Successful!
uni.showToast({
title: 'Copy Successful!',
icon: 'none',
duration: 1500
})
})
// #endif
// #ifdef APP-PLUS
var that = this
console.log(123132)
uni.setClipboardData({
data: text,
success() {
uni.showToast({
title: 'Copy Successful!',
icon: 'none',
duration: 1500
})
}
})
// #endif
}
},
onLoad(option) {
this.info = uni.getStorageSync('transDetail')
console.log(this.info.type)
this.isIn=this.info.type==='in';
console.log(this.isIn)
this.info.time = index.formatyymmddhhmmss33(this.info.time);
}
};

2
pages/menu/wallet/cwallet/index.css

@ -133,7 +133,7 @@
.bot_con .item .rig{
text-align: right;
color: #fff;
font-size: 34rpx;
font-size: 30rpx;
}
.bot_con .item .rig .text1{

32
pages/menu/wallet/index.vue

@ -106,8 +106,11 @@
onLoad() {
//
this.userObj = uni.getStorageSync('wallet');
// this.userObj2 = uni.getStorageSync('wallet');
this.updateData();
let that=this;
this.$walletUtil.updateBalance(function(){
that.userObj = uni.getStorageSync('wallet');
that.userObj2 = uni.getStorageSync('wallet');
});
},
// onPullDownRefresh() {
@ -118,30 +121,7 @@
// }, 500);
// },
methods: {
updateData() {
let thar = this;
setTimeout(
function() {
thar.userObj = uni.getStorageSync('wallet');
thar.userObj2 = uni.getStorageSync('wallet');
// thar.userObj.address = thar.userObj.ellipsisAddress;
// thar.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25,
// thar.userObj.address.length);
// thar.$walletUtil.updateBalance();
// thar.updateData();
// }, 100);
thar.$walletUtil.updateBalance();
console.log(thar.isStop,4444)
if (!thar.isStop) {
// thar.updateData()
}
}, 2000);
},
goOther() {
console.log(this.userObj2, 8888)
let item = JSON.stringify(this.userObj2)
@ -163,7 +143,9 @@
goTrans(itemm, index) {
let coin = this.userObj.coinList[index];
coin.type=this.userObj.type;
coin.privateKey=this.userObj.privateKey;
coin.address=this.userObj.address;
coin.password=this.userObj.password;
uni.setStorageSync('coin',coin)
uni.navigateTo({
url: '/pages/menu/token/btc/index'

8
pages/menu/wallet/mwallet/index.css

@ -102,18 +102,18 @@
width:auto;flex:1
}
.bot_con .item .left .textcon .text1{
font-size: 36rpx;
font-size: 30rpx;
color: #fff;
}
.bot_con .item .left .textcon .text2{
font-size: 28rpx;
color: rgba(255,255,255,.5);
font-size: 24rpx;
color: #FFFFFF;
word-break: break-word;
}
.bot_con .item .rig{
text-align: right;
color: #fff;
font-size: 34rpx;
font-size: 30rpx;
}
.bot_con .item .rig .text1{

10
utils/EthUtil.js

@ -97,7 +97,7 @@ let eth = {
transaction: async function(fromAddress, toAddress, value, privateKey, success) {
sendTransaction: async function(fromAddress, toAddress, value, privateKey, success) {
var nonce = await web3.eth.getTransactionCount(fromAddress);
var gas = await web3.eth.estimateGas({
@ -208,6 +208,14 @@ let eth = {
},
transaction:async function(fromAddress, toAddress, value, privateKey, contract, success){
if(contract){
await this.sendTokenTransaction(fromAddress, toAddress, value, privateKey, contract, success);
}else{
await this.sendTransaction(fromAddress, toAddress, value, privateKey, success)
}
}
}
export default eth;

7
utils/TronUtil.js

@ -76,6 +76,13 @@ let tron = {
}
return null;
},
transaction:async function(fromAddress, privateKey, toAddress, amount, remark, contract){
if(contract){
return await this.sendRawTransaction(fromAddress, privateKey, toAddress, amount, remark, contract);
}else{
return await this.sendTransaction(fromAddress, privateKey, toAddress, amount);
}
},
getContract:function(address,list,success){
uni.request({
url: 'https://apiasia.tronscan.io:5566/api/account/tokens?limit=100&address=' + address, //请求接口

25
utils/WalletUtil.js

@ -177,7 +177,8 @@ let WalletUtil = {
for (var k = 0, length = walletInfo[obj].length; k < length; k++) {
let address = walletInfo[obj][k].address;
walletInfo[obj][k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address.length-6,
walletInfo[obj][k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(
address.length - 6,
address.length);
walletInfo[obj][k].type = obj;
walletList.push(walletInfo[obj][k]);
@ -202,7 +203,7 @@ let WalletUtil = {
}
},
updateBalance:function() {
updateBalance: function(success) {
const wallet = uni.getStorageSync('wallet');
console.log(wallet, '更新余额')
const walletInfo = uni.getStorageSync('walletInfo');
@ -225,6 +226,7 @@ let WalletUtil = {
wallet.coinList[0].balance = balance
wallet.coinList[0].balancePrice = wallet.balancePrice
uni.setStorageSync('wallet', wallet);
success()
})
break;
case 'ETH':
@ -235,10 +237,14 @@ let WalletUtil = {
wallet.coinList[0].balance = balance
wallet.coinList[0].balancePrice = wallet.balancePrice
for (let i = 1; i < wallet.coinList.length; i++) {
EthUtil.getTokenBalance(wallet.address,wallet.coinList[i].contractAddress,function(b){
EthUtil.getTokenBalance(wallet.address, wallet.coinList[
i].contractAddress, function(b) {
wallet.coinList[i].balance = b;
wallet.coinList[1].balancePrice=(wallet.coinList[1].balance*usdt).toFixed(2);
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt)
.toFixed(2);
uni.setStorageSync('wallet', wallet);
success()
});
}
@ -252,11 +258,14 @@ let WalletUtil = {
wallet.balancePrice = (res * rr).toFixed(2);
wallet.coinList[0].balance = res
wallet.coinList[0].balancePrice = wallet.balancePrice
TronUtil.getContract(wallet.address,wallet.coinList,function(list){
TronUtil.getContract(wallet.address, wallet.coinList,
function(list) {
wallet.coinList = list;
wallet.coinList[1].balancePrice=(wallet.coinList[1].balance*usdt).toFixed(2);
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt).toFixed(2);
console.log(wallet.coinList)
uni.setStorageSync('wallet', wallet);
success()
})
})
@ -427,7 +436,9 @@ let WalletUtil = {
break;
case e.AUTHENTICATE_OVERLIMIT:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert('The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication');
plus.nativeUI.alert(
'The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication'
);
break;
case e.CANCEL:
plus.nativeUI.toast('Recognition has been cancelled');

Loading…
Cancel
Save