import Vue from "vue";
import api from "@/api/index.js";
import { Toast } from "vant";

export default {
  namespaced: true,
  state: {
    commonProblemList: []
  },
  actions: {
    findpage({ commit, state }, commonProblem) {
      return api.request("get", api.getURL("CommonProblem/cfindpage"), commonProblem).then(res => {
        if(res) {
          commit("SET_PROBLEM_LIST", res.data.data.list);
        }else {
          setTimeout(() => {
            Toast.fail("未登录");
          }, 500);
        }
        return res;
      });
    },
    getDetails({commit,state},details){
      return api.request("get",api.getURL("CommonProblem/cgetDetails"),{
        id:details
      }).then(res =>{
        
        return res;
      });
    }
  },
  mutations: {
    INIT_DATA_STATUS(state, data) {
			
    },
    SET_PROBLEM_LIST(state, data) {
      
      Vue.set(state, "commonProblemList", data);
    }
  },
  getters: {}
};