// components/star/star.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    score: {
      type: Number,
      value: 5
    },
    starKey: {
      type: String,
    },
    starType: {
      type: String,
      value: "stars"
    },
    size:{
      type:String,
      // value:""
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    stars: [
      {
        bgImg: "/assets/images/searchResult/star_0.png",
        bgImg_half: "/assets/images/searchResult/star_0.5.png",
        bgImg_all: "/assets/images/searchResult/star_1.png"
      },
      {
        bgImg: "/assets/images/searchResult/star_0.png",
        bgImg_half: "/assets/images/searchResult/star_0.5.png",
        bgImg_all: "/assets/images/searchResult/star_1.png"
      },
      {
        bgImg: "/assets/images/searchResult/star_0.png",
        bgImg_half: "/assets/images/searchResult/star_0.5.png",
        bgImg_all: "/assets/images/searchResult/star_1.png"
      },
      {
        bgImg: "/assets/images/searchResult/star_0.png",
        bgImg_half: "/assets/images/searchResult/star_0.5.png",
        bgImg_all: "/assets/images/searchResult/star_1.png"
      },
      {
        bgImg: "/assets/images/searchResult/star_0.png",
        bgImg_half: "/assets/images/searchResult/star_0.5.png",
        bgImg_all: "/assets/images/searchResult/star_1.png"
      }
    ],
    starsList: {
      stars: [
        {
          bgImg: "/assets/images/searchResult/star_0.png",
          bgImg_half: "/assets/images/searchResult/star_0.5.png",
          bgImg_all: "/assets/images/searchResult/star_1.png"
        },
        {
          bgImg: "/assets/images/searchResult/star_0.png",
          bgImg_half: "/assets/images/searchResult/star_0.5.png",
          bgImg_all: "/assets/images/searchResult/star_1.png"
        },
        {
          bgImg: "/assets/images/searchResult/star_0.png",
          bgImg_half: "/assets/images/searchResult/star_0.5.png",
          bgImg_all: "/assets/images/searchResult/star_1.png"
        },
        {
          bgImg: "/assets/images/searchResult/star_0.png",
          bgImg_half: "/assets/images/searchResult/star_0.5.png",
          bgImg_all: "/assets/images/searchResult/star_1.png"
        },
        {
          bgImg: "/assets/images/searchResult/star_0.png",
          bgImg_half: "/assets/images/searchResult/star_0.5.png",
          bgImg_all: "/assets/images/searchResult/star_1.png"
        }
      ],
      stars_half: [
        {
          bgImg: "/assets/images/searchResult/cStar_1.png",
          bgImg_half: "/assets/images/searchResult/cStar_0.5.png",
          bgImg_all: "/assets/images/searchResult/cStar_0.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar_1.png",
          bgImg_half: "/assets/images/searchResult/cStar_0.5.png",
          bgImg_all: "/assets/images/searchResult/cStar_0.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar_1.png",
          bgImg_half: "/assets/images/searchResult/cStar_0.5.png",
          bgImg_all: "/assets/images/searchResult/cStar_0.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar_1.png",
          bgImg_half: "/assets/images/searchResult/cStar_0.5.png",
          bgImg_all: "/assets/images/searchResult/cStar_0.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar_1.png",
          bgImg_half: "/assets/images/searchResult/cStar_0.5.png",
          bgImg_all: "/assets/images/searchResult/cStar_0.png"
        }
      ],
      cStars: [
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        }
      ],
      rStars: [
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        },
        {
          bgImg: "/assets/images/searchResult/cStar.png",
          bgImg_all: "/assets/images/searchResult/cStar_active.png"
        }
      ],
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleClick(e) {
      console.log(e);
      // if (e.currentTarget.dataset.score === 1) {
      //   this.triggerEvent('setScore', { score: 0 })
      // }else{
        this.triggerEvent('setScore', { score: e.currentTarget.dataset.score })
      // }
      
    }
  }
})
