mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-05-01 07:26:48 +00:00
优化下载会话选择页面
This commit is contained in:
@@ -1055,11 +1055,11 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeTab !== 'antiRevoke' && activeTab !== 'insight') return
|
if (activeTab !== 'antiRevoke' && activeTab !== 'insight' && activeTab !== 'autoDownload') return
|
||||||
let canceled = false
|
let canceled = false
|
||||||
;(async () => {
|
;(async () => {
|
||||||
try {
|
try {
|
||||||
if (activeTab === 'antiRevoke') {
|
if (activeTab === 'antiRevoke' || activeTab === 'autoDownload') {
|
||||||
await ensureAntiRevokeSessionsLoaded()
|
await ensureAntiRevokeSessionsLoaded()
|
||||||
} else {
|
} else {
|
||||||
await ensureChatSessionsLoaded()
|
await ensureChatSessionsLoaded()
|
||||||
@@ -4701,12 +4701,13 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const renderAutoDownloadTab = () => {
|
const renderAutoDownloadTab = () => {
|
||||||
const sortedSessions = [...chatSessions].sort((a, b) => (b.sortTimestamp || 0) - (a.sortTimestamp || 0))
|
const sortedSessions = [...antiRevokeSessions].sort((a, b) => (b.sortTimestamp || 0) - (a.sortTimestamp || 0))
|
||||||
const keyword = autoDownloadSearchKeyword.trim().toLowerCase()
|
const keyword = autoDownloadSearchKeyword.trim().toLowerCase()
|
||||||
const filteredSessions = sortedSessions.filter((session) => {
|
const filteredSessions = sortedSessions.filter((session) => {
|
||||||
if (!keyword) return true
|
if (!keyword) return true
|
||||||
return (session.displayName || '').toLowerCase().includes(keyword) ||
|
const displayName = String(session.displayName || '').toLowerCase()
|
||||||
session.username.toLowerCase().includes(keyword)
|
const username = String(session.username || '').toLowerCase()
|
||||||
|
return displayName.includes(keyword) || username.includes(keyword)
|
||||||
})
|
})
|
||||||
const filteredSessionIds = filteredSessions.map((session) => session.username)
|
const filteredSessionIds = filteredSessions.map((session) => session.username)
|
||||||
const selectedCount = autoDownloadSelectedIds.size
|
const selectedCount = autoDownloadSelectedIds.size
|
||||||
@@ -4718,7 +4719,6 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
const whitelistArr = Array.from(ids)
|
const whitelistArr = Array.from(ids)
|
||||||
configService.setAutoDownloadWhitelist(whitelistArr)
|
configService.setAutoDownloadWhitelist(whitelistArr)
|
||||||
if (autoDownloadHighRes) {
|
if (autoDownloadHighRes) {
|
||||||
// 转换为 wxid\0wxid\0wxid\0\0 格式
|
|
||||||
const whitelistStr = whitelistArr.length > 0 ? (whitelistArr.join('\0') + '\0\0') : '';
|
const whitelistStr = whitelistArr.length > 0 ? (whitelistArr.join('\0') + '\0\0') : '';
|
||||||
(window as any).electronAPI.image.startAutoDownload(whitelistStr)
|
(window as any).electronAPI.image.startAutoDownload(whitelistStr)
|
||||||
}
|
}
|
||||||
@@ -4747,10 +4747,10 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tab-content anti-revoke-tab">
|
<div className="tab-content anti-revoke-tab">
|
||||||
{/* 顶部 Hero 区域 */}
|
{/* 顶部 Hero 区域保持不变 */}
|
||||||
<div className="anti-revoke-hero" style={{ background: 'linear-gradient(110deg, var(--bg-primary) 0%, rgba(245, 158, 11, 0.1) 100%)', borderColor: 'rgba(245, 158, 11, 0.3)' }}>
|
<div className="anti-revoke-hero" style={{ background: 'linear-gradient(110deg, var(--bg-primary) 0%, rgba(245, 158, 11, 0.1) 100%)', borderColor: 'rgba(245, 158, 11, 0.3)' }}>
|
||||||
<div className="anti-revoke-hero-main">
|
<div className="anti-revoke-hero-main">
|
||||||
<span className="updates-chip" style={{ color: '#f59e0b', background: 'rgba(245, 158, 11, 0.15)', width: 'fit-content' }}>测试功能 (Beta)</span>
|
<span className="updates-chip" style={{ color: '#f59e0b', background: 'rgba(245, 158, 11, 0.15)', width: 'fit-content' }}>测试功能 (Test)</span>
|
||||||
<h2 style={{ marginTop: '8px' }}>自动下载原图</h2>
|
<h2 style={{ marginTop: '8px' }}>自动下载原图</h2>
|
||||||
<p>强制微信在接收图片时下载高清原图。建议仅在必要会话中开启以节省流量和空间。</p>
|
<p>强制微信在接收图片时下载高清原图。建议仅在必要会话中开启以节省流量和空间。</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -4782,14 +4782,14 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
<div className="anti-revoke-toolbar-actions">
|
<div className="anti-revoke-toolbar-actions">
|
||||||
<div className="anti-revoke-btn-group">
|
<div className="anti-revoke-btn-group">
|
||||||
<button className="btn btn-secondary btn-sm" onClick={selectAllFiltered} disabled={filteredSessionIds.length === 0 || allFilteredSelected}>
|
<button className="btn btn-secondary btn-sm" onClick={selectAllFiltered} disabled={filteredSessionIds.length === 0 || allFilteredSelected}>
|
||||||
全选过滤
|
全选
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn-secondary btn-sm" onClick={clearSelection} disabled={selectedCount === 0}>
|
<button className="btn btn-secondary btn-sm" onClick={clearSelection} disabled={selectedCount === 0}>
|
||||||
清空选择
|
清空选择
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="anti-revoke-btn-group" style={{ marginLeft: '12px', paddingLeft: '12px', borderLeft: '1px solid var(--border-color)' }}>
|
<div className="anti-revoke-btn-group" style={{ marginLeft: '12px', paddingLeft: '12px', borderLeft: '1px solid var(--border-color)' }}>
|
||||||
<label className="switch switch-md" title={autoDownloadHighRes ? '关闭自动下载' : '开启自动下载'}>
|
<label className="switch switch-md">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={autoDownloadHighRes}
|
checked={autoDownloadHighRes}
|
||||||
@@ -4798,7 +4798,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
<span className="switch-slider" />
|
<span className="switch-slider" />
|
||||||
</label>
|
</label>
|
||||||
<span style={{ fontSize: '12px', color: 'var(--text-secondary)', marginLeft: '8px' }}>
|
<span style={{ fontSize: '12px', color: 'var(--text-secondary)', marginLeft: '8px' }}>
|
||||||
{autoDownloadHighRes ? '已开启' : '已关闭'}
|
{autoDownloadHighRes ? '服务已开启' : '服务已关闭'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -4815,35 +4815,44 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
<div className="anti-revoke-list">
|
<div className="anti-revoke-list">
|
||||||
<div className="anti-revoke-list-header">
|
<div className="anti-revoke-list-header">
|
||||||
<span>会话({filteredSessions.length})</span>
|
<span>会话({filteredSessions.length})</span>
|
||||||
<span>选择</span>
|
<span>状态</span>
|
||||||
</div>
|
</div>
|
||||||
{filteredSessions.length === 0 ? (
|
{filteredSessions.length === 0 ? (
|
||||||
<div className="anti-revoke-empty">{autoDownloadSearchKeyword ? '没有匹配的会话' : '暂无会话'}</div>
|
<div className="anti-revoke-empty">{autoDownloadSearchKeyword ? '没有匹配的会话' : '暂无会话'}</div>
|
||||||
) : (
|
) : (
|
||||||
filteredSessions.map((session) => (
|
filteredSessions.map((session) => {
|
||||||
<div
|
const isSelected = autoDownloadSelectedIds.has(session.username)
|
||||||
key={session.username}
|
return (
|
||||||
className={`anti-revoke-row ${autoDownloadSelectedIds.has(session.username) ? 'selected' : ''}`}
|
<div key={session.username} className={`anti-revoke-row ${isSelected ? 'selected' : ''}`}>
|
||||||
onClick={() => toggleSelection(session.username)}
|
<label className="anti-revoke-row-main">
|
||||||
>
|
<span className="anti-revoke-check">
|
||||||
<div className="anti-revoke-row-main">
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={isSelected}
|
||||||
|
onChange={() => toggleSelection(session.username)}
|
||||||
|
/>
|
||||||
|
<span className="check-indicator" aria-hidden="true">
|
||||||
|
<Check size={12} />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
<Avatar src={session.avatarUrl} name={session.displayName} size={30} />
|
<Avatar src={session.avatarUrl} name={session.displayName} size={30} />
|
||||||
<div className="anti-revoke-row-text">
|
<div className="anti-revoke-row-text">
|
||||||
<span className="name">{session.displayName || session.username}</span>
|
<span className="name">{session.displayName || session.username}</span>
|
||||||
<span className="username" style={{ fontSize: '11px', opacity: 0.5 }}>{session.username}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</label>
|
||||||
<div className="anti-revoke-row-status">
|
<div className="anti-revoke-row-status">
|
||||||
<span className={`anti-revoke-check ${autoDownloadSelectedIds.has(session.username) ? 'checked' : ''}`}>
|
<span className={`status-badge ${isSelected ? 'installed' : 'not-installed'}`}>
|
||||||
<Check size={14} />
|
<i className="status-dot" aria-hidden="true" />
|
||||||
|
{isSelected ? '已监控' : '未开启'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
)
|
||||||
|
})
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 风险提示 */}
|
{/* 风险提示部分保持不变 */}
|
||||||
<div className="api-warning-modal" style={{ width: '100%', border: '1px solid rgba(239, 68, 68, 0.2)', marginTop: '16px', background: 'rgba(239, 68, 68, 0.02)', animation: 'none', boxShadow: 'none', position: 'static' }}>
|
<div className="api-warning-modal" style={{ width: '100%', border: '1px solid rgba(239, 68, 68, 0.2)', marginTop: '16px', background: 'rgba(239, 68, 68, 0.02)', animation: 'none', boxShadow: 'none', position: 'static' }}>
|
||||||
<div className="modal-header" style={{ border: 'none', padding: '12px 20px 0' }}>
|
<div className="modal-header" style={{ border: 'none', padding: '12px 20px 0' }}>
|
||||||
<Lock size={16} color="#ef4444" />
|
<Lock size={16} color="#ef4444" />
|
||||||
@@ -4856,6 +4865,8 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleToggleAutoDownload = async (whitelist?: string[] | string) => {
|
const handleToggleAutoDownload = async (whitelist?: string[] | string) => {
|
||||||
const newVal = !autoDownloadHighRes
|
const newVal = !autoDownloadHighRes
|
||||||
setAutoDownloadHighRes(newVal)
|
setAutoDownloadHighRes(newVal)
|
||||||
|
|||||||
Reference in New Issue
Block a user