<template>
  <div class="preview-protocol-wrapper dialog-title-border">
    <el-dialog
      title="用户协议"
      :visible="dialogVisible"
      @close="close"
      center
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      width="800px"
    > 
      <div slot="title" style="text-align: left;">
        <span style="font-weight: 700;">用户协议</span>
      </div>
      <div v-html="protocolInfo.contents"></div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="close">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</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>
