<template>
  <div class="page">
    <div class="detail-content">
      <div class="detail-info">
        <div class="info-title">{{ data.title }}</div>
        <div class="item-info">
          <span class="info-label">学习类别：</span>
          <span class="info-value">{{ $dict.getLabel('partyStudyType', data.type) }}</span>
        </div>
        <div class="item-info">
          <span class="info-label">发布人员：</span>
          <span class="info-value">{{ data.publishUserName }}</span>
        </div>
        <div class="item-info">
          <span class="info-label">发布时间：</span>
          <span class="info-value">{{ data.publishTime }}</span>
        </div>
        <div class="item-info">
          <span class="info-label">学习时间：</span>
          <span class="info-value">{{ data.studyBeginDate }}至{{ data.studyEndDate }}</span>
        </div>
        <div class="item-info">
          <span class="info-label">学习状态：</span>
          <span class="info-value">{{ $dict.getLabel('partyStudyStatus', data.studyStatus) }}</span>
        </div>
        <div class="item-info" v-if="data.studyStatus == 1">
          <span class="info-label">完成时间：</span>
          <span class="info-value">{{ data.finishDate || '-' }}</span>
        </div>
      </div>
      <!-- <div class="page-title">学习内容</div> -->
      <u-parse :html="data.content" class="content" v-if="data.content"></u-parse>
      <AiTransSpeech :src="data.speech"/>
    </div>
    <div class="btn-box" @click="toContent()">
      <span class="active">学习心得</span>
    </div>
  </div>
</template>
<script>

export default {
  data() {
    return {
      id: '',
      data: {},
    };
  },
  onLoad(options) {
    this.$dict.load('partyStudyStatus', 'partyStudyType')
    this.id = options.id
    this.getDetailInfo()
  },
  onShow() {
    this.getDetailInfo()
  },
  methods: {
    toContent() {
      uni.navigateTo({url: `./AppPartyStudy?id=${this.id}`})
    },
    getDetailInfo() {
      this.$http.post(`/app/apppartystudy/queryDetailByIdWeChat?id=${this.id}`, null, {}).then(res => {
        if (res.data) {
          if (res.data.files && res.data.files.length) {
            res.data.files.map(item => {
              var size = item.size / 1024;
              item.fileSize = size.toFixed(0);
              return item
            })
          }
          this.data = res.data
        }
      })
    },
  },
};
</script>
<style lang="scss" scope>
@import "../../../common/common.css";

.page {
  background-color: #fff;

  .detail-content {
    padding-bottom: 140px;
  }
  .content{
    padding: 20px;
    background-color: #fff;
  }

  .detail-info {
    padding: 16px 32px 8px 32px;
    border-bottom: 2px solid #D8DDE6;
    background-color: #E60012;
    padding-bottom: 80px;
    position: relative;

    .info-title {
      line-height: 64px;
      font-size: 40px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #fff;
      word-break: break-all;
      margin-bottom: 16px;
    }

    .item-info {
      line-height: 48px;
      font-size: 30px;
      margin-bottom: 8px;

      .info-label {
        display: inline-block;
        color: #fff;
        vertical-align: top;
      }

      .info-value {
        display: inline-block;
        width: 510px;
        word-break: break-all;
        color: #FFE8E8;
      }

      .item-status0 {
        color: #FF9B2B;
      }

      .item-status1 {
        color: #2EA222;
      }

      .item-status2 {
        color: #343D65;
      }

      .item-status3 {
        color: #5A98F2;
      }

      .item-status4 {
        color: #f46;
      }

    }

    .retract-btn {
      line-height: 80px;
      text-align: center;
      font-size: 28px;
      color: #fff;
      position: absolute;
      bottom: 0;
      width: 690px;

      .down-icon {
        width: 32px;
        height: 32px;
        margin-left: 4px;
        vertical-align: middle;
        transition: all .3s ease-in-out;
      }

      .icon-active {
        transform: rotate(180deg);
      }
    }
  }

  .page-title {
    line-height: 96px;
    color: #333;
    font-size: 32px;
    padding-left: 32px;
    background-color: #fff;

    span {
      font-size: 28px;
    }
  }

  .info-content {
    padding: 16px 32px;
    background-color: #fff;
    line-height: 48px;
    color: #333;
    font-size: 32px;
    box-sizing: border-box;
  }

  .user-list {
    background-color: #fff;

    .user-item {
      height: 112px;
      padding-top: 16px;
      box-sizing: border-box;

      .user-bg {
        display: inline-block;
        width: 80px;
        height: 80px;
        background-color: #4E8EEE;
        color: #fff;
        text-align: center;
        line-height: 80px;
        margin: 0 16px 0 32px;
        font-size: 28px;
        border-radius: 50%;
        vertical-align: top;
      }

      .user-info {
        display: inline-block;
        width: 622px;
        height: 96px;
        border-bottom: 2px solid #D8DDE6;
        box-sizing: border-box;

        .user-name {
          line-height: 44px;
          color: #333;
          font-size: 32px;
        }

        .user-unit {
          line-height: 34px;
          color: #999;
          font-size: 24px;
        }
      }
    }

    .user-item:nth-last-of-type(1) {
      .user-info {
        border-bottom: 0;
      }
    }
  }

  .mar-b8 {
    margin-bottom: 16px;
  }

  .color-1365DD {
    color: #1365DD;
  }

  .color-999999 {
    color: #999999;
  }

  .pad-l7 {
    padding-left: 14px;
  }

  .attachment {
    width: 100%;
    padding: 32px;
    box-sizing: border-box;
    background-color: #FFFFFF;
    margin-top: 16px;

    .attachment-title {
      font-size: 32px;
      color: #333333;
      font-weight: 500;

      image {
        width: 48px;
        height: 48px;
        vertical-align: middle;
      }
    }

    .attachment-item {
      border: 1px solid rgba(204, 204, 204, 1);
      padding: 16px;
      box-sizing: border-box;
      margin-top: 34px;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      border-radius: 8px;

      .file-name {
        justify-content: flex-start;
        align-items: center;

        image {
          width: 96px;
          height: 96px;
          vertical-align: middle;
        }

        .title {
          color: #333333;
          font-size: 32px;
          word-break: break-all;
          flex: 1;
        }
      }

      .size {
        color: #999;
        font-size: 28px;
        display: flex;
        justify-content: cemter;
        align-items: center;
      }
    }
  }

  .btn-box {
    position: fixed;
    display: flex;
    bottom: 0;
    height: 112px;
    line-height: 112px;
    width: 100%;
    color: #333;
    background-color: #fff;
    font-size: 36px;

    span {
      flex: 1;
      text-align: center;
    }

    .active {
      background-color: #E60012;
      color: #fff;
    }
  }
}


.partyStudyContent {
  width: 100%;
  height: calc(100% - 184rpx);
  padding: 32px;
  box-sizing: border-box;
  color: #666;
  font-size: 32px;
  background-color: #fff;
  word-break: break-all;
}
</style>
