|
1 | 1 | <template>
|
2 |
| - <div class="fixed inset-0 backdrop-blur-sm bg-white/20 dark:bg-gray-900/20 flex items-center justify-center z-50 transition-all duration-300 ease-out" |
3 |
| - :class="{ 'opacity-0': !isVisible, 'opacity-100': isVisible }"> |
4 |
| - <div |
5 |
| - class="bg-white/95 dark:bg-gray-800/95 backdrop-blur-md rounded-xl shadow-2xl w-6xl h-screen p-6 transform transition-all duration-300 ease-out border border-white/20 dark:border-gray-700/30 max-h-[80vh] overflow-y-auto" |
6 |
| - :class="{ |
7 |
| - 'scale-95 opacity-0 translate-y-4': !isVisible, |
8 |
| - 'scale-100 opacity-100 translate-y-0': isVisible |
9 |
| - }"> |
10 |
| - |
11 |
| - <!-- 头部 --> |
12 |
| - <div class="flex items-center justify-between mb-6"> |
13 |
| - <h2 class="text-xl font-bold text-gray-900 dark:text-white">设置</h2> |
14 |
| - <button |
15 |
| - @click="closeSettings" |
16 |
| - class="text-gray-400 hover:cursor-pointer hover:text-gray-600 dark:hover:text-gray-200 transition-all duration-200 hover:scale-110 rounded-full p-1 hover:bg-gray-200 dark:hover:bg-gray-700"> |
17 |
| - <X class="w-5 h-5"/> |
18 |
| - </button> |
19 |
| - </div> |
20 |
| - |
21 |
| - <!-- 日志设置 --> |
22 |
| - <div class="mb-6"> |
23 |
| - <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center"> |
24 |
| - <FileText class="w-5 h-5 mr-2"/> |
25 |
| - 日志设置 |
26 |
| - </h3> |
27 |
| - |
28 |
| - <div class="space-y-4"> |
29 |
| - <!-- 当前日志目录 --> |
30 |
| - <div> |
31 |
| - <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
32 |
| - 当前日志目录 |
33 |
| - </label> |
34 |
| - <div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 text-sm text-gray-600 dark:text-gray-400 font-mono"> |
35 |
| - {{ currentLogDir || '加载中...' }} |
36 |
| - </div> |
37 |
| - </div> |
38 |
| - |
39 |
| - <!-- 修改日志目录 --> |
40 |
| - <div> |
41 |
| - <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
42 |
| - 选择新的日志目录 |
43 |
| - </label> |
44 |
| - <div class="flex gap-2"> |
45 |
| - <input v-model="newLogDir" |
46 |
| - type="text" |
47 |
| - placeholder="选择或输入日志目录路径" |
48 |
| - class="flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm" |
49 |
| - readonly/> |
50 |
| - |
51 |
| - <Button type="primary" |
52 |
| - :icon-only="true" |
53 |
| - :icon="Folder" |
54 |
| - @click="selectLogDirectory"> |
55 |
| - </Button> |
56 |
| - </div> |
| 2 | + <Modal v-model:show="isVisible" title="设置" size="4xl" :close-on-backdrop="false" :close-on-esc="false" @close="closeSettings"> |
| 3 | + <!-- 日志设置 --> |
| 4 | + <div class="mb-6"> |
| 5 | + <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center"> |
| 6 | + <FileText class="w-5 h-5 mr-2"/> |
| 7 | + 日志设置 |
| 8 | + </h3> |
| 9 | + |
| 10 | + <div class="space-y-4"> |
| 11 | + <!-- 当前日志目录 --> |
| 12 | + <div> |
| 13 | + <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
| 14 | + 当前日志目录 |
| 15 | + </label> |
| 16 | + <div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 text-sm text-gray-600 dark:text-gray-400 font-mono"> |
| 17 | + {{ currentLogDir || '加载中...' }} |
57 | 18 | </div>
|
| 19 | + </div> |
58 | 20 |
|
59 |
| - <!-- 操作按钮 --> |
60 |
| - <div class="flex gap-3 pt-0.5"> |
61 |
| - <Button @click="applyLogDirChange" |
62 |
| - :disabled="!newLogDir || newLogDir === currentLogDir" |
63 |
| - type="secondary"> |
64 |
| - 应用更改 |
65 |
| - </Button> |
66 |
| - <Button @click="openLogDirectory" type="secondary"> |
67 |
| - 打开日志目录 |
68 |
| - </Button> |
69 |
| - <Button @click="resetLogDirectory" |
70 |
| - class="cursor-pointer px-4 py-2 bg-orange-500 hover:bg-orange-600 text-white text-sm font-medium rounded-md transition-colors"> |
71 |
| - 重置为默认 |
| 21 | + <!-- 修改日志目录 --> |
| 22 | + <div> |
| 23 | + <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
| 24 | + 选择新的日志目录 |
| 25 | + </label> |
| 26 | + <div class="flex gap-2"> |
| 27 | + <input v-model="newLogDir" |
| 28 | + type="text" |
| 29 | + placeholder="选择或输入日志目录路径" |
| 30 | + class="flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm" |
| 31 | + readonly/> |
| 32 | + |
| 33 | + <Button type="primary" |
| 34 | + :icon-only="true" |
| 35 | + :icon="Folder" |
| 36 | + @click="selectLogDirectory"> |
72 | 37 | </Button>
|
73 | 38 | </div>
|
| 39 | + </div> |
| 40 | + |
| 41 | + <!-- 操作按钮 --> |
| 42 | + <div class="flex gap-3 pt-0.5"> |
| 43 | + <Button @click="applyLogDirChange" |
| 44 | + :disabled="!newLogDir || newLogDir === currentLogDir" |
| 45 | + type="secondary"> |
| 46 | + 应用更改 |
| 47 | + </Button> |
| 48 | + <Button @click="openLogDirectory" type="secondary"> |
| 49 | + 打开日志目录 |
| 50 | + </Button> |
| 51 | + <Button @click="resetLogDirectory" |
| 52 | + class="cursor-pointer px-4 py-2 bg-orange-500 hover:bg-orange-600 text-white text-sm font-medium rounded-md transition-colors"> |
| 53 | + 重置为默认 |
| 54 | + </Button> |
| 55 | + </div> |
74 | 56 |
|
75 |
| - <!-- 日志文件列表 --> |
76 |
| - <div v-if="logFiles.length > 0"> |
77 |
| - <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
78 |
| - 最近的日志文件 |
79 |
| - </label> |
80 |
| - <div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 max-h-32 overflow-y-auto"> |
81 |
| - <div v-for="file in logFiles.slice(0, 5)" :key="file" |
82 |
| - class="text-sm text-gray-600 dark:text-gray-400 font-mono py-1 hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer" |
83 |
| - @click="openLogFile(file)"> |
84 |
| - {{ file }} |
85 |
| - </div> |
| 57 | + <!-- 日志文件列表 --> |
| 58 | + <div v-if="logFiles.length > 0"> |
| 59 | + <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
| 60 | + 最近的日志文件 |
| 61 | + </label> |
| 62 | + <div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 max-h-32 overflow-y-auto"> |
| 63 | + <div v-for="file in logFiles.slice(0, 5)" :key="file" |
| 64 | + class="text-sm text-gray-600 dark:text-gray-400 font-mono py-1 hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer" |
| 65 | + @click="openLogFile(file)"> |
| 66 | + {{ file }} |
86 | 67 | </div>
|
87 | 68 | </div>
|
88 | 69 | </div>
|
89 | 70 | </div>
|
| 71 | + </div> |
90 | 72 |
|
91 |
| - <!-- 日志管理 --> |
92 |
| - <div class="mb-6"> |
93 |
| - <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center"> |
94 |
| - <Settings2 class="w-5 h-5 mr-2"/> |
95 |
| - 日志管理 |
96 |
| - </h3> |
97 |
| - |
98 |
| - <div class="space-y-4"> |
99 |
| - <!-- 清理旧日志 --> |
100 |
| - <div> |
101 |
| - <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
102 |
| - 自动清理日志 |
103 |
| - </label> |
104 |
| - <div class="flex items-center gap-3"> |
105 |
| - <Select v-model="keepDays" |
106 |
| - class="w-36" |
107 |
| - :options="keepDaysOptions" |
108 |
| - placeholder="选择保留天数"> |
109 |
| - </Select> |
110 |
| - <Button type="danger" @click="clearLogs"> |
111 |
| - 立即清理 |
112 |
| - </Button> |
113 |
| - </div> |
| 73 | + <!-- 日志管理 --> |
| 74 | + <div class="mb-6"> |
| 75 | + <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center"> |
| 76 | + <Settings2 class="w-5 h-5 mr-2"/> |
| 77 | + 日志管理 |
| 78 | + </h3> |
| 79 | + |
| 80 | + <div class="space-y-4"> |
| 81 | + <!-- 清理旧日志 --> |
| 82 | + <div> |
| 83 | + <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> |
| 84 | + 自动清理日志 |
| 85 | + </label> |
| 86 | + <div class="flex items-center gap-3"> |
| 87 | + <Select v-model="keepDays" |
| 88 | + class="w-36" |
| 89 | + :options="keepDaysOptions" |
| 90 | + placeholder="选择保留天数"> |
| 91 | + </Select> |
| 92 | + <Button type="danger" @click="clearLogs"> |
| 93 | + 立即清理 |
| 94 | + </Button> |
114 | 95 | </div>
|
115 | 96 | </div>
|
116 | 97 | </div>
|
117 | 98 | </div>
|
118 |
| - </div> |
| 99 | + </Modal> |
119 | 100 | </template>
|
120 | 101 |
|
121 | 102 | <script setup lang="ts">
|
122 | 103 | import { nextTick, onMounted, ref } from 'vue'
|
123 | 104 | import { invoke } from '@tauri-apps/api/core'
|
124 | 105 | import { open as openDialog } from '@tauri-apps/plugin-dialog'
|
125 | 106 | import { openPath } from '@tauri-apps/plugin-opener'
|
126 |
| -import { FileText, Folder, Settings2, X } from 'lucide-vue-next' |
| 107 | +import { FileText, Folder, Settings2 } from 'lucide-vue-next' |
127 | 108 | import Select from '../ui/Select.vue'
|
128 | 109 | import { useToast } from '../plugins/toast'
|
129 | 110 | import Button from '../ui/Button.vue'
|
| 111 | +import Modal from '../ui/Modal.vue' |
130 | 112 |
|
131 | 113 | const toast = useToast()
|
132 | 114 | const isVisible = ref(false)
|
|
0 commit comments