Update App.jsx via upload script - 2026-11-16 22:56:44
This commit is contained in:
parent
4f0723fc95
commit
cc6d6d44ff
171
App.jsx
171
App.jsx
|
|
@ -2286,6 +2286,18 @@ const Styles = () => (
|
||||||
.cv-imp-h { display: grid; gap: 2px; } .cv-imp-h small { color: var(--ink-soft); font-size: 12px; }
|
.cv-imp-h { display: grid; gap: 2px; } .cv-imp-h small { color: var(--ink-soft); font-size: 12px; }
|
||||||
.cv-imp-me { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; margin-left: auto; }
|
.cv-imp-me { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; margin-left: auto; }
|
||||||
.cv-imp-me .input { width: 110px; height: 30px; }
|
.cv-imp-me .input { width: 110px; height: 30px; }
|
||||||
|
.cv-imp-lbl { font-size: 12px; color: var(--ink-soft); margin-left: 6px; }
|
||||||
|
.cv-prev { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); max-height: 300px; overflow: auto; }
|
||||||
|
.cv-prev-h { position: sticky; top: 0; background: var(--panel); font-size: 12.5px; font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--line); }
|
||||||
|
.cv-prev-h small { font-weight: 400; color: var(--ink-soft); }
|
||||||
|
.cv-prev-r { display: flex; gap: 8px; align-items: flex-start; padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
|
||||||
|
.cv-prev-r:last-child { border-bottom: 0; }
|
||||||
|
.cv-prev-who { flex: none; border: 0; border-radius: 99px; padding: 1px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer; color: #fff; background: #c2410c; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.cv-prev-r.me .cv-prev-who { background: #047857; }
|
||||||
|
.cv-prev-at { flex: none; color: var(--ink-soft); font-size: 11.5px; width: 82px; padding-top: 1px; }
|
||||||
|
.cv-prev-t { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
||||||
|
.cv-prev-img { height: 54px; border-radius: 5px; margin-right: auto; }
|
||||||
|
.cv-prev-r .cv-ico { margin-left: auto; flex: none; }
|
||||||
.cv-chat { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #efeae2; position: relative; }
|
.cv-chat { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #efeae2; position: relative; }
|
||||||
.cv-chat.drag::after { content: '松开鼠标,把文件加到要发送的消息里'; position: absolute; inset: 0; background: rgba(37,99,235,.10); border: 2px dashed #2563eb; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #1d4ed8; pointer-events: none; }
|
.cv-chat.drag::after { content: '松开鼠标,把文件加到要发送的消息里'; position: absolute; inset: 0; background: rgba(37,99,235,.10); border: 2px dashed #2563eb; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #1d4ed8; pointer-events: none; }
|
||||||
.cv-msgs { max-height: 620px; min-height: 180px; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px;
|
.cv-msgs { max-height: 620px; min-height: 180px; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px;
|
||||||
|
|
@ -6352,6 +6364,78 @@ const cvDayLabel = (d) => {
|
||||||
const cvIsImg = (f) => /^image\//.test(f.mime || '') || /\.(jpe?g|png|webp|gif|bmp)$/i.test(f.stored || f.name || '');
|
const cvIsImg = (f) => /^image\//.test(f.mime || '') || /\.(jpe?g|png|webp|gif|bmp)$/i.test(f.stored || f.name || '');
|
||||||
const cvSize = (n) => (n > 1048576 ? `${(n / 1048576).toFixed(1)} MB` : `${Math.max(1, Math.round((n || 0) / 1024))} KB`);
|
const cvSize = (n) => (n > 1048576 ? `${(n / 1048576).toFixed(1)} MB` : `${Math.max(1, Math.round((n || 0) / 1024))} KB`);
|
||||||
|
|
||||||
|
// 把粘贴进来的聊天文字拆成一条条消息。支持:
|
||||||
|
// · WhatsApp 导出 / 复制:12/11/2026, 14:05 - Anton: … · [12/11/2026, 14:05:33] Anton: … · [14:05, 12/11/2026] Anton: …
|
||||||
|
// · 微信电脑版复制:一行"名字 2026/11/12 14:05:33"(或"名字 14:05"),下面几行是内容
|
||||||
|
// · 每行"名字: 内容"(名字是客户或我)
|
||||||
|
// · 都认不出就当成一条消息
|
||||||
|
const CV_WA1 = /^\[?(\d{1,4}[./-]\d{1,2}[./-]\d{2,4}),?\s+(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[APap]\.?\s?[Mm]\.?)?)\]?\s*(?:-\s*)?([^:\n]{1,60}):\s?([\s\S]*)$/;
|
||||||
|
const CV_WA2 = /^\[(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[APap]\.?\s?[Mm]\.?)?),\s*(\d{1,4}[./-]\d{1,2}[./-]\d{2,4})\]\s*([^:\n]{1,60}):\s?([\s\S]*)$/;
|
||||||
|
const CV_WX = /^(\S.{0,38}?)\s+(?:(\d{4}[/.-]\d{1,2}[/.-]\d{1,2})\s+)?(\d{1,2}:\d{2})(?::\d{2})?\s*$/;
|
||||||
|
const cvPad = (n) => String(n).padStart(2, '0');
|
||||||
|
function cvToAt(d, t, order) {
|
||||||
|
const p = d.split(/[./-]/).map(Number);
|
||||||
|
let y, m, day;
|
||||||
|
if (p[0] > 31) [y, m, day] = p; else if (order === 'mdy') [m, day, y] = p; else [day, m, y] = p;
|
||||||
|
if (y < 100) y += 2000;
|
||||||
|
const tm = t.match(/(\d{1,2}):(\d{2})/); let h = +tm[1];
|
||||||
|
if (/p/i.test(t) && h < 12) h += 12; if (/a/i.test(t) && h === 12) h = 0;
|
||||||
|
if (!y || !m || !day || m > 12 || day > 31) return null;
|
||||||
|
return `${y}-${cvPad(m)}-${cvPad(day)} ${cvPad(h)}:${tm[2]}`;
|
||||||
|
}
|
||||||
|
const cvSameName = (a, b) => { a = String(a || '').toLowerCase().trim(); b = String(b || '').toLowerCase().trim(); return !!a && !!b && (a === b || a.split(/\s+/)[0] === b.split(/\s+/)[0] || a.includes(b) || b.includes(a)); };
|
||||||
|
function cvParsePaste(raw, names) {
|
||||||
|
const t = String(raw || '').replace(/[-]/g, '').replace(/\r\n?/g, '\n').trim();
|
||||||
|
if (!t) return [];
|
||||||
|
const lines = t.split('\n');
|
||||||
|
const out = [];
|
||||||
|
// 1) WhatsApp
|
||||||
|
const wa = [];
|
||||||
|
let cur = null;
|
||||||
|
for (const l of lines) {
|
||||||
|
let m = l.match(CV_WA1), g = null;
|
||||||
|
if (m) g = { d: m[1], t: m[2], who: m[3], x: m[4] };
|
||||||
|
else if ((m = l.match(CV_WA2))) g = { d: m[2], t: m[1], who: m[3], x: m[4] };
|
||||||
|
if (g) { cur = { ...g, who: g.who.trim() }; wa.push(cur); } else if (cur) cur.x += '\n' + l;
|
||||||
|
}
|
||||||
|
if (wa.length) {
|
||||||
|
let dmy = 0, mdy = 0;
|
||||||
|
for (const r of wa) { const p = r.d.split(/[./-]/).map(Number); if (p[0] <= 31) { if (p[0] > 12) dmy++; else if (p[1] > 12) mdy++; } }
|
||||||
|
const order = mdy > dmy ? 'mdy' : 'dmy';
|
||||||
|
return wa.map(r => ({ who: r.who, at: cvToAt(r.d, r.t, order), text: r.x.trim() })).filter(r => r.text);
|
||||||
|
}
|
||||||
|
// 2) 微信:名字 + 时间 单独一行
|
||||||
|
const isName = (n) => cvSameName(n, names.me) || cvSameName(n, names.customer) || (names.extra || []).some(x => cvSameName(n, x));
|
||||||
|
const heads = lines.map(l => l.match(CV_WX)).map(m => (m && !/[.!?。!?,,]$/.test(m[1]) ? m : null));
|
||||||
|
if (heads.filter(Boolean).length >= 1 && heads.some((m, i) => m && (isName(m[1]) || heads.filter(Boolean).length >= 2))) {
|
||||||
|
cur = null;
|
||||||
|
lines.forEach((l, i) => {
|
||||||
|
const m = heads[i];
|
||||||
|
if (m) {
|
||||||
|
let at = null;
|
||||||
|
if (m[2]) { const p = m[2].split(/[/.-]/).map(Number); at = `${p[0]}-${cvPad(p[1])}-${cvPad(p[2])} ${cvPad(+m[3].split(':')[0])}:${m[3].split(':')[1]}`; }
|
||||||
|
cur = { who: m[1].trim(), at, time: m[2] ? null : m[3], text: '' }; out.push(cur);
|
||||||
|
} else if (cur) cur.text += (cur.text ? '\n' : '') + l;
|
||||||
|
else out.push(cur = { who: '', at: null, text: l });
|
||||||
|
});
|
||||||
|
return out.map(r => ({ ...r, text: r.text.trim() })).filter(r => r.text);
|
||||||
|
}
|
||||||
|
// 3) 名字: 内容
|
||||||
|
const named = lines.map(l => l.match(/^([^::\n]{1,30})[::]\s?(.*)$/));
|
||||||
|
if (named.some(m => m && isName(m[1].trim()))) {
|
||||||
|
cur = null;
|
||||||
|
lines.forEach((l, i) => {
|
||||||
|
const m = named[i];
|
||||||
|
if (m && isName(m[1].trim())) { cur = { who: m[1].trim(), at: null, text: m[2] }; out.push(cur); }
|
||||||
|
else if (cur) cur.text += '\n' + l;
|
||||||
|
else out.push(cur = { who: '', at: null, text: l });
|
||||||
|
});
|
||||||
|
return out.map(r => ({ ...r, text: r.text.trim() })).filter(r => r.text);
|
||||||
|
}
|
||||||
|
// 4) 一整条
|
||||||
|
return [{ who: '', at: null, text: t }];
|
||||||
|
}
|
||||||
|
|
||||||
function ConversationPanel({ customer: c, onNotify, onPatchCustomer }) {
|
function ConversationPanel({ customer: c, onNotify, onPatchCustomer }) {
|
||||||
const custName = String(c.contact || '').replace(/\s*[((].*$/, '').trim() || c.company || '客户';
|
const custName = String(c.contact || '').replace(/\s*[((].*$/, '').trim() || c.company || '客户';
|
||||||
const [data, setData] = useState(null);
|
const [data, setData] = useState(null);
|
||||||
|
|
@ -6432,17 +6516,42 @@ function ConversationPanel({ customer: c, onNotify, onPatchCustomer }) {
|
||||||
} catch (e) { onNotify('发送失败:' + e.message); }
|
} catch (e) { onNotify('发送失败:' + e.message); }
|
||||||
finally { setSending(false); }
|
finally { setSending(false); }
|
||||||
}
|
}
|
||||||
|
const newImp = () => ({ text: '', files: [], defFrom: 'customer', channel: 'whatsapp', at: '', over: {}, removed: {}, busy: false });
|
||||||
|
const impAddFiles = (list) => {
|
||||||
|
const a = Array.from(list || []).map(f => ({ file: f, url: /^image\//.test(f.type) ? URL.createObjectURL(f) : '' }));
|
||||||
|
if (a.length) setImp(x => ({ ...x, files: [...x.files, ...a].slice(0, 30) }));
|
||||||
|
};
|
||||||
|
const closeImp = () => { setImp(x => { (x && x.files || []).forEach(f => f.url && URL.revokeObjectURL(f.url)); return null; }); };
|
||||||
|
const impRows = (() => {
|
||||||
|
if (!imp) return [];
|
||||||
|
const base = imp.at || cvNow();
|
||||||
|
const parsed = cvParsePaste(imp.text, { me: CV_ME, customer: custName, extra: [c.contact, c.company] });
|
||||||
|
const rows = parsed.map((r, i) => ({
|
||||||
|
key: 't' + i, who: r.who, text: r.text,
|
||||||
|
at: r.at || (r.time ? `${base.slice(0, 10)} ${r.time.padStart(5, '0')}` : null),
|
||||||
|
from: imp.over['t' + i] || (r.who ? (cvSameName(r.who, CV_ME) ? 'me' : 'customer') : imp.defFrom),
|
||||||
|
}));
|
||||||
|
imp.files.forEach((f, i) => rows.push({ key: 'f' + i, file: i, f, text: '', at: null, from: imp.over['f' + i] || imp.defFrom }));
|
||||||
|
return rows.filter(r => !imp.removed[r.key]);
|
||||||
|
})();
|
||||||
async function doImport() {
|
async function doImport() {
|
||||||
if (!imp.text.trim() && !imp.files.length) { onNotify('请选择导出的聊天文件,或粘贴聊天文字'); return; }
|
if (!impRows.length) { onNotify('先把聊天内容复制粘贴进来'); return; }
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('text', imp.text); fd.append('me', imp.me || CV_ME);
|
const used = [];
|
||||||
imp.files.forEach(f => fd.append('files', f));
|
const messages = impRows.map(r => {
|
||||||
|
const m = { from: r.from, channel: imp.channel, at: r.at || '', text: r.text, who: r.who || '' };
|
||||||
|
if (r.file !== undefined) { m.files = [used.length]; used.push(imp.files[r.file].file); }
|
||||||
|
return m;
|
||||||
|
});
|
||||||
|
fd.append('messages', JSON.stringify(messages));
|
||||||
|
fd.append('at', (imp.at || cvNow()).replace('T', ' '));
|
||||||
|
used.forEach(f => fd.append('files', f));
|
||||||
setImp(x => ({ ...x, busy: true }));
|
setImp(x => ({ ...x, busy: true }));
|
||||||
try {
|
try {
|
||||||
const j = await convoApi('POST', `/api/convos/${c.id}/import`, fd, true);
|
const j = await convoApi('POST', `/api/convos/${c.id}/import`, fd, true);
|
||||||
setData(d => ({ ...(d || {}), items: [...((d && d.items) || []), ...j.items] }));
|
setData(d => ({ ...(d || {}), items: [...((d && d.items) || []), ...j.items] }));
|
||||||
setImp(null); scrollEnd(); setTrState('');
|
closeImp(); scrollEnd(); setTrState('');
|
||||||
onNotify(`已导入 ${j.items.length} 条消息${j.skipped ? `(${j.skipped} 条已存在,跳过)` : ''}${!j.meFound && j.people && j.people.length ? `。注意:聊天里没找到"${imp.me}",发送人有:${j.people.join('、')}` : ''}`);
|
onNotify(`已导入 ${j.items.length} 条消息${j.skipped ? `(${j.skipped} 条已存在,跳过)` : ''}`);
|
||||||
} catch (e) { onNotify('导入失败:' + e.message); setImp(x => x && ({ ...x, busy: false })); }
|
} catch (e) { onNotify('导入失败:' + e.message); setImp(x => x && ({ ...x, busy: false })); }
|
||||||
}
|
}
|
||||||
async function saveEdit() {
|
async function saveEdit() {
|
||||||
|
|
@ -6504,7 +6613,7 @@ function ConversationPanel({ customer: c, onNotify, onPatchCustomer }) {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<button className={`btn btn-sm${showZh ? '' : ' btn-ghost'}`} onClick={() => setShowZh(v => !v)} title="显示 / 隐藏中文翻译"><Languages size={13} />中文对照{showZh ? ':开' : ':关'}</button>
|
<button className={`btn btn-sm${showZh ? '' : ' btn-ghost'}`} onClick={() => setShowZh(v => !v)} title="显示 / 隐藏中文翻译"><Languages size={13} />中文对照{showZh ? ':开' : ':关'}</button>
|
||||||
<button className="btn btn-sm" onClick={() => setImp(x => (x ? null : { text: '', files: [], me: CV_ME, busy: false }))}><Upload size={13} />导入聊天记录</button>
|
<button className={`btn btn-sm${imp ? ' btn-primary' : ''}`} onClick={() => (imp ? closeImp() : setImp(newImp()))}><Upload size={13} />粘贴导入聊天</button>
|
||||||
<button className="btn btn-sm btn-primary" disabled={!items.length || aiBusy} onClick={analyze} title={items.length ? '' : '先记录沟通内容'}>
|
<button className="btn btn-sm btn-primary" disabled={!items.length || aiBusy} onClick={analyze} title={items.length ? '' : '先记录沟通内容'}>
|
||||||
<Sparkles size={13} />{aiBusy ? `AI 分析中… ${aiSecs}s` : an ? '重新 AI 分析' : 'AI 分析'}
|
<Sparkles size={13} />{aiBusy ? `AI 分析中… ${aiSecs}s` : an ? '重新 AI 分析' : 'AI 分析'}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -6512,19 +6621,47 @@ function ConversationPanel({ customer: c, onNotify, onPatchCustomer }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{imp && (
|
{imp && (
|
||||||
<div className="cv-imp">
|
<div className={`cv-imp${drag ? ' drag' : ''}`}
|
||||||
<div className="cv-imp-h"><b>导入整段聊天</b><small>WhatsApp:聊天 → ⋮ → 更多 → 导出聊天(选"附带媒体"会连图片一起导入,得到 .zip);邮件:下载原始邮件 .eml。也可以直接把 WhatsApp 聊天文字粘贴进来。</small></div>
|
onPaste={e => { const fs = Array.from(e.clipboardData.files || []); if (fs.length) { e.preventDefault(); impAddFiles(fs); } }}
|
||||||
|
onDragOver={e => { e.preventDefault(); }}
|
||||||
|
onDrop={e => { e.preventDefault(); e.stopPropagation(); impAddFiles(e.dataTransfer.files); }}>
|
||||||
|
<div className="cv-imp-h"><b>粘贴导入聊天记录</b><small>在 WhatsApp / 微信 / 邮件里选中聊天内容 → 复制 → 在下面 Ctrl+V 粘贴。图片、文件也可以直接 Ctrl+V 粘贴(或拖进来),每个是一条消息。下面会先预览,确认谁说的再导入。</small></div>
|
||||||
<div className="cv-add-row">
|
<div className="cv-add-row">
|
||||||
<button type="button" className="btn btn-sm" onClick={() => impRef.current && impRef.current.click()}><Paperclip size={12} />选择文件(.zip / .txt / .eml)</button>
|
<div className="cv-chips">
|
||||||
<input ref={impRef} type="file" multiple hidden accept=".txt,.zip,.eml" onChange={e => { const a = Array.from(e.target.files || []); setImp(x => ({ ...x, files: [...x.files, ...a].slice(0, 5) })); e.target.value = ''; }} />
|
{CV_PICK.map(k => (
|
||||||
{imp.files.map((f, i) => <span key={i} className="cv-file"><Paperclip size={11} />{f.name}<button type="button" onClick={() => setImp(x => ({ ...x, files: x.files.filter((_, k) => k !== i) }))}><X size={11} /></button></span>)}
|
<button type="button" key={k} className={`cv-chip${imp.channel === k ? ' on' : ''}`} style={imp.channel === k ? { background: CONVO_CH[k].color, borderColor: CONVO_CH[k].color } : undefined} onClick={() => setImp(x => ({ ...x, channel: k }))}>{CONVO_CH[k].label}</button>
|
||||||
<label className="cv-imp-me">聊天里我的名字 <input className="input" value={imp.me} onChange={e => setImp(x => ({ ...x, me: e.target.value }))} /></label>
|
))}
|
||||||
|
</div>
|
||||||
|
<span className="cv-imp-lbl">没写名字的消息算</span>
|
||||||
|
<div className="cv-seg">
|
||||||
|
<button className={imp.defFrom === 'customer' ? 'on' : ''} onClick={() => setImp(x => ({ ...x, defFrom: 'customer' }))}>{custName}</button>
|
||||||
|
<button className={imp.defFrom === 'me' ? 'on me' : ''} onClick={() => setImp(x => ({ ...x, defFrom: 'me' }))}>{CV_ME}</button>
|
||||||
|
</div>
|
||||||
|
<label className="cv-at" title="聊天里没有时间的消息用这个时间">
|
||||||
|
<Clock size={12} />
|
||||||
|
<input type="datetime-local" value={imp.at} onChange={e => setImp(x => ({ ...x, at: e.target.value }))} />
|
||||||
|
{imp.at ? <button onClick={() => setImp(x => ({ ...x, at: '' }))}><X size={11} /></button> : <span>现在</span>}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<textarea className="textarea" rows={4} value={imp.text} onChange={e => setImp(x => ({ ...x, text: e.target.value }))} placeholder={'或者粘贴 WhatsApp 聊天文字,例如:\n12/11/2026, 14:05 - Anton: Hello, price for 10kVA?\n12/11/2026, 14:30 - Mike: Hi Anton, ...'} />
|
<textarea className="textarea" rows={5} autoFocus value={imp.text} onChange={e => setImp(x => ({ ...x, text: e.target.value, over: {}, removed: {} }))}
|
||||||
|
placeholder={'在这里 Ctrl+V 粘贴聊天内容,例如:\n[14:05, 12/11/2026] Anton: Hello, price for 10kVA?\n[14:30, 12/11/2026] Mike: Hi Anton, …\n\n也可以是邮件正文、微信聊天,或者一段话(当成一条消息)'} />
|
||||||
|
{impRows.length > 0 && (
|
||||||
|
<div className="cv-prev">
|
||||||
|
<div className="cv-prev-h">预览:{impRows.length} 条消息 <small>点名字可以切换是谁说的,× 不导入这条</small></div>
|
||||||
|
{impRows.map(r => (
|
||||||
|
<div key={r.key} className={`cv-prev-r ${r.from === 'me' ? 'me' : 'cu'}`}>
|
||||||
|
<button className="cv-prev-who" onClick={() => setImp(x => ({ ...x, over: { ...x.over, [r.key]: r.from === 'me' ? 'customer' : 'me' } }))} title="点击切换">{r.from === 'me' ? CV_ME : (r.who && !cvSameName(r.who, CV_ME) ? r.who : custName)}</button>
|
||||||
|
<span className="cv-prev-at">{r.at ? r.at.slice(5).replace('-', '/') : (imp.at ? imp.at.slice(5).replace('-', '/').replace('T', ' ') : '现在')}</span>
|
||||||
|
{r.f ? (r.f.url ? <img className="cv-prev-img" src={r.f.url} alt="" /> : <span className="cv-file"><Paperclip size={11} />{r.f.file.name}</span>) : <span className="cv-prev-t">{r.text}</span>}
|
||||||
|
<button className="cv-ico" title="不导入这条" onClick={() => setImp(x => ({ ...x, removed: { ...x.removed, [r.key]: true } }))}><X size={12} /></button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end', alignItems: 'center' }}>
|
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end', alignItems: 'center' }}>
|
||||||
<small style={{ color: 'var(--ink-soft)', marginRight: 'auto' }}>名字是"{imp.me || CV_ME}"的算我,其他人都算客户;重复导入同一个聊天会自动跳过已有的消息。</small>
|
<small style={{ color: 'var(--ink-soft)', marginRight: 'auto' }}>名字是"{CV_ME}"的算我,其他名字算客户;重复粘贴同样的内容会自动跳过。</small>
|
||||||
<button className="btn btn-sm btn-ghost" onClick={() => setImp(null)}>取消</button>
|
<button className="btn btn-sm btn-ghost" onClick={closeImp}>取消</button>
|
||||||
<button className="btn btn-sm btn-primary" disabled={imp.busy} onClick={doImport}>{imp.busy ? '导入中…' : '导入'}</button>
|
<button className="btn btn-sm btn-primary" disabled={imp.busy || !impRows.length} onClick={doImport}>{imp.busy ? '导入中…' : `导入${impRows.length ? ` ${impRows.length} 条` : ''}`}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -6597,7 +6734,7 @@ function ConversationPanel({ customer: c, onNotify, onPatchCustomer }) {
|
||||||
onDrop={e => { e.preventDefault(); setDrag(false); addFiles(e.dataTransfer.files); }}>
|
onDrop={e => { e.preventDefault(); setDrag(false); addFiles(e.dataTransfer.files); }}>
|
||||||
<div className="cv-msgs" ref={boxRef}>
|
<div className="cv-msgs" ref={boxRef}>
|
||||||
{data === null ? <div className="cv-empty">加载中…</div>
|
{data === null ? <div className="cv-empty">加载中…</div>
|
||||||
: items.length === 0 ? <div className="cv-empty">还没有沟通记录。<br />在下面选择是 <b>{custName}</b> 说的还是 <b>{CV_ME}</b> 回复的,输入内容发送;<br />也可以附图片、PDF,或者用右上角"导入聊天记录"一次导入 WhatsApp 导出 / 邮件。</div>
|
: items.length === 0 ? <div className="cv-empty">还没有沟通记录。<br />在下面选择是 <b>{custName}</b> 说的还是 <b>{CV_ME}</b> 回复的,输入内容发送;<br />也可以附图片、PDF,或者用右上角"粘贴导入聊天"把复制的整段聊天一次导进来。</div>
|
||||||
: shown.length === 0 ? <div className="cv-empty">没有匹配"{q}"的消息</div>
|
: shown.length === 0 ? <div className="cv-empty">没有匹配"{q}"的消息</div>
|
||||||
: shown.map(m => {
|
: shown.map(m => {
|
||||||
const day = String(m.at || '').slice(0, 10);
|
const day = String(m.at || '').slice(0, 10);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue