mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
fix: 导出时无需再去设置里面选择位置
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "weflow",
|
"name": "weflow",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "WeFlow - 微信聊天记录查看工具",
|
"description": "WeFlow - 微信聊天记录查看工具",
|
||||||
"main": "dist-electron/main.js",
|
"main": "dist-electron/main.js",
|
||||||
"author": "cc",
|
"author": "cc",
|
||||||
|
|||||||
@@ -463,6 +463,43 @@
|
|||||||
margin: 8px 0 0;
|
margin: 8px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select-folder-btn {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 10px 16px;
|
||||||
|
margin-top: 12px;
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--bg-hover);
|
||||||
|
border-color: var(--primary);
|
||||||
|
color: var(--primary);
|
||||||
|
|
||||||
|
svg {
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
transition: color 0.2s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.export-action {
|
.export-action {
|
||||||
padding: 20px 24px;
|
padding: 20px 24px;
|
||||||
border-top: 1px solid var(--border-color);
|
border-top: 1px solid var(--border-color);
|
||||||
|
|||||||
@@ -362,7 +362,26 @@ function ExportPage() {
|
|||||||
<FolderOpen size={16} />
|
<FolderOpen size={16} />
|
||||||
<span>{exportFolder || '未设置'}</span>
|
<span>{exportFolder || '未设置'}</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="path-hint">可在设置页面修改导出目录</p>
|
<button
|
||||||
|
className="select-folder-btn"
|
||||||
|
onClick={async () => {
|
||||||
|
try {
|
||||||
|
const result = await window.electronAPI.dialog.openFile({
|
||||||
|
title: '选择导出目录',
|
||||||
|
properties: ['openDirectory']
|
||||||
|
})
|
||||||
|
if (!result.canceled && result.filePaths.length > 0) {
|
||||||
|
setExportFolder(result.filePaths[0])
|
||||||
|
await configService.setExportPath(result.filePaths[0])
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('选择目录失败:', e)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FolderOpen size={16} />
|
||||||
|
<span>选择导出目录</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ import {
|
|||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import './SettingsPage.scss'
|
import './SettingsPage.scss'
|
||||||
|
|
||||||
type SettingsTab = 'appearance' | 'database' | 'export' | 'cache' | 'about'
|
type SettingsTab = 'appearance' | 'database' | 'cache' | 'about'
|
||||||
|
|
||||||
const tabs: { id: SettingsTab; label: string; icon: React.ElementType }[] = [
|
const tabs: { id: SettingsTab; label: string; icon: React.ElementType }[] = [
|
||||||
{ id: 'appearance', label: '外观', icon: Palette },
|
{ id: 'appearance', label: '外观', icon: Palette },
|
||||||
{ id: 'database', label: '数据库连接', icon: Database },
|
{ id: 'database', label: '数据库连接', icon: Database },
|
||||||
{ id: 'export', label: '导出', icon: Download },
|
|
||||||
{ id: 'cache', label: '缓存', icon: HardDrive },
|
{ id: 'cache', label: '缓存', icon: HardDrive },
|
||||||
{ id: 'about', label: '关于', icon: Info }
|
{ id: 'about', label: '关于', icon: Info }
|
||||||
]
|
]
|
||||||
@@ -31,8 +30,6 @@ function SettingsPage() {
|
|||||||
const [dbPath, setDbPath] = useState('')
|
const [dbPath, setDbPath] = useState('')
|
||||||
const [wxid, setWxid] = useState('')
|
const [wxid, setWxid] = useState('')
|
||||||
const [cachePath, setCachePath] = useState('')
|
const [cachePath, setCachePath] = useState('')
|
||||||
const [exportPath, setExportPath] = useState('')
|
|
||||||
const [defaultExportPath, setDefaultExportPath] = useState('')
|
|
||||||
const [logEnabled, setLogEnabled] = useState(false)
|
const [logEnabled, setLogEnabled] = useState(false)
|
||||||
|
|
||||||
const [isLoading, setIsLoadingState] = useState(false)
|
const [isLoading, setIsLoadingState] = useState(false)
|
||||||
@@ -53,7 +50,6 @@ function SettingsPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadConfig()
|
loadConfig()
|
||||||
loadDefaultExportPath()
|
|
||||||
loadAppVersion()
|
loadAppVersion()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@@ -85,7 +81,6 @@ function SettingsPage() {
|
|||||||
if (savedPath) setDbPath(savedPath)
|
if (savedPath) setDbPath(savedPath)
|
||||||
if (savedWxid) setWxid(savedWxid)
|
if (savedWxid) setWxid(savedWxid)
|
||||||
if (savedCachePath) setCachePath(savedCachePath)
|
if (savedCachePath) setCachePath(savedCachePath)
|
||||||
if (savedExportPath) setExportPath(savedExportPath)
|
|
||||||
if (savedImageXorKey != null) {
|
if (savedImageXorKey != null) {
|
||||||
setImageXorKey(`0x${savedImageXorKey.toString(16).toUpperCase().padStart(2, '0')}`)
|
setImageXorKey(`0x${savedImageXorKey.toString(16).toUpperCase().padStart(2, '0')}`)
|
||||||
}
|
}
|
||||||
@@ -96,14 +91,7 @@ function SettingsPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadDefaultExportPath = async () => {
|
|
||||||
try {
|
|
||||||
const downloadsPath = await window.electronAPI.app.getDownloadsPath()
|
|
||||||
setDefaultExportPath(downloadsPath)
|
|
||||||
} catch (e) {
|
|
||||||
console.error('获取默认导出路径失败:', e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const loadAppVersion = async () => {
|
const loadAppVersion = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -230,18 +218,7 @@ function SettingsPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSelectExportPath = async () => {
|
|
||||||
try {
|
|
||||||
const result = await dialog.openFile({ title: '选择导出目录', properties: ['openDirectory'] })
|
|
||||||
if (!result.canceled && result.filePaths.length > 0) {
|
|
||||||
setExportPath(result.filePaths[0])
|
|
||||||
await configService.setExportPath(result.filePaths[0])
|
|
||||||
showMessage('已设置导出目录', true)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
showMessage('选择目录失败', false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleAutoGetDbKey = async () => {
|
const handleAutoGetDbKey = async () => {
|
||||||
if (isFetchingDbKey) return
|
if (isFetchingDbKey) return
|
||||||
@@ -303,16 +280,7 @@ function SettingsPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleResetExportPath = async () => {
|
|
||||||
try {
|
|
||||||
const downloadsPath = await window.electronAPI.app.getDownloadsPath()
|
|
||||||
setExportPath(downloadsPath)
|
|
||||||
await configService.setExportPath(downloadsPath)
|
|
||||||
showMessage('已恢复为下载目录', true)
|
|
||||||
} catch (e) {
|
|
||||||
showMessage('恢复默认失败', false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleTestConnection = async () => {
|
const handleTestConnection = async () => {
|
||||||
if (!dbPath) { showMessage('请先选择数据库目录', false); return }
|
if (!dbPath) { showMessage('请先选择数据库目录', false); return }
|
||||||
@@ -396,7 +364,6 @@ function SettingsPage() {
|
|||||||
setDbPath('')
|
setDbPath('')
|
||||||
setWxid('')
|
setWxid('')
|
||||||
setCachePath('')
|
setCachePath('')
|
||||||
setExportPath('')
|
|
||||||
setLogEnabled(false)
|
setLogEnabled(false)
|
||||||
setDbConnected(false)
|
setDbConnected(false)
|
||||||
await window.electronAPI.window.openOnboardingWindow()
|
await window.electronAPI.window.openOnboardingWindow()
|
||||||
@@ -562,19 +529,7 @@ function SettingsPage() {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const renderExportTab = () => (
|
|
||||||
<div className="tab-content">
|
|
||||||
<div className="form-group">
|
|
||||||
<label>导出目录</label>
|
|
||||||
<span className="form-hint">聊天记录导出的默认保存位置</span>
|
|
||||||
<input type="text" placeholder={defaultExportPath || '系统下载目录'} value={exportPath || defaultExportPath} onChange={(e) => setExportPath(e.target.value)} />
|
|
||||||
<div className="btn-row">
|
|
||||||
<button className="btn btn-secondary" onClick={handleSelectExportPath}><FolderOpen size={16} /> 浏览选择</button>
|
|
||||||
<button className="btn btn-secondary" onClick={handleResetExportPath}><RotateCcw size={16} /> 恢复默认</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
|
|
||||||
const renderCacheTab = () => (
|
const renderCacheTab = () => (
|
||||||
<div className="tab-content">
|
<div className="tab-content">
|
||||||
@@ -672,7 +627,6 @@ function SettingsPage() {
|
|||||||
<div className="settings-body">
|
<div className="settings-body">
|
||||||
{activeTab === 'appearance' && renderAppearanceTab()}
|
{activeTab === 'appearance' && renderAppearanceTab()}
|
||||||
{activeTab === 'database' && renderDatabaseTab()}
|
{activeTab === 'database' && renderDatabaseTab()}
|
||||||
{activeTab === 'export' && renderExportTab()}
|
|
||||||
{activeTab === 'cache' && renderCacheTab()}
|
{activeTab === 'cache' && renderCacheTab()}
|
||||||
{activeTab === 'about' && renderAboutTab()}
|
{activeTab === 'about' && renderAboutTab()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user