12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import Vue from 'vue';
- import Vuex from 'vuex';
- import $request from '../lib/request.js';
- Vue.use(Vuex);
- const baseurl = 'http://192.168.0.45:18090';
- const api = {
- imgQuery: '/api/cms/imgnews/query',
- contentQuery: '/api/cms/contents/query',
- intactQuery: '/api/journal/intact/query',
- marketQuery: '/api/market/wares/query',
- };
- const state = () => ({
- imgList: [],
- contentList: [],
- intactLiost: [],
- details: {},
- marketList: []
- });
- const actions = {
- async imgQuery({ commit }) {
- const res = await $request.get(`${baseurl}${api.imgQuery}`);
- commit('imgQuery', res[1]?.data);
- return res;
- },
- async contentQuery({ commit }, payload) {
- const res = await $request.get(`${baseurl}${api.contentQuery}`, payload);
- commit('contentQuery', res[1]?.data);
- return res;
- },
- async intactQuery({ commit }, payload) {
- const res = await $request.get(`${baseurl}${api.intactQuery}`, payload);
- commit('intactQuery', res[1]?.data);
- return res[1]?.data.data;
- },
- async marketQuery ({ commit }, payload) {
- const res = await $request.get(`${baseurl}${api.marketQuery}`, payload);
- commit('marketQuery', res[1]?.data);
- return res[1]?.data.data;
- },
- };
- const mutations = {
- imgQuery(state, payload) {
- state.imgList = payload?.data;
- },
- contentQuery(state, payload) {
- state.contentList = payload?.data;
- },
- intactQuery(state, payload) {
- state.intactLiost = payload?.data;
- },
- marketQuery(state, payload) {
- state.marketList = payload?.data;
- },
- };
- export default new Vuex.Store({
- state,
- mutations,
- actions,
- modules: {}
- });
|