diff --git a/MeAgent/navigation/Screens.js b/MeAgent/navigation/Screens.js index 343b9979..c1f86863 100644 --- a/MeAgent/navigation/Screens.js +++ b/MeAgent/navigation/Screens.js @@ -58,7 +58,7 @@ import MemberList from "../src/screens/Social/MemberList"; import SocialNotifications from "../src/screens/Social/Notifications"; // 新个人中心页面 -import { ProfileScreen as NewProfileScreen } from "../src/screens/Profile"; +import { ProfileScreen as NewProfileScreen, FeedbackScreen } from "../src/screens/Profile"; // 订阅管理页面 import { SubscriptionScreen } from "../src/screens/Subscription"; @@ -460,6 +460,13 @@ function NewProfileStack(props) { cardStyle: { backgroundColor: "#0F172A" }, }} /> + ); } diff --git a/MeAgent/src/screens/Profile/FeedbackScreen.js b/MeAgent/src/screens/Profile/FeedbackScreen.js new file mode 100644 index 00000000..c9f90184 --- /dev/null +++ b/MeAgent/src/screens/Profile/FeedbackScreen.js @@ -0,0 +1,589 @@ +/** + * 意见反馈页面 + * 支持提交反馈和查看历史 + */ + +import React, { useState, useEffect, useCallback } from 'react'; +import { + StyleSheet, + ScrollView, + KeyboardAvoidingView, + Platform, + RefreshControl, + Alert, +} from 'react-native'; +import { + Box, + VStack, + HStack, + Text, + Icon, + Pressable, + Input, + TextArea, + Spinner, + useToast, +} from 'native-base'; +import { Ionicons } from '@expo/vector-icons'; +import { LinearGradient } from 'expo-linear-gradient'; +import { useNavigation } from '@react-navigation/native'; +import { SafeAreaView } from 'react-native-safe-area-context'; + +import { useAuth } from '../../contexts/AuthContext'; +import { feedbackService } from '../../services/feedbackService'; + +// 反馈类型配置 +const FEEDBACK_TYPES = [ + { value: 'bug', label: 'Bug', icon: 'bug', color: '#EF4444' }, + { value: 'suggestion', label: '建议', icon: 'bulb', color: '#F59E0B' }, + { value: 'complaint', label: '投诉', icon: 'warning', color: '#F97316' }, + { value: 'general', label: '其他', icon: 'help-circle', color: '#6B7280' }, +]; + +// 状态配置 +const STATUS_CONFIG = { + pending: { label: '待处理', color: '#6B7280' }, + processing: { label: '处理中', color: '#3B82F6' }, + resolved: { label: '已解决', color: '#10B981' }, + closed: { label: '已关闭', color: '#6B7280' }, +}; + +/** + * 标签页选择器 + */ +const TabSelector = ({ activeTab, onTabChange }) => { + const tabs = [ + { key: 'submit', label: '提交反馈', icon: 'send' }, + { key: 'history', label: '历史记录', icon: 'time' }, + ]; + + return ( + + {tabs.map((tab) => ( + onTabChange(tab.key)} + > + + + + + {tab.label} + + + + + ))} + + ); +}; + +/** + * 类型选择器 + */ +const TypeSelector = ({ selectedType, onTypeChange }) => { + return ( + + {FEEDBACK_TYPES.map((type) => ( + onTypeChange(type.value)} + mb={2} + > + + + + + {type.label} + + + + + ))} + + ); +}; + +/** + * 提交反馈表单 + */ +const SubmitFeedbackForm = ({ onSuccess }) => { + const [formData, setFormData] = useState({ + type: 'suggestion', + title: '', + content: '', + contact: '', + }); + const [submitting, setSubmitting] = useState(false); + const toast = useToast(); + + const handleSubmit = async () => { + if (!formData.content.trim()) { + toast.show({ + description: '请填写反馈内容', + placement: 'top', + bgColor: 'warning.500', + }); + return; + } + + try { + setSubmitting(true); + await feedbackService.submit({ + type: formData.type, + title: formData.title.trim() || undefined, + content: formData.content.trim(), + contact: formData.contact.trim() || undefined, + }); + + toast.show({ + description: '反馈提交成功,感谢您的宝贵意见!', + placement: 'top', + bgColor: 'success.500', + }); + + // 重置表单 + setFormData({ + type: 'suggestion', + title: '', + content: '', + contact: '', + }); + + // 通知刷新历史 + if (onSuccess) onSuccess(); + } catch (error) { + toast.show({ + description: error.message || '提交失败,请稍后重试', + placement: 'top', + bgColor: 'error.500', + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + {/* 反馈类型 */} + + + 反馈类型 + + setFormData({ ...formData, type })} + /> + + + {/* 标题 */} + + + 标题(可选) + + setFormData({ ...formData, title: text })} + placeholder="简短描述您的反馈" + placeholderTextColor="gray.600" + bg="rgba(255,255,255,0.05)" + borderColor="rgba(255,255,255,0.1)" + color="white" + fontSize={14} + py={3} + px={4} + borderRadius={12} + maxLength={100} + _focus={{ + borderColor: '#7C3AED', + bg: 'rgba(124, 58, 237, 0.1)', + }} + /> + + + {/* 内容 */} + + + + 反馈内容 + + + {formData.content.length}/2000 + + +