2026-01-15 13:31:54 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="terminal-hands-on">
|
|
|
|
|
|
<div class="lab-container">
|
|
|
|
|
|
<!-- Left Panel: Task Guide -->
|
|
|
|
|
|
<div class="task-panel">
|
|
|
|
|
|
<div class="panel-header">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<span class="panel-title">🎯 实操任务 ({{ currentTaskIndex + 1 }}/{{ tasks.length }})</span>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<div class="os-selector">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<select
|
|
|
|
|
|
v-model="currentOS"
|
|
|
|
|
|
@change="resetCurrentTask"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="mac">
|
|
|
|
|
|
macOS
|
|
|
|
|
|
</option>
|
|
|
|
|
|
<option value="win-ps">
|
|
|
|
|
|
Windows PowerShell
|
|
|
|
|
|
</option>
|
|
|
|
|
|
<option value="win-cmd">
|
|
|
|
|
|
Windows CMD
|
|
|
|
|
|
</option>
|
|
|
|
|
|
<option value="linux">
|
|
|
|
|
|
Linux
|
|
|
|
|
|
</option>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="task-content">
|
|
|
|
|
|
<h3>{{ currentTask.title }}</h3>
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<p class="task-desc">
|
|
|
|
|
|
{{ currentTask.description }}
|
|
|
|
|
|
</p>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<div class="ai-helper">
|
2026-01-15 14:11:44 +08:00
|
|
|
|
<div class="ai-header">
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<span class="ai-icon">🤖</span>
|
|
|
|
|
|
<span class="ai-title">不知道怎么写?问问 AI</span>
|
|
|
|
|
|
</div>
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-show="isAiOpen"
|
|
|
|
|
|
class="ai-chat"
|
|
|
|
|
|
>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<div class="chat-bubble user">
|
|
|
|
|
|
{{ currentTask.aiQuery }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="chat-bubble ai">
|
2026-01-16 19:10:21 +08:00
|
|
|
|
<p>
|
|
|
|
|
|
{{
|
|
|
|
|
|
currentTask.aiResponse[currentOS] ||
|
2026-02-18 17:38:10 +08:00
|
|
|
|
currentTask.aiResponse.common
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}}
|
|
|
|
|
|
</p>
|
2026-01-15 14:11:44 +08:00
|
|
|
|
<!-- Multiple Commands Support -->
|
2026-01-16 19:10:21 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="currentTask.commands && currentTask.commands[currentOS]"
|
|
|
|
|
|
class="cmd-buttons"
|
|
|
|
|
|
>
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-for="(cmdItem, idx) in currentTask.commands[currentOS]"
|
2026-01-15 14:11:44 +08:00
|
|
|
|
:key="idx"
|
2026-01-16 19:10:21 +08:00
|
|
|
|
class="copy-btn"
|
2026-01-15 14:11:44 +08:00
|
|
|
|
@click="copyCommand(cmdItem.cmd)"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ cmdItem.label || '复制命令' }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- Fallback for Single Command -->
|
2026-01-16 19:10:21 +08:00
|
|
|
|
<button
|
2026-01-15 14:11:44 +08:00
|
|
|
|
v-else-if="currentTask.expectedCmd"
|
2026-01-16 19:10:21 +08:00
|
|
|
|
class="copy-btn"
|
2026-02-19 10:54:31 +08:00
|
|
|
|
@click="copyCurrentTaskCommand"
|
2026-01-15 14:11:44 +08:00
|
|
|
|
>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
复制命令
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="!isTaskCompleted"
|
|
|
|
|
|
class="expected-result"
|
|
|
|
|
|
>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<span class="label">预期目标:</span>
|
|
|
|
|
|
<span class="value">{{ currentTask.goal }}</span>
|
|
|
|
|
|
</div>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="isTaskCompleted"
|
|
|
|
|
|
class="success-message"
|
|
|
|
|
|
>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<span class="icon">🎉</span>
|
|
|
|
|
|
<span>太棒了!任务完成!</span>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
<button
|
2026-02-18 17:38:10 +08:00
|
|
|
|
v-if="currentTaskIndex < tasks.length - 1"
|
2026-01-16 19:10:21 +08:00
|
|
|
|
class="next-btn"
|
|
|
|
|
|
@click="nextTask"
|
|
|
|
|
|
>
|
|
|
|
|
|
下一关
|
|
|
|
|
|
</button>
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<button
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="reset-btn"
|
|
|
|
|
|
@click="resetAll"
|
|
|
|
|
|
>
|
|
|
|
|
|
重新开始
|
|
|
|
|
|
</button>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Right Panel: Terminal Emulator -->
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="terminal-panel"
|
|
|
|
|
|
:class="currentOS"
|
|
|
|
|
|
>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<div class="terminal-header">
|
|
|
|
|
|
<div class="dots">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<span class="dot red" />
|
|
|
|
|
|
<span class="dot yellow" />
|
|
|
|
|
|
<span class="dot green" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="title">
|
|
|
|
|
|
{{ terminalTitle }}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
ref="terminalBody"
|
|
|
|
|
|
class="terminal-body"
|
|
|
|
|
|
@click="focusInput"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="(line, index) in history"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
class="line"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-if="line.type === 'input'"
|
|
|
|
|
|
class="prompt"
|
|
|
|
|
|
>{{
|
2026-01-16 19:10:21 +08:00
|
|
|
|
line.prompt
|
|
|
|
|
|
}}</span>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<span :class="line.type">{{ line.content }}</span>
|
|
|
|
|
|
</div>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="!isTaskCompleted || currentTaskIndex < tasks.length - 1"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
class="line input-line"
|
2026-01-16 19:10:21 +08:00
|
|
|
|
>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
<span class="prompt">{{ prompt }}</span>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
<input
|
2026-01-15 13:31:54 +08:00
|
|
|
|
ref="cmdInput"
|
2026-01-16 19:10:21 +08:00
|
|
|
|
v-model="inputCmd"
|
|
|
|
|
|
type="text"
|
2026-01-15 13:31:54 +08:00
|
|
|
|
spellcheck="false"
|
|
|
|
|
|
autocomplete="off"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
@keydown.enter="executeCommand"
|
|
|
|
|
|
@keydown.tab.prevent
|
2026-01-16 19:10:21 +08:00
|
|
|
|
>
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<span
|
|
|
|
|
|
v-if="inputCmd.length > 0"
|
|
|
|
|
|
class="enter-hint"
|
|
|
|
|
|
>⏎ 按回车执行</span>
|
2026-01-15 13:31:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, computed, nextTick, watch } from 'vue'
|
|
|
|
|
|
|
|
|
|
|
|
const currentOS = ref('win-cmd')
|
|
|
|
|
|
const currentTaskIndex = ref(0)
|
2026-01-15 14:11:44 +08:00
|
|
|
|
const isAiOpen = ref(true)
|
2026-01-15 13:31:54 +08:00
|
|
|
|
const inputCmd = ref('')
|
|
|
|
|
|
const history = ref([])
|
|
|
|
|
|
const cmdInput = ref(null)
|
|
|
|
|
|
const terminalBody = ref(null)
|
|
|
|
|
|
|
|
|
|
|
|
// System Configurations
|
|
|
|
|
|
const osConfig = {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: { prompt: 'user@MacBook ~ % ', title: 'user — -zsh' },
|
2026-01-15 13:31:54 +08:00
|
|
|
|
'win-ps': { prompt: 'PS C:\\Users\\User> ', title: 'Windows PowerShell' },
|
|
|
|
|
|
'win-cmd': { prompt: 'C:\\Users\\User> ', title: 'Command Prompt' },
|
2026-01-16 19:10:21 +08:00
|
|
|
|
linux: { prompt: 'user@localhost:~$ ', title: 'user@localhost: ~' }
|
2026-01-15 13:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const prompt = computed(() => osConfig[currentOS.value].prompt)
|
|
|
|
|
|
const terminalTitle = computed(() => osConfig[currentOS.value].title)
|
|
|
|
|
|
|
|
|
|
|
|
// Tasks Definition
|
|
|
|
|
|
const tasks = [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '第一步:看看这里有什么',
|
|
|
|
|
|
description: '在对文件进行操作之前,我们首先需要知道当前目录下有哪些文件。',
|
|
|
|
|
|
goal: '列出当前目录下的所有文件。',
|
|
|
|
|
|
aiQuery: '我想查看当前目录下的文件,应该用什么命令?',
|
|
|
|
|
|
aiResponse: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: '在 macOS 和 Linux 中,查看文件列表使用 `ls` 命令 (List)。',
|
|
|
|
|
|
linux: '在 macOS 和 Linux 中,查看文件列表使用 `ls` 命令 (List)。',
|
2026-01-15 13:31:54 +08:00
|
|
|
|
'win-ps': '在 PowerShell 中,你可以使用 `ls` 或 `dir` 命令。',
|
|
|
|
|
|
'win-cmd': '在 Windows CMD 中,查看文件列表使用 `dir` 命令 (Directory)。',
|
2026-01-16 19:10:21 +08:00
|
|
|
|
common: '通常使用 ls 或 dir。'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
expectedCmd: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: 'ls',
|
|
|
|
|
|
linux: 'ls',
|
|
|
|
|
|
'win-ps': 'ls',
|
|
|
|
|
|
'win-cmd': 'dir'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
validate: (cmd, os) => {
|
|
|
|
|
|
const valid = os === 'win-cmd' ? ['dir'] : ['ls', 'dir', 'll']
|
|
|
|
|
|
return valid.includes(cmd.trim().toLowerCase())
|
|
|
|
|
|
},
|
|
|
|
|
|
output: (os) => {
|
|
|
|
|
|
if (os === 'win-cmd' || os === 'win-ps') {
|
|
|
|
|
|
return `
|
|
|
|
|
|
Directory: C:\\Users\\User
|
|
|
|
|
|
|
|
|
|
|
|
Mode LastWriteTime Length Name
|
|
|
|
|
|
---- ------------- ------ ----
|
|
|
|
|
|
d---- 1/15/2026 9:00 AM Documents
|
|
|
|
|
|
d---- 1/15/2026 9:00 AM Downloads
|
|
|
|
|
|
-a--- 1/15/2026 9:00 AM 128 todo.txt`
|
|
|
|
|
|
}
|
|
|
|
|
|
return `Documents Downloads todo.txt`
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '第二步:创建一个新家',
|
2026-01-16 19:10:21 +08:00
|
|
|
|
description:
|
|
|
|
|
|
'文件太多会很乱,我们创建一个专门的文件夹来存放今天的练习文件。',
|
2026-01-15 13:31:54 +08:00
|
|
|
|
goal: '创建一个名为 "demo" 的文件夹。',
|
|
|
|
|
|
aiQuery: '怎么创建一个新的文件夹?名字叫 demo。',
|
|
|
|
|
|
aiResponse: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
common:
|
|
|
|
|
|
'创建文件夹(目录)的命令是 `mkdir` (Make Directory)。你可以输入 `mkdir demo`。'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
expectedCmd: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
common: 'mkdir demo'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
validate: (cmd) => cmd.trim() === 'mkdir demo',
|
|
|
|
|
|
output: () => '' // mkdir usually has no output on success
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '第三步:进入新家',
|
|
|
|
|
|
description: '文件夹建好了,但我们现在还在外面。我们需要“走”进去。',
|
|
|
|
|
|
goal: '进入 "demo" 文件夹。',
|
|
|
|
|
|
aiQuery: '怎么进入刚才建好的 demo 文件夹?',
|
|
|
|
|
|
aiResponse: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
common: '切换目录使用 `cd` 命令 (Change Directory)。输入 `cd demo` 即可。'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
expectedCmd: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
common: 'cd demo'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
validate: (cmd) => cmd.trim() === 'cd demo',
|
|
|
|
|
|
output: () => '' // cd usually has no output, but prompt changes
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '第四步:新建一个文件',
|
|
|
|
|
|
description: '现在我们在 demo 文件夹里了。来创建一个简单的文本文件吧。',
|
|
|
|
|
|
goal: '创建一个名为 "hello.txt" 的文件。',
|
|
|
|
|
|
aiQuery: '我想新建一个空文件叫 hello.txt,怎么做?',
|
|
|
|
|
|
aiResponse: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: '在 Mac/Linux 上,使用 `touch hello.txt` 可以快速创建一个空文件。',
|
|
|
|
|
|
linux: '在 Mac/Linux 上,使用 `touch hello.txt` 可以快速创建一个空文件。',
|
|
|
|
|
|
'win-ps':
|
|
|
|
|
|
'在 PowerShell 中,可以使用 `ni hello.txt` 或 `echo "" > hello.txt`。',
|
|
|
|
|
|
'win-cmd':
|
|
|
|
|
|
'在 CMD 中,可以使用 `type nul > hello.txt` 或 `echo. > hello.txt`。'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
expectedCmd: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: 'touch hello.txt',
|
|
|
|
|
|
linux: 'touch hello.txt',
|
2026-01-15 13:31:54 +08:00
|
|
|
|
'win-ps': 'ni hello.txt',
|
|
|
|
|
|
'win-cmd': 'type nul > hello.txt'
|
|
|
|
|
|
},
|
|
|
|
|
|
validate: (cmd, os) => {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
if (
|
|
|
|
|
|
cmd.includes('touch') ||
|
|
|
|
|
|
cmd.includes('echo') ||
|
|
|
|
|
|
cmd.includes('ni') ||
|
|
|
|
|
|
cmd.includes('type')
|
|
|
|
|
|
) {
|
2026-01-15 13:31:54 +08:00
|
|
|
|
return cmd.includes('hello.txt')
|
|
|
|
|
|
}
|
|
|
|
|
|
return false
|
|
|
|
|
|
},
|
|
|
|
|
|
output: () => ''
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2026-01-15 14:11:44 +08:00
|
|
|
|
title: '第五步:安装程序 (系统软件 & Python库)',
|
2026-01-16 19:10:21 +08:00
|
|
|
|
description:
|
|
|
|
|
|
'终端不仅能管理文件,还能安装软件。我们来尝试两种常见的安装场景:安装系统工具(如 wget/git)和安装 Python 库(如 requests)。',
|
2026-01-15 14:11:44 +08:00
|
|
|
|
goal: '任选其一:安装系统工具或 Python 库。',
|
|
|
|
|
|
aiQuery: '怎么用命令行安装软件?我想装 git 或者 python 的 requests 库。',
|
2026-01-15 13:31:54 +08:00
|
|
|
|
aiResponse: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: 'macOS 推荐使用 Homebrew 安装系统软件,使用 pip 安装 Python 库。',
|
|
|
|
|
|
linux:
|
|
|
|
|
|
'Linux (Ubuntu/Debian) 使用 apt 安装系统软件,使用 pip 安装 Python 库。',
|
|
|
|
|
|
'win-ps':
|
|
|
|
|
|
'Windows PowerShell 推荐使用 winget 安装系统软件,使用 pip 安装 Python 库。',
|
|
|
|
|
|
'win-cmd':
|
|
|
|
|
|
'Windows CMD 推荐使用 winget 安装系统软件,使用 pip 安装 Python 库。',
|
|
|
|
|
|
common: '不同系统有不同的包管理器。'
|
2026-01-15 14:11:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
commands: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: [
|
2026-01-15 14:11:44 +08:00
|
|
|
|
{ label: '安装 wget (系统)', cmd: 'brew install wget' },
|
|
|
|
|
|
{ label: '安装 requests (Python)', cmd: 'pip install requests' }
|
|
|
|
|
|
],
|
2026-01-16 19:10:21 +08:00
|
|
|
|
linux: [
|
2026-01-15 14:11:44 +08:00
|
|
|
|
{ label: '安装 git (系统)', cmd: 'sudo apt install git' },
|
|
|
|
|
|
{ label: '安装 requests (Python)', cmd: 'pip install requests' }
|
|
|
|
|
|
],
|
|
|
|
|
|
'win-ps': [
|
2026-01-15 20:10:19 +08:00
|
|
|
|
{ label: '安装 git (系统)', cmd: 'winget install git.git' },
|
2026-01-15 14:11:44 +08:00
|
|
|
|
{ label: '安装 requests (Python)', cmd: 'pip install requests' }
|
|
|
|
|
|
],
|
|
|
|
|
|
'win-cmd': [
|
2026-01-15 20:10:19 +08:00
|
|
|
|
{ label: '安装 git (系统)', cmd: 'winget install git.git' },
|
2026-01-15 14:11:44 +08:00
|
|
|
|
{ label: '安装 requests (Python)', cmd: 'pip install requests' }
|
|
|
|
|
|
]
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
expectedCmd: {
|
2026-01-15 14:11:44 +08:00
|
|
|
|
// Fallback/Legacy
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: 'brew install wget',
|
|
|
|
|
|
linux: 'sudo apt install git',
|
2026-01-15 14:11:44 +08:00
|
|
|
|
'win-ps': 'pip install requests',
|
|
|
|
|
|
'win-cmd': 'pip install requests'
|
|
|
|
|
|
},
|
|
|
|
|
|
validate: (cmd, os) => {
|
|
|
|
|
|
const c = cmd.trim()
|
2026-01-16 19:10:21 +08:00
|
|
|
|
if (os === 'mac')
|
|
|
|
|
|
return c === 'brew install wget' || c === 'pip install requests'
|
|
|
|
|
|
if (os === 'linux')
|
|
|
|
|
|
return (
|
|
|
|
|
|
c === 'sudo apt install git' ||
|
|
|
|
|
|
c === 'apt install git' ||
|
|
|
|
|
|
c === 'pip install requests'
|
|
|
|
|
|
)
|
|
|
|
|
|
if (os === 'win-ps' || os === 'win-cmd')
|
|
|
|
|
|
return (
|
|
|
|
|
|
c === 'winget install git.git' ||
|
|
|
|
|
|
c === 'winget install git' ||
|
|
|
|
|
|
c === 'pip install requests'
|
|
|
|
|
|
)
|
2026-01-15 14:11:44 +08:00
|
|
|
|
return c === 'pip install requests'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
2026-01-16 19:10:21 +08:00
|
|
|
|
output: (os, cmd) => {
|
|
|
|
|
|
// Modified to accept cmd
|
2026-01-15 14:11:44 +08:00
|
|
|
|
const c = cmd ? cmd.trim() : ''
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-01-15 14:11:44 +08:00
|
|
|
|
// Python requests output
|
|
|
|
|
|
if (c.includes('pip install requests')) {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
return `
|
2026-01-15 13:31:54 +08:00
|
|
|
|
Downloading/unpacking requests
|
|
|
|
|
|
Downloading requests-2.31.0-py3-none-any.whl (62kB): 62kB downloaded
|
|
|
|
|
|
Installing collected packages: requests
|
|
|
|
|
|
Successfully installed requests
|
|
|
|
|
|
Cleaning up...`
|
2026-01-15 14:11:44 +08:00
|
|
|
|
}
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-01-15 20:10:19 +08:00
|
|
|
|
// Windows winget output
|
|
|
|
|
|
if (c.includes('winget install')) {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
return `
|
2026-01-15 20:10:19 +08:00
|
|
|
|
Found Git [Git.Git] Version 2.43.0
|
|
|
|
|
|
This application is licensed to you by its owner.
|
|
|
|
|
|
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
|
|
|
|
|
|
Downloading https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/Git-2.43.0-64-bit.exe
|
|
|
|
|
|
██████████████████████████████ 58.2 MB / 58.2 MB
|
|
|
|
|
|
Successfully verified installer hash
|
|
|
|
|
|
Starting package install...
|
|
|
|
|
|
Successfully installed`
|
|
|
|
|
|
}
|
2026-01-15 14:11:44 +08:00
|
|
|
|
|
|
|
|
|
|
// System tools output
|
|
|
|
|
|
if (os === 'mac') {
|
|
|
|
|
|
return `
|
|
|
|
|
|
==> Downloading https://ghcr.io/v2/homebrew/core/wget/manifests/1.21.4
|
|
|
|
|
|
######################################################################## 100.0%
|
|
|
|
|
|
==> Installing wget
|
|
|
|
|
|
🍺 /usr/local/Cellar/wget/1.21.4: 90 files, 4.2MB`
|
|
|
|
|
|
}
|
|
|
|
|
|
if (os === 'linux') {
|
|
|
|
|
|
return `
|
|
|
|
|
|
Reading package lists... Done
|
|
|
|
|
|
Building dependency tree... Done
|
|
|
|
|
|
The following NEW packages will be installed:
|
|
|
|
|
|
git
|
|
|
|
|
|
0 upgraded, 1 newly installed, 0 to remove.
|
|
|
|
|
|
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 git amd64 1:2.34.1 [3MB]
|
|
|
|
|
|
Fetched 3MB in 1s (2560 kB/s)
|
|
|
|
|
|
Setting up git (1:2.34.1-1ubuntu1.9) ...`
|
|
|
|
|
|
}
|
|
|
|
|
|
return `Successfully installed.`
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '第六步:打扫战场',
|
|
|
|
|
|
description: '练习结束了,我们把刚才创建的文件删除掉,保持环境整洁。',
|
|
|
|
|
|
goal: '删除 "hello.txt" 文件。',
|
|
|
|
|
|
aiQuery: '我不想要 hello.txt 了,怎么删除它?',
|
|
|
|
|
|
aiResponse: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: '删除文件使用 `rm` 命令 (Remove)。小心,这个操作通常不可撤销!输入 `rm hello.txt`。',
|
|
|
|
|
|
linux:
|
|
|
|
|
|
'删除文件使用 `rm` 命令 (Remove)。小心,这个操作通常不可撤销!输入 `rm hello.txt`。',
|
2026-01-15 13:31:54 +08:00
|
|
|
|
'win-ps': '在 PowerShell 中使用 `rm` 或 `del`。输入 `rm hello.txt`。',
|
2026-01-16 19:10:21 +08:00
|
|
|
|
'win-cmd': '在 CMD 中使用 `del` 命令 (Delete)。输入 `del hello.txt`。'
|
2026-01-15 13:31:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
expectedCmd: {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
mac: 'rm hello.txt',
|
|
|
|
|
|
linux: 'rm hello.txt',
|
2026-01-15 13:31:54 +08:00
|
|
|
|
'win-ps': 'rm hello.txt',
|
|
|
|
|
|
'win-cmd': 'del hello.txt'
|
|
|
|
|
|
},
|
|
|
|
|
|
validate: (cmd, os) => {
|
|
|
|
|
|
const c = cmd.trim()
|
|
|
|
|
|
return c === 'rm hello.txt' || c === 'del hello.txt'
|
|
|
|
|
|
},
|
|
|
|
|
|
output: () => ''
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
const currentTask = computed(() => tasks[currentTaskIndex.value])
|
|
|
|
|
|
const isTaskCompleted = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
const toggleAi = () => {
|
|
|
|
|
|
isAiOpen.value = !isAiOpen.value
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const copyCommand = (cmd) => {
|
|
|
|
|
|
inputCmd.value = cmd
|
|
|
|
|
|
focusInput()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-19 10:54:31 +08:00
|
|
|
|
const copyCurrentTaskCommand = () => {
|
|
|
|
|
|
const cmd = currentTask.value.expectedCmd[currentOS.value] || currentTask.value.expectedCmd.common
|
|
|
|
|
|
copyCommand(cmd)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 13:31:54 +08:00
|
|
|
|
const focusInput = () => {
|
|
|
|
|
|
if (cmdInput.value) {
|
|
|
|
|
|
cmdInput.value.focus()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const scrollToBottom = () => {
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
if (terminalBody.value) {
|
|
|
|
|
|
terminalBody.value.scrollTop = terminalBody.value.scrollHeight
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const executeCommand = () => {
|
|
|
|
|
|
const cmd = inputCmd.value
|
|
|
|
|
|
if (!cmd.trim()) return
|
|
|
|
|
|
|
|
|
|
|
|
// 1. Add to history
|
|
|
|
|
|
let currentPrompt = prompt.value
|
|
|
|
|
|
// Special handling for prompt update simulation (hacky way)
|
2026-01-16 19:10:21 +08:00
|
|
|
|
if (
|
|
|
|
|
|
currentTaskIndex.value >= 2 &&
|
|
|
|
|
|
currentTaskIndex.value < 6 &&
|
|
|
|
|
|
history.value.length > 0
|
|
|
|
|
|
) {
|
|
|
|
|
|
// If we are inside demo folder
|
|
|
|
|
|
if (currentOS.value === 'mac') currentPrompt = 'user@MacBook demo % '
|
|
|
|
|
|
else if (currentOS.value === 'linux')
|
|
|
|
|
|
currentPrompt = 'user@localhost:~/demo$ '
|
|
|
|
|
|
else if (currentOS.value === 'win-ps')
|
|
|
|
|
|
currentPrompt = 'PS C:\\Users\\User\\demo> '
|
|
|
|
|
|
else currentPrompt = 'C:\\Users\\User\\demo> '
|
2026-01-15 13:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
history.value.push({ type: 'input', prompt: currentPrompt, content: cmd })
|
|
|
|
|
|
inputCmd.value = ''
|
|
|
|
|
|
|
|
|
|
|
|
// 2. Process Command
|
|
|
|
|
|
// Check if it matches current task requirement
|
2026-01-16 19:10:21 +08:00
|
|
|
|
if (
|
|
|
|
|
|
!isTaskCompleted.value &&
|
|
|
|
|
|
currentTask.value.validate(cmd, currentOS.value)
|
|
|
|
|
|
) {
|
2026-01-15 13:31:54 +08:00
|
|
|
|
// Success
|
2026-01-15 14:11:44 +08:00
|
|
|
|
const out = currentTask.value.output(currentOS.value, cmd) // Pass cmd to output
|
2026-01-15 13:31:54 +08:00
|
|
|
|
if (out) {
|
|
|
|
|
|
history.value.push({ type: 'output', content: out })
|
|
|
|
|
|
}
|
|
|
|
|
|
isTaskCompleted.value = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Failure or just random command
|
|
|
|
|
|
// Simple mock responses for common commands if not matching task
|
|
|
|
|
|
if (cmd.trim() === 'ls' || cmd.trim() === 'dir') {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
if (currentTaskIndex.value < 2) {
|
|
|
|
|
|
// Initial state
|
|
|
|
|
|
history.value.push({
|
|
|
|
|
|
type: 'output',
|
|
|
|
|
|
content: tasks[0].output(currentOS.value)
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (currentTaskIndex.value >= 2) {
|
|
|
|
|
|
// Inside demo
|
|
|
|
|
|
if (currentTaskIndex.value === 3)
|
|
|
|
|
|
history.value.push({ type: 'output', content: '' }) // empty
|
|
|
|
|
|
else history.value.push({ type: 'output', content: 'hello.txt' })
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
} else if (cmd.trim() === 'clear' || cmd.trim() === 'cls') {
|
|
|
|
|
|
history.value = []
|
|
|
|
|
|
} else if (!isTaskCompleted.value) {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
history.value.push({
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
content: `Command not found or not matching task: ${cmd}`
|
|
|
|
|
|
})
|
|
|
|
|
|
history.value.push({
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
content: `💡 提示:试试点击左侧的“问问 AI”?`
|
|
|
|
|
|
})
|
2026-01-15 13:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
scrollToBottom()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const nextTask = () => {
|
|
|
|
|
|
if (currentTaskIndex.value < tasks.length - 1) {
|
|
|
|
|
|
currentTaskIndex.value++
|
|
|
|
|
|
isTaskCompleted.value = false
|
|
|
|
|
|
// Clear history to keep it clean? Or keep it? Let's keep it but maybe add a separator
|
2026-01-16 19:10:21 +08:00
|
|
|
|
history.value.push({
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
content: `--- 进入下一关: ${currentTask.value.title} ---`
|
|
|
|
|
|
})
|
2026-01-15 13:31:54 +08:00
|
|
|
|
scrollToBottom()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const resetCurrentTask = () => {
|
|
|
|
|
|
isTaskCompleted.value = false
|
|
|
|
|
|
inputCmd.value = ''
|
|
|
|
|
|
history.value = []
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const resetAll = () => {
|
|
|
|
|
|
currentTaskIndex.value = 0
|
|
|
|
|
|
resetCurrentTask()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
watch(currentOS, () => {
|
|
|
|
|
|
// When OS changes, prompt changes, reset history to look consistent
|
|
|
|
|
|
resetCurrentTask()
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.terminal-hands-on {
|
|
|
|
|
|
margin: 2rem 0;
|
|
|
|
|
|
font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.lab-container {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
|
gap: 20px;
|
|
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
overflow: hidden;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
2026-01-15 13:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.lab-container {
|
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Left Panel */
|
|
|
|
|
|
.task-panel {
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
border-right: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-title {
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: var(--vp-c-brand);
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.os-selector select {
|
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-content h3 {
|
|
|
|
|
|
margin: 0 0 10px 0;
|
|
|
|
|
|
font-size: 1.2rem;
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.task-desc {
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* AI Helper */
|
|
|
|
|
|
.ai-helper {
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-radius: 6px;
|
2026-01-15 13:31:54 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ai-header {
|
|
|
|
|
|
padding: 10px 15px;
|
|
|
|
|
|
background: linear-gradient(to right, rgba(16, 185, 129, 0.1), transparent);
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
|
|
|
|
|
transition: background 0.2s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ai-header:hover {
|
|
|
|
|
|
background: linear-gradient(to right, rgba(16, 185, 129, 0.2), transparent);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ai-chat {
|
|
|
|
|
|
padding: 15px;
|
|
|
|
|
|
border-top: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
background: var(--vp-c-bg-alt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.chat-bubble {
|
|
|
|
|
|
padding: 8px 12px;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-radius: 6px;
|
2026-01-15 13:31:54 +08:00
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
max-width: 90%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.chat-bubble.user {
|
|
|
|
|
|
background: var(--vp-c-bg-mute);
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
border-bottom-right-radius: 2px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.chat-bubble.ai {
|
|
|
|
|
|
background: var(--vp-c-brand-soft);
|
|
|
|
|
|
color: var(--vp-c-brand-dark);
|
|
|
|
|
|
margin-right: auto;
|
|
|
|
|
|
border-bottom-left-radius: 2px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 14:11:44 +08:00
|
|
|
|
.cmd-buttons {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 13:31:54 +08:00
|
|
|
|
.copy-btn {
|
|
|
|
|
|
font-size: 0.8rem;
|
2026-01-15 14:11:44 +08:00
|
|
|
|
padding: 4px 10px;
|
2026-01-15 13:31:54 +08:00
|
|
|
|
border: 1px solid var(--vp-c-brand);
|
|
|
|
|
|
color: var(--vp-c-brand);
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
cursor: pointer;
|
2026-01-15 14:11:44 +08:00
|
|
|
|
text-align: left;
|
2026-01-15 13:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.copy-btn:hover {
|
|
|
|
|
|
background: var(--vp-c-brand);
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Result & Success */
|
|
|
|
|
|
.expected-result {
|
|
|
|
|
|
margin-top: auto;
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
background: var(--vp-c-bg-mute);
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.expected-result .label {
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.success-message {
|
|
|
|
|
|
margin-top: auto;
|
|
|
|
|
|
padding: 15px;
|
|
|
|
|
|
background: rgba(16, 185, 129, 0.1);
|
|
|
|
|
|
border: 1px solid rgba(16, 185, 129, 0.2);
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-radius: 6px;
|
2026-01-15 13:31:54 +08:00
|
|
|
|
color: #10b981;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
animation: slideIn 0.3s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes slideIn {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
from {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
transform: translateY(10px);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.next-btn,
|
|
|
|
|
|
.reset-btn {
|
2026-01-15 13:31:54 +08:00
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
padding: 6px 16px;
|
|
|
|
|
|
background: #10b981;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 20px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
transition: transform 0.1s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.next-btn:hover,
|
|
|
|
|
|
.reset-btn:hover {
|
2026-01-15 13:31:54 +08:00
|
|
|
|
transform: scale(1.05);
|
|
|
|
|
|
background: #059669;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Right Panel: Terminal */
|
|
|
|
|
|
.terminal-panel {
|
|
|
|
|
|
background: #1e1e1e;
|
|
|
|
|
|
color: #f0f0f0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
min-height: 400px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.terminal-panel.win-cmd {
|
|
|
|
|
|
background: #0c0c0c;
|
|
|
|
|
|
color: #cccccc;
|
|
|
|
|
|
font-family: 'Consolas', monospace;
|
|
|
|
|
|
}
|
|
|
|
|
|
.terminal-panel.win-ps {
|
|
|
|
|
|
background: #012456;
|
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
font-family: 'Consolas', monospace;
|
|
|
|
|
|
}
|
|
|
|
|
|
.terminal-panel.mac,
|
|
|
|
|
|
.terminal-panel.linux {
|
|
|
|
|
|
background: #2b2b2b;
|
|
|
|
|
|
color: #f0f0f0;
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
|
|
|
|
|
|
.terminal-header {
|
|
|
|
|
|
padding: 8px 12px;
|
|
|
|
|
|
background: rgba(255, 255, 255, 0.1);
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dots {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dot {
|
|
|
|
|
|
width: 12px;
|
|
|
|
|
|
height: 12px;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
}
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.dot.red {
|
|
|
|
|
|
background: #ff5f56;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dot.yellow {
|
|
|
|
|
|
background: #ffbd2e;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dot.green {
|
|
|
|
|
|
background: #27c93f;
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.terminal-panel.win-cmd .dot,
|
|
|
|
|
|
.terminal-panel.win-ps .dot {
|
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
|
background: #ccc;
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
|
|
|
|
|
|
.terminal-header .title {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.6);
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.terminal-body {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
padding: 10px;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
|
2026-01-15 13:31:54 +08:00
|
|
|
|
cursor: text;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.line {
|
|
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.prompt {
|
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
color: #87d700;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.terminal-panel.win-cmd .prompt {
|
|
|
|
|
|
color: #cccccc;
|
|
|
|
|
|
}
|
|
|
|
|
|
.terminal-panel.win-ps .prompt {
|
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
}
|
2026-01-15 13:31:54 +08:00
|
|
|
|
|
|
|
|
|
|
.input-line {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.input-line input {
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
color: inherit;
|
|
|
|
|
|
font-family: inherit;
|
|
|
|
|
|
font-size: inherit;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 14:11:44 +08:00
|
|
|
|
.enter-hint {
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
|
animation: blink 1.5s infinite;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes blink {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
0%,
|
|
|
|
|
|
100% {
|
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
|
}
|
|
|
|
|
|
50% {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
}
|
2026-01-15 14:11:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 13:31:54 +08:00
|
|
|
|
.line.output {
|
|
|
|
|
|
color: inherit;
|
|
|
|
|
|
opacity: 0.9;
|
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.line.error {
|
|
|
|
|
|
color: #ff5f56;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.line.info {
|
|
|
|
|
|
color: #27c93f;
|
|
|
|
|
|
margin: 8px 0;
|
|
|
|
|
|
font-style: italic;
|
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|