版本更新: v1.2.16 - 用户信息完善版本

This commit is contained in:
甲辰生产 2026-03-26 23:06:47 +08:00
parent a71697aed0
commit 2aae399ce4
4 changed files with 81 additions and 75 deletions

View File

@ -1 +1 @@
VERSION=1.2.15 VERSION=1.2.16

View File

@ -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.14</title> <title>甲辰收藏 v1.2.15</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" />

View File

@ -8,13 +8,15 @@ export default function Info() {
const [editingItem, setEditingItem] = useState(null) const [editingItem, setEditingItem] = useState(null)
const [formData, setFormData] = useState({ const [formData, setFormData] = useState({
edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: '', content: '' edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: ''
}) })
const [content, setContent] = useState('')
useEffect(() => { useEffect(() => {
if (activeTab === 'manage') fetchMyList() if (activeTab === 'manage') fetchMyList()
}, [activeTab]) }, [activeTab])
//
useEffect(() => { useEffect(() => {
const now = new Date() const now = new Date()
const date = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}` const date = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`
@ -41,13 +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: formData.content, info_type: formData.category === '成交' ? 'deal' : 'seek' }) body: JSON.stringify({ title: formData.title, content: content, 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: '', content: '' }) setFormData({ edition: '龙钞', type: '标百', isGraded: true, category: '成交', source: '直播', title: '' })
setContent('')
fetchMyList() fetchMyList()
} else { alert(data.message || '发布失败') } } else { alert(data.message || '发布失败') }
} catch (e) { alert('发布失败: ' + e.message) } } catch (e) { alert('发布失败: ' + e.message) }
@ -109,10 +112,10 @@ export default function Info() {
{/* 顶部标签 */} {/* 顶部标签 */}
<div style={{ position: 'sticky', top: 0, background: 'rgba(15,23,42,0.95)', backdropFilter: 'blur(10px)', padding: '16px 20px', borderBottom: '1px solid #1e293b', zIndex: 100 }}> <div style={{ position: 'sticky', top: 0, background: 'rgba(15,23,42,0.95)', backdropFilter: 'blur(10px)', padding: '16px 20px', borderBottom: '1px solid #1e293b', zIndex: 100 }}>
<div style={{ display: 'flex', gap: '8px', background: '#1e293b', borderRadius: '12px', padding: '4px' }}> <div style={{ display: 'flex', gap: '8px', background: '#1e293b', borderRadius: '12px', padding: '4px' }}>
{[{ key: 'publish', label: '📝 发布行情', icon: '📝' }, { key: 'manage', label: '📋 发布管理', icon: '📋' }].map(t => ( {[{ key: 'publish', label: '📝 寻配号发布' }, { key: 'manage', label: '📋 发布管理' }].map(t => (
<div key={t.key} onClick={() => setActiveTab(t.key)} <div key={t.key} onClick={() => setActiveTab(t.key)}
style={{ flex: 1, padding: '12px 16px', borderRadius: '10px', background: activeTab === t.key ? 'linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)' : 'transparent', 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', boxShadow: activeTab === t.key ? '0 2px 10px rgba(59,130,246,0.4)' : 'none' }}> color: activeTab === t.key ? '#fff' : '#9ca3af', cursor: 'pointer', textAlign: 'center', fontSize: '14px', fontWeight: '600', transition: 'all 0.3s' }}>
{t.label} {t.label}
</div> </div>
))} ))}
@ -120,78 +123,81 @@ export default function Info() {
</div> </div>
<div style={{ padding: '20px' }}> <div style={{ padding: '20px' }}>
{/* 寻配号发布 - 提示页面 */}
{activeTab === 'publish' && ( {activeTab === 'publish' && (
<div> <div style={{ padding: '40px', textAlign: 'center', color: '#94a3b8' }}>
{/* 新增按钮 */} <div style={{ fontSize: '48px', marginBottom: '16px' }}>📝</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', marginBottom: '20px' }}> <div style={{ fontSize: '16px', marginBottom: '8px', color: '#fff' }}>寻配号发布</div>
<button onClick={() => setShowPublish(!showPublish)} <div style={{ fontSize: '13px' }}>请到发布管理tab进行发布</div>
style={{ background: showPublish ? 'linear-gradient(135deg, #6b7280 0%, #4b5563 100%)' : 'linear-gradient(135deg, #10b981 0%, #059669 100%)',
color: '#fff', border: 'none', padding: '12px 24px', borderRadius: '10px', cursor: 'pointer', fontSize: '14px', fontWeight: '600', boxShadow: '0 4px 15px rgba(16,185,129,0.3)', transition: 'all 0.3s' }}>
{showPublish ? '✕ 收起表单' : '+ 新增发布'}
</button>
</div>
{showPublish && (
<Card title="📝 发布行情信息">
<BtnGroup label="版别" options={[
{ value: '龙钞', label: '🐉 龙钞' }, { value: '马钞', label: '🐎 马钞' }, { value: '蛇钞', label: '🐍 蛇钞' }, { value: '其他', label: '📄 其他' }
]} value={formData.edition} onChange={v => setFormData({...formData, edition: v})} />
<div style={{ display: 'flex', gap: '12px', marginBottom: '16px' }}>
<div style={{ flex: 2 }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px', fontWeight: '500' }}>类型</div>
<div style={{ display: 'flex', gap: '6px' }}>
{['标百', '标十', '单张'].map(t => (
<button key={t} onClick={() => setFormData({...formData, type: t})}
style={{ flex: 1, padding: '10px', borderRadius: '8px', border: formData.type === t ? '2px solid #10b981' : '1px solid #374151',
background: formData.type === t ? 'rgba(16,185,129,0.15)' : '#1f2937', color: formData.type === t ? '#10b981' : '#d1d5db', cursor: 'pointer', fontSize: '13px' }}>{t}</button>
))}
</div>
</div>
<div style={{ flex: 1 }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px', fontWeight: '500' }}>是否评级</div>
<button onClick={() => setFormData({...formData, isGraded: !formData.isGraded})}
style={{ width: '100%', padding: '10px', borderRadius: '8px', border: formData.isGraded ? '2px solid #10b981' : '1px solid #374151',
background: formData.isGraded ? 'rgba(16,185,129,0.15)' : '#1f2937', color: formData.isGraded ? '#10b981' : '#d1d5db', cursor: 'pointer', fontSize: '13px' }}>
{formData.isGraded ? '✓ 评级币' : '○ 裸钞'}
</button>
</div>
</div>
<BtnGroup label="分类" options={[
{ value: '成交', label: '💰 成交' }, { value: '求购', label: '🔍 求购' }, { value: '出售', label: '💵 出售' }
]} value={formData.category} onChange={v => setFormData({...formData, category: v})} />
<BtnGroup label="信息来源" options={[
{ value: '直播', label: '📺 直播' }, { value: '一尘', label: '💼 一尘' }, { value: '爱藏', label: '📦 爱藏' }, { value: '其他', label: '📋 其他' }
]} value={formData.source} onChange={v => setFormData({...formData, source: v})} />
<div style={{ marginBottom: '16px' }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px', fontWeight: '500' }}>标题自动生成</div>
<input type="text" value={formData.title} readOnly
style={{ width: '100%', padding: '14px', background: '#0f172a', border: '1px solid #374151', borderRadius: '10px', color: '#10b981', fontSize: '14px', boxSizing: 'border-box' }} />
</div>
<div style={{ marginBottom: '20px' }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px', fontWeight: '500' }}>正文内容</div>
<textarea value={formData.content} onChange={(e) => setFormData({...formData, content: e.target.value})} placeholder="请输入详细信息..." rows={4}
style={{ width: '100%', padding: '14px', background: '#0f172a', border: '1px solid #374151', borderRadius: '10px', color: '#fff', resize: 'vertical', boxSizing: 'border-box', fontSize: '14px' }} />
</div>
<button onClick={handlePublish}
style={{ width: '100%', padding: '16px', background: 'linear-gradient(135deg, #f59e0b 0%, #d97706 100%)', border: 'none', borderRadius: '12px', color: '#fff', fontSize: '16px', fontWeight: 'bold', cursor: 'pointer', boxShadow: '0 4px 15px rgba(245,158,11,0.3)', transition: 'transform 0.2s' }}>
🚀 提交发布
</button>
</Card>
)}
</div> </div>
)} )}
{/* 发布管理 */}
{activeTab === 'manage' && ( {activeTab === 'manage' && (
<div> <div>
<Card title="📋 我的发布"> <Card title="📋 发布管理">
<div style={{ marginBottom: '16px' }}>
<button onClick={() => setShowPublish(!showPublish)}
style={{ background: showPublish ? 'linear-gradient(135deg, #6b7280 0%, #4b5563 100%)' : 'linear-gradient(135deg, #10b981 0%, #059669 100%)',
color: '#fff', border: 'none', padding: '12px 24px', borderRadius: '10px', cursor: 'pointer', fontSize: '14px', fontWeight: '600' }}>
{showPublish ? '✕ 收起' : '+ 新增发布'}
</button>
</div>
{/* 发布表单 */}
{showPublish && (
<div style={{ background: '#0f172a', borderRadius: '12px', padding: '16px', marginBottom: '16px' }}>
<BtnGroup label="版别" options={[
{ value: '龙钞', label: '🐉 龙钞' }, { value: '马钞', label: '🐎 马钞' }, { value: '蛇钞', label: '🐍 蛇钞' }, { value: '其他', label: '📄 其他' }
]} value={formData.edition} onChange={v => setFormData({...formData, edition: v})} />
<div style={{ display: 'flex', gap: '12px', marginBottom: '16px' }}>
<div style={{ flex: 2 }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px' }}>类型</div>
<div style={{ display: 'flex', gap: '6px' }}>
{['标百', '标十', '单张'].map(t => (
<button key={t} onClick={() => setFormData({...formData, type: t})}
style={{ flex: 1, padding: '10px', borderRadius: '8px', border: formData.type === t ? '2px solid #10b981' : '1px solid #374151',
background: formData.type === t ? 'rgba(16,185,129,0.15)' : '#1f2937', color: formData.type === t ? '#10b981' : '#d1d5db', cursor: 'pointer', fontSize: '13px' }}>{t}</button>
))}
</div>
</div>
<div style={{ flex: 1 }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px' }}>是否评级</div>
<button onClick={() => setFormData({...formData, isGraded: !formData.isGraded})}
style={{ width: '100%', padding: '10px', borderRadius: '8px', border: formData.isGraded ? '2px solid #10b981' : '1px solid #374151',
background: formData.isGraded ? 'rgba(16,185,129,0.15)' : '#1f2937', color: formData.isGraded ? '#10b981' : '#d1d5db', cursor: 'pointer', fontSize: '13px' }}>
{formData.isGraded ? '✓ 评级币' : '○ 裸钞'}
</button>
</div>
</div>
<BtnGroup label="分类" options={[
{ value: '成交', label: '💰 成交' }, { value: '求购', label: '🔍 求购' }, { value: '出售', label: '💵 出售' }
]} value={formData.category} onChange={v => setFormData({...formData, category: v})} />
<div style={{ marginBottom: '16px' }}>
<div style={{ color: '#9ca3af', fontSize: '13px', marginBottom: '8px' }}>标题自动生成</div>
<input type="text" value={formData.title} readOnly
style={{ width: '100%', padding: '14px', background: '#1f2937', border: '1px solid #374151', borderRadius: '10px', color: '#10b981', fontSize: '14px', boxSizing: 'border-box' }} />
</div>
<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}
style={{ width: '100%', padding: '14px', background: '#1f2937', border: '1px solid #374151', borderRadius: '10px', color: '#fff', resize: 'vertical', boxSizing: 'border-box', fontSize: '14px' }} />
</div>
<button onClick={handlePublish}
style={{ width: '100%', padding: '14px', background: 'linear-gradient(135deg, #f59e0b 0%, #d97706 100%)', border: 'none', borderRadius: '10px', color: '#fff', fontSize: '15px', fontWeight: 'bold', cursor: 'pointer' }}>
🚀 提交发布
</button>
</div>
)}
{/* 发布列表 */}
{loading ? ( {loading ? (
<div style={{ color: '#9ca3af', textAlign: 'center', padding: '30px' }}> 加载中...</div> <div style={{ color: '#9ca3af', textAlign: 'center', padding: '30px' }}>加载中...</div>
) : myList.length === 0 ? ( ) : myList.length === 0 ? (
<div style={{ color: '#9ca3af', textAlign: 'center', padding: '30px', fontSize: '14px' }}>暂无发布记录</div> <div style={{ color: '#9ca3af', textAlign: 'center', padding: '30px', fontSize: '14px' }}>暂无发布记录</div>
) : ( ) : (
@ -223,8 +229,8 @@ export default function Info() {
{/* 编辑弹窗 */} {/* 编辑弹窗 */}
{editingItem && ( {editingItem && (
<div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.8)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 1000, padding: '20px', backdropFilter: 'blur(5px)' }}> <div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.8)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 1000, padding: '20px' }}>
<div style={{ background: '#1f2937', borderRadius: '16px', padding: '24px', width: '100%', maxWidth: '420px', border: '1px solid #374151', boxShadow: '0 20px 40px rgba(0,0,0,0.5)' }}> <div style={{ background: '#1f2937', borderRadius: '16px', padding: '24px', width: '100%', maxWidth: '420px', border: '1px solid #374151' }}>
<h3 style={{ color: '#f9fafb', marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}> 编辑信息</h3> <h3 style={{ color: '#f9fafb', marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}> 编辑信息</h3>
<div style={{ marginBottom: '16px' }}> <div style={{ marginBottom: '16px' }}>
<label style={{ color: '#9ca3af', fontSize: '13px', display: 'block', marginBottom: '8px' }}>标题</label> <label style={{ color: '#9ca3af', fontSize: '13px', display: 'block', marginBottom: '8px' }}>标题</label>

View File

@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
// - // -
export default function News() { export default function News() {
const [activeTab, setActiveTab] = useState('seek') const [activeTab, setActiveTab] = useState('deal')
const [infoList, setInfoList] = useState([]) const [infoList, setInfoList] = useState([])
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)