Files
vic-team-vue/src/store/modules/vreq.js
chaosBreaking 1baba5c882 fear:vreq
2019-10-18 23:23:49 +08:00

88 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import axios from 'axios'
export default {
namespaced: true,
state: {
pageEntity: [10, 20],
headers: [
{ text: '用户userId', value: 'userId', align: 'center' },
{ text: '申请认证等级verifyLevel', value: 'type', align: 'center' },
{ text: '认证状态status(0认证中/1认证成功/2认证失败)', value: 'status', align: 'center' },
{ text: '回执信息info', value: 'info', align: 'center' },
{ text: '真实姓名realname', value: 'realname', align: 'center' },
{ text: '证件号idNo', value: 'idNo', align: 'center' },
{ text: '正照pic1', value: 'pic1', align: 'center' },
{ text: '反照pic2', value: 'pic2', align: 'center' },
{ text: '创建时间createdAt', value: 'createdAt', align: 'center' },
],
itemList: [
{
userId: 'loading',
type: 'loading',
status: 'loading',
info: 'loading',
realname: 'loading',
idNo: 'loading',
pic1: 'loading',
pic2: 'loading',
createdAt: 'loading',
},
],
},
mutations: {
inputFilter(state, filter) {
state.filter = filter
},
setUserNumSum(state, address) {
state.address = address
},
setUserList(state, actions) {
state.itemList = actions
},
},
actions: {
async queryVreqInfo({ state, commit }) {
const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
const { userId } = state
const pageSize = 20
const pageIndex = 1
const result = await axios.post('admin/vreqs', { query: { userId }, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || []
commit('setUserList', arr)
},
async nextPage({ state, commit }, event) {
const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
const { page, rowsPerPage } = event
const pageSize = rowsPerPage
const pageIndex = page
const { type, status } = state
const result = await axios.post('admin/vreqs', { query: { type, status }, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || []
commit('setUserList', arr)
},
async searchVreq({ 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/vreqs', { query, option: { pageSize, pageIndex } }, { headers: { token } })
const arr = result.data && result.data.data || []
commit('setUserList', arr)
},
},
getters: {},
}