From 4b8747d72fb2f56155b9d1b00518f77cb958a3d4 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 13 Aug 2026 11:08:32 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-08-13 11:08:12 --- App.jsx | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/App.jsx b/App.jsx index dfdf3dc..5ce1989 100644 --- a/App.jsx +++ b/App.jsx @@ -2523,6 +2523,10 @@ function MainApp({ username, onLogout }) { notify('已删除'); } + function reorderJmsLines(fromIndex, toIndex) { + setJmsLines(prev => reorderArray(prev, fromIndex, toIndex)); + } + async function handleExportProductPdf() { @@ -3243,6 +3247,7 @@ function MainApp({ username, onLogout }) { lines={jmsLines} onSave={saveJmsLine} onDelete={deleteJmsLine} + onReorder={reorderJmsLines} onNotify={notify} /> )} @@ -4352,15 +4357,25 @@ function jmsCopyText(text, label, onNotify) { .catch(() => onNotify && onNotify('复制失败,请手动选择')); } -function JmsLineCard({ line, ip, onRefreshIp, onCopy, onQr, onDuplicate, onEdit, onDelete, onNotify }) { +function JmsLineCard({ line, idx, ip, dragIdx, onDragStart, onDropCard, onDragEnd, onRefreshIp, onCopy, onQr, onDuplicate, onEdit, onDelete, onNotify }) { const meta = JMS_PROTO_META[line.protocol] || { label: line.protocol }; const ipDisplay = ip === 'resolving' ? '解析中…' : (ip || '解析中…'); const hasPassword = line.protocol === 'ss' && !!line.password; + const hasMethod = line.protocol === 'ss' && !!line.method; return ( -
+
onDragStart(idx)} + onDragOver={(e) => e.preventDefault()} + onDrop={() => onDropCard(idx)} + onDragEnd={onDragEnd} + >
+ {line.name || line.addr}
{meta.label} @@ -4381,6 +4396,9 @@ function JmsLineCard({ line, ip, onRefreshIp, onCopy, onQr, onDuplicate, onEdit,
端口{line.port}
+ {hasMethod && ( +
加密方式{line.method}
+ )} {hasPassword && (
密码 @@ -4436,7 +4454,7 @@ function JmsLineFormFields({ protocol, draft, setDraft }) { return null; } -function JmsPage({ lines, onSave, onDelete, onNotify }) { +function JmsPage({ lines, onSave, onDelete, onReorder, onNotify }) { const [ipMap, setIpMap] = useState({}); const [modalOpen, setModalOpen] = useState(false); const [editingId, setEditingId] = useState(null); @@ -4444,6 +4462,13 @@ function JmsPage({ lines, onSave, onDelete, onNotify }) { const [draft, setDraft] = useState({}); const [qrLine, setQrLine] = useState(null); const [qrDataUrl, setQrDataUrl] = useState(''); + const [dragIdx, setDragIdx] = useState(null); + + function handleJmsDrop(dropIdx) { + if (dragIdx === null || dragIdx === dropIdx) { setDragIdx(null); return; } + onReorder(dragIdx, dropIdx); + setDragIdx(null); + } const total = lines.length; const ssCount = lines.filter(l => l.protocol === 'ss').length; @@ -4537,10 +4562,15 @@ function JmsPage({ lines, onSave, onDelete, onNotify }) {
{lines.length === 0 &&
还没有线路,点右上角"新增线路"添加
} - {lines.map(line => ( + {lines.map((line, idx) => ( setDragIdx(null)} ip={ipMap[line.id]} onRefreshIp={refreshIp} onCopy={copyLink}