privacyAgreementDialog.vue 1.99 KB
<!-- 设置用户隐私协议 -->
<template>
  <d2-dialog title="用户隐私协议"
             :is-visible="privacyVisible"
             class="privacyDailog"
             width="30%"
             @closeDialog="handleClose"
             @confirmDialog="handleAddConfirm">
    <el-form ref="privacyForm"
             :model="infoForm"
             label-width="120px">
      <el-form-item label="协议名称:"
                    prop="title">
        <el-input v-model="infoForm.title"
                  placeholder="请输入隐私协议名称"
                  style="width: 400px"
                  maxlength="20"
                  clearable />
      </el-form-item>
    </el-form>
  </d2-dialog>
</template>

<script>
import { getPrivacyAgreement, insertOrUpdatePrivacyAgreement } from '@api/index'
import { deepClone } from '@/common/util'
export default {
  name: 'PrivacyAgreementDialog',
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      infoForm: {
        title: '',
        module: 'PrivacyAgreement'
      },

      // 基本数据
      baseData: {

      }
    }
  },

  props: {
    privacyVisible: {
      type: Boolean,
      default: false
    }
  },

  watch: {
  },

  created() {
  },
  components: {},

  computed: {

  },

  mounted() {
    this.getPrivacyAgreement()
  },

  methods: {
    getPrivacyAgreement() {
      var params = {}
      params.module = this.infoForm.module
      getPrivacyAgreement(params).then(res => {
        this.infoForm.title = res || ''
      })
    },

    handleAddConfirm() {
      // this.$refs.privacyForm.validate(valid => {
      // if (valid) {
      var params = {}
      var infoForm = deepClone(this.infoForm)
      params = infoForm
      insertOrUpdatePrivacyAgreement(params).then(res => {
        this.notice.okTips()
        this.handleClose()
      })
      // }
      // })
    },

    handleClose() {
      this.$emit('dialogClose', true)
    }
  }
}
</script>
<style>
.privacyDailog .el-dialog {
  min-width: 700px;
}
</style>