<!--  -->
<template>
  <div
    v-if="
      remarkDetail &&
      (remarkDetail.chs || remarkDetail.en || (remarkDetail.img_list && remarkDetail.img_list.length > 0))
    "
    class="remarkChs"
    :style="{ top: marginTop ? marginTop + 'px' : '0px' }"
  >
    <div v-if="remarkDetail.chs" class="remark-chs" v-html="remarkDetail.chs"></div>
    <div v-if="remarkDetail.en" class="remark-en" v-html="remarkDetail.en"></div>
    <div v-if="remarkDetail.img_list && remarkDetail.img_list.length > 0" class="remark-img">
      <el-image
        :style="{
          width: remarkDetail.widthNumber ? remarkDetail.widthNumber + 'px' : '',
          height: remarkDetail.heightNumber ? remarkDetail.heightNumber + 'px' : '',
        }"
        :src="remarkDetail.img_list[0].url"
        fit="contain"
        :preview-src-list="[remarkDetail.img_list[0].url]"
      />
    </div>
  </div>
</template>

<script>
export default {
  name: 'RemarkChs',
  components: {},
  props: ['remarkDetail', 'marginTop'],
  data() {
    return {};
  },
  computed: {},
  watch: {},
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {},
  // 方法集合
  methods: {}, // 如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang="scss" scoped>
//@import url(); 引入公共css类
.remarkChs {
  position: absolute;
  top: 0;
  box-sizing: border-box;
  width: 95%;

  // border: 1px solid rgba(0, 0, 0, 10%);
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 10%);

  > .remark-chs {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 34px;
    font-size: 14px;
    font-weight: normal;
    line-height: 22px;
    color: #fff;
    text-align: center;
    background: #988ed6;
    border: 1px solid rgba(0, 0, 0, 10%);
    border-radius: 8px 8px 0 0;

    :deep p {
      margin: 0;
    }
  }

  > .remark-en {
    box-sizing: border-box;
    min-height: 34px;
    font-size: 14px;
    line-height: 22px;
    color: #000;
    text-align: center;
    word-break: break-word;
    border-top: 0;
    border-radius: 0 0 8px 8px;

    :deep p {
      margin: 0;
    }
  }

  > .remark-img {
    width: 100%;
    text-align: center;

    .el-image {
      max-width: 178px;
    }
  }
}
</style>
