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.
 
 
 
 

320 lines
7.7 KiB

<template>
<view class="">
<navigation :showBack="true">
{{i18n.Importmnemonics}}
</navigation>
<view class="main">
<view class="title">
{{i18n.Mnemonicsimportverification}}
</view>
<u-input type="textarea" :clearable="false" v-model="wordInfo" @input="getmon()" :placeholder="teee"
class="textareaa" placeholderStyle="color:rgb(224,229,242)" :focus="foucStatus" @blur="hideMon" />
<u-button class="custom-style" @click="confirm">{{i18n.Confirm}}</u-button>
<view class="info_con" v-if="show">
<image src="../../../../static/tongyonh/xg.png" mode="aspectFit" class="img2" @click="show=false">
</image>
<image src="../../../../static/tongyonh/Frame60.png" mode="aspectFit" class="img"></image>
<view class="info">
{{i18n.Successful}}
</view>
<view class="text">
{{i18n.backCom}}
</view>
<view class="btn">
{{i18n.Confirm}}
</view>
</view>
<view class="info_con" v-if="show2">
<image src="../../../../static/tongyonh/xg.png" mode="aspectFit" class="img2" @click="show2=false">
</image>
<image src="../../../../static/tongyonh/Subtract.png" mode="aspectFit" class="img"></image>
<view class="info">
{{i18n.seed}}
</view>
<view class="text">
{{i18n.wrongWord}} <br>{{i18n.wrongWord2}}
</view>
<view class="btncon">
<view class="can" @click="show2=false">
{{i18n.Cancel}}
</view>
<view class="con" @click="restart">
{{i18n.Confirm}}
</view>
</view>
</view>
<u-mask :show="show" z-index="10"></u-mask>
<u-mask :show="show2" z-index="10"></u-mask>
</view>
<!-- v-if="wordType" -->
<scroll-view :scroll-x="true" class="">
<!-- @click="toWord(item)" -->
<view class="scroll">
<view class="item" v-for="item,index in worcon" @touchend.prevent="toWord(item)">
{{item}}
</view>
</view>
</scroll-view>
<!-- <u-keyboard mode="car" v-model="show222"></u-keyboard> -->
</view>
</view>
</template>
<script>
import cont from "@/components/navigation/navigation.vue"
export default {
data() {
return {
show222: '',
wordType: false,
teee: this.$t('index').separatedbyspaces,
mnemonics: [],
wordArr: [],
show: false,
index: 0,
returnIndex: 0,
// 拿来对比的
mnemonics2: [],
show2: false,
wordInfo: '',
walletInfo: {},
go: false,
name: '',
typename: '',
info: {},
worcon: [],
keyUp: '',
foucStatus: false,
defaultPhoneHeight: '', //屏幕默认高度
nowPhoneHeight: '', //屏幕现在的高度
};
},
computed: {
i18n() {
return this.$t('index')
},
},
// watch: {
// nowPhoneHeight: {
// handler (newName, oldName) {
// console.log(newName,78888888888)
// },
// }
// },
// nowPhoneHeight(){
// handler(newName, oldName) {
// console.log(this.nowPhoneHeight,777777777777777)
// // if(this.defaultPhoneHeight != this.nowPhoneHeight){
// // //手机键盘被唤起了。
// // //写软键盘唤起你需要做的操作
// // //如this.tabbar = true
// // }else{
// // //手机键盘被关闭了。
// // //写软键盘关闭你需要做的操作
// // //如this.tabbar = false
// // this.wordType=false
// // }
// console.log(newName)
// }
// }
methods: {
test() {
// uni.onKeyboardHeightChange(res => {
// console.log(res.height)
// })
// 获取屏幕高度
let self = this;
uni.getSystemInfo({
success: function(res) {
console.log(res.screenHeight); //屏幕高度 注意这里获得的高度宽度都是px 需要转换rpx
console.log(res.windowWidth); //可使用窗口宽度
console.log(res.windowHeight); //可使用窗口高度
console.log(res.screenWidth); //屏幕宽度
this.defaultPhoneHeight = res.windowHeight
this.nowPhoneHeight = res.windowHeight
console.log(this.nowPhoneHeight, 7878787);
// self.emulator_Height = (res.screenHeight * (750 / res.windowWidth)) //将px 转换rpx
// console.log("rpx*********", self.emulator_Height)
}
});
},
hideMon() {
this.wordType = false
},
getmon() {
// this.test();
console.log(this.wordInfo)
var ss = this.wordInfo.split(" ")
this.keyUp = ss[ss.length - 1];
console.log(ss[ss.length - 1], 444)
this.worcon = this.$Token.searchMnemonic(ss[ss.length - 1])
if (this.worcon.length > 0) {
this.wordType = true;
} else if (this.worcon.length == 0) {
uni.showToast({
title: this.keyUp + this.$t('index').MnemonicsError,
icon: 'none',
duration: 1500
})
}
console.log(this.worcon, 444444)
},
toWord(item) {
console.log(this.keyUp + item, 78787878)
this.wordInfo += item + ' '
this.wordInfo = this.wordInfo.replace(this.keyUp + item, item)
this.keyUp = '';
this.wordType = false
console.log(this.foucStatus, 7878787878787787777777777)
},
// 成功去到设置交易密码
goTranPaw() {
uni.navigateTo({
url: '/pages/menu/backUp/transPaw/index'
})
},
// 失败重刷新
restart() {
uni.redirectTo({
url: '../backUp4/index'
})
},
// 提交
confirm() {
this.wordInfo = this.wordInfo.trimRight();
console.log(this.wordInfo, 1231564)
if (this.wordInfo == '') {
uni.showToast({
title: this.$t('index').MnemonicsError,
icon: 'none',
duration: 1500
})
return;
}
this.typename = uni.getStorageSync('createWalletName')
try {
this.$Token.generateBtc(this.wordInfo)
} catch (e) {
console.log(e)
uni.showToast({
title: this.$t('index').MnemonicsError,
icon: 'none',
duration: 1500
})
return;
}
if (!this.typename) {
if (this.wordInfo.split(" ").length % 12 != 0) {
uni.showToast({
title: this.$t('index').MnemonicsError,
icon: 'none',
duration: 1500
})
return;
}
uni.setStorageSync('word', this.wordInfo);
uni.navigateTo({
url: '/pages/menu/backUp/transPaw/index'
})
} else {
this.walletInfo = uni.getStorageSync('walletInfo');
for(var i=0;i<this.walletInfo[this.typename].length;i++){
if(this.walletInfo[this.typename][i]["mnemonic"]===this.wordInfo){
uni.showToast({
title: this.$t('index').beenimported,
icon: 'none',
duration: 1500
})
return;
}
}
console.log(this.walletInfo, 123654)
if (this.wordInfo == null) {
uni.showToast({
title: this.$t('index').beempty,
icon: 'none',
duration: 1500
})
return;
}
this.walletInfo = uni.getStorageSync('walletInfo');
for (var i = 0; i < this.walletInfo[this.typename].length; i++) {
if (this.wordInfo == this.walletInfo[this.typename][i].address) {
uni.showToast({
title: this.$t('index').beenimported,
icon: 'none',
duration: 1500
})
return;
} else {
uni.setStorageSync('word', this.wordInfo);
uni.navigateTo({
url: '/pages/menu/backUp/transPaw/index'
})
}
}
}
},
},
onLoad(item) {
if (item != '' || item != undefined) {
uni.setStorageSync('createWalletName', item.name)
}
},
};
</script>
<style scoped>
.custom-style {
height: 112rpx;
text-align: center;
color: #fff;
background-color: #5B53FF !important;
border-radius: 40rpx;
margin-top: 50rpx;
}
.u-default-hover {
background-color: #5B53FF !important;
border-radius: 40rpx !important;
color: #fff !important;
border: none;
}
</style>
<style>
@import './index.css';
</style>