<template>
  <el-dialog
    title="预览协议"
    :visible="dialogVisible"
    @close="close"
    center
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    width="800px"
  > 
    <div v-html="protocolInfo.contents"></div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="close">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      protocolInfo: {
        contents: ''
      }
    };
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    protocolId: {
      type: String | Number,
      default: 0
    }
  },
  watch: {
    protocolId(newVal) {
      if(newVal) {
        this.getProtocolInfoById(newVal);
      }
    }
  },
  computed: {

  },
  mounted() {
  },
  methods: {
    // 查询列表
    getProtocolInfoById(protocolId) {
      let req = {
        protocolId: protocolId
      };
      this.GET("smartcontract/protocolManage/protocol", req).then(res => {
        if (res.code == "000000") {
          this.protocolInfo = res.data;
        }
      });
    },
    close() {
      this.$emit('close');
    },
  }
};
</script>
<style scoped lang="scss">
</style>
