},
mnemonic:{
"title":"备份助记词",
- "hint":"请牢记助记词,一旦丢失您的资产将无法找回!"
+ "hint":"请牢记助记词,一旦丢失您的资产将无法找回!",
+ "passwordHint":"请输入密码展示助记词"
},
verifyMnemonic:{
"title":"验证助记词",
BTM0005:'输入数量大于可用余额。',
BTM0006:'输入有效的地址格式。',
BTM0007:'钱包名称错误,请输入正确钱包名称。',
+ BTM0008:'密码不能为空'
},
successMsg:{
createWallet:{
<div class="logo_divider"></div>
<figure :class="active('HOME')" v-on:click="toggleTab('HOME')"><i class="iconfont iconhome_filled"></i></figure>
<figure v-on:click=""><i class="iconfont iconbapp_filled"></i></figure>
- <figure v-on:click=""><i class="iconfont iconwallet_filled"></i></figure>
+ <figure :class="active('WALLETS')" v-on:click="toggleTab('WALLETS')"><i class="iconfont iconwallet_filled"></i></figure>
<figure :class="active('BACKUP')" v-on:click="toggleTab('BACKUP')"><i class="iconfont iconbackup_filled"></i></figure>
</section>
<figure class="setting" :class="active('SETTINGS')" v-on:click="toggleTab('SETTINGS')">
RouteNames.BACKUP,
RouteNames.BACKUP_MNEMONIC,
]
+
+ const wallet_tab = [
+ RouteNames.WALLETS,
+ ]
switch(name){
case 'HOME':{
if(home_tab.includes(this.$route.name)){
}
break;
}
+ case 'WALLETS':{
+ if(wallet_tab.includes(this.$route.name)){
+ return "active";
+ }
+ break;
+ }
default:
return ""
resultObj.keyAlias = keyAlias
resultObj.vMnemonic = false
- _bytom.keychain.pairs[accountAlias] = resultObj
- _bytom.currentAccount = resultObj
- context[Actions.UPDATE_STORED_BYTOM](_bytom).then(() => {
- resolve(ret)
- })
- .catch(error => {
- reject(error)
- })
+
+ context[Actions.SET_MNEMONIC](resultObj['mnemonic']).then(()=>{
+ delete resultObj['mnemonic']
+
+ _bytom.keychain.pairs[accountAlias] = resultObj
+ _bytom.currentAccount = resultObj
+ context[Actions.UPDATE_STORED_BYTOM](_bytom).then(() => {
+ resolve(resultObj)
+ }).catch(e => { throw e })
+ })
+ .catch(error => {
+ reject(error)
+ })
})
})
return retPromise
// CHANGE_PASSWORD:'changePassword',
BACKUP:'backup',
BACKUP_MNEMONIC:'backup-mnemonic',
- // DESTROY:'destroy',
+ WALLETS:'wallets',
// AUTO_LOCK:'autoLock',
// LANGUAGE:'language',
// KEYPAIRS:'keypairs',
require(['@/views/sideMenu/homeMenu.vue'], resolve)
},
children: [
- {
- path: '/menu/account/create',
- name: 'menu-account-creation',
- meta: { title: '创建账户' },
- component: resolve => {
- require(['@/views/sideMenu/menuCreation.vue'], resolve)
- }
- },
+
{
path: '/menu/help',
name: 'menu-help',
]
},
{
+ path: '/wallets',
+ name: RouteNames.WALLETS,
+ meta: { title: '钱包' },
+ component: resolve => {
+ require(['@/views/wallets.vue'], resolve)
+ }
+ },
+ {
path: '/backup',
name: RouteNames.BACKUP,
meta: { title: '备份' },
<span class="mnemonic" v-for="n in inputMnemonic">{{ n }} </span>
</div>
<p class="hint">{{ $t('backup.mnemonicHint') }}</p>
- <button class="btn btn-primary">{{ $t("backup.ok") }}</button>
+ <button class="btn btn-primary" @click="back">{{ $t("backup.ok") }}</button>
</section>
</div>
</template>
])
},
methods: {
+ back(){
+ this.$router.push({ name: RouteNames.BACKUP });
+ },
...mapActions([
Actions.SET_MNEMONIC
])
},
mounted() {
if (!this.mnemonic){
- this.$router.push({ name: RouteNames.BACKUP })
+ this.back();
}
},
beforeDestroy() {
+++ /dev/null
-<style scoped>
- .form-item {
- background: transparent;
- margin: 0;
- padding: 0;
- }
- .form-item .form-item-label {
- float: none;
- width: 200px;
- margin: 0;
- padding: 0;
- }
- .submit {
- margin-top: 15px;
- height: 48px;
- padding: 15px;
- }
- .form{
- border-radius:4px;
- background: white;
- padding: 20px 20px 28px;
- }
-</style>
-
-<template>
- <MenuPage :title="$t('createAccount.title')">
- <div class="form">
- <div class="form-item">
- <label class="form-item-label">{{ $t('createAccount.accountAlias') }}</label>
- <div class="form-item-content">
- <input type="text" v-model="formItem.accAlias">
- </div>
- </div>
-
- <div class="form-item">
- <label class="form-item-label">{{ $t('createAccount.keyPassword') }}</label>
- <div class="form-item-content">
- <input type="password" v-model="formItem.passwd1">
- </div>
- </div>
- <div class="form-item">
- <label class="form-item-label">{{ $t('createAccount.confirmPassword') }}</label>
- <div class="form-item-content">
- <input type="password" v-model="formItem.passwd2">
- </div>
- </div>
- <div class="tips">{{tips}}</div>
- </div>
- <a class="btn btn-primary submit" @click="create">{{ $t('createAccount.create') }}</a>
- </MenuPage>
-</template>
-
-<script>
-import account from "@/models/account";
-import * as Actions from '@/store/constants';
-import { mapActions, mapState, mapGetters } from 'vuex'
-
-export default {
- name: "",
- components: {},
- data() {
- return {
- formItem: {
- accAlias: "",
- keyAlias: "",
- passwd1: "",
- passwd2: ""
- },
- tips: ""
- };
- },
- computed: {
- ...mapState([
- 'bytom'
- ]),
- ...mapGetters([
- 'net',
- 'netType'
- ])
- },
- methods: {
- create: function () {
- if (this.formItem.accAlias == "") {
- this.$dialog.show({
- body: this.$t("createAccount.inputAlias")
- });
- return;
- }
-
- if (this.formItem.passwd1 == "") {
- this.$dialog.show({
- body: this.$t("createAccount.inputPass")
- });
- return;
- }
- if (this.formItem.passwd1 != this.formItem.passwd2) {
- this.$dialog.show({
- body: this.$t('createAccount.passwordAgain')
- });
- return;
- }
-
- let loader = this.$loading.show({
- container: this.fullPage ? null : this.$refs.formContainer,
- canCancel: true,
- onCancel: this.onCancel
- });
-
- account.setupNet(`${this.net}`);
- if(this.netType === 'vapor'){
- account.create(this.formItem.accAlias, null, this.formItem.passwd1, this).then((resp) => {
- account.setupNet(`${this.net}vapor`);
- return account.copy(resp.guid).then((currentRespAccount)=>{
- this[Actions.CREATE_NEW_BYTOM_ACCOUNT](currentRespAccount).then(()=>{
- loader.hide();
- this.$router.push('/');
- })
- })
- }).catch(err => {
- console.log(err);
- loader.hide();
- this.$dialog.show({
- body: err.message
- });
- });
- }else{
- account.create(this.formItem.accAlias, null, this.formItem.passwd1,this).then(account => {
- this[Actions.CREATE_NEW_BYTOM_ACCOUNT](account).then(()=>{
- loader.hide();
- this.$router.push('/');
- })
-
- }).catch(err => {
- console.log(err);
- loader.hide();
- this.$dialog.show({
- body: err.message
- });
- });
- }
- },
- ...mapActions([
- Actions.CREATE_NEW_BYTOM_ACCOUNT,
- Actions.UPDATE_STORED_BYTOM
- ])
- },
- mounted() { }
-};
-</script>
--- /dev/null
+<style scoped>
+
+</style>
+
+<template>
+ <MenuPage :title="$t('createAccount.title')">
+ <div class="form">
+ <div class="form-item">
+ <label class="form-item-label">{{ $t('createAccount.accountAlias') }}</label>
+ <div class="form-item-content">
+ <input type="text" v-model="formItem.accAlias">
+ </div>
+ </div>
+
+ <div class="form-item">
+ <label class="form-item-label">{{ $t('createAccount.keyPassword') }}</label>
+ <div class="form-item-content">
+ <input type="password" v-model="formItem.passwd1">
+ </div>
+ </div>
+ <div class="form-item">
+ <label class="form-item-label">{{ $t('createAccount.confirmPassword') }}</label>
+ <div class="form-item-content">
+ <input type="password" v-model="formItem.passwd2">
+ </div>
+ </div>
+ <div class="tips">{{tips}}</div>
+ </div>
+ <a class="btn btn-primary submit" @click="create">{{ $t('createAccount.create') }}</a>
+ </MenuPage>
+</template>
+
+<script>
+import account from "@/models/account";
+import * as Actions from '@/store/constants';
+import { mapActions, mapState, mapGetters } from 'vuex'
+
+export default {
+ name: "",
+ components: {},
+ data() {
+ return {
+ formItem: {
+ accAlias: "",
+ keyAlias: "",
+ passwd1: "",
+ passwd2: ""
+ },
+ tips: ""
+ };
+ },
+ computed: {
+ ...mapState([
+ 'bytom'
+ ]),
+ ...mapGetters([
+ 'net',
+ 'netType'
+ ])
+ },
+ methods: {
+ create: function () {
+
+ },
+ ...mapActions([
+ Actions.CREATE_NEW_BYTOM_ACCOUNT,
+ Actions.UPDATE_STORED_BYTOM
+ ])
+ },
+ mounted() { }
+};
+</script>
...mapActions([
Actions.CREATE_NEW_BYTOM,
Actions.IMPORT_BYTOM,
- Actions.UPDATE_STORED_BYTOM
+ Actions.UPDATE_STORED_BYTOM,
+ Actions.SET_MNEMONIC
])
},
mounted() {
</h1>
</div>
<div class="divider"></div>
- <div class="container">
- <div>
- <p class="hint">{{ $t('mnemonic.hint')}}</p>
- <div class="mnemnonic-box">
- <span class="mnemonic" v-for="n in mnemonic">{{ n }} </span>
- </div>
+
+ <div v-if="mnemonic" class="container">
+ <div>
+ <p class="hint">{{ $t('mnemonic.hint')}}</p>
+ <div class="mnemnonic-box">
+ <span class="mnemonic" v-for="n in inputMnemonic">{{ n }} </span>
</div>
- <div>
- <div class="btn btn-primary btn-round float-right" @click="$router.push({ name: 'welcome-verify-mnemonic' })"><i class="iconfont icon-right-arrow"></i></div>
+ </div>
+ <div>
+ <div class="btn btn-primary btn-round float-right" @click="$router.push({ name: 'welcome-verify-mnemonic' })">
+ <i class="iconfont icon-right-arrow"></i></div>
+ </div>
+ </div>
+ <div class="container" v-else>
+ <div>
+ <div class="form">
+ <div class="form-item">
+ <div class="form-item-content">
+ <input type="password"
+ id="passwd1"
+ :placeholder="$t('mnemonic.passwordHint')"
+ name="passwd1"
+ ref="passwd1"
+ v-model="passwd"
+ >
+ </div>
+ </div>
</div>
</div>
- </div>
- <Footer/>
+ <div>
+ <div class="btn btn-primary btn-round float-right" @click="showMnemonic">
+ <i class="iconfont icon-right-arrow"></i></div>
+ </div>
+
+ </div>
+ </div>
+ <Footer/>
</div>
</template>
<script>
import { getLanguage } from '@/assets/language'
import { mapActions, mapGetters, mapState } from 'vuex'
+import account from "@/models/account";
+import {RouteNames} from '@/router'
+import * as Actions from '@/store/constants';
export default {
name: "",
+ data() {
+ return {
+ passwd:''
+ };
+ },
computed: {
- mnemonic: function () {
- return this.currentAccount.mnemonic.split(' ')
+ inputMnemonic: function () {
+ return this.mnemonic? this.mnemonic.split(' '): null;
},
...mapState([
- 'bytom'
+ 'bytom',
+ 'mnemonic'
]),
...mapGetters([
'currentAccount'
])
},
+ methods: {
+ showMnemonic: function () {
+ if (! this.passwd) {
+ this.$toast.error(
+ this.$t("error.BTM0008")
+ );
+ return;
+ }
+
+ const vault = this.currentAccount.vault;
+ try{
+ const mnemonic = account.decryptMnemonic(vault, this.passwd, this)
+ this[Actions.SET_MNEMONIC](mnemonic)
+ }
+ catch (e){
+ this.$toast.error(
+ e.message || e
+ );
+ }
+ },
+ ...mapActions([
+ Actions.SET_MNEMONIC
+ ])
+ },
};
</script>
import { mapActions, mapGetters, mapState } from 'vuex'
import * as Actions from '@/store/constants';
import { required } from "vuelidate/lib/validators";
+import {RouteNames} from '@/router'
export default {
return "form-item-label form-item-label-cn";
},
...mapState([
- 'bytom'
+ 'bytom',
+ 'mnemonic'
]),
...mapGetters([
'currentAccount'
} else {
const formMnemonic = this.inputMnemonic.trim()
- if (formMnemonic !== this.currentAccount.mnemonic) {
+ if (formMnemonic !== this.mnemonic) {
this.$toast.error(
this.$t("error.BTM0002")
);
Actions.UPDATE_STORED_BYTOM,
Actions.PUSH_ALERT
])
+ },
+ mounted() {
+ if (!this.mnemonic){
+ this.$router.push({ name: RouteNames.MNEMONIC })
+ }
}
};
</script>