diff --git a/src/app.config.ts b/src/app.config.ts index 5b577bd..1020ac7 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -4,7 +4,6 @@ export default defineAppConfig({ 'pages/home/index', // 新的模板卡片首页 'pages/history/index', // 历史记录页面 'pages/generate/index', // 生成处理页面 - 'pages/index/index', // 保留原有首页,暂时作为模板页面 'pages/result/index' ], tabBar: { diff --git a/src/pages/imageaudit-demo/index.css b/src/pages/imageaudit-demo/index.css deleted file mode 100644 index 325207a..0000000 --- a/src/pages/imageaudit-demo/index.css +++ /dev/null @@ -1,93 +0,0 @@ -.imageaudit-demo { - padding: 20rpx; - background-color: #f5f5f5; - min-height: 100vh; -} - -.demo-header { - text-align: center; - margin-bottom: 40rpx; - padding: 30rpx 20rpx; - background-color: #fff; - border-radius: 16rpx; - box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1); -} - -.demo-title { - font-size: 36rpx; - font-weight: bold; - color: #333; - margin-bottom: 16rpx; - display: block; -} - -.demo-subtitle { - font-size: 28rpx; - color: #666; - display: block; -} - -.demo-content { - background-color: #fff; - border-radius: 16rpx; - padding: 30rpx; - margin-bottom: 40rpx; - box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1); -} - -.audit-history { - background-color: #fff; - border-radius: 16rpx; - padding: 30rpx; - box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1); -} - -.history-title { - font-size: 32rpx; - font-weight: bold; - color: #333; - margin-bottom: 30rpx; - display: block; -} - -.history-item { - padding: 20rpx; - border: 1rpx solid #eee; - border-radius: 12rpx; - margin-bottom: 20rpx; - background-color: #fafafa; -} - -.history-item:last-child { - margin-bottom: 0; -} - -.history-info { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 16rpx; -} - -.history-time { - font-size: 24rpx; - color: #999; -} - -.history-result { - font-size: 28rpx; - font-weight: bold; -} - -.history-details { - display: flex; - justify-content: space-between; - padding-top: 12rpx; - border-top: 1rpx solid #eee; -} - -.history-score, -.history-risk { - font-size: 24rpx; - color: #666; -} \ No newline at end of file diff --git a/src/pages/imageaudit-demo/index.tsx b/src/pages/imageaudit-demo/index.tsx deleted file mode 100644 index bd3201f..0000000 --- a/src/pages/imageaudit-demo/index.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, { useState } from 'react'; -import { View, Text } from '@tarojs/components'; -import Taro from '@tarojs/taro'; -import ImageAudit from '../../components/ImageAudit'; -import { ImageAuditResult } from '../../hooks/useImageDetectionTaskManager'; -import './index.css'; - -const ImageAuditDemo: React.FC = () => { - const [currentImageUrl, setCurrentImageUrl] = useState(''); - const [auditHistory, setAuditHistory] = useState>([]); - - const handleImageUpload = (imageUrl: string) => { - console.log('图片上传成功:', imageUrl); - setCurrentImageUrl(imageUrl); - Taro.showToast({ - title: '图片上传成功', - icon: 'success' - }); - }; - - const handleAuditComplete = (result: ImageAuditResult) => { - // 添加到历史记录 - if (currentImageUrl) { - setAuditHistory(prev => [{ - imageUrl: currentImageUrl, - result, - timestamp: Date.now() - }, ...prev]); - } - }; - - const handleAuditError = (error: Error) => { - console.error('审核失败:', error); - Taro.showToast({ - title: `审核失败: ${error.message}`, - icon: 'error', - duration: 3000 - }); - }; - - const formatTimestamp = (timestamp: number): string => { - return new Date(timestamp).toLocaleString('zh-CN'); - }; - - const getResultColor = (conclusion?: string): string => { - switch (conclusion) { - case 'PASS': - return '#52c41a'; - case 'REJECT': - return '#ff4d4f'; - case 'REVIEW': - return '#faad14'; - default: - return '#666'; - } - }; - - return ( - - - 图片审核组件演示 - 上传图片进行内容安全审核 - - - - - - - {auditHistory.length > 0 && ( - - 审核历史记录 - {auditHistory.map((item, index) => ( - - - - {formatTimestamp(item.timestamp)} - - - {item.result?.conclusion === 'pass' && '✅ 审核通过'} - {item.result?.conclusion === 'reject' && '❌ 审核拒绝'} - {item.result?.conclusion === 'review' && '⚠️ 人工复审'} - {item.result?.conclusion === 'uncertain' && '❓ 结果不确定'} - {!item.result?.conclusion && '❓ 结果未知'} - - - {item.result?.result && ( - - - 安全评分: {Math.round((item.result.result.score || 0) * 100)} - - - 风险等级: {item.result.result.riskLevel || '未知'} - - - )} - - ))} - - )} - - ); -}; - -export default ImageAuditDemo; \ No newline at end of file diff --git a/src/pages/index/index.config.ts b/src/pages/index/index.config.ts deleted file mode 100644 index 8e6e931..0000000 --- a/src/pages/index/index.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: 'AI手办生成器', - navigationBarBackgroundColor: '#ffffff', - navigationBarTextStyle: 'black', - backgroundColorTop: '#ffffff', - backgroundColorBottom: '#ffffff', - backgroundColor: '#ffffff' -}) diff --git a/src/pages/index/index.css b/src/pages/index/index.css deleted file mode 100644 index a4f6a98..0000000 --- a/src/pages/index/index.css +++ /dev/null @@ -1,16 +0,0 @@ -.index { - font-size: 1rem; - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-end; - min-height: 100vh; - min-width: 100vw; - margin: 0; - padding: 0; - background-image: url('../../assets/images/Figure.jpg'); - background-size: cover; - background-position: center; - background-repeat: no-repeat; - position: relative; -} \ No newline at end of file diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx deleted file mode 100644 index 12e13a6..0000000 --- a/src/pages/index/index.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { View } from '@tarojs/components' -import { useState } from 'react' -import { navigateTo } from '@tarojs/taro' -import './index.css' -import { useSdk, useUploadVideo } from '../../hooks/index' -import UploadButton from '../../components/UploadButton' -import LoadingOverlay from '../../components/LoadingOverlay' -import ErrorOverlay from '../../components/ErrorOverlay' -import { createPlatformFactory } from '../../platforms' - -type PageStep = 'upload' | 'loading' | 'error' - -interface AppState { - step: PageStep; - error: string | null; -} - -export default function Index() { - const sdk = useSdk() - const [state, setState] = useState({ - step: 'upload', - error: null - }) - - const [videoPath, setVidePath] = useState() - - useUploadVideo((res) => { - console.log(res) - return { - videoPath: videoPath, - titleConfig: { - title: `视频发布` - }, - success() { - console.log("视频发布/挂载成功"); - }, - fail() { - console.log("视频发布/挂载失败"); - }, - } - }) - - const chooseAndGenerateImage = async () => { - try { - // 选择图片,选择完成后会自动触发loading状态 - const task_id = await sdk.chooseAndGenerateImage({ - onImageSelected: () => { - // 选择图片完成后立即显示loading - setState({ step: 'loading', error: null }) - } - }) - - // 等待生成完成 - await new Promise((resolve) => setTimeout(resolve, 5000)) - const urls = await sdk.getTaskStatus(task_id) - - // 跳转到结果页面 - navigateTo({ - url: `/pages/result/index?images=${encodeURIComponent(JSON.stringify(urls))}` - }) - - // 重置状态 - setState({ step: 'upload', error: null }) - } catch (error) { - const errorMsg = error instanceof Error ? error.message : '生成失败' - setState({ step: 'error', error: errorMsg }) - } - } - - - - const resetToUpload = () => { - setState({ step: 'upload', error: null }) - } - - const renderCurrentStep = () => { - switch (state.step) { - case 'upload': - return - case 'loading': - return - case 'error': - return - default: - return - } - } - - return ( - - {renderCurrentStep()} - - ) -}