<template>
  <view class="page-content regulationsdetails">
    <view class="regulationsdetails-content">
      <view class="regulationsdetails-item regulationsdetails-arttitle">
        <view class="item-content">
          <view class="item-text">
            <view class="item-textlable">
              <text class="item-lable">标题：</text>
            </view>
            <view class="item-textvalue">
              <text class="item-value">{{ regulationsDetailsObj.artTitle }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="regulationsdetails-item regulationsdetails-artauthor">
        <view class="item-content">
          <view class="item-text">
            <view class="item-textlable">
              <text class="item-lable">作者：</text>
            </view>
            <view class="item-textvalue">
              <text class="item-value">{{ regulationsDetailsObj.artAuthor }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="regulationsdetails-item regulationsdetails-artsummary">
        <view class="item-content">
          <view class="item-text">
            <view class="item-textlable">
              <text class="item-lable">简介：</text>
            </view>
            <view class="item-textvalue">
              <text class="item-value">{{ regulationsDetailsObj.artSummary }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="regulationsdetails-artcontent">
        <view class="artcontent-text">
          <view class="artcontent-textlable">
            <text class="artcontent-lable">内容：</text>
          </view>
          <view class="artcontent-textvalue">
            <view class="u-content">
              <u-parse
                :html="regulationsDetailsObj.artContent"
                :selectable="false"
                :show-with-animation="true"
              ></u-parse>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { regulationsViewData } from '@/agrcloud-api/regulations';

export default {
  name: 'regulationsDetails',
  data() {
    return {
      regulationsDetailsObj: {
        artTitle: '',
        artAuthor: '',
        artSummary: '',
        artContent: ''
      }
    };
  },
  onLoad() {
    this.initData();
  },
  methods: {
    /** 初始化数据 */
    initData() {
      const currRegulationDetailsItem = (this.$store.getters || {}).regulationsDetailsObj || {};
      regulationsViewData({
        id: currRegulationDetailsItem.artId
      }).then(res => {
        this.regulationsDetailsObj = res.data || {};
      }).catch(() => {
        this.regulationsDetailsObj = {};
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.regulationsdetails {
  padding: 0;

  .regulationsdetails-content {
    width: 100%;
    padding-top: 24rpx;

    .regulationsdetails-item {
      height: 138rpx;
      padding-left: 24rpx;
      background-color: #ffffff;

      .item-content {
        height: 138rpx;
        border-bottom: 1px solid #eeeeee;

        .item-text {
          padding: 24rpx 24rpx 24rpx 0;

          .item-textlable {
            height: 42rpx;
            line-height: 42rpx;

            .item-lable {
              height: 42rpx;
              font-size: 30rpx;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #666666;
              line-height: 42rpx;
            }
          }

          .item-textvalue {
            height: 48rpx;
            line-height: 48rpx;

            .item-value {
              height: 48rpx;
              font-size: 34rpx;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #333333;
              line-height: 48rpx;
            }
          }
        }
      }
    }

    .regulationsdetails-artcontent {
      margin-top: 24rpx;
      background-color: #ffffff;
      min-height: 154rpx;

      .artcontent-text {
        padding: 24rpx;

        .artcontent-textlable {
          height: 42rpx;
          line-height: 42rpx;

          .artcontent-lable {
            height: 42rpx;
            font-size: 30rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #666666;
            line-height: 42rpx;
          }
        }

        .artcontent-textvalue {
          .artcontent-textarea {
            min-height: 48rpx;
            font-size: 34rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #333333;
          }
        }
      }
    }
  }
}
</style>
