<style scoped>
</style>
<template>
  <div class="toolbar-buttons-ct">
  <el-button :disabled="!contentIds" @click="changeAttriutes('recommend')" :text="buttonType">
      <i class="fa fa-paper-plane"></i>推荐
    </el-button>
    <el-button :disabled="!contentIds" @click="changeAttriutes('cancelrecommend')" :text="buttonType">
      <i class="fa fa-exclamation-triangle"></i>取消推荐
    </el-button>
    <el-button :disabled="!contentIds" @click="changeAttriutes('sethot')" :text="buttonType">
      <i class="fa fa-bolt fa-fw"></i>设置热点
    </el-button>
    <el-button :disabled="!contentIds" @click="changeAttriutes('cancelhot')" :text="buttonType">
      <i class="fa fa-exclamation-triangle"></i>取消热点
    </el-button>
  </div>
</template>
<script>
import util from '@src/common/util.js'
export default {
  name: 'content-attributes-button',
  props: {
    contentIds: {
      type: [String, Number]
    },
    buttonType: {
      type: String,
      default: 'info'
    }
  },
  methods: {
    async changeAttriutes(attr) {
      // TODO: 下面的逻辑有问题吧，ids从哪儿来的？！
      let resp = await axios.put(`/ui/contentcore/contents/${window.ids.join(',')}`, { type: attr })
      util.showResponseMessage(resp.data)
      if (resp.data.status === 1) {
        this.$emit('refresh-content', this.contentId)
      }
    }
  }

}
</script>
