10 .topbar .topbar-left {
13 text-overflow: ellipsis;
18 .topbar-left .btn-menu {
22 .topbar-left .btn-menu i {
31 .topbar .topbar-middle {
34 border: 2px solid #fff;
52 .content .token-amount {
60 justify-content: space-evenly;
68 box-shadow: 0px 2px 16px rgba(0, 0, 0, 0.08);
78 .transaction-title h3 {
81 padding: 10px 0 10px 20px;
93 border-bottom: solid 1px rgba(0, 0, 0, 0.04)
97 text-transform: capitalize;
127 .icon-crosschain-svg{
128 background-image: url('../assets/img/icon/crosschain.svg');
131 background-image: url('../assets/img/icon/vote.svg');
134 background-image: url('../assets/img/icon/receive.svg');
137 background-image: url('../assets/img/icon/send.svg');
144 <section class="bg-image">
146 <div class="topbar-left">
147 <a class="btn-menu" @click="openMenu">
148 <i class="iconfont icon-menu"></i>
151 <div class="topbar-middle bg-secondary">
152 <select class="network-select" :value="netType" @change="netTypeToggle">
153 <option value="bytom">{{ $t('main.bytom') }} {{net}}</option>
154 <option value="vapor">{{ $t('main.vapor') }} {{net}}</option>
158 <div class="content">
159 <div v-if="address!=undefined" class="amount color-white">
160 <span class="alias color-grey">{{currentAccount.alias}}</span>
161 <div class="token-amount">
166 <p style="width: 250px; margin: 45px auto; text-align: center;">{{ $t('main.noAccount') }}</p>
170 <div v-if="netType =='vapor' && address!=undefined" class="btn-send-transfer">
172 <a @click="listVoteOpen">
173 <div class="icon icon-vote-svg"></div>
174 <div>{{ $t('main.vote') }}</div>
176 <a @click="crossChainOpen">
177 <div class="icon icon-crosschain-svg"></div>
178 <div>{{ $t('main.crossChain') }}</div>
180 <a @click="showQrcode">
181 <div class="icon icon-receive-svg"></div>
182 <div>{{ $t('main.receive') }}</div>
184 <a @click="transferOpen">
185 <div class="icon icon-send-svg"></div>
186 <div>{{ $t('main.send') }}</div>
189 <div v-else-if="address!=undefined" class="btn-send-transfer">
190 <a @click="showQrcode">
191 <div class="icon icon-receive-svg"></div>
192 <div>{{ $t('main.receive') }}</div>
194 <a @click="transferOpen">
195 <div class="icon icon-send-svg"></div>
196 <div>{{ $t('main.send') }}</div>
200 <section v-if="address!=undefined" class="transaction-title">
201 <h3 class="color-black">{{ $t('main.asset') }}</h3>
203 <section class="transactions">
204 <div v-if="address!=undefined">
205 <div v-if="balances && balances.length > 0">
207 <li class="list-item" v-for="(asset, index) in balances" :key="index" @click="assetOpen(asset)">
208 <div class="float-right text-align-right">
209 <div class="value">{{ itemBalance(asset) }}</div>
210 <div class="addr color-grey">{{ formatCurrency(asset[ currency ]) }}</div>
212 <div v-if="asset.symbol">
213 <div class="uppercase">
217 <div class="addr color-grey">{{asset.name}}</div>
224 <div class="addr color-grey uppercase">{{shortAddress(asset.asset)}}</div>
231 <div class="bg-emptytx"></div>
233 <span class="color-lightgrey center-text no-record">{{$t('main.noAssetRecord')}}</span>
238 <router-link :to="{name: 'menu-account-creation'}">
239 <div class="bg-emptytx"></div>
241 <span class="color-lightgrey center-text no-record">{{$t('main.noAssetRecord')}}</span>
243 <a class="btn btn-primary btn-creation">{{ $t('main.create') }}</a>
249 <div class="mask" v-show="maskShow"></div>
250 <transition :enter-active-class="enterActive" :leave-active-class="leaveActive">
251 <router-view></router-view>
258 import address from "@/utils/address";
259 import account from "@/models/account";
260 import transaction from "@/models/transaction";
261 import { BTM } from "@/utils/constants";
262 import { mapActions, mapGetters, mapState } from 'vuex'
263 import * as Actions from '@/store/constants';
264 import _ from 'lodash';
265 import { Number as Num } from "@/utils/Number"
268 const EnterActive = 'animated faster fadeInLeft';
269 const LeaveActive = 'animated faster fadeOutLeft';
278 enterActive: EnterActive,
279 leaveActive: LeaveActive,
284 if (to.name.startsWith('menu')) {
286 } else if (from.name.startsWith('menu')) {
287 this.maskShow = false
290 // remove transition for some page
291 this.enterActive = EnterActive
292 this.leaveActive = LeaveActive
293 if (to.name == 'transfer-confirm' || from.name == 'transfer-confirm') {
294 this.enterActive = ''
295 this.leaveActive = ''
297 if (from.name == 'transfer-confirm') {
301 currentAccount(newVal, oldVal) {
302 if (newVal.guid == undefined){
307 if(this.netType === 'vapor'){
308 addr = newVal.vpAddress
310 addr = newVal.address
315 accountBalance: function () {
317 const balances = this.balances
319 if(balances && balances.length >0 ){
320 const currency = this.currency
321 balance = _.sumBy(balances, function(o) { return Number(o[currency]); })
323 return Num.formatCurrency( (balance != null && balance != 0)? balance : '0.00', this.currency)
326 if(this.netType === 'vapor'){
327 return this.currentAccount.vpAddress
329 return this.currentAccount.address
332 balances: function(){
333 if(this.netType === 'vapor'){
334 return this.currentAccount.vpBalances
336 return this.currentAccount.balances
351 shortAddress: function (add) {
352 return address.short(add)
354 formatCurrency: function (num) {
355 return Num.formatCurrency(num, this.currency)
357 itemBalance: function(asset){
358 if(asset.asset === BTM){
359 return Num.formatNue(asset.balance,8)
361 return Num.formatNue(asset.balance,asset.decimals)
364 setupRefreshTimer() {
366 this.refreshBalance(this.currentAccount.guid)
370 account.setupNet(`${this.net}${this.netType}`);
372 netTypeToggle: function (event) {
373 const newNetType = event.target.value
374 if( newNetType !== this.netType){
375 const bytom = this.bytom.clone();
377 bytom.settings.netType = newNetType;
379 account.setupNet(`${this.net}${newNetType}`)
380 if(newNetType === 'vapor'&& !this.currentAccount.vpAddress){
381 account.copy(this.currentAccount.guid).then(accounts => {
382 //update currentAccount
383 bytom.currentAccount = accounts
386 const objectIndex = bytom.accountList.findIndex(a => a.guid == this.currentAccount.guid)
387 bytom.accountList[objectIndex].vpAddress = accounts.vpAddress
389 this[Actions.UPDATE_STORED_BYTOM](bytom)
392 this[Actions.UPDATE_STORED_BYTOM](bytom)
394 this.refreshBalance(this.currentAccount.guid)
397 showQrcode: function () {
398 this.$router.push('received')
400 openMenu: function () {
401 this.$router.push('menu')
403 transferOpen: function () {
404 this.$router.push('transfer')
406 crossChainOpen: function () {
407 this.$router.push('crossChain')
409 listVoteOpen: function () {
410 this.$router.push('listVote')
412 assetOpen: function (asset) {
413 this[Actions.SET_CURRENT_ASSET](asset)
414 this.$router.push('asset')
416 refreshBalance: function (guid) {
418 account.balance(guid)
420 const balances = obj.balances
421 const votes = obj.votes
423 const balanceNotEqual = !_.isEqual(this.balances, balances)
425 const voteNotEqual = (this.netType === 'vapor' && !_.isEqual(this.currentAccount.votes, votes))
427 if(balanceNotEqual || voteNotEqual){
430 const bytom = this.bytom.clone();
432 const objectIndex = bytom.accountList.findIndex(a => a.guid == this.currentAccount.guid)
435 if(this.netType === 'vapor'){
436 bytom.currentAccount.vpBalances = balances;
437 bytom.accountList[objectIndex].vpBalances = balances
439 bytom.currentAccount.balances = balances;
440 bytom.accountList[objectIndex].balances = balances
445 bytom.currentAccount.votes = votes;
446 bytom.accountList[objectIndex].votes = votes
449 this[Actions.UPDATE_STORED_BYTOM](bytom)
458 Actions.UPDATE_STORED_BYTOM,
459 Actions.SET_CURRENT_ASSET,
464 this.setupRefreshTimer();
465 this.refreshBalance(this.currentAccount.guid)