Browse Source

修改

master
vee 4 years ago
parent
commit
484cb32467
  1. 121
      pages/menu/sendToken/enPassword/index.vue
  2. 143
      pages/menu/sendToken/index.vue
  3. 310
      pages/menu/sendToken/transfer/index.vue
  4. 7
      pages/menu/setting/index.vue
  5. 152
      pages/menu/token/btc/index.css
  6. 2
      pages/menu/token/btc/index.vue
  7. 207
      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. 385
      utils/WalletUtil.js

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

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

143
pages/menu/sendToken/index.vue

@ -1,41 +1,42 @@
<template> <template>
<view class=""> <view class="">
<navigation :showBack="true" :bgnum="true"> <navigation :showBack="true" :bgnum="true">
{{addressInfo.name}} Receive {{addressInfo.name}} Receive
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <view class="main_con">
<image :src="addressInfo.icon" mode="aspectFit" class="logoimg" ></image> <image :src="addressInfo.icon" mode="aspectFit" class="logoimg"></image>
<view class="title"> <view class="title">
{{addressInfo.name}} Receiving address {{addressInfo.name}} Receiving address
</view> </view>
<view class="code_con"> <view class="code_con">
<tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit" :background="background" <tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit"
:foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval" :loadMake="loadMake" :background="background" :foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval"
:showLoading="showLoading" :loadingText="loadingText" :icon="icon" class="test" /> :loadMake="loadMake" :showLoading="showLoading" :loadingText="loadingText" :icon="icon"
</view> class="test" />
<view class="text1"> </view>
Scan the QR code to transfer to the asset <view class="text1">
</view> Scan the QR code to transfer to the asset
<view class="bottom_con"> </view>
<view class="text2"> <view class="bottom_con">
{{addressInfo.address}} <view class="text2">
</view> {{addressInfo.address}}
<view class="text3 copy" @click="copyTextMethod">
<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
Copy address
</view> </view>
<!-- <view class="text3"> <view class="text3 copy" @click="copyTextMethod">
<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
Copy address
</view>
<!-- <view class="text3">
<image src="../../../static/tongyonh/Frame58.png" mode="aspectFit" class="copyImg"></image> <image src="../../../static/tongyonh/Frame58.png" mode="aspectFit" class="copyImg"></image>
Switching address Switching address
</view> --> </view> -->
</view> </view>
</view> </view>
<view class="info_con green" :class="toTop?'goTop':''"> <view class="info_con green" :class="toTop?'goTop':''">
<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image> <image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
Copy address Successful! Copy address Successful!
</view> </view>
</view> </view>
@ -53,67 +54,65 @@
}, },
data() { data() {
return { return {
addressInfo:{}, addressInfo: {},
toTop:false, toTop: false,
// //
showErweiMask: false, showErweiMask: false,
ercodeText: '', ercodeText: '',
size: 400, size: 400,
background: '#ffffff', background: '#ffffff',
foreground: '#000000', foreground: '#000000',
pdground: '#000000', pdground: '#000000',
iconsize: 30, iconsize: 30,
lv: 3, lv: 3,
onval: true, onval: true,
unit: 'upx', unit: 'upx',
loadMake: true, loadMake: true,
icon: '', icon: '',
showLoading: true, showLoading: true,
loadingText: 'One moment please', loadingText: 'One moment please',
// //
} }
}, },
methods: { methods: {
copyTextMethod() { copyTextMethod() {
// #ifdef H5 // #ifdef H5
this.$copyText(this.addressInfo.address).then(res => { this.$copyText(this.addressInfo.address).then(res => {
this.toTop=true; this.toTop = true;
setTimeout(()=>{ setTimeout(() => {
this.toTop=false; this.toTop = false;
},1500) }, 1500)
}) })
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
var that=this var that = this
console.log(123132) console.log(123132)
uni.setClipboardData({ uni.setClipboardData({
data: this.addressInfo.address, data: this.addressInfo.address,
success() { success() {
uni.hideToast() uni.hideToast()
that.toTop=true; that.toTop = true;
setTimeout(()=>{ setTimeout(() => {
that.toTop=false; that.toTop = false;
},1500) }, 1500)
} }
}) })
// #endif // #endif
}, },
}, },
onLoad() { onLoad() {
this.addressInfo=uni.getStorageSync('coin') this.addressInfo = uni.getStorageSync('coin')
} }
}; };
</script> </script>
<style scoped> <style scoped>
page{ page {
background: #FAFAFA; background: #FAFAFA;
} }
</style> </style>
<style> <style>
@import './index.css'; @import './index.css';
</style> </style>

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

@ -27,7 +27,7 @@
<view class="inputcon"> <view class="inputcon">
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" <input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="Please enter the recipient address" class="input1" 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> <image src="../../../../static/tongyonh/Frame330.png" mode="aspectFit" class="img1"></image>
</view> </view>
</view> </view>
@ -44,15 +44,16 @@
{{coin.name}} {{coin.name}}
</view> </view>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" <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> </view>
<text></text> <text></text>
<view class="inputc flex"> <view class="inputc flex">
<view class="textt"> <view class="textt">
USD USD
</view> </view>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" <input type="text" value="" disabled="disabled"
placeholder="0.0000000" class="input3" /> placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="0.0000000"
class="input3" />
</view> </view>
</view> </view>
<view class="top flex bottom"> <view class="top flex bottom">
@ -74,7 +75,7 @@
</view> </view>
<view class="inputcon"> <view class="inputcon">
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" <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>
</view> </view>
@ -89,7 +90,7 @@
<input type="text" v-model="fee" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" <input type="text" v-model="fee" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="Please enter a note (off-chain)" class="input2" /> placeholder="Please enter a note (off-chain)" class="input2" />
<view class="rig"> <view class="rig">
<text class="text2">{{coin.type}}</text> <text class="text2">{{coin.type}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -114,7 +115,7 @@
Amount Amount
</view> </view>
<view class="text1"> <view class="text1">
{{transAmount}} {{coin.name}} {{transInfoPass.amount}} {{coin.name}}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -122,7 +123,7 @@
Send address Send address
</view> </view>
<view class="text2"> <view class="text2">
{{coin.address}} {{transInfoPass.fromAddress}}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -130,7 +131,7 @@
Receiving address Receiving address
</view> </view>
<view class="text2"> <view class="text2">
{{recipientAddress}} {{transInfoPass.toAddress}}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -156,7 +157,7 @@
</view> </view>
</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> --> <!-- <u-mask z-index="1000" :show="show2" @click="show2 = false"></u-mask> -->
<view class="zhiwen_con" v-if="showFinger"> <view class="zhiwen_con" v-if="showFinger">
<view class="tiao" @click="cancel"> <view class="tiao" @click="cancel">
@ -170,7 +171,7 @@
Touch the fingerprint sensor Touch the fingerprint sensor
</view> </view>
<view class="flex con"> <view class="flex con">
<view class="textt1" @click="goPassword" v-if="!passShow"> <view class="textt1" @click="goPassword">
Use Password Use Password
</view> </view>
<view class="textt2" @click="cancel"> <view class="textt2" @click="cancel">
@ -213,14 +214,14 @@
<view class="text1 green"> <view class="text1 green">
Fingerprint recognized. Fingerprint recognized.
</view> </view>
<!-- <view class="flex con"> <view class="flex con">
<view class="textt1"> <view class="textt1">
Use Password Use Password
</view> </view>
<view class="textt2"> <view class="textt2">
Confirm Confirm
</view> </view>
</view> --> </view>
</view> </view>
</view> </view>
@ -243,15 +244,12 @@
export default { export default {
data() { data() {
return { return {
coin:{}, coin: {},
fee: 0, fee: 0,
show: false, show: false,
show2: false, show2: false,
showFinger: false, showFinger: false,
showBottom: false, showBottom: false,
addressInfo: {},
recipientAddress: '',
transAmount: '',
fingerSuccess: false, fingerSuccess: false,
fingerFail: false, fingerFail: false,
// 使 // 使
@ -259,16 +257,85 @@
// //
transInfoPass: { transInfoPass: {
fromAddress: '', fromAddress: '',
toAddress: "", toAddress: '1',
privateKey: '', privateKey: '',
amount: '', amount: '1',
remark:'1',
contractAddress:'',
password:''
} }
} }
}, },
methods: { methods: {
cancelAll(){ transaction() {
this.show=false; let that=this;
this.showBottom=false; 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;
}, },
cancelFail() { cancelFail() {
this.printCancel() this.printCancel()
@ -278,35 +345,38 @@
}, },
cancel() { cancel() {
this.showFinger = false this.showFinger = false
this.showBottom=true; this.showBottom = true;
this.printCancel() this.printCancel()
}, },
// //
goPassword() { goPassword() {
this.printCancel(); this.printCancel();
this.show = false;
this.showBottom=false;
console.log(111) console.log(111)
uni.setStorageSync('transInfoPass', this.transInfoPass)
uni.navigateTo({ uni.navigateTo({
url: '/pages/menu/sendToken/enPassword/index' url: '/pages/menu/sendToken/enPassword/index'
}) })
}, },
// //
confirmTo(type) { confirmTo(type) {
if (type == 'try') { if(!this.passShow){
this.fingerFail = false; this.goPassword();
}else{
console.log('点击提交')
if (type == 'try') {
this.fingerFail = false;
}
console.log(123123132132132)
this.show = true
this.showFinger = true
this.showBottom = false;
this.fingerprint();
} }
console.log(123123132132132)
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() { back() {
@ -316,12 +386,12 @@
}, },
// //
forAll() { forAll() {
this.transAmount = this.coin.balance this.transInfoPass.amount = this.coin.balance
}, },
// //
Confirm() { Confirm() {
// //
if (this.transAmount == '') { if (this.transInfoPass.amount == '') {
uni.showToast({ uni.showToast({
title: 'Please enter the transfer amount', title: 'Please enter the transfer amount',
icon: 'none', icon: 'none',
@ -329,7 +399,7 @@
}) })
return return
} }
if (this.recipientAddress == '') { if (this.transInfoPass.toAddress == '') {
uni.showToast({ uni.showToast({
title: 'Please enter the receiving address', title: 'Please enter the receiving address',
icon: 'none', icon: 'none',
@ -337,7 +407,7 @@
}) })
return return
} }
if (this.transAmount == '' < 0) { if (Number(this.transInfoPass.amount) == '' < 0) {
uni.showToast({ uni.showToast({
title: 'The entered amount cannot be less than 0', title: 'The entered amount cannot be less than 0',
icon: 'none', icon: 'none',
@ -345,7 +415,7 @@
}) })
return return
} }
if( this.transAmount>this.coin.balance){ if (Number(this.transInfoPass.amount) > this.coin.balance) {
uni.showToast({ uni.showToast({
title: 'Sorry, your credit is running low', title: 'Sorry, your credit is running low',
icon: 'none', icon: 'none',
@ -357,13 +427,13 @@
this.show = true; this.show = true;
}, },
// //
printCancel(){ printCancel() {
this.showFinger=false; this.showFinger = false;
console.log(this.showFinger,4444) console.log(this.showFinger, 4444)
plus.fingerprint.cancel(); //plus.fingerprint.cancel();
console.log(this.showFinger,4444) console.log(this.showFinger, 4444)
}, },
fingerprint: function(sett) { fingerprint: function(sett) {
let bltype = true; let bltype = true;
// #ifdef APP-PLUS // #ifdef APP-PLUS
@ -412,126 +482,8 @@
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.fingerprint.authenticate(function() { plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //Android 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) { }, function(e) {
switch (e.code) { switch (e.code) {
@ -609,14 +561,16 @@
} }
}, },
onLoad() { onLoad() {
//
if(uni.getStorageSync('myTransAddress')){ this.coin = uni.getStorageSync('coin')
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')) { if (uni.getStorageSync('fingerPass')) {
this.passShow = uni.getStorageSync('fingerPass') this.passShow = uni.getStorageSync('fingerPass')
} }

7
pages/menu/setting/index.vue

@ -5,12 +5,7 @@
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <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="item flex">
<view class="text1"> <view class="text1">
Fingerprint password Fingerprint password

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

@ -1,185 +1,211 @@
.renYou{ .renYou {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
position: absolute; position: absolute;
right: 30rpx; right: 30rpx;
} }
.big_title{
.big_title {
font-size: 36rpx; font-size: 36rpx;
} }
.main .money_con{ .main .money_con {
display: block; display: block;
width:95%; width: 95%;
margin: 0 auto; margin: 0 auto;
margin-top: 50rpx; margin-top: 50rpx;
margin-bottom: 50rpx; margin-bottom: 50rpx;
height: 320rpx; height: 320rpx;
background-image: linear-gradient(to right, #FF820C , #FFB606); background-image: linear-gradient(to right, #FF820C, #FFB606);
padding: 40rpx 50rpx; padding: 40rpx 50rpx;
border-radius: 24rpx; border-radius: 24rpx;
} }
.textcon1{
.textcon1 {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
line-height: 56rpx; line-height: 56rpx;
} }
.textcon1 .text1{
.textcon1 .text1 {
color: #fff; color: #fff;
font-size: 56rpx ; font-size: 56rpx;
} }
.textcon1 .text1 .text2{
.textcon1 .text1 .text2 {
color: #fff; color: #fff;
font-size: 32rpx ; font-size: 32rpx;
} }
.textcon1 .img1{
.textcon1 .img1 {
width: 100rpx; width: 100rpx;
height: 110rpx; height: 110rpx;
} }
.textcon1 .v1{
} .textcon1 .v1 {}
.textcon1 .v1 .t1{
.textcon1 .v1 .t1 {
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
} }
.textcon1 .v1 .t2{
.textcon1 .v1 .t2 {
color: #fff; color: #fff;
font-size: 24rpx; font-size: 24rpx;
} }
.textcon1 .v2{
.textcon1 .v2 {
margin-right: 100rpx; margin-right: 100rpx;
} }
.select_con{
.select_con {
width: 100%; width: 100%;
padding-bottom: 260rpx; padding-bottom: 260rpx;
} }
.select_con .select{
margin: 0 12px; .select_con .select {
margin: 0 12px;
border-radius: 30rpx; border-radius: 30rpx;
background-color: #fff; background-color: #fff;
box-shadow: 0 0 30px #EBEEF1; box-shadow: 0 0 30px #EBEEF1;
} }
/deep/ .u-tabs{
/deep/ .u-tabs {
border-bottom: 2rpx solid #F6F8FD; border-bottom: 2rpx solid #F6F8FD;
border-radius: 30rpx 30rpx 0 0; border-radius: 30rpx 30rpx 0 0;
} }
.select_con .item1{
.select_con .item1 {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-top: 60rpx; padding-top: 60rpx;
padding-bottom: 50rpx; padding-bottom: 50rpx;
border-bottom: 2rpx solid #F6F8FD; border-bottom: 2rpx solid #F6F8FD;
padding-left: 40rpx; padding-left: 40rpx;
padding-right: 24rpx; padding-right: 24rpx;
} }
.select_con .item1 .lef_con{
.select_con .item1 .lef_con {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.select_con .item1 .lef_con .img1{
.select_con .item1 .lef_con .img1 {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
} }
.select_con .item1 .lef_con .textcon{
.select_con .item1 .lef_con .textcon {
margin-left: 24rpx; margin-left: 24rpx;
} }
.select_con .item1 .lef_con .textcon .text1{
font-size: 32rpx; .select_con .item1 .lef_con .textcon .text1 {
font-size: 26rpx;
} }
.select_con .item1 .lef_con .textcon .text2{
font-size: 24rpx; .select_con .item1 .lef_con .textcon .text2 {
font-size: 22rpx;
color: #999; color: #999;
} }
.select_con .item1 .rig_con .text1{ .select_con .item1 .rig_con .text1 {
font-size: 32rpx; font-size: 24rpx;
} }
.select_con .item1 .rig_con .img1{
.select_con .item1 .rig_con .img1 {
width: 28rpx; width: 28rpx;
height: 20rpx; height: 20rpx;
float: right; float: right;
margin-top: 20rpx; margin-top: 20rpx;
} }
.select_con .item1 .rig_con .img2{
.select_con .item1 .rig_con .img2 {
width: 28rpx; width: 28rpx;
height: 40rpx; height: 40rpx;
float: right; float: right;
margin-top: 20rpx; margin-top: 20rpx;
} }
.btnconn{
position: fixed; .btnconn {
bottom: 0; position: fixed;
bottom: 0;
background-color: #fff; background-color: #fff;
padding: 24rpx 24rpx; padding: 24rpx 24rpx;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.btnconn .btn{
width: 334rpx; .btnconn .btn {
line-height: 96rpx; width: 306rpx;
line-height: 78rpx;
border-radius: 30rpx; border-radius: 30rpx;
border: 2rpx solid #5B53FF; border: 2rpx solid #5B53FF;
text-align: center; text-align: center;
display: flex; display: flex;
align-items: center; align-items: center;
color:#5B53FF; color: #5B53FF;
justify-content: center; justify-content: center;
font-size: 34rpx; font-size: 28rpx;
position: relative; position: relative;
} }
.active{
color: #fff !important; .active {
color: #fff !important;
background-color: #5B53FF; background-color: #5B53FF;
} }
.btnconn .btn .img1{
.btnconn .btn .img1 {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
} }
.arrow-up-left{ .arrow-up-left {
width: 48rpx; width: 44rpx;
height: 48rpx; height: 44rpx;
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
left: 68rpx; left: 68rpx;
} }
.btn13{
.btn13 {
margin-left: 40rpx; margin-left: 40rpx;
} }
.main .money_con{ .main .money_con {
margin-top: 32rpx; margin-top: 32rpx;
background-image: linear-gradient(to right, #6441CF , #877BFE); background-image: linear-gradient(to right, #6441CF, #877BFE);
height: 320rpx; height: 320rpx;
padding: 40rpx 36rpx; padding: 40rpx 36rpx;
position: relative; position: relative;
border-radius: 24rpx; border-radius: 24rpx;
} }
.main .money_con2{
.main .money_con2 {
margin-top: 32rpx; margin-top: 32rpx;
background-image: linear-gradient(to right, #FF820C , #FFB606); background-image: linear-gradient(to right, #FF820C, #FFB606);
height: 320rpx; height: 320rpx;
padding: 40rpx 36rpx; padding: 40rpx 36rpx;
position: relative; position: relative;
border-radius: 24rpx; border-radius: 24rpx;
} }
.main .money_con3{
.main .money_con3 {
margin-top: 32rpx; margin-top: 32rpx;
background-image: linear-gradient(to right, #B6162A , #F96D7D); background-image: linear-gradient(to right, #B6162A, #F96D7D);
height: 320rpx; height: 320rpx;
padding: 40rpx 36rpx; padding: 40rpx 36rpx;
position: relative; position: relative;
border-radius: 24rpx; border-radius: 24rpx;
} }
.select_con .item1 .rig_con .text1 text{ .select_con .item1 .rig_con .text1 text {
margin-left: 10rpx; margin-left: 10rpx;
} }
/deep/ .u-empty { /deep/ .u-empty {
padding: 30px !important; padding: 30px !important;
} }

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

@ -45,7 +45,7 @@
<view class="select_con"> <view class="select_con">
<view class="select"> <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> :is-scroll="false" :current="current" @change="change"></u-tabs>
<u-empty text="No content" mode="list" v-if="showInfo"></u-empty> <u-empty text="No content" mode="list" v-if="showInfo"></u-empty>

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

@ -2,102 +2,103 @@
<view class=""> <view class="">
<navigation :showBack="true" :bgnum="true"> <navigation :showBack="true" :bgnum="true">
<text class="big_title"> <text class="big_title">
Transaction details Transaction details
</text> </text>
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <view class="main_con">
<view class="yuan"> <view class="yuan">
<image src="../../../../static/tongyonh/check-circle.png" mode="aspectFit" class="img1"></image> <image src="../../../../static/tongyonh/check-circle.png" mode="aspectFit" class="img1"></image>
</view> </view>
<view class="title"> <view class="title">
Confirmed Confirmed
</view> </view>
<view class="scroll"> <view class="scroll">
<view class="title_con flex"> <view class="title_con flex">
<view class="text1"> <view class="text1">
Amount Amount
</view> </view>
<view class="text1"> <view class="text1">
{{info.value}} {{info.network}} {{info.value}} {{info.network}}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="text1"> <view class="text1">
Time Time
</view> </view>
<view class="text2"> <view class="text2">
{{info.time}} {{info.time}}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="text1"> <view class="text1">
Tx Fee Tx Fee
</view> </view>
<view class="text2"> <view class="text2">
{{info.fee}} {{info.network}} {{info.fee}} {{info.network}}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="text1"> <view class="text1">
Transaction ID Transaction ID
</view> </view>
<view class="text2"> <view class="text2">
{{info.txid}} {{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"
</view> @click="copyTextMethod(info.txid)"></image>
</view> </view>
<view class="item"> </view>
<view class="text1"> <view class="item">
Send address <view class="text1">
<text v-if="info.type=='out'"> (others)</text> Send address
<text v-else>(me)</text> <text v-if="isIn"> (others)</text>
</view> <text v-else>(me)</text>
<view class="text2"> </view>
{{info.from}} <view class="text2">
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image> {{info.from}}
</view> <image @click="copyTextMethod(info.from)" src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view> </view>
<view class="item"> </view>
<view class="text1"> <view class="item">
Receiving address <view class="text1">
<text v-if="info.type=='in'">(me)</text> Receiving address
<text v-else>(others)</text> <text v-if="isIn">(me)</text>
</view> <text v-else>(others)</text>
<view class="text2"> </view>
{{info.to}} <view class="text2">
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image> {{info.to}}
</view> <image @click="copyTextMethod(info.to)" src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view> </view>
</view> </view>
<view class="item goto">
Go to your browser for more information
</view>
<view class="sett" v-if="show">
<view class="top">
<view class="item">
Copy address
</view>
<view class="item">
Add to Address Book
</view> </view>
</view> <view class="item goto">
<view class="cancel" @click="show = false"> Go to your browser for more information
Cancel
</view> </view>
</view> <!-- <view class="sett" v-if="show">
</view> <view class="top">
<view class="item">
Copy address
</view>
<view class="item">
Add to Address Book
</view>
</view>
<view class="cancel" @click="show = false">
Cancel
</view>
</view> -->
</view>
<u-mask :show="show" z-index="10"></u-mask> <u-mask :show="show" z-index="10"></u-mask>
</view> </view>
</view> </view>
@ -109,16 +110,48 @@
export default { export default {
data() { data() {
return { return {
show: false, show: false,
info:{}, info: {},
isIn:true,
toTop: false,
} }
}, },
methods: { 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) { onLoad(option) {
this.info=uni.getStorageSync('transDetail') this.info = uni.getStorageSync('transDetail')
this.info.time = index.formatyymmddhhmmss33(this.info.time); console.log(this.info.type)
this.isIn=this.info.type==='in';
console.log(this.isIn)
this.info.time = index.formatyymmddhhmmss33(this.info.time);
} }
}; };
</script> </script>

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

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

32
pages/menu/wallet/index.vue

@ -106,8 +106,11 @@
onLoad() { onLoad() {
// //
this.userObj = uni.getStorageSync('wallet'); this.userObj = uni.getStorageSync('wallet');
// this.userObj2 = uni.getStorageSync('wallet'); let that=this;
this.updateData(); this.$walletUtil.updateBalance(function(){
that.userObj = uni.getStorageSync('wallet');
that.userObj2 = uni.getStorageSync('wallet');
});
}, },
// onPullDownRefresh() { // onPullDownRefresh() {
@ -118,30 +121,7 @@
// }, 500); // }, 500);
// }, // },
methods: { 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() { goOther() {
console.log(this.userObj2, 8888) console.log(this.userObj2, 8888)
let item = JSON.stringify(this.userObj2) let item = JSON.stringify(this.userObj2)
@ -163,7 +143,9 @@
goTrans(itemm, index) { goTrans(itemm, index) {
let coin = this.userObj.coinList[index]; let coin = this.userObj.coinList[index];
coin.type=this.userObj.type; coin.type=this.userObj.type;
coin.privateKey=this.userObj.privateKey;
coin.address=this.userObj.address; coin.address=this.userObj.address;
coin.password=this.userObj.password;
uni.setStorageSync('coin',coin) uni.setStorageSync('coin',coin)
uni.navigateTo({ uni.navigateTo({
url: '/pages/menu/token/btc/index' url: '/pages/menu/token/btc/index'

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

@ -102,18 +102,18 @@
width:auto;flex:1 width:auto;flex:1
} }
.bot_con .item .left .textcon .text1{ .bot_con .item .left .textcon .text1{
font-size: 36rpx; font-size: 30rpx;
color: #fff; color: #fff;
} }
.bot_con .item .left .textcon .text2{ .bot_con .item .left .textcon .text2{
font-size: 28rpx; font-size: 24rpx;
color: rgba(255,255,255,.5); color: #FFFFFF;
word-break: break-word; word-break: break-word;
} }
.bot_con .item .rig{ .bot_con .item .rig{
text-align: right; text-align: right;
color: #fff; color: #fff;
font-size: 34rpx; font-size: 30rpx;
} }
.bot_con .item .rig .text1{ .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 nonce = await web3.eth.getTransactionCount(fromAddress);
var gas = await web3.eth.estimateGas({ 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; export default eth;

7
utils/TronUtil.js

@ -76,6 +76,13 @@ let tron = {
} }
return null; 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){ getContract:function(address,list,success){
uni.request({ uni.request({
url: 'https://apiasia.tronscan.io:5566/api/account/tokens?limit=100&address=' + address, //请求接口 url: 'https://apiasia.tronscan.io:5566/api/account/tokens?limit=100&address=' + address, //请求接口

385
utils/WalletUtil.js

@ -7,7 +7,7 @@ let fullWallet = {
"BTC": [{ "BTC": [{
balance: 0, balance: 0,
name: "BTC", name: "BTC",
type:'BTC', type: 'BTC',
coinList: [{ coinList: [{
name: "BTC", name: "BTC",
xname: 'Bitcoin', xname: 'Bitcoin',
@ -18,7 +18,7 @@ let fullWallet = {
"ETH": [{ "ETH": [{
balance: 0, balance: 0,
name: "ETH", name: "ETH",
type:'ETH', type: 'ETH',
coinList: [{ coinList: [{
name: "ETH", name: "ETH",
xname: 'Ethereum', xname: 'Ethereum',
@ -37,7 +37,7 @@ let fullWallet = {
"TRX": [{ "TRX": [{
balance: 0, balance: 0,
name: "TRX", name: "TRX",
type:'TRX', type: 'TRX',
coinList: [{ coinList: [{
name: "TRX", name: "TRX",
xname: 'TRON', xname: 'TRON',
@ -58,7 +58,7 @@ let fullWallet = {
let WalletUtil = { let WalletUtil = {
//初次创建钱包 //初次创建钱包
initialWallet: function(mnemonic, password) { initialWallet: function(mnemonic, password) {
console.log(password,'password') console.log(password, 'password')
let walletInfo = fullWallet; let walletInfo = fullWallet;
let btc = TokenUtil.generateBtc(mnemonic); let btc = TokenUtil.generateBtc(mnemonic);
walletInfo.BTC[0].password = password; walletInfo.BTC[0].password = password;
@ -95,28 +95,28 @@ let WalletUtil = {
//助记词新建 //助记词新建
mnemonicEstablishWallet: function(type, mnemonic, password) { mnemonicEstablishWallet: function(type, mnemonic, password) {
let walletInfo = uni.getStorageSync('walletInfo'); let walletInfo = uni.getStorageSync('walletInfo');
console.log(password,'password',type) console.log(password, 'password', type)
let walletdec; let walletdec;
switch (type) { switch (type) {
case 'BTC': case 'BTC':
walletdec = TokenUtil.generateBtc(mnemonic); walletdec = TokenUtil.generateBtc(mnemonic);
if(uni.getStorageSync('walletInfo')){ if (uni.getStorageSync('walletInfo')) {
uni.setStorageSync('walleti',walletdec.address) uni.setStorageSync('walleti', walletdec.address)
} }
break; break;
case 'ETH': case 'ETH':
walletdec = TokenUtil.generateEth(mnemonic); walletdec = TokenUtil.generateEth(mnemonic);
if(uni.getStorageSync('walletInfo')){ if (uni.getStorageSync('walletInfo')) {
uni.setStorageSync('walleti',walletdec.address) uni.setStorageSync('walleti', walletdec.address)
} }
break; break;
case 'TRX': case 'TRX':
walletdec = TokenUtil.generateTron(mnemonic); walletdec = TokenUtil.generateTron(mnemonic);
if(uni.getStorageSync('walletInfo')){ if (uni.getStorageSync('walletInfo')) {
uni.setStorageSync('walleti',walletdec.address) uni.setStorageSync('walleti', walletdec.address)
} }
break; break;
@ -138,7 +138,7 @@ let WalletUtil = {
privateKeyEstablishWallet: function(type, privateKey, password) { privateKeyEstablishWallet: function(type, privateKey, password) {
let walletInfo = uni.getStorageSync('walletInfo'); let walletInfo = uni.getStorageSync('walletInfo');
console.log(type) console.log(type)
console.log(password,'password') console.log(password, 'password')
let walletdec; let walletdec;
switch (type) { switch (type) {
case 'BTC': case 'BTC':
@ -156,7 +156,7 @@ let WalletUtil = {
wallet.privateKey = walletdec.privateKey; wallet.privateKey = walletdec.privateKey;
wallet.address = walletdec.address; wallet.address = walletdec.address;
walletInfo[type].push(wallet); walletInfo[type].push(wallet);
console.log(walletInfo,'当前私钥建的') console.log(walletInfo, '当前私钥建的')
uni.setStorageSync('walletInfo', walletInfo); uni.setStorageSync('walletInfo', walletInfo);
uni.setStorageSync('wallet', wallet); uni.setStorageSync('wallet', wallet);
uni.setStorageSync('walleti', wallet.address); uni.setStorageSync('walleti', wallet.address);
@ -177,7 +177,8 @@ let WalletUtil = {
for (var k = 0, length = walletInfo[obj].length; k < length; k++) { for (var k = 0, length = walletInfo[obj].length; k < length; k++) {
let address = walletInfo[obj][k].address; 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); address.length);
walletInfo[obj][k].type = obj; walletInfo[obj][k].type = obj;
walletList.push(walletInfo[obj][k]); walletList.push(walletInfo[obj][k]);
@ -202,43 +203,48 @@ let WalletUtil = {
} }
}, },
updateBalance:function() { updateBalance: function(success) {
const wallet = uni.getStorageSync('wallet'); const wallet = uni.getStorageSync('wallet');
console.log(wallet,'更新余额') console.log(wallet, '更新余额')
const walletInfo = uni.getStorageSync('walletInfo'); const walletInfo = uni.getStorageSync('walletInfo');
for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) { for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) {
if (walletInfo[wallet.type][k].address === wallet.address) { if (walletInfo[wallet.type][k].address === wallet.address) {
walletInfo[wallet.type][k]=wallet; walletInfo[wallet.type][k] = wallet;
break; break;
} }
} }
uni.setStorageSync('walletInfo', walletInfo); uni.setStorageSync('walletInfo', walletInfo);
let that=this let that = this
this.getPrice(wallet.type,function(rr){ this.getPrice(wallet.type, function(rr) {
that.getPrice('USDT',function(usdt){ that.getPrice('USDT', function(usdt) {
switch (wallet.type) { switch (wallet.type) {
case 'BTC': case 'BTC':
console.log("进来BTC") console.log("进来BTC")
BtcUtil.getBalance(wallet.address,function(balance){ BtcUtil.getBalance(wallet.address, function(balance) {
wallet.balance=balance; wallet.balance = balance;
wallet.balancePrice=(balance*rr).toFixed(2); wallet.balancePrice = (balance * rr).toFixed(2);
wallet.coinList[0].balance=balance wallet.coinList[0].balance = balance
wallet.coinList[0].balancePrice=wallet.balancePrice wallet.coinList[0].balancePrice = wallet.balancePrice
uni.setStorageSync('wallet', wallet); uni.setStorageSync('wallet', wallet);
success()
}) })
break; break;
case 'ETH': case 'ETH':
console.log("进来ETH") console.log("进来ETH")
EthUtil.getBalance(wallet.address,function(balance){ EthUtil.getBalance(wallet.address, function(balance) {
wallet.balance=balance; wallet.balance = balance;
wallet.balancePrice=(balance*rr).toFixed(2); wallet.balancePrice = (balance * rr).toFixed(2);
wallet.coinList[0].balance=balance wallet.coinList[0].balance = balance
wallet.coinList[0].balancePrice=wallet.balancePrice wallet.coinList[0].balancePrice = wallet.balancePrice
for(let i=1;i<wallet.coinList.length;i++){ 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[
wallet.coinList[i].balance=b; i].contractAddress, function(b) {
wallet.coinList[1].balancePrice=(wallet.coinList[1].balance*usdt).toFixed(2); wallet.coinList[i].balance = b;
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt)
.toFixed(2);
uni.setStorageSync('wallet', wallet); uni.setStorageSync('wallet', wallet);
success()
}); });
} }
@ -248,16 +254,19 @@ let WalletUtil = {
case 'TRX': case 'TRX':
console.log("进来TRX") console.log("进来TRX")
TronUtil.getTronBalance(wallet.address).then((res) => { TronUtil.getTronBalance(wallet.address).then((res) => {
wallet.balance=res; wallet.balance = res;
wallet.balancePrice=(res*rr).toFixed(2); wallet.balancePrice = (res * rr).toFixed(2);
wallet.coinList[0].balance=res wallet.coinList[0].balance = res
wallet.coinList[0].balancePrice=wallet.balancePrice wallet.coinList[0].balancePrice = wallet.balancePrice
TronUtil.getContract(wallet.address,wallet.coinList,function(list){ TronUtil.getContract(wallet.address, wallet.coinList,
wallet.coinList=list; function(list) {
wallet.coinList[1].balancePrice=(wallet.coinList[1].balance*usdt).toFixed(2); wallet.coinList = list;
console.log(wallet.coinList) wallet.coinList[1].balancePrice = (wallet
uni.setStorageSync('wallet', wallet); .coinList[1].balance * usdt).toFixed(2);
}) console.log(wallet.coinList)
uni.setStorageSync('wallet', wallet);
success()
})
}) })
@ -270,7 +279,7 @@ let WalletUtil = {
}) })
}, },
getPrice:function(type,success){ getPrice: function(type, success) {
uni.request({ uni.request({
url: 'https://apilist.tronscan.org/api/token/price?token=' + type.toLowerCase(), //请求接口 url: 'https://apilist.tronscan.org/api/token/price?token=' + type.toLowerCase(), //请求接口
header: { header: {
@ -289,51 +298,51 @@ let WalletUtil = {
// 封装地址方法 // 封装地址方法
updateAddress:function(type,value,bigAddress,addressName) { updateAddress: function(type, value, bigAddress, addressName) {
let that=this let that = this
switch (wallet.type) { switch (wallet.type) {
case 'BTC': case 'BTC':
break; break;
case 'ETH': case 'ETH':
break; break;
case 'TRX': case 'TRX':
if(value=='ETH'){ if (value == 'ETH') {
const gai = uni.getStorageSync('ETHAddressInfo') const gai = uni.getStorageSync('ETHAddressInfo')
const gai2 = uni.getStorageSync('TRXAddressInfo') const gai2 = uni.getStorageSync('TRXAddressInfo')
const index=uni.getStorageSync('editIndex') const index = uni.getStorageSync('editIndex')
let eth=new Object; let eth = new Object;
eth.address=bigAddress; eth.address = bigAddress;
eth.name=addressName eth.name = addressName
eth.coinList=[{ eth.coinList = [{
name:"ETH", name: "ETH",
name2:"ETH", name2: "ETH",
xname:'Ethereum', xname: 'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png') icon: require('@/static/tongyonh/Frame3299.png')
}]; }];
gai2.splice(index,1) gai2.splice(index, 1)
uni.setStorageSync('TRXAddressInfo',gai2) uni.setStorageSync('TRXAddressInfo', gai2)
gai.push(eth); gai.push(eth);
uni.setStorageSync('ETHAddressInfo',gai) uni.setStorageSync('ETHAddressInfo', gai)
uni.showToast({ uni.showToast({
title: 'Successfully', title: 'Successfully',
icon: 'success', icon: 'success',
duration: 1500 duration: 1500
}) })
uni.navigateTo({ uni.navigateTo({
url:'../address/index' url: '../address/index'
}) })
} }
break; break;
} }
}, },
// 指纹识别 // 指纹识别
finger(){ finger() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) { if (!plus.fingerprint.isSupport()) {
this.result = '此设备不支持指纹识别'; this.result = '此设备不支持指纹识别';
@ -358,115 +367,117 @@ let WalletUtil = {
// #endif // #endif
}, },
fingerprint: function(sett) { fingerprint: function(sett) {
let bltype=true; let bltype = true;
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) { if (!plus.fingerprint.isSupport()) {
uni.showToast({ uni.showToast({
title: 'This device does not support fingerprint identification', title: 'This device does not support fingerprint identification',
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
// this.disabled = true; // this.disabled = true;
} else if (!plus.fingerprint.isKeyguardSecure()) { } else if (!plus.fingerprint.isKeyguardSecure()) {
uni.showToast({ uni.showToast({
title: 'This device is not equipped with a password lock screen and cannot use fingerprint identification', title: 'This device is not equipped with a password lock screen and cannot use fingerprint identification',
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
} else if (!plus.fingerprint.isEnrolledFingerprints()) {
uni.showToast({
title: 'There is no fingerprint entered in this device. Please turn it on in the setting',
icon: 'none',
duration: 1500
})
// this.disabled = true;
} else {
// this.result = '此设备支持指纹识别';
// // this.disabled = false;
// #ifdef MP-WEIXIN
// this.disabled = false;
uni.showToast({
title: 'Please use it in wechat real machine. The simulator does not support it',
icon: 'none',
duration: 1500
})
// #endif
// #ifndef APP-PLUS || MP-WEIXIN
uni.showToast({
title: 'Fingerprint identification is not supported on this platform',
icon: 'none',
duration: 1500,
})
// #endif
} else if (!plus.fingerprint.isEnrolledFingerprints()) {
uni.showToast({
title: 'There is no fingerprint entered in this device. Please turn it on in the setting',
icon: 'none',
duration: 1500
})
// this.disabled = true;
} else {
// this.result = '此设备支持指纹识别';
// // this.disabled = false;
// #ifdef MP-WEIXIN
// this.disabled = false;
uni.showToast({
title: 'Please use it in wechat real machine. The simulator does not support it',
icon: 'none',
duration: 1500
})
// #endif
// #ifndef APP-PLUS || MP-WEIXIN
uni.showToast({
title: 'Fingerprint identification is not supported on this platform',
icon: 'none',
duration: 1500,
})
// #endif
let that = this;
let forSett = true;
// #ifdef APP-PLUS
plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
// uni.showToast({
// title: 'Fingerprint identification succeeded',
// icon: 'none',
// duration: 1500,
// })
// 存储设置里开启指纹后的状态,隐藏使用密码
console.log(forSett, 12121)
if (sett) {
uni.setStorageSync('fingerPass', true)
console.log(forSett, 12121)
let that=this; }
let forSett=true; //plus.nativeUI.alert('Fingerprint identification succeeded');
// #ifdef APP-PLUS }, function(e) {
plus.fingerprint.authenticate(function() { switch (e.code) {
case e.AUTHENTICATE_MISMATCH:
plus.nativeUI.toast('Fingerprint matching failed, please re-enter');
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'
);
break;
case e.CANCEL:
plus.nativeUI.toast('Recognition has been cancelled');
break;
default:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框 plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
// uni.showToast({ plus.nativeUI.alert('Fingerprint identification failed, please try again');
// title: 'Fingerprint identification succeeded', break;
// icon: 'none', }
// duration: 1500, });
// }) // Android平台手动弹出等待提示框
// 存储设置里开启指纹后的状态,隐藏使用密码 if ('Android' == plus.os.name) {
console.log(forSett,12121) this.show = true;
if(sett){ /* plus.nativeUI.showWaiting('...').onclose = function() {
uni.setStorageSync('fingerPass',true) plus.fingerprint.cancel();
console.log(forSett,12121) } */
}
} // #endif
//plus.nativeUI.alert('Fingerprint identification succeeded');
}, function(e) { // #ifdef MP-WEIXIN
switch (e.code) { wx.startSoterAuthentication({
case e.AUTHENTICATE_MISMATCH: requestAuthModes: ['fingerPrint'],
plus.nativeUI.toast('Fingerprint matching failed, please re-enter'); challenge: '123456',
break; authContent: '请用指纹解锁',
case e.AUTHENTICATE_OVERLIMIT: success(res) {
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框 uni.showToast({
plus.nativeUI.alert('The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication'); title: '识别成功',
break; mask: false,
case e.CANCEL: duration: 1500
plus.nativeUI.toast('Recognition has been cancelled');
break;
default:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert('Fingerprint identification failed, please try again');
break;
}
}); });
// Android平台手动弹出等待提示框
if ('Android' == plus.os.name) {
this.show=true;
/* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel();
} */
}
// #endif
// #ifdef MP-WEIXIN
wx.startSoterAuthentication({
requestAuthModes: ['fingerPrint'],
challenge: '123456',
authContent: '请用指纹解锁',
success(res) {
uni.showToast({
title: '识别成功',
mask: false,
duration: 1500
});
}
})
// #endif
} }
// #endif })
// #endif
}
// #endif
}, },
printCancel:function(){ printCancel: function() {
plus.fingerprint.cancel(); plus.fingerprint.cancel();
// this.result="停止指纹识别" // this.result="停止指纹识别"
}, },

Loading…
Cancel
Save