enhance the event delivery of RunningStatus

This commit is contained in:
bossgeekgo
2024-02-21 01:25:21 +08:00
parent 331ae81e50
commit eea4439dc6
@@ -6,27 +6,36 @@
<p>📱 你可以在<b>手机</b> / <b>平板电脑</b>使用BOSS直聘App与为你开聊的BOSS聊天</p> <p>📱 你可以在<b>手机</b> / <b>平板电脑</b>使用BOSS直聘App与为你开聊的BOSS聊天</p>
<p>🍀 祝你求职顺利</p> <p>🍀 祝你求职顺利</p>
</article> </article>
<el-button :disabled="isStopping" @click="handleStop">停止开聊</el-button> <el-button :disabled="isStopping" @click="handleStopButtonClick">停止开聊</el-button>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref, onUnmounted } from 'vue';
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const { ipcRenderer } = electron const { ipcRenderer } = electron
const router = useRouter() const router = useRouter()
const isStopping = ref(false) const handleStopButtonClick = async () => {
const handleStop = async () => {
ipcRenderer.once('geek-auto-start-chat-with-boss-stopping', () => {
isStopping.value = true
ipcRenderer.once('geek-auto-start-chat-with-boss-stopped', () => {
router.replace('/configuration/GeekAutoStartChatWithBoss')
})
})
ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss') ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss')
} }
const isStopping = ref(false)
const handleStopping = () => {
isStopping.value = true
}
ipcRenderer.once('geek-auto-start-chat-with-boss-stopping', handleStopping)
const handleStopped = () => {
router.replace('/configuration/GeekAutoStartChatWithBoss')
}
ipcRenderer.once('geek-auto-start-chat-with-boss-stopped', handleStopped)
onUnmounted(() => {
ipcRenderer.removeListener('geek-auto-start-chat-with-boss-stopped', handleStopped)
ipcRenderer.removeListener('geek-auto-start-chat-with-boss-stopping', handleStopping)
})
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>