<template>
  <div>
    <PerfectScrollbar>
       <lay-index></lay-index>
    </PerfectScrollbar>
  </div>

  <d-modal class="!w-80" v-model="modal.visible" :title="modal.title">
    {{ modal.content }}
    <div class="mt-10 w-full flex justify-between">
      <d-button @click="modal.handdleCancel" variant="text"
        class="w-[49%] hover:bg-[#8a6684] hover:!text-white">{{modal.cancelText}}</d-button>
      <span class="text-[20px]"> | </span>
      <d-button @click="modal.handdleSubmit" variant="text" class="w-[49%] hover:bg-[#5c866a] hover:!text-white"
        color="primary">{{modal.submitText}}</d-button>
    </div>
  </d-modal>
</template>

<script setup lang="ts">
import layIndex from './Index.vue'
// 空白项目入口
const route = useRoute()
const logStatus = $store.log.useLogStore()
const modal = reactive<any>({
  visible: false,
  title: "",
  content: "",
  handdleCancel: () => { modal.visible = false },
  handdleSubmit: () => { },
})

function comemodal(mv: any) {
  if (!mv) return
  modal.visible = true
  modal.title = mv.title
  modal.content = mv.content
  modal.cancelText = mv.cancelText || "取消"
  modal.submitText = mv.submitText || "确定"
  if (mv.handdleCancel)  modal.handdleCancel = () => {
    mv.handdleCancel()
    modal.visible = false
  }
  modal.handdleSubmit = () => {
    mv.handdleSubmit()
    modal.visible = false
  }
}

window.$modal = comemodal

// 全局禁用右键菜单
document.oncontextmenu = function () {
  return false;
};

onMounted(() => {
  if($cookies.get('userinfo')) logStatus.setIsLogin(true)
})
</script>

<style scoped lang="less">
.ps {
  width: 100vw;
  height: 100vh;
  padding-inline-start: 0;
}
</style>