<template>
  <view class="column-list-content-detail">
    <view class="introduce-content">
      <view class="introduce"></view>
      <view :class="['introduce-detail', item.isExpand && 'expand']" :style="{ height: isExpand ? 'auto' : richTextHeight + 'px' }">
        {{ content }}
        <view class="expan-btn-sl" v-if="isShowBtn && !isExpand">......</view>
      </view>

      <view class="expan-btn" @click.stop="handleExpand" v-if="isShowBtn">{{ isExpand ? "收起" : "展开" }}</view>
    </view>
    <view class="content-item">
      <view class="type-time">
        <view class="type"> 笔 记</view>
        <view class="time"> 2023.08.24 13:13:13</view>
      </view>
      <view class="title-item"> 标题标题标题标题标题标题标题标题标题标题标题标题</view>
      <view class="text-conten">
        有专栏详情页面，内容详情页面，暂时都不设置行业权限。专栏详情页未登录也可查看，收藏操作需先登录
        内容详情页面也需要登录后才查看，登录也可查看，收藏操作需先登录，内容详情页面也需要登录后才查专栏介绍：有专栏详情页面，内容详情页面，暂时都不设置行业权限。专栏详情页未登录也可查看，收藏操作需先登录，
      </view>
      <view class="look-all"> 查看全文 </view>
      <view class="file-item"> 文档名称.docx </view>
      <view class="image-conten">
        <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/Maskgroupbg.png" @click="previewImageMediahandler"></image>
        <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/Maskgroupbg.png"></image>
      </view>
      <view class="lable-conten">
        <text>石头科技</text>
        <text>公司调研电话会</text>
      </view>
      <view class="collect-conten">
        <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_icon.png"></image>
        <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image> 88
      </view>
      <view class="introduce-detail-one" v-show="showText">
        有专栏详情页面，情页面，暂时都不设置行业权限。专栏详情页未登录也可查看，收藏操作需先登录，内容详情页面也需要登录后才查容详情页面也需要登录后
      </view>
    </view>
    <view v-show="loadTimeLine" class="loadTimeLine"></view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      loadTimeLine: true, //时间线的遮罩
      richTextHeight: 1000,
      isExpand: true,
      isShowBtn: true,
      showText: true,
      content:
        "情页面，有专栏详情页面，内容详情页面，有专栏详情页面，内容详情页面，有专栏详情页面，内容详情页面，暂时都不设置行业权限。专栏详情页未登录也可查看，收藏操作需先登录，内容详情页面也需要登录后才查容详情页面也需要登录后",
    };
  },
  mounted() {
    const queryOne = wx.createSelectorQuery().in(this).selectAll(".introduce-detail-one").boundingClientRect();
    queryOne.exec((res) => {
      this.richTextHeight = res[0][0].height;
      this.showText = false;
      this.getConentsHeight();
    });
  },
  methods: {
    previewImageMediahandler() {
      uni.previewImage({
        urls: ["https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/Maskgroupbg.png"], //查看图片的数组
      });
    },
    // 去往文章详情的
    async handleExpand() {
      this.isExpand = !this.isExpand;
    },
    getConentsHeight() {
      const query = wx.createSelectorQuery().in(this);
      query.selectAll(".introduce-detail").boundingClientRect();
      query.exec((res) => {
        console.log(res[0][0].height);
        if (res[0][0].height > this.richTextHeight) {
          this.isExpand = false;
          this.isShowBtn = true;
        } else {
          this.isExpand = true;
          this.isShowBtn = false;
        }
        setTimeout(() => {
          this.loadTimeLine = false;
        }, 300);
      });
    },
  },
};
</script>

<style lang="scss" scope>
.column-list-content-detail {
  position: relative;
  padding: 50rpx 40rpx;
  background: #fff;
  .loadTimeLine {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    position: absolute;
    background-color: #fff;
    z-index: 6;
  }
  .introduce-content {
    padding-bottom: 50rpx;
    border-bottom: 1px solid #f0f1f3;
    .introduce {
      width: 100%;
      height: 53rpx;
      text-align: center;
      line-height: 53rpx;
      background-color: #fff6de;
      color: #928563;
      font-weight: 500;
      margin-bottom: 40rpx;
    }
  }
  .introduce-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: justify;
    // display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    position: relative;
    &.expand {
      -webkit-line-clamp: 999;
      height: auto;
    }
    .expan-btn-sl {
      position: absolute;
      bottom: 0;
      right: 0;
      background-color: #fff;
      padding: 2rpx 0 2rpx 8rpx;
      z-index: 9;
    }
  }
  .expan-btn {
    margin-top: 15rpx;
    color: #2c83ff;
    text-align: right;
    position: relative;
    &.pos {
      padding: 0 0 0 40rpx;
      background-color: rgba(255, 255, 255, 0.882);
      position: absolute;
      right: 0;
      bottom: 0;
    }
  }
  .content-item {
    padding: 40rpx 0;
    border-bottom: 1px solid #f0f1f3;
    .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;
      }
    }
    .look-all {
      float: right;
      width: 108rpx;
      height: 42rpx;
      border-radius: 150rpx;
      text-align: center;
      line-height: 42rpx;
      font-size: 21rpx;
      color: #fff;
      background-color: #376cbb;
      margin: 20rpx 0;
    }
  }
}
</style>
