<template>
  <div class="disclaimerEditor">
    <div>
      <TextEditor :height="600" @change="handleChange" />
    </div>
    <div class="btn">
      <a-button @click="handleReset" v-auth="['sys:config:edit']" class="mr-4">重置</a-button>
      <a-button type="primary" @click="handleSubmit" v-auth="['sys:config:edit']">保存</a-button>
    </div>
  </div>
</template>
<script lang="ts" setup>
  import { ref } from 'vue';
  import TextEditor from '/@/components/Form/src/components/TextEditor.vue';
  import { useMessage } from '/@/hooks/web/useMessage';

  const { createMessage } = useMessage();

  const disclaimerContent = ref();
  function handleReset() {}

  function handleSubmit() {
    console.log(disclaimerContent.value);
    if (!disclaimerContent.value) {
      createMessage.error('请输入免责声明后提交');
      return;
    }
  }

  function handleChange(val) {
    console.log(val);
    disclaimerContent.value = val;
  }
</script>
<style lang="less">
  .disclaimerEditor {
    width: 50%;
    margin-left: 25%;
  }

  .btn {
    margin-top: 30px;
    float: right;
  }
</style>
