分页init
This commit is contained in:
@@ -2,7 +2,8 @@ import axios from 'axios'
|
||||
// import app from './app'
|
||||
// let baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/`
|
||||
// let baseURL = `${location.protocol}//${location.hostname}:80/api/`
|
||||
let baseURL = `https://server.vic.yuanjin.net/v1/`
|
||||
// let baseURL = `https://server.vic.yuanjin.net/v1/`
|
||||
let baseURL = `http://localhost:80/v1/`
|
||||
|
||||
// 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台,或者让用户在控制台启动时,自己设置一个节点主机。
|
||||
axios.defaults.baseURL = baseURL
|
||||
|
||||
@@ -40,10 +40,10 @@ export default {
|
||||
async queryTickets({ state, commit }) {
|
||||
const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
|
||||
const { userId, type = 0, op } = state
|
||||
const result = await axios.post('admin/tickets', { userId, type, op }, { headers: { token } })
|
||||
axios.post('admin/tickets', { userId, type, op }, { headers: { token } })
|
||||
const pageSize = 20
|
||||
const pageIndex = 1
|
||||
const result = await axios.post('admin/tickets', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } })
|
||||
const arr = result.data && result.data.data || []
|
||||
console.log(arr)
|
||||
commit('updateTickets', arr)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -49,56 +49,6 @@ export default {
|
||||
commit('setUserList', arr)
|
||||
commit('setUserNumSum', sum)
|
||||
},
|
||||
|
||||
async performTransfer({ state, commit, rootState }) {
|
||||
commit('updateSubmitting', true)
|
||||
const {
|
||||
targetAddress,
|
||||
transferAmount,
|
||||
transferFee,
|
||||
// transferRemark,
|
||||
} = state
|
||||
let wrongAddress, wrongAmount, wrongFee
|
||||
if (!(await ticApi.isAddress(targetAddress))) {
|
||||
wrongAddress = '错误的地址'
|
||||
} else {
|
||||
wrongAddress = ''
|
||||
}
|
||||
if (!(+transferAmount > 0)) {
|
||||
wrongAmount = '请输入正确的交易金额'
|
||||
} else {
|
||||
wrongAmount = ''
|
||||
}
|
||||
if (!(+transferFee > 0)) {
|
||||
wrongFee = '请输入正确的手续费'
|
||||
} else {
|
||||
wrongFee = ''
|
||||
}
|
||||
commit('updateWrongAddress', wrongAddress)
|
||||
commit('updateWrongAmount', wrongAmount)
|
||||
commit('updateWrongFee', wrongFee)
|
||||
if (wrongAddress || wrongAmount || wrongFee) {
|
||||
commit('updateSubmitting', false)
|
||||
return
|
||||
}
|
||||
|
||||
const res = await ticApi.transferTic({
|
||||
mnemonic: rootState.account.mnemonic,
|
||||
to: targetAddress,
|
||||
amount: +transferAmount,
|
||||
fee: +transferFee,
|
||||
})
|
||||
if (res) {
|
||||
// success
|
||||
commit('updateTransferResult', '转账成功')
|
||||
await app.delay(1000)
|
||||
commit('toggleTransferDlg', false)
|
||||
} else {
|
||||
// fail
|
||||
commit('updateTransferResult', '转账失败')
|
||||
}
|
||||
commit('updateSubmitting', false)
|
||||
},
|
||||
},
|
||||
|
||||
getters: {},
|
||||
|
||||
Reference in New Issue
Block a user