版本更新: v1.2.16 - 修复信息发布输入问题
This commit is contained in:
parent
2aae399ce4
commit
3b80d17010
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<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">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>甲辰收藏 v1.2.15</title>
|
<title>甲辰收藏 v1.2.16</title>
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico" />
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default function Info() {
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: ''
|
edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: ''
|
||||||
})
|
})
|
||||||
const [content, setContent] = useState('')
|
// content使用原生DOM
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeTab === 'manage') fetchMyList()
|
if (activeTab === 'manage') fetchMyList()
|
||||||
|
|
@ -43,14 +43,14 @@ export default function Info() {
|
||||||
const token = localStorage.getItem('token')
|
const token = localStorage.getItem('token')
|
||||||
const res = await fetch(`${API_BASE}/api/information/`, {
|
const res = await fetch(`${API_BASE}/api/information/`, {
|
||||||
method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' },
|
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()
|
const data = await res.json()
|
||||||
if (data.id || data.code === 0) {
|
if (data.id || data.code === 0) {
|
||||||
alert('发布成功!')
|
alert('发布成功!')
|
||||||
setShowPublish(false)
|
setShowPublish(false)
|
||||||
setFormData({ edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: '' })
|
setFormData({ edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: '' })
|
||||||
setContent('')
|
const el = document.getElementById('publishContent'); if(el) el.value = ''
|
||||||
fetchMyList()
|
fetchMyList()
|
||||||
} else { alert(data.message || '发布失败') }
|
} else { alert(data.message || '发布失败') }
|
||||||
} catch (e) { alert('发布失败: ' + e.message) }
|
} catch (e) { alert('发布失败: ' + e.message) }
|
||||||
|
|
@ -184,7 +184,7 @@ export default function Info() {
|
||||||
|
|
||||||
<div style={{ marginBottom: '16px' }}>
|
<div style={{ marginBottom: '16px' }}>
|
||||||
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px' }}>正文</div>
|
<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' }} />
|
style={{ width: '100%', padding: '14px', background: '#1f2937', border: '1px solid #374151', borderRadius: '10px', color: '#fff', resize: 'vertical', boxSizing: 'border-box', fontSize: '14px' }} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue