<template>
  <view class="page-content meteorologicaldetails">
    <view class="meteorologicaldetails-content">
      <view class="meteorologicaldetails-item meteorologicaldetails-mettitle">
        <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">{{ meteorologicalDetailsObj.metTitle }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="meteorologicaldetails-item meteorologicaldetails-metauthor">
        <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">{{ meteorologicalDetailsObj.metAuthor }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="meteorologicaldetails-item meteorologicaldetails-metsummary">
        <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">{{ meteorologicalDetailsObj.metSummary }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="meteorologicaldetails-metcontent">
        <view class="metcontent-text">
          <view class="metcontent-textlable">
            <text class="metcontent-lable">内容：</text>
          </view>
          <view class="metcontent-textvalue">
            <view class="u-content">
              <u-parse
                :html="meteorologicalDetailsObj.metContent"
                :selectable="false"
                :show-with-animation="true"
              ></u-parse>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { meteorologicalViewData } from '@/agrcloud-api/meteorological';

export default {
  name: 'meteorologicalDetails',
  data() {
    return {
      meteorologicalDetailsObj: {
        metTitle: '',
        metAuthor: '',
        metSummary: '',
        metContent: ''
      }
    };
  },
  onLoad() {
    this.initData();
  },
  methods: {
    /** 初始化数据 */
    initData() {
      const currMeteorologicalDetailsItem = (this.$store.getters || {}).meteorologicalDetailsObj || {};
      meteorologicalViewData({
        id: currMeteorologicalDetailsItem.metId
      }).then(res => {
        this.meteorologicalDetailsObj = res.data || {};
      }).catch(() => {
        this.meteorologicalDetailsObj = {};
      });
    }
  }
}
</script>

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

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

    .meteorologicaldetails-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;
            }
          }
        }
      }
    }

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

      .metcontent-text {
        padding: 24rpx;

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

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

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