|
9 | 9 | </div> |
10 | 10 | <h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-2 transition-all duration-600 delay-100">CodeForge</h2> |
11 | 11 | <p class="text-gray-600 dark:text-gray-400 mb-4 transition-all duration-600 delay-200">CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发者、学生和编程爱好者设计。</p> |
| 12 | + |
| 13 | + <!-- GitHub Actions --> |
| 14 | + <div class="flex justify-center gap-3 mt-4"> |
| 15 | + <Button @click="starRepository" type="warning" :icon="Star" class="transition-all duration-200 transform hover:scale-105 hover:shadow-lg"> |
| 16 | + 给个 Star |
| 17 | + </Button> |
| 18 | + <Button @click="openGitHubRepo" :icon="GithubIcon" class="transition-all duration-200 transform hover:scale-105 hover:shadow-lg"> |
| 19 | + 查看源码 |
| 20 | + </Button> |
| 21 | + <Button @click="reportIssue" type="danger" :icon="Bug" class="transition-all duration-200 transform hover:scale-105 hover:shadow-lg"> |
| 22 | + 报告问题 |
| 23 | + </Button> |
| 24 | + </div> |
12 | 25 | </div> |
13 | 26 |
|
14 | 27 | <!-- 版本信息 --> |
|
70 | 83 | </template> |
71 | 84 |
|
72 | 85 | <script setup lang="ts"> |
73 | | -import { nextTick, onMounted, ref, watch } from 'vue' |
74 | | -import { invoke } from '@tauri-apps/api/core' |
75 | | -import { open } from '@tauri-apps/plugin-shell' |
| 86 | +import { onMounted } from 'vue' |
76 | 87 | import Modal from '../ui/Modal.vue' |
77 | | -
|
78 | | -interface AppInfo |
79 | | -{ |
80 | | - version: string |
81 | | - build_time: string |
82 | | - platform: string |
83 | | - arch: string |
84 | | -} |
85 | | -
|
86 | | -const platform = ref('Unknown') |
87 | | -const version = ref('1.0.0') |
88 | | -const buildTime = ref('2025-08-09') |
89 | | -const isVisible = ref(false) |
90 | | -
|
91 | | -const features = [ |
92 | | - '多语言代码执行支持', |
93 | | - '智能语法高亮系统', |
94 | | - '实时执行统计分析', |
95 | | - '现代化用户界面' |
96 | | -] |
97 | | -
|
98 | | -const techStack = [ |
99 | | - { name: 'Vue 3', class: 'bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200', url: 'https://vuejs.org' }, |
100 | | - { name: 'TypeScript', class: 'bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200', url: 'https://www.typescriptlang.org' }, |
101 | | - { name: 'Tauri', class: 'bg-purple-100 dark:bg-purple-900/50 text-purple-800 dark:text-purple-200', url: 'https://tauri.app' }, |
102 | | - { name: 'Rust', class: 'bg-orange-100 dark:bg-orange-900/50 text-orange-800 dark:text-orange-200', url: 'https://www.rust-lang.org' }, |
103 | | - { name: 'Tailwind CSS', class: 'bg-cyan-100 dark:bg-cyan-900/50 text-cyan-800 dark:text-cyan-200', url: 'https://tailwindcss.com' } |
104 | | -] |
| 88 | +import { useAboutModal } from '../composables/useAboutModal' |
| 89 | +import Button from '../ui/Button.vue' |
| 90 | +import { Bug, GithubIcon, Star } from 'lucide-vue-next' |
105 | 91 |
|
106 | 92 | const emit = defineEmits<{ |
107 | 93 | close: [] |
108 | 94 | }>() |
109 | 95 |
|
110 | | -const closeAbout = () => { |
111 | | - isVisible.value = false |
112 | | - setTimeout(() => { |
113 | | - emit('close') |
114 | | - }, 300) |
115 | | -} |
116 | | -
|
117 | | -const openTechUrl = async (url: string) => { |
118 | | - try { |
119 | | - console.log('Opening URL:', url) |
120 | | - await open(url) |
121 | | - } |
122 | | - catch (error) { |
123 | | - console.error('Failed to open URL:', error) |
124 | | - } |
125 | | -} |
126 | | -
|
127 | | -const loadAppInfo = async () => { |
128 | | - try { |
129 | | - const appInfo: AppInfo = await invoke('get_app_info') |
130 | | - version.value = appInfo.version |
131 | | - buildTime.value = appInfo.build_time |
132 | | - platform.value = `${ appInfo.platform } (${ appInfo.arch })` |
133 | | - } |
134 | | - catch (error) { |
135 | | - console.error('Failed to get app info:', error) |
136 | | - // 使用默认值 |
137 | | - platform.value = navigator.platform |
138 | | - } |
139 | | -} |
140 | | -
|
141 | | -// 监听组件显示状态,当组件重新显示时重置动画 |
142 | | -watch(() => true, () => { |
143 | | - if (!isVisible.value) { |
144 | | - nextTick(() => { |
145 | | - setTimeout(() => { |
146 | | - isVisible.value = true |
147 | | - }, 50) |
148 | | - }) |
149 | | - } |
150 | | -}) |
| 96 | +const { |
| 97 | + isVisible, |
| 98 | + platform, |
| 99 | + version, |
| 100 | + buildTime, |
| 101 | + features, |
| 102 | + techStack, |
| 103 | + openTechUrl, |
| 104 | + openGitHubRepo, |
| 105 | + starRepository, |
| 106 | + reportIssue, |
| 107 | + closeAbout, |
| 108 | + showModal |
| 109 | +} = useAboutModal(emit) |
151 | 110 |
|
152 | 111 | onMounted(async () => { |
153 | | - await loadAppInfo() |
154 | | -
|
155 | | - // 延迟显示动画 |
156 | | - await nextTick() |
157 | | - setTimeout(() => { |
158 | | - isVisible.value = true |
159 | | - }, 50) |
| 112 | + await showModal() |
160 | 113 | }) |
161 | 114 | </script> |
0 commit comments