<template>
  <!--AGR-->
  <el-dialog v-if="visible" :visible.sync="visible" width="60%" :close-on-click-modal="false" append-to-body center
    :show-close="true" @close="cancel">
    <!-- <div slot="title">
      {{ agreement.FileName }} 
    </div> -->
    <div v-html="agreement.FileEnContent" class="content" v-if="IsEn_Us"></div>
    <div v-html="agreement.FileContent" class="content" v-else></div>
  </el-dialog>
</template>
<script>
import {
  getUserAgreementById
} from '@/api/dictionary'
export default {
  name: "AGR",
  data() {
    return {
      visible: false,
      agreement: {},
      IsEn_Us: false
    }
  },
  mounted() {

  },
  methods: {
    async getAgreement(Id) {
      try {
        let data = {
          Id
        }
        let res = await getUserAgreementById(data)
        if (res.IsSuccess) {
          this.agreement = res.Result
        }
      } catch (err) {
        console.log(err)
      }
    },
    open(data) {
      let { Id, IsEn_Us } = data;
      this.IsEn_Us = IsEn_Us
      this.getAgreement(Id)
      this.visible = true
    },
    cancel() {
      this.visible = false;
      this.$emit("closed");
    },

  },
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
  height: 500px;
}

.content {
  height: 100%;
  overflow-y: auto;
}
</style>