Refactor axios & Owner page
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="owner-page">
|
||||
<div class="card-content">
|
||||
<div class="app-card elevation-1">
|
||||
<div>余额为 {{ balance }}</div>
|
||||
<div>余额为 {{ balance }}</div>
|
||||
</div>
|
||||
<div class="app-sep"></div>
|
||||
<div class="app-card elevation-1"></div>
|
||||
@@ -54,19 +54,12 @@
|
||||
import {
|
||||
createNamespacedHelpers,
|
||||
} from 'vuex'
|
||||
import axios from 'axios'
|
||||
|
||||
const { mapState, mapGetters, mapActions, mapMutations } = createNamespacedHelpers('owner')
|
||||
|
||||
export default {
|
||||
name: 'Owner',
|
||||
|
||||
data(){
|
||||
return {
|
||||
balance:0,
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState([
|
||||
'headers',
|
||||
@@ -74,27 +67,18 @@ export default {
|
||||
'pageEntity',
|
||||
'fetching',
|
||||
'filter',
|
||||
'balance',
|
||||
]),
|
||||
...mapGetters([]),
|
||||
},
|
||||
created:async function(){
|
||||
|
||||
|
||||
mounted() {
|
||||
this.queryAccount()
|
||||
},
|
||||
mounted:async function(){
|
||||
let account=sessionStorage.getItem('KEY_ACCOUNT')
|
||||
try{
|
||||
account=JSON.parse(account)
|
||||
let result=await axios({
|
||||
method:'post',
|
||||
url:location.protocol+'//'+location.hostname+':6842/api/Account/getBalance',
|
||||
data: {Account:{address:account.address}}
|
||||
})
|
||||
this.balance=result.data||0
|
||||
} catch(e){}
|
||||
}
|
||||
,
|
||||
|
||||
methods: {
|
||||
...mapActions([
|
||||
'queryAccount',
|
||||
]),
|
||||
...mapMutations([
|
||||
'inputFilter',
|
||||
|
||||
Reference in New Issue
Block a user