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.
 
 
 
 

246 lines
5.6 KiB

<template>
<view class="">
<navigation :showBack="true" :bgnum="false">
<text class="big_title">
Transaction password
</text>
</navigation>
<view class="main">
<view class="big_title" v-if="borNum">
Set transaction password
</view>
<view class="big_title" v-if="borNum2">
Please enter again
</view>
<view class="title">
Secure transaction passwords, <br>please do not disclose
</view>
<u-message-input @finish="finish" inactive-color="#E0E5F2" active-color="#5B53FF" :width="94" :maxlength="6" mode="box" :focus="fes" :dot-fill="true" v-if="borNum"></u-message-input>
<u-message-input @finish="finish2" :inactive-color="info?'#F16063':'#E0E5F2'" active-color="#5B53FF" :width="94" :maxlength="6" mode="box" :focus="fes" :dot-fill="true" v-if="borNum2" @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,
borNum:true,
borNum2:false,
info:false,
word:{},
walletInfo:{},
}
},
watch:{
},
onLoad() {
}
methods: {
setWalletInfo(e){
this.word = uni.getStorageSync('word');
this.walletInfo=this.$Token.initialWallet(this.word,e)
uni.setStorageSync('walletInfo',this.walletInfo);
},
// 删除触发
back(e){
if(e.length<6){
this.info=false;
}
},
// 比较
finish2(e) {
var a=uni.getStorageSync('createWalletName')
console.log(a);
console.log('222222')
if(a=='BTC'&&a!=''&&a!=undefined){
this.walletInfo=uni.getStorageSync('walletInfo');
var mnemonic=uni.getStorageSync('privateKey');
console.log(mnemonic,7777777777)
let btc=this.$Token.importBtcPrivateKey(mnemonic);
btc.mnemonic=mnemonic;
btc.password=e;
btc.coinList=[{
name:"BTC",
xname:'Bitcoin',
icon:require('@/static/tongyonh/bye.png')
}];
console.log(this.$store.state.btci,555566565)
this.$store.commit('addBtci',1)
this.walletInfo.BTC[this.$store.state.btci]=btc;
// 增加钱包位置
console.log(this.$store.state.btci,555566565)
console.log(this.walletInfo,44444)
uni.setStorageSync('walletInfo',this.walletInfo);
if(this.password!=e){
this.info=true;
return;
}else{
uni.showToast({
title: 'Set successfully',
icon: 'success',
duration: 1500,
})
setTimeout(()=>{
uni.navigateTo({
url:'../../wallet/index'
})
},1500)
this.info=false;
}
return;
}
if(a=='ETH'&&a!=''&&a!=undefined){
this.walletInfo=uni.getStorageSync('walletInfo');
var mnemonic=uni.getStorageSync('word');
console.log(mnemonic,7777777777)
let eth=this.$Token.generateEth(mnemonic);
eth.mnemonic=mnemonic;
eth.password=e;
eth.coinList=[{
name:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
console.log(this.$store.state.ethi,555566565)
this.$store.commit('addEthi',1)
this.walletInfo.ETH[this.$store.state.ethi]=eth;
// 增加钱包位置
console.log(this.$store.state.ethi,555566565)
console.log(this.walletInfo,44444)
uni.setStorageSync('walletInfo',this.walletInfo);
if(this.password!=e){
this.info=true;
return;
}else{
uni.showToast({
title: 'Set successfully',
icon: 'success',
duration: 1500,
})
setTimeout(()=>{
uni.navigateTo({
url:'../../wallet/index'
})
},1500)
this.info=false;
}
return;
}
if(a=='TRX'&&a!=''&&a!=undefined){
this.walletInfo=uni.getStorageSync('walletInfo');
var mnemonic=uni.getStorageSync('word');
let tron=this.$Token.generateTron(mnemonic);
tron.mnemonic=mnemonic;
tron.password=e;
tron.coinList=[{
name:"TRX",
xname:'TRON',
icon:require('@/static/tongyonh/tron1.png')
}];
console.log(this.$store.state.troni,555566565)
// 增加钱包位置
this.$store.commit('addTroni',1)
this.walletInfo.TRON[this.$store.state.troni]=tron;
uni.setStorageSync('walletInfo',this.walletInfo);
if(this.password!=e){
this.info=true;
return;
}else{
uni.showToast({
title: 'Set successfully',
icon: 'success',
duration: 1500,
})
setTimeout(()=>{
uni.navigateTo({
url:'../../wallet/index'
})
},1500)
this.info=false;
}
return;
}
if(this.password!=e){
this.info=true;
return;
}else{
uni.showToast({
title: 'Set successfully',
icon: 'success',
duration: 1500,
})
this.setWalletInfo(e);
setTimeout(()=>{
// uni.navigateTo({
// url:'../reSuccessful'
// })
uni.navigateTo({
url:'../../wallet/index'
})
},1500)
this.info=false;
}
},
// 第一次存密码
finish(e) {
this.password=e
var that=this;
that.borNum=false;
that.borNum2=false;
// uni.setStorage({
// key: 'transPaw',
// data: e,
// success: function() {
//
// },
// });
setTimeout(()=>{
that.borNum2=true;
},50)
},
}
};
</script>
<style scoped>
</style>
<style>
@import './index.css';
</style>