|
|
import { get } from 'lodash';
|
|
|
import { getImgUrl } from '../../common/utils';
|
|
|
|
|
|
export default function() {
|
|
|
return {
|
|
|
namespaced: true,
|
|
|
state: {
|
|
|
list: [],
|
|
|
resource: '',
|
|
|
page: 1,
|
|
|
size: 10
|
|
|
},
|
|
|
mutations: {
|
|
|
addList(state, { list }) {
|
|
|
state.list = state.list.concat(list);
|
|
|
},
|
|
|
addResource(state, { url }) {
|
|
|
state.resource = url;
|
|
|
},
|
|
|
changePage(state, { page }) {
|
|
|
state.page = page;
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
|
|
async fetchList({ commit, state }) {
|
|
|
let page = state.page;
|
|
|
|
|
|
const result = await this.$api.get('/api/union/inviteList', {
|
|
|
page: page,
|
|
|
size: state.size
|
|
|
});
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
commit('addList', { list: result.data.list });
|
|
|
commit('changePage', { page: ++page });
|
|
|
}
|
|
|
|
|
|
return result.data.length || 0;
|
|
|
},
|
|
|
async fetchResource({ commit }) {
|
|
|
const result = await this.$api.get('/api/yoho/resource', { content_code: 'a51c8222d21b3d88faa4a49c01c9c93e' });
|
|
|
|
|
|
commit('addResource', { url: getImgUrl(get(result, 'data[0].data.src') || '', 700, 500) });
|
|
|
},
|
|
|
|
|
|
async fetchUnionStatus() {
|
|
|
const result = await this.$api.get('/api/union/queryUnion');
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
} |
...
|
...
|
|