<template>
  <ui-page-layout class="bg-white" title="我的点赞">
    <div class="p-24rem">
      <ui-main-article v-for="item in articles" :item="item" class="mb-24rem">

        <!-- <img src="/imgs/like-button-checked.png" slot="right" class="w-39rem right-0 bottom-17rem absolute" /> -->
        <img @click.stop="handleCancel(item)" src="/imgs/like-button-checked.png" slot="right" class="w-39rem right-0 bottom-17rem absolute" />
      </ui-main-article>
    </div>
  </ui-page-layout>
</template>

<script>
  export default {
    components: {},
    data(){
      return {
        articles:[]
      }
    },
    methods:{
      async handleLoad(){
        let resp = await this.$http.post(this.$api.cms.myLikeArticles,this.$qs.stringify({onPage:false}));
        this.articles = resp.data.data.cmsArticles;

      },
      async handleCancel(item){

        await this.$dialog.confirm( {
          message:this.$t('您现在正在进行取消点赞操作, 是否继续?'),
          title:this.$t('提示'),
          confirmButtonText: this.$t('确认'),
          cancelButtonText: this.$t('取消'),
        });

        let resp = await  this.$http.post(this.$api.cms.like,this.$qs.stringify({refArticle:item.code}));
        if(resp.data.status === 200){
          this.handleLoad();
        }

      }
    },
    async created() {
      this.handleLoad();
    }

  };
</script>

<style lang="scss" scoped>

</style>


