// component/progressImage/progressImage.js
const wxService = require('../../utils/wxService')

Component({
  properties: {
    goal: {
      type: Number,
      value: 0
    },
    showNum: {
      type: Boolean,
      value: false
    },
    AvailableNum: {
      type: Number,
      value: 0
    },
    showRemNum: {
      type: Number,
      value: 0
    },
    iconImage: {
      type: String,
      value: ''
    },
    iconImageFinsh: {
      type: String,
      value: ''
    }
  },
  /**
   * 页面的初始数据
   */
  data: {
    num: 5,
    currentProgress: 0, // 当前已完成进度
  },
  attached() {},
  observers: {
    AvailableNum() {
      wxService.nextTick(()=>{
        const { AvailableNum, showRemNum,goal, showNum } = this.data
         this.setData({
          currentProgress: AvailableNum ? (showNum ? goal : showRemNum) : showRemNum
        })
      })
    }
  }
})