home.js 1.51 KB
import { HomeApi } from "@/api/ServerApi"

const HomeData = {
  carouseTime: 2, // 轮播图滚动间隔时间 单位秒
  carouseVOList: [ // 轮播图
    {
      picUrl: null, //轮播图地址
      linkUrl: null, // 轮播图链接地址
      linkType: null // 1-内链 2-外链
    }
  ],
  iconVOS: [ // 金刚区图标
    {
      iconName: null, // 图标名称
      iconEnName: null, // 图标英文名称
      iconUrl: null, // 图标地址
      linkUrlType: null, // 图标类型
      jumpLink: null // 图标跳转地址
    }
  ],
  scrollBarVOS: [ // 滚动热点
    {
      id: null, // 数据ID
      scrollTitle: null, // 热点标题
      scrollTag: null, // 热点标签
      backgroundColor: null // 热点标签背景颜色

    }
  ],
  newsQueryVOS: { // 新闻动态
    total: 0, // 数据条数合计
    list: [
      {
        id: null, // 数据ID
        newsTitle: null, // 数据标题
        newsType: null, // 数据类型
        newsTypeName: null, // 类型名称
        releaseTime: null, // 发布时间
        isRecommend: null // 是否推荐, 1-推荐
      }
    ]
  }
}
export default {
  namespaced: true,
  state: {
    HomeData: { ...HomeData }
  },
  mutations: {
    MSetHomeData (state, data) {
      state.HomeData = data
    }
  },
  actions: {

    AGetHomeData ({ state, commit }, param = {}) {
      return HomeApi.getIndex(param).then(res => {
        if (res.data) {
          commit('MSetHomeData', res.data)
        }
        return Promise.resolve(res)
      })
    }

  }
}