export default {

  state:{
    count: '0',
    fileDownloads: [],
    step:0,
    imageSrc:'',
  },

  mutations: {
    updateImageSrc(state,val){
      state.imageSrc = val;
    },
    changeStep(state,val){
      state.step = val;
    },
    /**
     * 添加下载次数和下载文件
     * @param {*} state 
     * @param {*} item 
     */
    addCount(state, item) {
      state.fileDownloads.push(item);
      var i = 0;
      state.fileDownloads.forEach(function (item1) {
        if (item1.status == '') {
          i++;
        }
      });
      state.count = i;
    },

    /**
     * 修改下载次数和文件下载状态
     * @param {*} state 
     * @param {*} item 
     */
    updateCount(state, item) {
      var i = 0;
      state.fileDownloads.forEach(function (item1) {
        if (item1.taskId == item.taskId) {
          item1.status = item.status;
        }
        if (item1.status == '') {
          i++;
        }
      });
      state.count = i;
    },
  },

  actions: {},

  getters: {},
};