fix(mobile-upgrade): 添加解析失败时的友好提示

当 APK/IPA 解析失败时,显示黄色警告提示用户手动填写版本信息

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Developer 2025-12-03 08:17:02 -08:00
parent eb57309724
commit 12ec5e6fc3
1 changed files with 10 additions and 1 deletions

View File

@ -26,6 +26,7 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
})
const [file, setFile] = useState<File | null>(null)
const [error, setError] = useState<string | null>(null)
const [parseWarning, setParseWarning] = useState<string | null>(null)
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
const selectedFile = e.target.files?.[0]
@ -33,6 +34,7 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
setFile(selectedFile)
setError(null)
setParseWarning(null)
// Auto-detect platform from file extension
let detectedPlatform: Platform = 'android'
@ -56,7 +58,8 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
}))
} catch (err) {
console.error('Failed to parse package:', err)
// Don't show error, just let user fill in manually
// Show warning but allow user to fill in manually
setParseWarning('无法自动解析安装包信息,请手动填写版本号和构建号')
} finally {
setIsParsing(false)
}
@ -123,6 +126,12 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
</div>
)}
{parseWarning && (
<div className="mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg text-yellow-700 text-sm">
{parseWarning}
</div>
)}
<form onSubmit={handleSubmit} className="space-y-4">
{/* File Upload */}
<div>