<template>
  <div class="container">
    <div class="title">{{ info.title }}</div>
    <div class="date">{{ info.publicTime }}</div>
    <hr />
    <div class="content"></div>
  </div>
</template>
<script>
import { mgop } from "@aligov/jssdk-mgop";
export default {
  data() {
    return {
      info: {}
    };
  },
  created() {
    this.getData();
  },
  methods: {
    // 获取数据
    getData() {
      mgop({
        api: "mgop.kykj.houseexpropriat.getpoliciesinfo",
        host: "https://mapi.zjzwfw.gov.cn/",
        dataType: "JSON",
        type: "POST",
        data: {
          ticket: this.$route.query.ticket,
          id: this.$route.query.id
        },
        appKey: "es4b8zmz+2001833218+dehllx",
        onSuccess: data => {
          const { data: res } = data;
          this.info = res.data;
          let content = document.querySelector(".content");
          content.innerHTML = res.data.contents;
        },
        onFail: function(err) {
          console.log("错误信息", err);
        }
      });
    }
  }
};
</script>
<style lang="less" scoped>
.container {
  padding: 20px;
  .title {
    text-align: center;
    font-weight: bolder;
    font-size: 14px;
  }
  .date {
    text-align: center;
    margin: 10px 0;
    font-size: 14px;
  }
}
</style>
