<template>
  <Dialog
    ref="dialog"
    width="542px"
  >
    <div class="bg"/>
    <div class="content">
      <div class="title">{{ title }}</div>
      <div class="message">{{ message }}</div>
      <div class="dialog-footer">
        <div v-audio class="btn" @click="visible = false">取 消</div>
        <div v-audio class="btn" type="primary" @click="confirm">确 定</div>
      </div>
      <div class="footer-tip">
        {{ tip }}
      </div>
    </div>
  </Dialog>
</template>

<script>
import Dialog from '@/components/dialog/index'
import { mapState } from 'vuex'
export default {
  components: {
    Dialog,
  },
  props: {
    title: {
      type: String,
      default: '',
    },
    message: {
      type: String,
      default: '',
    },
    tip: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      visible: false,
    }
  },
  computed: {
    ...mapState([
      'zoom',
    ]),
  },
  watch: {
    visible(value) {
      if (value) {
        this.$refs.dialog.show()
      } else {
        this.$refs.dialog.close()
      }
    },
  },
  methods: {
    confirm() {
      this.$emit('confirm')
      this.visible = false
    },
    show() {
      this.visible = true
    },
  },
}
</script>

<style lang="scss" scoped>
.bg {
  background-image: url(https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/tip/tip_bg_b.png);
  background-size: 100% 100%;
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
  top: 0;
  left: 0;
}
.content {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  .title {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    color: #f5be5e;
    margin-top: 30px;
  }
  .message {
    text-align: center;
    color: #f5be5e;
    margin-top: 48px;
    font-size: 18px;
    flex: 1;
  }
  .dialog-footer {
    padding-bottom: 20px;
    display: flex;
    justify-content: center;
    .btn {
      background-image: url(https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/tip/tip_btn_b.png);
      background-size: 100% 100%;
      width: 150px;
      height: 40px;
      opacity: 0.80;
      text-align: center;
      line-height: 40px;
      color: #5e4926;
      font-size: 18px;
      font-weight: bold;
      margin: 0 36px;
      &:hover {
        opacity: 1;
      };
    }
  }
  .footer-tip {
    height: 30px;
    line-height: 30px;
    text-align: right;
    padding: 4px 16px;
    font-size: 12px;
    color: #bc9a6c;
  }
}
/deep/ .game-dialog {
  position: relative;
  background: transparent;
  height: 320px;
  padding: 0;
  .el-dialog__header {
    padding: 0;
  }
  .el-dialog__body {
    max-height: inherit;
    padding: 0;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
  }
}
</style>
