Files
pengcheng-exam-teacher/src/views/paper/question/independent/ps.vue
2025-08-15 15:33:15 +08:00

50 lines
1.2 KiB
Vue

<template>
<div class="independent-window">
<PsForm ref="formRef" :isIndependent="true" />
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { listen } from '@tauri-apps/api/event'
import { getCurrentWindow } from '@tauri-apps/api/window'
import PsForm from '@/views/paper/question/PsForm.vue'
defineOptions({ name: 'PsIndependent' })
const formRef = ref()
onMounted(async () => {
console.log('PsIndependent mounted, sending ready signal...')
// 发送窗口准备就绪信号
try {
const { emit } = await import('@tauri-apps/api/event')
await emit('ps-window-ready', { timestamp: Date.now() })
console.log('Sent ps-window-ready event')
} catch (error) {
console.error('Failed to send ready signal:', error)
}
// 监听表单提交成功事件,关闭窗口
await listen('ps-form-success', async () => {
const appWindow = getCurrentWindow()
await appWindow.close()
})
// 监听表单取消事件,关闭窗口
await listen('ps-form-cancel', async () => {
const appWindow = getCurrentWindow()
await appWindow.close()
})
})
</script>
<style lang="scss" scoped>
.independent-window {
width: 100vw;
height: 100vh;
overflow: hidden;
}
</style>