OSDN Git Service

wording
authorZhiting Lin <zlin035@uottawa.ca>
Wed, 11 Sep 2019 07:30:44 +0000 (15:30 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Wed, 11 Sep 2019 07:30:44 +0000 (15:30 +0800)
src/assets/language/cn.js
src/assets/language/en.js
src/views/sendTransaction/crossChainTransaction.vue
src/views/sendTransaction/transferConfirm.vue
src/views/vote/veto.vue
src/views/vote/vote.vue
src/views/vote/voteConfirm.vue

index 7b15cc0..212250c 100644 (file)
@@ -27,8 +27,8 @@ const cn = {
     feeType: '标准',
     send: '发送交易',
     confirmPassword: '密码',
-    confirm: '确认发送',
-    cancel: '取消发送',
+    confirm: '提交',
+    cancel: '取消',
     emptyPassword: '密码不能为空',
     unit: '单位',
     asset:'资产',
@@ -50,6 +50,7 @@ const cn = {
   },
   crossChain:{
     title:'跨链',
+    detail:'跨链详情',
     amountPlaceHolder:"链可用",
     amountHint:'跨链交易预计24小时内完成',
     toVapor:'转入\nVapor链',
@@ -69,7 +70,8 @@ const cn = {
     bpPubkey:'节点公钥',
     vote:'投票',
     votes:'票数',
-    voteAccount:'投票账户'
+    voteAccount:'投票账户',
+    vetoAccount:'取消投票账户'
   },
   listCancel:{
     voted:'已投票',
@@ -78,7 +80,12 @@ const cn = {
     availableVeto:'可取消投票数'
   },
   vote:{
-    selectNode:'选择节点'
+    selectNode:'选择节点',
+    voteDetials:'投票详情',
+    vetoDetials:'取消投票详情',
+    confirmVote:'确认投票',
+    confirmVeto:'确认取消投票',
+    amountPlaceHolder:"可用"
   },
   signMessage:{
     title:'请求签名',
index 8142558..1d12d9d 100644 (file)
@@ -50,6 +50,7 @@ const en = {
   },
   crossChain:{
     title:'Cross Chain',
+    detail:'Cross Chain Details',
     amountPlaceHolder:" available amount: ",
     amountHint:'Cross Chain Transaction will be completed in 24 hrs.',
     toVapor:'Transfer to \n Vapor Chain',
@@ -69,7 +70,8 @@ const en = {
     bpPubkey:'BP Public Key',
     vote:'Vote',
     votes:'Votes',
-    voteAccount:'Vote Account'
+    voteAccount:'Vote Account',
+    vetoAccount:'Veto Account'
   },
   listCancel:{
     voted:'Voted',
@@ -78,7 +80,12 @@ const en = {
     availableVeto:'Available veto amount'
   },
   vote:{
-    selectNode:'Select Node'
+    selectNode:'Select Node',
+    voteDetials:'Vote Details',
+    vetoDetials:'Veto Details',
+    confirmVote:'Confirm Vote',
+    confirmVeto:'Confirm Veto',
+    amountPlaceHolder:"available amount: "
   },
   signMessage:{
     title:'Request Signature',
index 5e5ef49..560efb5 100644 (file)
@@ -186,8 +186,9 @@ import Confirm from "./transferConfirm";
 import { BTM } from "@/utils/constants";
 import { mapActions, mapGetters, mapState } from 'vuex'
 import { Number as Num } from "@/utils/Number"
+  import _ from 'lodash';
 
-const currencyInPrice = {
+  const currencyInPrice = {
   in_cny: 'cny_price',
   in_usd: 'usd_price',
   in_btc:'btc_price'
@@ -235,13 +236,31 @@ export default {
         let balance, balances
         if(this.transaction.type === 'toVapor'){
           balances = this.currentAccount.balances
-        }else if(this.transaction.type === 'toBytom'){
+        }else if(this.transaction.type === 'toBytom') {
           balances = this.currentAccount.vpBalances
         }
+
         if(balances && balances.length >0 ){
-          const balanceObject = balances.filter(b => b.asset === this.selectAsset.asset)[0]
+          if( this.selectAsset.asset === BTM && this.transaction.type === 'toBytom' ){
+            const balanceObject = balances.filter(b => b.asset === BTM)[0]
+            balance = balanceObject.balance
+
+            let vote, lock
+
+            const votes = this.currentAccount.votes
+
+            if (votes && votes.length > 0) {
+              vote = _.sumBy(votes, 'total')
+              lock = _.sumBy(votes, 'locked')
+            }
+
+            balance = Num.formatNue((balance - vote - lock), balanceObject.decimals)
+          }else{
+
+            const balanceObject = balances.filter(b => b.asset === this.selectAsset.asset)[0]
+            balance = Num.formatNue(balanceObject.balance, balanceObject.decimals)
+          }
 
-          balance = Num.formatNue(balanceObject.balance, balanceObject.decimals)
         }
 
         if(this.transaction.type === 'toVapor'){
index 644cb1f..832eae5 100644 (file)
     <div class="warp bg-gray">
         <section class="header bg-header">
             <i class="iconfont icon-back" @click="$router.go(-1)"></i>
-            <p>{{ $t('transfer.confirmTransaction') }}</p>
+            <p>{{ title || $t('transfer.confirmTransaction') }}</p>
         </section>
 
         <div class="scorll-panel">
@@ -194,6 +194,7 @@ export default {
     data() {
         return {
           full: false,
+          title:null,
           rawData: {},
             account: {},
             transaction: {
@@ -206,6 +207,15 @@ export default {
             assetAlias:null
         };
     },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      if(from.name === 'cross-chain') {
+        vm.title = vm.$t('crossChain.detail')
+      }
+
+      next()
+    });
+  },
     computed: {
       totalAmount(){
         if(this.assetAlias && this.assetAlias.toUpperCase() === 'BTM'){
index d40f0a4..45cbda2 100644 (file)
@@ -76,7 +76,6 @@
                   <label class="form-item-label">
                     {{ $t('transfer.quantity') }}
 
-                    <small class="float-right" style="margin-right: 8px;">{{ formatCurrency(transaction.cost||0 )}}</small>
                   </label>
                   <div class="form-item-content" style=" display: flex;">
                       <input type="number" v-model="transaction.amount" :placeholder="bytomBalance">
@@ -84,7 +83,7 @@
                   </div>
               </div>
           </div>
-          <a class="btn btn-primary" @click="send">{{ $t('transfer.send') }}</a>
+          <a class="btn btn-primary" @click="send">{{ $t('transfer.confirm') }}</a>
         </section>
     </div>
 </template>
@@ -135,7 +134,7 @@ export default {
           vetoAmount = Num.formatNue(vote.total-vote.locked,8)
         }
 
-          return `Vapor${this.$t("listCancel.availableVeto")}${(vetoAmount != null && vetoAmount != 0) ? vetoAmount : '0.00'}`
+          return `${this.$t("listCancel.availableVeto")}${(vetoAmount != null && vetoAmount != 0) ? vetoAmount : '0.00'}`
       },
       ...mapState([
         'bytom',
@@ -150,10 +149,6 @@ export default {
       ])
     },
     watch: {
-        "transaction.amount": function (newAmount) {
-          this.transaction.cost = Number(this.selectAsset[currencyInPrice[this.currency]] * newAmount).toFixed(2);
-
-        },
         account: function (newAccount) {
             this.guid = newAccount.guid;
         }
index 9d374fb..e65b456 100644 (file)
@@ -83,7 +83,7 @@
                   </div>
               </div>
           </div>
-          <a class="btn btn-primary" @click="send">{{ $t('transfer.send') }}</a>
+          <a class="btn btn-primary" @click="send">{{ $t('transfer.confirm') }}</a>
         </section>
     </div>
 </template>
@@ -95,6 +95,7 @@ import Confirm from "../sendTransaction/transferConfirm";
 import { BTM } from "@/utils/constants";
 import { mapGetters, mapState } from 'vuex'
 import { Number as Num } from "@/utils/Number"
+import _ from 'lodash';
 
 const currencyInPrice = {
   in_cny: 'cny_price',
@@ -132,10 +133,19 @@ export default {
           balances = this.currentAccount.vpBalances
         if(balances && balances.length >0 ){
           const balanceObject = balances.filter(b => b.asset === BTM)[0]
-          balance = balanceObject.balance/Math.pow(10,balanceObject.decimals)
+          balance = balanceObject.balance
+
+          let vote, lock
+          const votes = this.currentAccount.votes
+          if(votes && votes.length >0 ){
+            vote = _.sumBy(votes,'total')
+            lock = _.sumBy(votes,'locked')
+          }
+
+          balance = (balance-vote-lock)/Math.pow(10,balanceObject.decimals)
         }
 
-          return `Vapor${this.$t("crossChain.amountPlaceHolder")}${(balance != null && balance != 0) ? balance : '0.00'}`
+          return `${this.$t("vote.amountPlaceHolder")}${(balance != null && balance != 0) ? balance : '0.00'}`
       },
       ...mapState([
         'bytom',
@@ -150,9 +160,6 @@ export default {
       ])
     },
     watch: {
-        "transaction.amount": function (newAmount) {
-          this.transaction.cost = Number(this.selectAsset[currencyInPrice[this.currency]] * newAmount).toFixed(2);
-        },
         account: function (newAccount) {
             this.guid = newAccount.guid;
         }
index f051dcd..8b85f0c 100644 (file)
     <div class="warp bg-gray">
         <section class="header bg-header">
             <i class="iconfont icon-back" @click="$router.go(-1)"></i>
-            <p>{{ title || $t('transfer.confirmTransaction') }}</p>
+            <p>{{ title || $t('vote.voteDetials') }}</p>
         </section>
 
         <div class="scorll-panel">
                 <table>
                     <tbody>
                         <tr class="row">
-                            <td class="col label">{{ $t('listVote.voteAccount') }}</td>
+                            <td class="col label">{{ accountLabel }}</td>
                             <td class="col value">{{account.alias}}</td>
                         </tr>
                         <tr v-if="selectVote.name" class="row">
@@ -181,6 +181,7 @@ export default {
         return {
           full: false,
           title:null,
+          accountLabel: this.$t('listVote.voteAccount'),
           rawData: {},
             account: {},
             transaction: {
@@ -193,18 +194,17 @@ export default {
             assetAlias:null
         };
     },
-    watch: {
-      '$route'(to, from) {
-        console.log(from)
-        console.log(to)
-        if (from.name == 'vote') {
-          this.title = 'vote'
-        }else if(from.name =='veto'){
-          this.title = 'veto'
-        }
-      },
-    },
-    computed: {
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      if(from.name === 'veto') {
+        vm.title = vm.$t('vote.vetoDetials')
+        vm.accountLabel = vm.$t('listVote.vetoAccount')
+      }
+
+      next()
+    });
+  },
+  computed: {
       totalAmount(){
         if(this.assetAlias && this.assetAlias.toUpperCase() === 'BTM'){
           const n = new BigNumber(this.transaction.amount)