v1.2.65 - 添加联系我们按钮到快捷操作

This commit is contained in:
甲辰生产 2026-04-08 18:44:45 +08:00
parent e502f06d81
commit 2360041c16
1 changed files with 94 additions and 1 deletions

View File

@ -96,7 +96,26 @@ export default function Home() {
}).catch(() => {})
//
fetch('/api/information/seek/stats').then(res => res.json()).then(data => {
//
const submitFeedback = async () => {
if (!feedbackContent.trim()) return alert('请输入反馈内容')
try {
const res = await fetch('/api/feedback', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${localStorage.getItem('token')}` },
body: JSON.stringify({ content: feedbackContent, contact: feedbackContact })
})
const data = await res.json()
if (data.success) {
alert('反馈已提交,感谢您的意见!')
setShowFeedback(false)
setFeedbackContent('')
setFeedbackContact('')
}
} catch (e) { alert('提交失败') }
}
fetch('/api/information/seek/stats').then(res => res.json()).then(data => {
setSeekStats(data || {})
}).catch(() => {})
}, [])
@ -126,6 +145,62 @@ export default function Home() {
{ label: '总利润', value: formatMoney(stats.totalProfit) + '万', color: stats.totalProfit >= 0 ? '#10b981' : '#f43f5e' }
]
//
if (showFeedback) {
//
if (showFeedback) {
return (
<div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.8)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999 }}>
<div style={{ background: '#1a1a2e', borderRadius: '12px', padding: '24px', width: '90%', maxWidth: '400px' }}>
<div style={{ fontSize: '18px', fontWeight: 'bold', marginBottom: '16px', color: '#fff' }}>联系我们</div>
<textarea
value={feedbackContent}
onChange={(e) => setFeedbackContent(e.target.value)}
placeholder="请输入您的反馈内容..."
style={{ width: '100%', height: '120px', background: '#16213e', border: '1px solid #333', borderRadius: '8px', padding: '12px', color: '#fff', fontSize: '14px', marginBottom: '12px' }}
/>
<input
type="text"
value={feedbackContact}
onChange={(e) => setFeedbackContact(e.target.value)}
placeholder="联系方式(选填)"
style={{ width: '100%', background: '#16213e', border: '1px solid #333', borderRadius: '8px', padding: '12px', color: '#fff', fontSize: '14px', marginBottom: '16px' }}
/>
<div style={{ display: 'flex', gap: '12px' }}>
<button onClick={() => setShowFeedback(false)} style={{ flex: 1, padding: '12px', background: '#333', border: 'none', borderRadius: '8px', color: '#fff', cursor: 'pointer' }}>取消</button>
<button onClick={submitFeedback} style={{ flex: 1, padding: '12px', background: '#3b82f6', border: 'none', borderRadius: '8px', color: '#fff', cursor: 'pointer', fontWeight: 'bold' }}>提交</button>
</div>
</div>
</div>
)
}
return (
<div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.8)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999 }}>
<div style={{ background: '#1a1a2e', borderRadius: '12px', padding: '24px', width: '90%', maxWidth: '400px' }}>
<div style={{ fontSize: '18px', fontWeight: 'bold', marginBottom: '16px', color: '#fff' }}>联系我们</div>
<textarea
value={feedbackContent}
onChange={(e) => setFeedbackContent(e.target.value)}
placeholder="请输入您的反馈内容..."
style={{ width: '100%', height: '120px', background: '#16213e', border: '1px solid #333', borderRadius: '8px', padding: '12px', color: '#fff', fontSize: '14px', marginBottom: '12px' }}
/>
<input
type="text"
value={feedbackContact}
onChange={(e) => setFeedbackContact(e.target.value)}
placeholder="联系方式(选填)"
style={{ width: '100%', background: '#16213e', border: '1px solid #333', borderRadius: '8px', padding: '12px', color: '#fff', fontSize: '14px', marginBottom: '16px' }}
/>
<div style={{ display: 'flex', gap: '12px' }}>
<button onClick={() => setShowFeedback(false)} style={{ flex: 1, padding: '12px', background: '#333', border: 'none', borderRadius: '8px', color: '#fff', cursor: 'pointer' }}>取消</button>
<button onClick={submitFeedback} style={{ flex: 1, padding: '12px', background: '#3b82f6', border: 'none', borderRadius: '8px', color: '#fff', cursor: 'pointer', fontWeight: 'bold' }}>提交</button>
</div>
</div>
</div>
)
}
//
if (showFeedback) {
return (
@ -247,6 +322,24 @@ export default function Home() {
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '11px' }}>添加新藏品</div>
</div>
</div>
<div onClick={() => {
if (!localStorage.getItem('token')) return alert('请先登录')
setShowFeedback(true)
}} style={{
background: 'linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%)',
borderRadius: '12px',
padding: '16px',
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
gap: '12px'
}}>
<div style={{ fontSize: '24px' }}>📮</div>
<div>
<div style={{ color: '#fff', fontSize: '15px', fontWeight: '600' }}>联系我们</div>
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '11px' }}>反馈建议</div>
</div>
</div>
</div>
</div>