From 9fe3f77d4586df5b60a4f151ed61ec3253d627fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Tue, 14 Apr 2026 08:02:45 +0800 Subject: [PATCH] =?UTF-8?q?v1.2.91=20-=20=E4=BF=AE=E5=A4=8D=E5=8D=95?= =?UTF-8?q?=E6=9D=A1=E5=BD=95=E5=85=A5=E5=86=A0=E5=AD=97=E5=8F=B7=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=A7=84=E5=88=99(7=E4=BD=8D=E2=86=92J0+0+=E6=95=B0?= =?UTF-8?q?=E5=AD=97,8=E4=BD=8D=E2=86=92J0+=E6=95=B0=E5=AD=97,9=E4=BD=8D?= =?UTF-8?q?=E2=86=92J0+=E5=90=8E8=E4=BD=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- config/VERSION | 2 +- frontend/src/pages/Add.jsx | 29 +++++++++++++------- frontend/src/pages/Home.jsx | 54 +++++++++++++++++++++++++++---------- 4 files changed, 62 insertions(+), 25 deletions(-) diff --git a/VERSION b/VERSION index 2d04904..da5c718 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.90 +1.2.91 \ No newline at end of file diff --git a/config/VERSION b/config/VERSION index f73f4c0..55f1222 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.81 +1.2.89 diff --git a/frontend/src/pages/Add.jsx b/frontend/src/pages/Add.jsx index 0c21dd0..5fde9a7 100644 --- a/frontend/src/pages/Add.jsx +++ b/frontend/src/pages/Add.jsx @@ -824,21 +824,32 @@ export default function Add() { setSavingDeal(true) try { const token = localStorage.getItem('token') - const digits = dealForm.serial.replace('J', '').replace(/[^0-9]/g, '').slice(0, 9) - let tailNumber = '', sizeType = '' - if (dealForm.packaging === '标十' && digits.length >= 2) { - tailNumber = digits.slice(-2) - sizeType = ['01','11','21','31','41','51'].includes(tailNumber) ? '小号' : '大号' - } else if (dealForm.packaging === '标百' && digits.length >= 3) { - tailNumber = digits.slice(-3) - sizeType = ['101','201','301','401','501'].includes(tailNumber) ? '小号' : '大号' + // 冠字号矫正:用户输入的数字位数不同,生成规则不同 + // 7位 → J0 + 0 + 数字 (如 J00123456) + // 8位 → J0 + 数字 (如 J01234567) + // 9位 → J0 + 取后8位数字 (如 J02345678) + const rawSerial = dealForm.serial.replace('J', '').replace(/\D/g, '') + let normalizedSerial = '' + if (rawSerial.length === 7) { + normalizedSerial = 'J0' + '0' + rawSerial + } else if (rawSerial.length === 8) { + normalizedSerial = 'J0' + rawSerial + } else if (rawSerial.length >= 9) { + normalizedSerial = 'J0' + rawSerial.slice(1, 9) // 取后8位 + } else { + normalizedSerial = 'J0' + rawSerial } + + const tailNumber = rawSerial.slice(-2) + const sizeType = (dealForm.packaging === '标十' && ['01','11','21','31','41','51','61','71','81','91'].includes(tailNumber)) ? '小号' : + (dealForm.packaging === '标百' && ['001','011','021','031','041','051','061','071','081','091'].includes(rawSerial.slice(-3))) ? '小号' : '大号' + const response = await fetch(`${API_BASE}/api/information/`, { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ info_type: 'deal', - title: `J0${dealForm.serial.replace('J', '').slice(0, 8)}-¥${dealForm.price}`, + title: `${normalizedSerial}-¥${dealForm.price}`, content: `分类: ${dealForm.category || '未分类'}\n尾号: ${tailNumber || '-'}\n大小号: ${sizeType || '-'}\n包装: ${dealForm.packaging}\n平台: ${dealForm.platform}\n价格: ¥${dealForm.price}\n出售者: ${dealForm.seller || '-'}\n购买者: ${dealForm.buyer || '-'}\n日期: ${dealForm.date}\n评级: ${dealForm.gradingCompany ? dealForm.gradingCompany + ' ' + dealForm.gradingScore : '未评级'}`, deal_price: parseFloat(dealForm.price), deal_date: dealForm.date, diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 90c9aab..f6912a9 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -174,32 +174,58 @@ export default function Home() {
window.location.hash = '#/add?mode=ocr'} style={{ background: 'linear-gradient(135deg, #22c55e 0%, #16a34a 100%)', borderRadius: '12px', - padding: '16px', + padding: '12px 16px', cursor: 'pointer', display: 'flex', + flexDirection: 'column', alignItems: 'center', - gap: '12px' + justifyContent: 'center', + textAlign: 'center' }}> -
📷
-
-
AI识别
-
拍照识别藏品
-
+
藏品录入
+
AI识别添加
+
+
window.location.hash = '#/add?mode=deal'} style={{ + background: 'linear-gradient(135deg, #ec4899 0%, #db2777 100%)', + borderRadius: '12px', + padding: '12px 16px', + cursor: 'pointer', + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'center', + textAlign: 'center' + }}> +
行情录入
+
录入成交行情
+
+
window.location.hash = '#/news?type=seek'} style={{ + background: 'linear-gradient(135deg, #f59e0b 0%, #d97706 100%)', + borderRadius: '12px', + padding: '12px 16px', + cursor: 'pointer', + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'center', + textAlign: 'center' + }}> +
发布寻号
+
发布寻配需求
window.location.hash = '#/add?mode=manual'} style={{ background: 'linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)', borderRadius: '12px', - padding: '16px', + padding: '12px 16px', cursor: 'pointer', display: 'flex', + flexDirection: 'column', alignItems: 'center', - gap: '12px' + justifyContent: 'center', + textAlign: 'center' }}> -
✏️
-
-
手动录入
-
添加新藏品
-
+
发布藏品
+
手动发布