<script lang="ts" setup>
import { defineOptions, ref } from 'vue';
import { useRouter } from 'vue-router';

defineOptions({ name: 'ShortcutModal' })


const emit = defineEmits<{
  (e: 'refresh', value: any),
  (e: 'cancel', value: any)
}>()


const show = ref(false)
const isFold = ref(false)
const router = useRouter()

const cardStyle = {
  'width': '29vw',
  '--n-padding-bottom': '10px',
  '--n-padding-left': '10px',
}
function toggle() {
  isFold.value = !isFold.value
}
function showModal() {
  show.value = true
}
function closeModal() {
  show.value = false
}
function refresh() {
  emit('refresh', true)
}
function cancel() {
  closeModal()
  emit('cancel', true)
}

defineExpose({
  showModal,
  closeModal
})
</script>

<template>
  <div class="removeMask">
    <n-modal v-model:show="show" :show-mask="false" :mask-closable="false" transform-origin="center" style="position: fixed;right: 0;bottom: 0;">
      <n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true" style="padding: 8px 8px 0 8px;">
        <div class="wrapper">
          <div class="title">查重进度</div>
          <div class="icon-list">
            <svg-icon size="20" name="refresh" @click="refresh" style="margin-right: 16px;cursor: pointer;" />
            <svg-icon v-show="!isFold" size="20" name="down-line" style="margin-right: 16px;cursor: pointer;" @click="toggle"/>
            <svg-icon v-show="isFold" size="20" name="top-line" style="margin-right: 16px;cursor: pointer;" @click="toggle"/>
            <svg-icon size="20" name="close-none-border" @click="cancel" style="margin-right: 16px;cursor: pointer;"/>
          </div>
        </div>
        <div v-show="!isFold" style="display: flex;background-color: #F9F9F9;height: 54px;margin-top: 24px;margin-bottom: 6px;">
          <div><svg-icon size="40" name="robot2" /></div>
          <div class="msg">
            <div>正在查重中</div>
          </div>
        </div>
      </n-card>
    </n-modal>
  </div>
</template>

<style lang="less" scoped>
.wrapper{
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
  margin: 0 -18px;
}
.icon-list{
}
.title {
  padding-left: 24px;
  padding-bottom: 10px;
  color: #333333;
  font-size: 16px
}

.msg {
  text-align: center;
  margin-left: 20px;
  font-size: 14px;
  font-size: 14px;
  line-height: 54px;
}
.removeMask {
  ::v-deep(.n-modal-mask) {
    display: none !important;
  }
}
</style>
