bitcooo
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.
 
 
 
 

143 lines
3.1 KiB

<template>
<view class="">
<navigation :showBack="true" :bgnum="false">
<text class="big_title">
Enter Password
</text>
</navigation>
<view class="main">
<view class="big_title big_title2">
Enter Password
</view>
<u-message-input @finish="finish2" :inactive-color="info?'#F16063':'#E0E5F2'" active-color="#5B53FF"
:width="94" :maxlength="6" mode="box" :focus="fes" :dot-fill="true" @change="back">
</u-message-input>
<view class="infoText" v-if="info">
Password discrepansies
</view>
</view>
</view>
</view>
</template>
<script>
import cont from "@/components/navigation/navigation.vue"
export default {
data() {
return {
password: '',
password2: '',
msg: '',
msgLength: 0,
fes: false,
info: false,
transInfoPass: {
},
wallet: {}
}
},
methods: {
// 删除密码触发
back(e) {
if (e.length < 6) {
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)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 2000
})
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}).catch(err => {
uni.showToast({
title: err,
icon: 'none',
duration: 2000
})
})
} else {
// 如果转的是trx代币
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 (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)
})
}
}
},
},
onLoad() {
// 拿到转账信息
this.transInfoPass = uni.getStorageSync('transInfoPass')
// 拿到当前钱包信息
this.wallet = uni.getStorageSync('wallet')
console.log(this.transInfoPass, 2222)
console.log(this.wallet, 2222)
}
};
</script>
<style scoped>
</style>
<style>
@import './index.css';
</style>