|
|
@ -15,8 +15,11 @@ |
|
|
|
<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> |
|
|
|
<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 |
|
|
@ -27,7 +30,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -38,205 +41,91 @@ |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
password:'', |
|
|
|
password2:'', |
|
|
|
msg:'', |
|
|
|
msgLength:0, |
|
|
|
fes:false, |
|
|
|
borNum:true, |
|
|
|
borNum2:false, |
|
|
|
info:false, |
|
|
|
word:{}, |
|
|
|
walletInfo:{}, |
|
|
|
password: '', |
|
|
|
password2: '', |
|
|
|
msg: '', |
|
|
|
msgLength: 0, |
|
|
|
fes: false, |
|
|
|
borNum: true, |
|
|
|
borNum2: false, |
|
|
|
info: false, |
|
|
|
word: {}, |
|
|
|
walletInfo: {}, |
|
|
|
btcBalance: 0, |
|
|
|
ethBbalance: 0, |
|
|
|
trxBbalance: 0, |
|
|
|
} |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
watch: { |
|
|
|
|
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
|
|
|
|
} |
|
|
|
methods: { |
|
|
|
|
|
|
|
setWalletInfo(e){ |
|
|
|
// 首次创建三条主链钱包 首次执行这里 |
|
|
|
setWalletInfo(e) { |
|
|
|
this.word = uni.getStorageSync('word'); |
|
|
|
this.walletInfo=this.$Token.initialWallet(this.word,e) |
|
|
|
uni.setStorageSync('walletInfo',this.walletInfo); |
|
|
|
this.$walletUtil.initialWallet(this.word,this.password ) |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除触发 |
|
|
|
back(e){ |
|
|
|
if(e.length<6){ |
|
|
|
this.info=false; |
|
|
|
// 删除密码触发 |
|
|
|
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", |
|
|
|
name2:"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; |
|
|
|
if (this.password != e) { |
|
|
|
this.info = true; |
|
|
|
return; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
|
|
|
|
// 私鑰創建 |
|
|
|
var createWalletName= uni.getStorageSync('createWalletName') |
|
|
|
var privateKey= uni.getStorageSync('privateKey') |
|
|
|
uni.setStorageSync('privateKey', this.wordInfo); |
|
|
|
try { |
|
|
|
this.$walletUtil.privateKeyEstablishWallet(createWalletName,privateKey,this.password); |
|
|
|
uni.showToast({ |
|
|
|
title: 'Set successfully', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500, |
|
|
|
}) |
|
|
|
setTimeout(()=>{ |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url:'../../wallet/index' |
|
|
|
url: '../../wallet/index' |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
this.info=false; |
|
|
|
} |
|
|
|
return; |
|
|
|
}, 1500) |
|
|
|
} |
|
|
|
|
|
|
|
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", |
|
|
|
name2:"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{ |
|
|
|
catch(err){ |
|
|
|
uni.showToast({ |
|
|
|
title: 'Set successfully', |
|
|
|
icon: 'success', |
|
|
|
title: 'Creation failed', |
|
|
|
icon: 'none', |
|
|
|
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", |
|
|
|
name2:"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; |
|
|
|
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) |
|
|
|
this.password = e |
|
|
|
var that = this; |
|
|
|
that.borNum = false; |
|
|
|
that.borNum2 = false; |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
that.borNum2 = true; |
|
|
|
}, 50) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|