diff --git a/src/common/lang/en.js b/src/common/lang/en.js index 381ebfe..09f4b40 100644 --- a/src/common/lang/en.js +++ b/src/common/lang/en.js @@ -49,6 +49,17 @@ export default { contractHash: 'Contract hash: ' }, + FormField: { + label: 'name', + password: 'password', + passwordConfirmation: 'password confirmation', + mnemonic: 'mnemonic', + privateKey: 'private key', + oldPassword: 'old password', + newPassword: 'new password', + newPasswordConfirmation: 'new password confirmation' + }, + TopNav: { new: 'New', edit: 'Edit' diff --git a/src/common/lang/zh.js b/src/common/lang/zh.js index d54ba12..10be3f2 100644 --- a/src/common/lang/zh.js +++ b/src/common/lang/zh.js @@ -49,6 +49,17 @@ export default { contractHash: '合约哈希:' }, + FormField: { + label: '名称', + password: '密码', + passwordConfirmation: '确认密码', + mnemonic: '助记词', + privateKey: '私钥', + oldPassword: '旧密码', + newPassword: '新密码', + newPasswordConfirmation: '确认新的密码' + }, + TopNav: { new: '新建', edit: '编辑' diff --git a/src/core/consts.js b/src/core/consts.js index 72f3cb5..f6472ec 100644 --- a/src/core/consts.js +++ b/src/core/consts.js @@ -79,4 +79,22 @@ export const PAX_API = { export const PAX_SC_HASH = { MAIN: '6bbc07bae862db0d7867e4e5b1a13c663e2b4bc8', TEST: 'b06f8eaf757030c7a944ce2a072017bde1e72308' -} \ No newline at end of file +} + +export const VALIDATE_DICTIONARY = { + zh: { + messages: { + required: (field, val) => `字段 ${field} 是必填项`, + min: (field, val) => `字段 ${field} 的长度不能少于${val[0]}`, + length: (field, val) => `字段 ${field} 的长度必须是${val[0]}` + }, + attributes: { + password: '密码', + name: '名称', + label: '名称', + rePassword: '确认密码', + keystore: 'keystore', + keystorePassword: '' + } + } +} \ No newline at end of file diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 8b1fe1f..0b5a09d 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -183,6 +183,7 @@ .v-validate-span-errors { color: red; font-size: 12px; + display: block; } .refresh-icon { diff --git a/src/renderer/components/Identitys/Create/BasicInfo.vue b/src/renderer/components/Identitys/Create/BasicInfo.vue index 5d228c0..30d5529 100644 --- a/src/renderer/components/Identitys/Create/BasicInfo.vue +++ b/src/renderer/components/Identitys/Create/BasicInfo.vue @@ -2,7 +2,7 @@
{{ errors.first('label') }} @@ -12,7 +12,7 @@ {{ errors.first('password') }} {{ errors.first('rePassword') }} diff --git a/src/renderer/components/Identitys/Import/BasicInfo.vue b/src/renderer/components/Identitys/Import/BasicInfo.vue index 416373d..5da6d89 100644 --- a/src/renderer/components/Identitys/Import/BasicInfo.vue +++ b/src/renderer/components/Identitys/Import/BasicInfo.vue @@ -13,12 +13,12 @@ aria-labelledby="import-identity-keystore-pills-tab"> {{ errors.first('keystore') }} {{ errors.first('keystorePassword') }}
diff --git a/src/renderer/components/JsonWallet/Create/BasicInfo.vue b/src/renderer/components/JsonWallet/Create/BasicInfo.vue index 339cb2b..db844fb 100644 --- a/src/renderer/components/JsonWallet/Create/BasicInfo.vue +++ b/src/renderer/components/JsonWallet/Create/BasicInfo.vue @@ -12,7 +12,7 @@ {{ errors.first('password') }} {{ errors.first('rePassword') }}
diff --git a/src/renderer/components/JsonWallet/Import/BasicInfo.vue b/src/renderer/components/JsonWallet/Import/BasicInfo.vue index 5559bf2..a56ff47 100644 --- a/src/renderer/components/JsonWallet/Import/BasicInfo.vue +++ b/src/renderer/components/JsonWallet/Import/BasicInfo.vue @@ -155,7 +155,10 @@
- + + {{ errors.first('wifLabel') }} {{ errors.first('wif') }} {{ errors.first('wifPassword') }} {{ errors.first('pk') }} {{ errors.first('pkPassword') }} {{ errors.first('pkRePassword') }} @@ -197,7 +200,7 @@ {{$t('importJsonWallet.importFirstDefault')}}

- {{ errors.first('datLabel') }} {{ datPath }} @@ -205,7 +208,7 @@ {{ errors.first('datPassword') }}
@@ -215,16 +218,16 @@ {{ errors.first('mnemonic') }} {{ errors.first('mnemonicPassword') }} {{ errors.first('mnemonicRePassword') }} @@ -322,6 +325,7 @@ }) } else if (this.tabName === 'wif') { this.$validator.validateAll({ + wifLabel: this.wifLabel, wif: this.wif, wifPassword: this.wifPassword, wifRePassword: this.wifRePassword diff --git a/src/renderer/components/JsonWallet/View/Details.vue b/src/renderer/components/JsonWallet/View/Details.vue index 2f4e2a2..4863e19 100644 --- a/src/renderer/components/JsonWallet/View/Details.vue +++ b/src/renderer/components/JsonWallet/View/Details.vue @@ -63,21 +63,21 @@
{{ errors.first('oldPassword') }}
{{ errors.first('newPassword') }}
{{ errors.first('reNewPassword') }}
diff --git a/src/renderer/main.js b/src/renderer/main.js index 7d42c02..4c1dfa2 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -15,10 +15,17 @@ import VueClipboard from 'vue-clipboard2' VueClipboard.config.autoSetContainer = true // add this line Vue.use(VueClipboard) -import VeeValidate from 'vee-validate' -Vue.use(VeeValidate) - import i18n from '../common/lang' +import VeeValidate from 'vee-validate' +import { VALIDATE_DICTIONARY } from '../core/consts' +import validationMessages from 'vee-validate/dist/locale/en'; +Vue.use(VeeValidate, { + i18n, + dictionary: { + en: validationMessages, + zh: VALIDATE_DICTIONARY.zh + } +}) import service from '../core/utils' Vue.prototype.httpService = service;