import { getArticleList,addArticle,delArticle,getArticleInfo,updateArticle,upArticleStatus, getGoodList,addGood,delGood,getGoodInfo,updateGood,websiteList,getWebsiteNavList } from '@/api/news'

const state = {

}

const mutations = {

}

const actions = {
  //1.资讯中心 start ---------------------------------------->
  //获取资讯列表
  getArticleList({commit},data) {
    return new Promise((resolve, reject) => {
      getArticleList(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //添加资讯
  addArticle({commit},data) {
    return new Promise((resolve, reject) => {
      addArticle(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //删除资讯
  delArticle({commit},data) {
    return new Promise((resolve, reject) => {
      delArticle(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //获取资讯详情
  getArticleInfo({commit},data) {
    return new Promise((resolve, reject) => {
      getArticleInfo(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //修改资讯内容
  updateArticle({commit},data) {
    return new Promise((resolve, reject) => {
      updateArticle(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //修改资讯显示或隐藏
  upArticleStatus({commit},data) {
    return new Promise((resolve, reject) => {
      upArticleStatus(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //资讯中心 end ---------------------------------------->

  //20250226  产品列表
  //获取产品列表
  getGoodList({commit},data) {
    return new Promise((resolve, reject) => {
      getGoodList(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  getGoodInfo({commit},data) {
    return new Promise((resolve, reject) => {
      getGoodInfo(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  addGood({commit},data) {
    return new Promise((resolve, reject) => {
      addGood(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  delGood({ commit }, data)  {
    return new Promise((resolve, reject) => {
      delGood(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  updateGood({ commit }, data)  {
    return new Promise((resolve, reject) => {
      updateGood(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  websiteList({ commit }, data)  {
    return new Promise((resolve, reject) => {
      websiteList(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  getWebsiteNavList({ commit }, data)  {
    return new Promise((resolve, reject) => {
      getWebsiteNavList(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
   //20250226  产品列表



}


export default {
  namespaced: true,
  state,
  mutations,
  actions
}
