<template>
  <view class="container note-and-viewpoint">
    <view class="content-item">
      <view class="author-name">
        <view class="img-box">
          <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/T2ddwIIaULVdkGM6gVMuNxBSft8Y.png"></image>
        </view>
        <text style="margin-left: 10rpx">{{ detailDataForm.NickName }}</text>
      </view>
      <view class="type-time">
        <view class="type"> 笔 记</view>
        <view class="time">{{ detailDataForm.NickName }}</view>
      </view>
      <view class="title-item"> {{ detailDataForm.Title }}</view>
      <view class="text-conten">
        <mp-html :content="detailDataForm.Content" />
      </view>
      <view class="file-item"> 文档名称.docx </view>
      <view class="image-conten">
        <image v-for="key in dataProcessing(detailDataForm.ImgUrl)" :key="key" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/Maskgroupbg.png" @click="previewImageMediahandler"></image>
      </view>
      <view class="lable-conten">
        <text v-for="key in dataProcessing(detailDataForm.Tags)" :key="key">{{ key }}</text>
      </view>
      <view class="collect-conten">
        <image v-if="detailDataForm.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
        <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_icon.png"></image>
        {{ detailDataForm.CollectNum }}
      </view>
    </view>
  </view>
</template>

<script>
import { purchaserApi } from "@/config/api";
export default {
  data() {
    return {
      detailDataForm: "",
      detailId: 0,
    };
  },
  methods: {
    previewImageMediahandler() {
      uni.previewImage({
        urls: ["https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/Maskgroupbg.png"], //查看图片的数组
      });
    },
    // 获取专栏详情
    async getDetaliData() {
      const res = await purchaserApi.yanxuanSpecialDetail({
        Id: this.detailId,
      });
      if (res.Ret === 200) {
        this.detailDataForm = res.Data;
      }
    },
    // 数据处理
    dataProcessing(item) {
      return item ? item.split(",") : [];
    },
  },
  onLoad(options) {
    this.detailId = Number(options.id) || 0;
    console.log(this.detailId);
    this.detailId > 0 && this.getDetaliData();
  },
};
</script>

<style lang="scss" scope>
.note-and-viewpoint {
  padding: 30rpx;
  background: #f3f5f9;
  .content-item {
    padding: 40rpx;
    background-color: #fff;
    .type-time {
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: #666666;
      .type {
        width: 110rpx;
        height: 42rpx;
        line-height: 42rpx;
        text-align: center;
        border-radius: 38rpx;
        color: #928563;
        background-color: #fff6de;
        font-weight: 500;
      }
    }
    .title-item {
      margin: 10rpx 0 20rpx;
      color: #333;
      font-size: 32rpx;
      font-weight: 500;
      line-height: 46rpx;
    }
    .file-item {
      width: 100%;
      height: 42rpx;
      margin: 20rpx 0;
      display: flex;
      align-items: center;
      background-color: #f8f8fa;
      color: #376cbb;
    }
    .image-conten {
      display: flex;
      flex-wrap: wrap;
      image {
        width: 144rpx;
        height: 144rpx;
        margin-right: 20rpx;
      }
    }
    .lable-conten {
      display: flex;
      margin: 20rpx 0;
      font-size: 24rpx;
      text {
        height: 34rpx;
        border-radius: 44rpx;
        padding: 3rpx 35rpx 3rpx 35rpx;
        background-color: #f0f1f3;
        margin-right: 20rpx;
      }
    }
    .collect-conten {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      color: #666666;
      image {
        width: 27rpx;
        height: 26rpx;
        margin-right: 8rpx;
      }
    }
    .author-name {
      display: flex;
      align-items: center;
      margin-bottom: 50rpx;
      .img-box {
        width: 48rpx;
        height: 48rpx;
        overflow: hidden;
        font-size: 28rpx;
        color: #333;
        image {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
</style>
