// components/base/blockInfo/blockInfo.js
const app=getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  lifetimes:{
    attached(){
      this.getInfo()
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    areaName:'',
    totalTitle:'累计数据',
    todayTitle:'今日数据',
    outBreakObj:{
      total:[],
      today:[]
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getInfo(){
      const targetItem = {...app.globalData.hotData.targetItem}

      const total=[
        {name:'累计确诊',
      value:targetItem.total.confirm,
      background:'#EE5A24',
    },
      {name:'累计治愈',
      value:targetItem.total.heal,
      background:'#009432',
    },
      {name:`${targetItem.name}本土确诊`,
      value:targetItem.total.provinceLocalConfirm,
      background:'#F79F1F',
    },
      {name:'高风险区',
      value:targetItem.total.highRiskAreaNum,
      background:'#EE5A24',},
      {name:'中风险区',
      value:targetItem.total.mediumRiskAreaNum,
      background:'#F79F1F',},
      ]
      const today=[
        {name:'新增确诊',
        value:targetItem.today.confirm,
        background:'#F79F1F'
      },
        {name:'无症状感染者',
        value:targetItem.today.wzz_add,
        background:'#ee5a24'
      },
      ]

      this.setData({
        areaName:targetItem.name,
        outBreakObj:{
          total:total,
          today:today
        }
      })
      console.log('targetItem',targetItem)
      console.log('data',this.data)
    }
  }
})
