You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
636 lines
17 KiB
636 lines
17 KiB
<template>
|
|
<view class="ac">
|
|
<navigation :showBack="false" :bgnum="true">
|
|
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()"></image>
|
|
<text class="big_title">
|
|
{{coin.name}} Transfer
|
|
</text>
|
|
</navigation>
|
|
<view class="main">
|
|
<view class="main_con">
|
|
<view class="yuan">
|
|
<image :src="coin.icon" mode="aspectFit" class="img1"></image>
|
|
</view>
|
|
|
|
<view class="title">
|
|
{{coin.name}}
|
|
</view>
|
|
<view class="item">
|
|
<view class="top flex">
|
|
<view class="text1">
|
|
Receiving address
|
|
</view>
|
|
<view class="text2" @click="goAddress('transfer')">
|
|
Adress Book
|
|
</view>
|
|
</view>
|
|
<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" />
|
|
<image src="../../../../static/tongyonh/Frame330.png" mode="aspectFit" class="img1"></image>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="item">
|
|
<view class="top flex">
|
|
<view class="text1">
|
|
Transfer amount
|
|
</view>
|
|
</view>
|
|
<view class="inputcon2 flex">
|
|
<view class="inputc flex">
|
|
<view class="textt">
|
|
{{coin.name}}
|
|
</view>
|
|
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
|
|
placeholder="0.0000000" class="input3" v-model="transAmount" />
|
|
</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" />
|
|
</view>
|
|
</view>
|
|
<view class="top flex bottom">
|
|
<view class="text3">
|
|
Balance: {{coin.balance}}
|
|
</view>
|
|
<view class="text1 bg" @click="forAll">
|
|
ALL
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="item">
|
|
<view class="top flex">
|
|
<view class="text1">
|
|
Remark
|
|
</view>
|
|
|
|
</view>
|
|
<view class="inputcon">
|
|
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
|
|
placeholder="Please enter a note (off-chain)" class="input1" />
|
|
</view>
|
|
</view>
|
|
|
|
<view class="item">
|
|
<view class="top flex">
|
|
<view class="text1">
|
|
Transaction fee
|
|
</view>
|
|
|
|
</view>
|
|
<view class="inputcon">
|
|
<input type="text" v-model="fee" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
|
|
placeholder="Please enter a note (off-chain)" class="input2" />
|
|
<view class="rig">
|
|
<text class="text2">{{coin.type}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="big_con" v-if="showBottom">
|
|
<view class="tiao" @click="cancelAll">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Transfer confirmation
|
|
</view>
|
|
<view class="bottom_con">
|
|
<view class="yuan">
|
|
<image :src="coin.icon" mode="aspectFit" class="img1"></image>
|
|
</view>
|
|
<view class="title">
|
|
{{coin.type}}
|
|
</view>
|
|
<view class="title_con flex">
|
|
<view class="text1">
|
|
Amount
|
|
</view>
|
|
<view class="text1">
|
|
{{transAmount}} {{coin.name}}
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="text1">
|
|
Send address
|
|
</view>
|
|
<view class="text2">
|
|
{{coin.address}}
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="text1">
|
|
Receiving address
|
|
</view>
|
|
<view class="text2">
|
|
{{recipientAddress}}
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="text1">
|
|
Remark
|
|
</view>
|
|
<view class="text2">
|
|
1.00 TRX
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="text1">
|
|
Transaction fee
|
|
</view>
|
|
<view class="text2">
|
|
{{fee}} {{coin.type}}
|
|
</view>
|
|
</view>
|
|
|
|
<view class="goto" @click="confirmTo">
|
|
Confirm
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<u-mask z-index="10" :show="show"></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">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Fingerprint password
|
|
</view>
|
|
<view class="bottom_con">
|
|
<image src="../../../../static/tongyonh/zhiwen.png" mode="aspectFit" class="img1"></image>
|
|
<view class="text1">
|
|
Touch the fingerprint sensor
|
|
</view>
|
|
<view class="flex con">
|
|
<view class="textt1" @click="goPassword" v-if="!passShow">
|
|
Use Password
|
|
</view>
|
|
<view class="textt2" @click="cancel">
|
|
Cancel
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="zhiwen_con" v-if="fingerFail">
|
|
<view class="tiao">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Fingerprint password
|
|
</view>
|
|
<view class="bottom_con">
|
|
<image src="../../../../static/tongyonh/alert-circle.png" mode="aspectFit" class="img1"></image>
|
|
<view class="text1 red">
|
|
Fingerprint not recognized. <br><text @click="confirmTo('try')">Try again</text> .
|
|
</view>
|
|
<view class="flex con">
|
|
<view class="textt1" @click="goPassword">
|
|
Use Password
|
|
</view>
|
|
<view class="textt2" @click="cancelFail">
|
|
Cancel
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="zhiwen_con" v-if="fingerSuccess">
|
|
<view class="tiao">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Fingerprint password
|
|
</view>
|
|
<view class="bottom_con">
|
|
<image src="../../../../static/tongyonh/x-circle.png" mode="aspectFit" class="img1"></image>
|
|
<view class="text1 green">
|
|
Fingerprint recognized.
|
|
</view>
|
|
<!-- <view class="flex con">
|
|
<view class="textt1">
|
|
Use Password
|
|
</view>
|
|
<view class="textt2">
|
|
Confirm
|
|
</view>
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
|
|
<view class="btn_con" @click="Confirm">
|
|
<view class="btn">
|
|
Confirm
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import cont from "@/components/navigation/navigation.vue"
|
|
export default {
|
|
data() {
|
|
return {
|
|
coin:{},
|
|
fee: 0,
|
|
show: false,
|
|
show2: false,
|
|
showFinger: false,
|
|
showBottom: false,
|
|
addressInfo: {},
|
|
recipientAddress: '',
|
|
transAmount: '',
|
|
fingerSuccess: false,
|
|
fingerFail: false,
|
|
// 是否显示使用密码,有设置指纹就不显示
|
|
passShow: false,
|
|
// 不用指纹去密码页面存的信息
|
|
transInfoPass: {
|
|
fromAddress: '',
|
|
toAddress: "",
|
|
privateKey: '',
|
|
amount: '',
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
cancelAll(){
|
|
this.show=false;
|
|
this.showBottom=false;
|
|
},
|
|
cancelFail() {
|
|
this.printCancel()
|
|
this.fingerFail = false
|
|
this.showBottom = true;
|
|
this.showFinger = false;
|
|
},
|
|
cancel() {
|
|
this.showFinger = false
|
|
this.showBottom=true;
|
|
this.printCancel()
|
|
},
|
|
// 不用指纹去密码页
|
|
goPassword() {
|
|
this.printCancel();
|
|
console.log(111)
|
|
uni.navigateTo({
|
|
url: '/pages/menu/sendToken/enPassword/index'
|
|
})
|
|
},
|
|
// 唤起指纹
|
|
confirmTo(type) {
|
|
if (type == 'try') {
|
|
this.fingerFail = false;
|
|
}
|
|
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() {
|
|
uni.reLaunch({
|
|
url: '../../wallet/index'
|
|
})
|
|
},
|
|
// 点击获取所有钱
|
|
forAll() {
|
|
this.transAmount = this.coin.balance
|
|
},
|
|
// 确认提交
|
|
Confirm() {
|
|
// 做判断
|
|
if (this.transAmount == '') {
|
|
uni.showToast({
|
|
title: 'Please enter the transfer amount',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if (this.recipientAddress == '') {
|
|
uni.showToast({
|
|
title: 'Please enter the receiving address',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if (this.transAmount == '' < 0) {
|
|
uni.showToast({
|
|
title: 'The entered amount cannot be less than 0',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if( this.transAmount>this.coin.balance){
|
|
uni.showToast({
|
|
title: 'Sorry, your credit is running low',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
this.showBottom = true;
|
|
this.show = true;
|
|
},
|
|
// 取消指纹识别
|
|
printCancel(){
|
|
this.showFinger=false;
|
|
console.log(this.showFinger,4444)
|
|
plus.fingerprint.cancel();
|
|
console.log(this.showFinger,4444)
|
|
|
|
},
|
|
fingerprint: function(sett) {
|
|
let bltype = true;
|
|
// #ifdef APP-PLUS
|
|
if (!plus.fingerprint.isSupport()) {
|
|
uni.showToast({
|
|
title: 'This device does not support fingerprint identification',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
// this.disabled = true;
|
|
} else if (!plus.fingerprint.isKeyguardSecure()) {
|
|
uni.showToast({
|
|
title: 'This device is not equipped with a password lock screen and cannot use fingerprint identification',
|
|
icon: 'none',
|
|
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
|
|
|
|
|
|
let that = this;
|
|
// #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
|
|
// })
|
|
// })
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, function(e) {
|
|
switch (e.code) {
|
|
case e.AUTHENTICATE_MISMATCH:
|
|
// plus.nativeUI.toast('Fingerprint matching failed, please re-enter');
|
|
// uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger, 454545)
|
|
that.showBottom = false;
|
|
that.fingerFail = true;
|
|
console.log(that.fingerFail, 454545)
|
|
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');
|
|
// uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger, 454545)
|
|
that.showBottom = false;
|
|
that.fingerFail = true;
|
|
console.log(that.fingerFail, 454545)
|
|
break;
|
|
case e.CANCEL:
|
|
plus.nativeUI.toast('Recognition has been cancelled');
|
|
// uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger, 454545)
|
|
that.showBottom = false;
|
|
that.fingerFail = true;
|
|
console.log(that.fingerFail, 454545)
|
|
break;
|
|
default:
|
|
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
uni.setStorageSync('fingerPass', false)
|
|
console.log(that.showFinger, 454545)
|
|
that.showBottom = false;
|
|
that.fingerFail = true;
|
|
console.log(that.fingerFail, 454545)
|
|
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
|
|
|
|
|
|
},
|
|
|
|
|
|
goAddress(text) {
|
|
console.log(text)
|
|
uni.navigateTo({
|
|
url: '../address/index?item=' + text
|
|
})
|
|
}
|
|
},
|
|
onLoad() {
|
|
// 拿从地址页面传过来的接受地址
|
|
if(uni.getStorageSync('myTransAddress')){
|
|
this.recipientAddress=uni.getStorageSync('myTransAddress').address
|
|
// 拿完清掉
|
|
uni.removeStorageSync('myTransAddress')
|
|
}
|
|
this.coin=uni.getStorageSync('coin')
|
|
// 每次进来拿缓存里有没有指纹
|
|
if (uni.getStorageSync('fingerPass')) {
|
|
this.passShow = uni.getStorageSync('fingerPass')
|
|
}
|
|
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
page {
|
|
background: #FAFAFA;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
|
|
<style>
|
|
@import './index.css';
|
|
</style>
|
|
|