diff --git a/VERSION b/VERSION index 8bd9cb1..e4ae45b 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1 @@ -VERSION=1.2.19 -# 2026-03-28 寻号功能增强:去掉类型匹配度字段,标题在正文前面,联系方式***隐藏,匹配状态按钮,留言功能 +VERSION=1.2.24 diff --git a/config/VERSION b/config/VERSION index e8e268a..e4ae45b 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.19 +VERSION=1.2.24 diff --git a/frontend/src/pages/Info.jsx b/frontend/src/pages/Info.jsx index c9b4a77..a93782d 100644 --- a/frontend/src/pages/Info.jsx +++ b/frontend/src/pages/Info.jsx @@ -1,10 +1,9 @@ import React, { useState, useEffect } from 'react' export default function Info() { - const [activeTab, setActiveTab] = useState('deal') + const [activeTab, setActiveTab] = useState('publish') const [showPublish, setShowPublish] = useState(false) const [myList, setMyList] = useState([]) - const [listFilter, setListFilter] = useState('all') const [loading, setLoading] = useState(false) const [editingItem, setEditingItem] = useState(null) @@ -14,21 +13,15 @@ export default function Info() { // content使用原生DOM useEffect(() => { - if (activeTab === 'deal') fetchMyList() + if (activeTab === 'manage') fetchMyList() }, [activeTab]) - - // Auto-fetch on mount (only if logged in) - useEffect(() => { - const token = localStorage.getItem('token') - if (token) fetchMyList() - }, []) // 自动生成标题 useEffect(() => { const now = new Date() const date = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}` const gradeNote = formData.isGraded ? '(评级币)' : '(裸钞)' - const title = `「${date} ${formData.edition} ${formData.type} ${formData.category} ${gradeNote}」` + const title = `「${date} ${formData.edition} ${formData.type} ${formData.category} 行情信息${gradeNote}」` setFormData(prev => ({...prev, title})) }, [formData.edition, formData.type, formData.isGraded, formData.category]) @@ -50,7 +43,7 @@ export default function Info() { const token = localStorage.getItem('token') const res = await fetch(`${API_BASE}/api/information/`, { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, - body: JSON.stringify({ title: formData.title, content: document.getElementById('publishContent')?.value || '', info_type: 'deal' }) + body: JSON.stringify({ title: formData.title, content: document.getElementById('publishContent')?.value || '', info_type: formData.category === '成交' ? 'deal' : 'seek' }) }) const data = await res.json() if (data.id || data.code === 0) { @@ -117,8 +110,16 @@ export default function Info() { return (
{/* 顶部标签 */} -
-

💰 行情管理

+
+
+ {[{ key: 'publish', label: '📝 寻配号发布' }, { key: 'manage', label: '📋 发布管理' }].map(t => ( +
setActiveTab(t.key)} + style={{ flex: 1, padding: '12px 16px', borderRadius: '10px', background: activeTab === t.key ? 'linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)' : 'transparent', + color: activeTab === t.key ? '#fff' : '#9ca3af', cursor: 'pointer', textAlign: 'center', fontSize: '14px', fontWeight: '600', transition: 'all 0.3s' }}> + {t.label} +
+ ))} +
@@ -132,7 +133,7 @@ export default function Info() { )} {/* 发布管理 */} - {true && ( + {activeTab === 'manage' && (
@@ -172,7 +173,7 @@ export default function Info() {
setFormData({...formData, category: v})} />
@@ -201,18 +202,12 @@ export default function Info() {
暂无发布记录
) : (
-
- - - -
- - {myList.filter(i => listFilter === 'all' || i.info_type === listFilter).map(item => ( + {myList.map(item => (
{item.title}
- {item.info_type === 'deal' ? '💰 行情' : '🔍 求购'} + {item.info_type === 'deal' ? '💰 成交' : '🔍 求购'}
{item.content &&
{item.content}
} diff --git a/frontend/src/pages/News.jsx b/frontend/src/pages/News.jsx index 63ab3eb..a5ff477 100644 --- a/frontend/src/pages/News.jsx +++ b/frontend/src/pages/News.jsx @@ -4,7 +4,6 @@ import React, { useState, useEffect } from 'react' export default function News() { const [activeTab, setActiveTab] = useState(localStorage.getItem('news_activeTab') || 'seek') const [showSeekPublish, setShowSeekPublish] = useState(false) - const [customModal, setCustomModal] = useState({show: false, title: '', content: ''}) const [showMySeeks, setShowMySeeks] = useState(false) // 我的寻号 const [showContactId, setShowContactId] = useState(null) // 显示联系方式的寻号ID const [showCommentId, setShowCommentId] = useState(null) // 显示评论输入的寻号ID @@ -118,7 +117,7 @@ export default function News() { if (data.message === '匹配成功,已通知发布者') { setMatchedStatus(prev => ({...prev, [infoId]: 'matched'})) setShowContactId(infoId) // 显示联系方式 - setCustomModal({show: true, title: '匹配成功', content: '已通知发布者,请等待对方联系'}) + alert('匹配成功!') fetchInfoList() // 刷新列表 } } catch (e) { @@ -131,7 +130,7 @@ export default function News() { try { const res = await fetch(`${API_BASE}/api/information/seek/matched-user/${infoId}`, { headers: { Authorization: `Bearer ${token}` } }) const data = await res.json() - if (data.matched_user_id) setCustomModal({show: true, title: '匹配者信息', content: `用户名: ${data.user_name}\n联系方式: ${data.matched_contact || '未提供'}`}) + if (data.matched_user_id) alert(`匹配者: ${data.user_name}, 联系方式: ${data.matched_contact || '未提供'}`) } catch (e) { console.error(e) } } const fetchPublisherInfo = async (infoId) => { @@ -140,7 +139,7 @@ export default function News() { try { const res = await fetch(`${API_BASE}/api/information/seek/publisher/${infoId}`, { headers: { Authorization: `Bearer ${token}` } }) const data = await res.json() - if (data.user_id) setCustomModal({show: true, title: '发布者信息', content: `用户名: ${data.user_name}\n联系方式: ${data.contact || '未提供'}`}) + if (data.user_id) alert(`发布者: ${data.user_name}, 联系方式: ${data.contact || '未提供'}`) } catch (e) { console.error(e) } } const fetchMatchCollections = async (infoId) => { @@ -250,7 +249,7 @@ export default function News() { }) const data = await res.json() if (data.id || data.code === 0) { - setCustomModal({show: true, title: '发布成功', content: '您的寻配号信息已发布成功'}) + alert('发布成功!') setShowSeekPublish(false) setSeekForm({ edition: '龙钞', type: '', category: '寻号', price: '', matchType: '模糊', features: '', content: '', title: '', contact: (() => { try { const u = JSON.parse(localStorage.getItem('user') || '{}'); return u.phone || '' } catch { return '' } })() || '' }) fetchInfoList() @@ -505,7 +504,7 @@ export default function News() { : 1 }}> {(item.is_matched === 'matched' || matchedStatus[item.id] === 'matched') ? '已经匹配' : '尚未匹配'} - {(item.is_matched === 'matched' || matchedStatus[item.id] === 'matched') && } + {(item.is_matched === 'matched' || matchedStatus[item.id] === 'matched') && }
)} @@ -769,24 +768,6 @@ export default function News() {
)} - {customModal.show && ( -
-
-
-

{customModal.title}

-
-
- {customModal.content.split('\n').map((line, i) => ( -
- {line.split(':')[0]} - {line.split(':')[1]} -
- ))} -
- -
-
- )}
) }