fix: 修改历史记录bug

This commit is contained in:
imeepos
2025-09-04 23:20:01 +08:00
parent 870991d81d
commit 39b81bf0bb
4 changed files with 220 additions and 148 deletions

View File

@@ -1,11 +1,11 @@
.generate { .generate {
padding: 40rpx; padding: 0;
min-height: 100vh; min-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #f8f9fa; background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
} }
.generate-loading { .generate-loading {
@@ -51,27 +51,101 @@
height: 100vh; height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
padding: 40rpx 32rpx;
box-sizing: border-box;
} }
.result-container { /* 成功页面头部 */
.success-header {
text-align: center;
margin-bottom: 40rpx;
padding-top: 80rpx;
}
.success-badge {
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
margin-bottom: 24rpx;
}
.success-icon {
font-size: 64rpx;
filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.1));
}
.success-title {
font-size: 48rpx;
font-weight: 700;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
letter-spacing: -0.5rpx;
}
.success-subtitle {
font-size: 28rpx;
color: #666;
font-weight: 500;
line-height: 1.5;
}
/* 预览区域 */
.result-preview {
flex: 1; flex: 1;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 40rpx;
min-height: 0;
padding: 0 16rpx;
}
.preview-container {
border-radius: 32rpx;
padding: 0;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
border: 1rpx solid #f0f0f0;
position: relative; position: relative;
overflow: hidden;
width: 90%;
max-width: 600rpx;
min-height: 680rpx;
height: 60vh;
display: block;
}
.preview-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 680rpx;
object-fit: cover;
border-radius: 32rpx;
cursor: pointer;
display: block;
transform: translateZ(0);
image-rendering: optimizeSpeed;
backface-visibility: hidden;
} }
.success-text { .preview-video {
position: absolute; width: 100%;
top: 60rpx; height: 100%;
left: 50%; min-height: 680rpx;
transform: translateX(-50%); object-fit: cover;
font-size: 40rpx; border-radius: 32rpx;
color: white; display: block;
font-weight: 600; transform: translateZ(0);
z-index: 10; backface-visibility: hidden;
background: rgba(0, 0, 0, 0.5); }
padding: 20rpx 40rpx;
border-radius: 25rpx; /* 底部操作区域 */
.success-actions {
margin-top: auto;
width: 100%;
} }
.result-media { .result-media {
@@ -97,17 +171,38 @@
.generate-error { .generate-error {
text-align: center; text-align: center;
padding: 60rpx; padding: 60rpx;
background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
} }
.error-container { .error-container {
margin-bottom: 60rpx; margin-bottom: 60rpx;
background: #fff;
border-radius: 32rpx;
padding: 60rpx 40rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
border: 1rpx solid #f0f0f0;
max-width: 600rpx;
} }
.error-text { .error-text {
font-size: 40rpx; font-size: 40rpx;
color: #ff3b30; color: #ff3b30;
font-weight: 600; font-weight: 700;
margin-bottom: 20rpx; margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
}
.error-text::before {
content: '⚠️';
font-size: 36rpx;
} }
.error-message { .error-message {
@@ -119,32 +214,60 @@
.action-buttons { .action-buttons {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 40rpx; gap: 24rpx;
width: 100%; width: 100%;
max-width: 600rpx; max-width: 600rpx;
margin-top: 60rpx; margin: 0 auto 32rpx;
} }
.generate-success .action-buttons { .success-actions .action-buttons {
position: absolute; margin-bottom: 24rpx;
bottom: 80rpx; }
left: 50%;
transform: translateX(-50%); /* 结果提示 */
z-index: 10; .result-tips {
padding: 0 40rpx; text-align: center;
box-sizing: border-box; margin-top: 16rpx;
}
.tips-text {
font-size: 24rpx;
color: #999;
background: rgba(255, 255, 255, 0.8);
padding: 12rpx 24rpx;
border-radius: 20rpx;
display: inline-block;
backdrop-filter: blur(10rpx);
-webkit-backdrop-filter: blur(10rpx);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
} }
.btn-primary { .btn-primary {
flex: 1; flex: 1;
background-color: #FFD67A; background: linear-gradient(135deg, #FFD67A 0%, #FFC947 100%);
color: #333; color: #333;
border-radius: 16rpx; border-radius: 24rpx;
height: 96rpx; height: 96rpx;
font-size: 34rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
border: none; border: none;
box-shadow: 0 4rpx 12rpx rgba(255, 214, 122, 0.3); box-shadow: 0 8rpx 24rpx rgba(255, 214, 122, 0.3);
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.btn-primary::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
z-index: 1;
} }
.btn-primary::after { .btn-primary::after {
@@ -153,16 +276,26 @@
.btn-secondary { .btn-secondary {
flex: 1; flex: 1;
background-color: #fff; background: rgba(255, 255, 255, 0.9);
color: #000000; color: #333;
border: 3rpx solid #FFD67A; border: 2rpx solid rgba(255, 214, 122, 0.6);
border-radius: 16rpx; border-radius: 24rpx;
height: 96rpx; height: 96rpx;
font-size: 34rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1); box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
backdrop-filter: blur(10rpx);
-webkit-backdrop-filter: blur(10rpx);
display: flex;
align-items: center;
justify-content: center;
} }
.btn-secondary::after { .btn-secondary::after {
border: none; border: none;
} }
.btn-text {
position: relative;
z-index: 2;
}

View File

@@ -44,7 +44,7 @@ export default function Generate() {
if (result.status === 'completed') { if (result.status === 'completed') {
setStatus('success') setStatus('success')
setResult({ success: true, imageUrl: result.outputUrl }) setResult({ success: true, imageUrl: result.outputUrl, thumbnailUrl: result.thumbnailUrl })
} else if (result.status === 'failed') { } else if (result.status === 'failed') {
setStatus('error') setStatus('error')
setResult({ success: false, error: result.error || '处理失败' }) setResult({ success: false, error: result.error || '处理失败' })
@@ -99,19 +99,26 @@ export default function Generate() {
) )
const renderSuccess = () => { const renderSuccess = () => {
// 检测是否为视频 const isVideo = result?.imageUrl && (result.imageUrl.includes('.mp4') || result.imageUrl.includes('video'))
const isVideo = result?.imageUrl && /\.(mp4|webm|ogg|mov|avi|mkv|flv)$/i.test(result.imageUrl) const mediaUrl = result?.imageUrl
return ( return (
<View className='generate-success'> <View className='generate-success'>
<View className='result-container'> <View className='success-header'>
<Text className='success-text'></Text> <View className='success-badge'>
{result?.imageUrl && ( <Text className='success-icon'></Text>
<View className='result-media'> <Text className='success-title'></Text>
</View>
<Text className='success-subtitle'></Text>
</View>
{mediaUrl && (
<View className='result-preview'>
<View className='preview-container'>
{isVideo ? ( {isVideo ? (
<Video <Video
className='result-video' className='preview-video'
src={result.imageUrl} src={mediaUrl}
autoplay autoplay
muted muted
loop loop
@@ -120,25 +127,40 @@ export default function Generate() {
showCenterPlayBtn={false} showCenterPlayBtn={false}
showFullscreenBtn={false} showFullscreenBtn={false}
controls={false} controls={false}
poster={result?.thumbnailUrl}
/> />
) : ( ) : (
<Image <Image
className='result-image' className='preview-image'
src={result.imageUrl} src={mediaUrl}
mode='aspectFit' mode='aspectFit'
onClick={() => {
navigateTo({
url: `/pages/result/index?images=${encodeURIComponent(JSON.stringify([mediaUrl]))}`
})
}}
/> />
)} )}
</View> </View>
</View>
)}
<View className='success-actions'>
<View className='action-buttons'>
<Button className='btn-primary' onClick={handleTryAgain}>
<Text className='btn-text'></Text>
</Button>
<Button className='btn-secondary' onClick={handleViewHistory}>
<Text className='btn-text'></Text>
</Button>
</View>
{mediaUrl && (
<View className='result-tips'>
<Text className='tips-text'></Text>
</View>
)} )}
</View> </View>
<View className='action-buttons'>
<Button className='btn-primary' onClick={handleTryAgain}>
</Button>
<Button className='btn-secondary' onClick={handleViewHistory}>
</Button>
</View>
</View> </View>
) )
} }

View File

@@ -41,14 +41,12 @@
padding: 16rpx 24rpx; padding: 16rpx 24rpx;
border-radius: 24rpx; border-radius: 24rpx;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease;
border: 1rpx solid rgba(0, 122, 255, 0.2); border: 1rpx solid rgba(0, 122, 255, 0.2);
font-weight: 500; font-weight: 500;
} }
.clear-btn:active { .clear-btn:active {
background: rgba(0, 122, 255, 0.2); background: rgba(0, 122, 255, 0.2);
transform: scale(0.95);
} }
.history-list { .history-list {
@@ -128,7 +126,6 @@
} }
.history-item:active { .history-item:active {
transform: scale(0.98);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12); box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
} }
@@ -148,11 +145,6 @@
height: 100%; height: 100%;
border-radius: 20rpx; border-radius: 20rpx;
background: #f5f5f5; background: #f5f5f5;
transition: transform 0.2s ease;
}
.history-item:active .thumbnail-image {
transform: scale(0.95);
} }
.thumbnail-placeholder { .thumbnail-placeholder {
@@ -257,7 +249,6 @@
.item-status[style*="color: rgb(255, 149, 0)"]::before, .item-status[style*="color: rgb(255, 149, 0)"]::before,
.item-status[style*="color: #FF9500"]::before { .item-status[style*="color: #FF9500"]::before {
background: #fff; background: #fff;
animation: pulse 2s infinite;
} }
/* 已完成状态 */ /* 已完成状态 */
@@ -286,17 +277,6 @@
background: #fff; background: #fff;
} }
@keyframes pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.item-info { .item-info {
display: flex; display: flex;
@@ -323,42 +303,6 @@
opacity: 0.8; opacity: 0.8;
} }
/* 添加一些动画效果 */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.history-item {
animation: fadeInUp 0.5s ease-out;
}
.history-item:nth-child(1) {
animation-delay: 0.1s;
}
.history-item:nth-child(2) {
animation-delay: 0.2s;
}
.history-item:nth-child(3) {
animation-delay: 0.3s;
}
.history-item:nth-child(4) {
animation-delay: 0.4s;
}
.history-item:nth-child(5) {
animation-delay: 0.5s;
}
/* 加载指示器 */ /* 加载指示器 */
.loading-indicator { .loading-indicator {
@@ -373,34 +317,6 @@
border-radius: 50%; border-radius: 50%;
background: #FF9500; background: #FF9500;
font-size: 0; font-size: 0;
animation: loadingPulse 1.5s ease-in-out infinite;
}
.loading-dot:nth-child(1) {
animation-delay: 0s;
}
.loading-dot:nth-child(2) {
animation-delay: 0.3s;
}
.loading-dot:nth-child(3) {
animation-delay: 0.6s;
}
@keyframes loadingPulse {
0%,
60%,
100% {
opacity: 0.3;
transform: scale(0.8);
}
30% {
opacity: 1;
transform: scale(1);
}
} }
/* 操作提示 */ /* 操作提示 */

View File

@@ -13,6 +13,7 @@ export default function History() {
const loadRecords = async () => { const loadRecords = async () => {
try { try {
const logs = await serverSdk.getMineLogs() const logs = await serverSdk.getMineLogs()
console.log(logs)
setRecords(logs || []) setRecords(logs || [])
} catch (error) { } catch (error) {
console.error('加载记录失败:', error) console.error('加载记录失败:', error)
@@ -136,7 +137,7 @@ export default function History() {
onClick={() => handleItemClick(record)} onClick={() => handleItemClick(record)}
> >
<View className='item-thumbnail'> <View className='item-thumbnail'>
{record.status === 'completed' && record.outputResult ? ( {record.status === "completed" && record.outputResult ? (
<Image <Image
className='thumbnail-image' className='thumbnail-image'
src={record.outputUrl || record.inputImageUrl} src={record.outputUrl || record.inputImageUrl}
@@ -144,11 +145,11 @@ export default function History() {
/> />
) : ( ) : (
<View className={`thumbnail-placeholder ${record.status}`}> <View className={`thumbnail-placeholder ${record.status}`}>
<Text className='thumbnail-icon'> <Image
{record.status === 'processing' ? '⏳' : className='thumbnail-image'
record.status === 'failed' ? '❌' : src={record.outputUrl || record.inputImageUrl}
record.type === 'image-to-video' ? '🎬' : '🎨'} mode='aspectFill'
</Text> />
</View> </View>
)} )}
</View> </View>