版本更新: v1.2.16 - 修复信息发布输入问题

This commit is contained in:
甲辰生产 2026-03-26 23:11:20 +08:00
parent 2aae399ce4
commit 3b80d17010
2 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>甲辰收藏 v1.2.15</title>
<title>甲辰收藏 v1.2.16</title>
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico" />

View File

@ -10,7 +10,7 @@ export default function Info() {
const [formData, setFormData] = useState({
edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: ''
})
const [content, setContent] = useState('')
// content使DOM
useEffect(() => {
if (activeTab === 'manage') fetchMyList()
@ -43,14 +43,14 @@ 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: content, info_type: formData.category === '成交' ? 'deal' : 'seek' })
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) {
alert('发布成功!')
setShowPublish(false)
setFormData({ edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: '' })
setContent('')
const el = document.getElementById('publishContent'); if(el) el.value = ''
fetchMyList()
} else { alert(data.message || '发布失败') }
} catch (e) { alert('发布失败: ' + e.message) }
@ -184,7 +184,7 @@ export default function Info() {
<div style={{ marginBottom: '16px' }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px' }}>正文</div>
<textarea defaultValue={content} onChange={(e) => setContent(e.target.value)} placeholder="请输入..." rows={3}
<textarea id="publishContent" placeholder="请输入..." rows={3}
style={{ width: '100%', padding: '14px', background: '#1f2937', border: '1px solid #374151', borderRadius: '10px', color: '#fff', resize: 'vertical', boxSizing: 'border-box', fontSize: '14px' }} />
</div>