From f29629bfcc064502b0a999dead7a5bd2442b8733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Fri, 27 Mar 2026 00:28:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0:=20v1.2.17?= =?UTF-8?q?=20-=20=E5=AF=BB=E5=8F=B7=E5=9F=BA=E6=9C=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/VERSION | 2 +- frontend/src/pages/News.jsx | 96 +++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/config/VERSION b/config/VERSION index 5b54187..e6b8eb2 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.16 +VERSION=1.2.17 diff --git a/frontend/src/pages/News.jsx b/frontend/src/pages/News.jsx index 65dddfe..580fbdb 100644 --- a/frontend/src/pages/News.jsx +++ b/frontend/src/pages/News.jsx @@ -3,6 +3,10 @@ import React, { useState, useEffect } from 'react' // 资讯页面 - 展示寻配号和行情信息(所有人可见) export default function News() { const [activeTab, setActiveTab] = useState('deal') + const [showSeekPublish, setShowSeekPublish] = useState(false) + const [seekForm, setSeekForm] = useState({ + edition: '龙钞', type: '标百', category: '寻号', price: '', matchType: '模糊', features: '', content: '', title: '', contact: '' + }) const [infoList, setInfoList] = useState([]) const [loading, setLoading] = useState(false) @@ -13,6 +17,12 @@ export default function News() { fetchInfoList() }, [activeTab]) + // 自动生成寻号标题 + useEffect(() => { + const title = `「寻号 ${seekForm.edition} ${seekForm.type} ${seekForm.features || '号码特征'} ${seekForm.matchType}」` + setSeekForm(prev => ({...prev, title})) + }, [seekForm.edition, seekForm.type, seekForm.features, seekForm.matchType]) + const fetchInfoList = async () => { setLoading(true) try { @@ -30,6 +40,25 @@ export default function News() { setLoading(false) } + const handleSeekPublish = async () => { + if (!seekForm.contact) { alert('请填写联系方式'); return } + try { + const token = localStorage.getItem('token') + const content = (seekForm.content ? seekForm.content + '\n' : '') + (seekForm.price ? `价格: ${seekForm.price}` : '') + (seekForm.features ? '\n号码特征: ' + seekForm.features : '') + '\n联系方式: ' + seekForm.contact + const res = await fetch(`${API_BASE}/api/information/`, { + method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, + body: JSON.stringify({ title: seekForm.title, content, info_type: 'seek' }) + }) + const data = await res.json() + if (data.id || data.code === 0) { + alert('发布成功!') + setShowSeekPublish(false) + setSeekForm({ edition: '龙钞', type: '标百', category: '寻号', price: '', matchType: '模糊', features: '', content: '', title: '', contact: '' }) + fetchInfoList() + } else { alert(data.message || '发布失败') } + } catch (e) { alert('发布失败: ' + e.message) } + } + // Tab切换 const tabs = [ { key: 'seek', label: '🔍 寻配号' }, @@ -67,8 +96,75 @@ export default function News() { {/* 资讯列表 */}
+ {showSeekPublish && activeTab === 'seek' && ( +
+
+
+ {['龙钞','马钞','蛇钞','其他'].map(e => ( + + ))} +
+
+
+
+ {['标百','标十','单张'].map(e => ( + + ))} +
+
+
+
+ {['求购','出售','寻号'].map(e => ( + + ))} +
+
+
+ setSeekForm({...seekForm, price: e.target.value})} placeholder="请输入价格" + style={{ width: '100%', padding: '8px', marginTop: '6px', background: '#0f172a', border: '1px solid #334155', borderRadius: '6px', color: '#fff', fontSize: '13px', boxSizing: 'border-box' }} /> +
+
+
+ {['精准','模糊'].map(e => ( + + ))} +
+
+
+ setSeekForm({...seekForm, features: e.target.value})} placeholder="如: 8888/7777/开门号" + style={{ width: '100%', padding: '8px', marginTop: '6px', background: '#0f172a', border: '1px solid #334155', borderRadius: '6px', color: '#fff', fontSize: '13px', boxSizing: 'border-box' }} /> +
+
+