mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: echo start after creating session
This commit is contained in:
1 parent
94ef3749f5
commit
dcd8f441f8
2 files changed
+16
-18
No files matched your search
@@ -5,13 +5,18 @@ import MarkdownText from '../MarkdownText.vue'
|
|||||||
|
|
||||||
const sessionStore = useSession()
|
const sessionStore = useSession()
|
||||||
const current = ref(-1)
|
const current = ref(-1)
|
||||||
watch(
|
const length = computed(() => {
|
||||||
() => sessionStore.session?.hints,
|
console.log(sessionStore.session?.responses)
|
||||||
(hints) => {
|
return sessionStore.session?.responses.length ?? 0
|
||||||
current.value = hints ? hints.length - 1 : -1
|
})
|
||||||
},
|
|
||||||
{ deep: true }
|
const disabled = computed(() => {
|
||||||
)
|
return current.value === length.value - 1
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(length, () => {
|
||||||
|
current.value = length.value - 1
|
||||||
|
})
|
||||||
|
|
||||||
const left = () => {
|
const left = () => {
|
||||||
if (current.value > 0) {
|
if (current.value > 0) {
|
||||||
@@ -20,18 +25,10 @@ const left = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const right = () => {
|
const right = () => {
|
||||||
if (current.value < (sessionStore.session?.hints.length ?? 0) - 1) {
|
if (current.value < length.value - 1) {
|
||||||
current.value += 1
|
current.value += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const length = computed(() => {
|
|
||||||
return sessionStore.session?.hints.length ?? 0
|
|
||||||
})
|
|
||||||
|
|
||||||
const disabled = computed(() => {
|
|
||||||
return current.value === length.value - 1
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -41,7 +38,7 @@ const disabled = computed(() => {
|
|||||||
:icon="['far', 'lightbulb']"
|
:icon="['far', 'lightbulb']"
|
||||||
class="text-yellow-200 p-2 content-center"
|
class="text-yellow-200 p-2 content-center"
|
||||||
/>
|
/>
|
||||||
<h1 class="inline text-text w-1/2 font-xl p-2 m-1">提示</h1>
|
<h1 class="inline text-text w-1/2 font-xl p-2 m-1">提示 {{ length }}</h1>
|
||||||
<div v-if="current !== -1" class="flex w-full justify-end items-end">
|
<div v-if="current !== -1" class="flex w-full justify-end items-end">
|
||||||
<button
|
<button
|
||||||
class="p-2 m-1 w-1/8"
|
class="p-2 m-1 w-1/8"
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ const useSession = defineStore('session', {
|
|||||||
},
|
},
|
||||||
async createSession() {
|
async createSession() {
|
||||||
const session = await createSession(this.questId)
|
const session = await createSession(this.questId)
|
||||||
this.setSession(session)
|
await this.setSession(session)
|
||||||
|
socket.emit('terminal', 'echo start\n')
|
||||||
},
|
},
|
||||||
async getActiveSession() {
|
async getActiveSession() {
|
||||||
const session = await getActiveSession(this.questId)
|
const session = await getActiveSession(this.questId)
|
||||||
|
|||||||
Reference in new issue
Block a user