基本可用

This commit is contained in:
chaosBreaking
2019-10-09 09:03:59 +08:00
parent 7b246bebef
commit 8291a5cb81
7 changed files with 95 additions and 40 deletions

View File

@@ -2,8 +2,8 @@ import axios from 'axios'
// import app from './app' // import app from './app'
// let baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/` // let baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/`
// let baseURL = `${location.protocol}//${location.hostname}:80/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/` // let baseURL = `http://localhost:80/v1/`
// 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台或者让用户在控制台启动时自己设置一个节点主机。 // 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台或者让用户在控制台启动时自己设置一个节点主机。
axios.defaults.baseURL = baseURL axios.defaults.baseURL = baseURL

View File

@@ -8,11 +8,11 @@ export default {
state: { state: {
pageEntity: [10, 20], pageEntity: [10, 20],
headers: [ headers: [
{ text: '类型', value: 'type', align: 'center' }, { text: '类型type', value: 'type', align: 'center' },
{ text: '用户id', value: '_id', align: 'center' }, { text: '用户userId', value: 'userId', align: 'center' },
{ text: '资金类型', value: 'tokenType', align: 'center' }, { text: '资金类型tokenType', value: 'tokenType', align: 'center' },
{ text: '金额', value: 'amount', align: 'center' }, { text: '金额amount', value: 'amount', align: 'center' },
{ text: '创建时间', value: 'createdAt', align: 'center' }, { text: '创建时间createdAt', value: 'createdAt', align: 'center' },
], ],
itemList: [ itemList: [
{ {
@@ -62,7 +62,23 @@ export default {
const result = await axios.post('admin/actions', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } }) const result = await axios.post('admin/actions', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || [] const arr = result.data && result.data.data || []
commit('setUserList', arr) commit('setUserList', arr)
} },
async searchTicket({ state, commit }, event) {
const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
const { page, rowsPerPage } = event
const t = state.filter
if (!t) return 0
const query = {}
t.replace(/{|}| /g, '').replace('', ',').replace('', ':').replace('id', '_id').split(',').map(obj => {
const [k, v] = obj.split(':')
query[k] = v
})
const pageSize = rowsPerPage
const pageIndex = page
const result = await axios.post('admin/actions', { query, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || []
commit('setUserList', arr)
},
}, },
getters: {}, getters: {},

View File

@@ -8,12 +8,12 @@ export default {
state: { state: {
pageEntity: [10, 20], pageEntity: [10, 20],
headers: [ headers: [
{ text: '类型', value: 'type', align: 'center' }, { text: '类型type', value: 'type', align: 'center' },
{ text: '用户id', value: 'userId', align: 'center' }, { text: '用户userId', value: 'userId', align: 'center' },
{ text: '状态', value: 'status', align: 'center' }, { text: '状态type', value: 'status', align: 'center' },
{ text: '目标地址', value: 'amount', align: 'center' }, { text: '目标地址targetAddress', value: 'targetAddress', align: 'center' },
{ text: '目标地址', value: 'targetAddress', align: 'center' }, { text: '金额amount', value: 'amount', align: 'center' },
{ text: '创建时间', value: 'createdAt', align: 'center' }, { text: '创建时间createdAt', value: 'createdAt', align: 'center' },
], ],
itemList: [ itemList: [
{ {
@@ -46,7 +46,7 @@ export default {
actions: { actions: {
async queryTickets({ state, commit }) { async queryTickets({ state, commit }) {
const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT')) const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
const { userId, type = 0, op } = state const { userId, type, op } = state
const pageSize = 20 const pageSize = 20
const pageIndex = 1 const pageIndex = 1
const result = await axios.post('admin/tickets', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } }) const result = await axios.post('admin/tickets', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } })
@@ -63,7 +63,23 @@ export default {
const result = await axios.post('admin/tickets', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } }) const result = await axios.post('admin/tickets', { query: { userId, type, op }, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || [] const arr = result.data && result.data.data || []
commit('updateTickets', arr) commit('updateTickets', arr)
} },
async searchTicket({ state, commit }, event) {
const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
const { page, rowsPerPage } = event
const t = state.filter
if (!t) return 0
const query = {}
t.replace(/{|}| /g, '').replace('', ',').replace('', ':').replace('id', '_id').split(',').map(obj => {
const [k, v] = obj.split(':')
query[k] = v
})
const pageSize = rowsPerPage
const pageIndex = page
const result = await axios.post('admin/tickets', { query, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || []
commit('updateTickets', arr)
},
}, },
getters: {}, getters: {},

View File

@@ -1,6 +1,7 @@
import axios from 'axios' import axios from 'axios'
import { app } from '../../services' import { app } from '../../services'
import { ticApi } from '../../services/api' import { ticApi } from '../../services/api'
import lodash from 'lodash'
export default { export default {
namespaced: true, namespaced: true,
@@ -9,9 +10,14 @@ export default {
pageEntity: [10, 20], pageEntity: [10, 20],
headers: [ headers: [
{ text: '用户id', value: 'id', align: 'center' }, { text: '用户id', value: 'id', align: 'center' },
{ text: '手机号', value: 'phone', align: 'center' }, { text: '手机号phone', value: 'phone', align: 'center' },
{ text: '邀请人数', value: 'group', align: 'center' }, { text: '邀请人数', value: 'group', align: 'center' },
{ text: '持有vic', value: 'vic', align: 'center' }, { text: '持有vic', value: 'vic', align: 'center' },
{ text: '买入vic总额', value: 'fundSum', align: 'center' },
{ text: '邀请人', value: 'inviter', align: 'center' },
{ text: '注册时间', value: 'createdAt', align: 'center' },
{ text: '上次充值', value: 'lastDeposit', align: 'center' },
{ text: '矿晶', value: 'fundList', align: 'center' },
], ],
itemList: [ itemList: [
{ {
@@ -19,6 +25,11 @@ export default {
phone: 'loading', phone: 'loading',
group: 'loading', group: 'loading',
vic: 'loading', vic: 'loading',
inviter: 'loading',
fundSum: 'loading',
createdAt: 'loading',
lastDeposit: 'loading',
fundList: 'loading',
}, },
], ],
@@ -65,24 +76,27 @@ export default {
commit('setUserList', arr) commit('setUserList', arr)
commit('setUserNumSum', sum) commit('setUserNumSum', sum)
}, },
async searchUser ({ state, commit }, event) { async searchUser({ state, commit }, event) {
// const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT')) const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
// const { page, rowsPerPage } = event const { page, rowsPerPage } = event
console.log(state.filter) const t = state.filter
try { if (!t) return 0
console.log(`{${state.filter.x}}`) const query = {}
const query = JSON.parse(`{${state.filter}}`) t.replace(/{|}| /g, '').replace('', ',').replace('', ':').replace('id', '_id').split(',').map(obj => {
} catch (error) { const [k, v] = obj.split(':')
console.log(error) query[k] = v
alert('输入格式错误!') })
} const pageSize = rowsPerPage
// commit('nextPage', page) const pageIndex = page
// const pageSize = rowsPerPage const [result, { data: { data: funds } }] = await Promise.all([
// const pageIndex = page axios.post('admin/users', { query, option: { pageSize, pageIndex } }, { headers: { token } }),
// const { id, phone } = state query._id && axios.post('admin/funds', { query: query._id ? { userId: query._id } : {}, option: { pageSize, pageIndex } }, { headers: { token } }),
// const result = await axios.post('admin/users', { query: { id, phone }, option: { pageSize, pageIndex } }, { headers: { token } }) ])
// const arr = result.data && result.data.data || [] // 只有查某个具体用户 才会查fund
// commit('setUserList', arr) let users = result.data.data || []
delete funds[0]['_id']
Object.assign(users[0], funds[0])
commit('setUserList', users)
}, },
}, },

View File

@@ -5,7 +5,8 @@
<h3>{{ $t('netnode.tableHeader') }}</h3> <h3>{{ $t('netnode.tableHeader') }}</h3>
<div class="search-input"> <div class="search-input">
<v-text-field <v-text-field
:placeholder="$t('netnode.searchHolder')" @keyup.13="searchAction"
placeholder="输入查询条件"
:value="filter" :value="filter"
@input="inputFilter" @input="inputFilter"
append-icon="search" /> append-icon="search" />
@@ -65,7 +66,8 @@ export default {
...mapActions([ ...mapActions([
'queryUserInfo', 'queryUserInfo',
'queryOne', 'queryOne',
'nextPage' 'nextPage',
'searchAction'
]), ]),
...mapMutations([ ...mapMutations([
'inputFilter', 'inputFilter',

View File

@@ -5,7 +5,8 @@
<h3>{{ $t('network.tableHeader') }}</h3> <h3>{{ $t('network.tableHeader') }}</h3>
<div class="search-input"> <div class="search-input">
<v-text-field <v-text-field
:placeholder="$t('network.searchHolder')" @keyup.13="searchTicket"
placeholder="输入查询条件"
:value="filter" :value="filter"
@input="inputFilter" @input="inputFilter"
append-icon="search" /> append-icon="search" />
@@ -68,7 +69,8 @@ export default {
methods: { methods: {
...mapActions([ ...mapActions([
'queryTickets', 'queryTickets',
'nextPage' 'nextPage',
'searchTicket'
]), ]),
...mapMutations([ ...mapMutations([
'inputFilter', 'inputFilter',

View File

@@ -48,7 +48,12 @@
<td>{{ props.item._id }}</td> <td>{{ props.item._id }}</td>
<td>{{ props.item.phone }}</td> <td>{{ props.item.phone }}</td>
<td>{{ props.item.group.length }}</td> <td>{{ props.item.group.length }}</td>
<td>{{ props.item.vic }}</td> <td>{{ props.item.asset && props.item.asset.vic }}</td>
<td>{{ props.item.fundSum }}</td>
<td>{{ props.item.inviter }}</td>
<td>{{ props.item.createdAt }}</td>
<td>{{ props.item.lastDeposit }}</td>
<td>{{ props.item.fundList }}</td>
</template> </template>
<template slot="no-results"> <template slot="no-results">
{{ $t('owner.tableNone') }} {{ $t('owner.tableNone') }}