home.js 600 B

123456789101112131415161718192021222324252627
  1. import http from '@/request/index.js';
  2. export const state = {
  3. groundData: [], //查询待上架和已上架数据
  4. };
  5. export const mutations = {
  6. setGroundData(state, data) {
  7. state.groundData = data
  8. },
  9. }
  10. export const actions = {
  11. getGroundData({
  12. commit,
  13. rootState
  14. }, data) {
  15. return new Promise((resolve, reject) => {
  16. http('home.getData', data, '加载中').then(res => {
  17. if (res.code == "0" && res.success == "true") {
  18. commit('setGroundData', res.data);
  19. }else{
  20. commit('setGroundData', []);
  21. }
  22. }).catch(e => {
  23. reject(e)
  24. })
  25. })
  26. }
  27. }