diff --git a/client/mobile/mobile_app.tsx b/client/mobile/mobile_app.tsx
index 8f3b4ce..a9fb809 100644
--- a/client/mobile/mobile_app.tsx
+++ b/client/mobile/mobile_app.tsx
@@ -192,6 +192,7 @@ const ErrorPage = () => {
};
import ProfilePage from './pages_profile.tsx'
+import SettingsPage from './pages_settings.tsx'
// 移动端布局组件 - 包含底部导航
const MobileLayout = () => {
@@ -224,7 +225,7 @@ const MobileLayout = () => {
通知
- {
{
path: 'notifications',
element:
+ },
+ {
+ path: 'settings',
+ element:
}
]
},
diff --git a/client/mobile/pages_profile.tsx b/client/mobile/pages_profile.tsx
index 0ed74c4..681fb13 100644
--- a/client/mobile/pages_profile.tsx
+++ b/client/mobile/pages_profile.tsx
@@ -104,80 +104,13 @@ export default function ProfilePage() {
个人信息
-
-
-
-
编辑信息
-
+
+
diff --git a/client/mobile/pages_settings.tsx b/client/mobile/pages_settings.tsx
new file mode 100644
index 0000000..5bffe2d
--- /dev/null
+++ b/client/mobile/pages_settings.tsx
@@ -0,0 +1,110 @@
+import React from 'react'
+import { useForm } from 'react-hook-form'
+import { useMutation } from '@tanstack/react-query'
+import { UserAPI } from './api.ts'
+import { useAuth } from './hooks.tsx'
+
+export default function SettingsPage() {
+ const { register, handleSubmit, formState: { errors } } = useForm<{
+ nickname: string
+ email: string
+ phone?: string
+ password?: string
+ }>()
+
+ const { mutate: updateUser, isPending } = useMutation({
+ mutationFn: async (data: {
+ nickname: string
+ email: string
+ phone?: string
+ password?: string
+ }) => {
+ const res = await UserAPI.getUsers({ limit: 1 })
+ if (!res.data?.[0]?.id) throw new Error('用户ID不存在')
+ return UserAPI.updateUser(res.data[0].id, {
+ nickname: data.nickname,
+ email: data.email,
+ phone: data.phone,
+ ...(data.password ? { password: data.password } : {})
+ })
+ },
+ onSuccess: () => alert('更新成功'),
+ onError: (error) => {
+ console.error('更新失败:', error)
+ alert('更新失败')
+ }
+ })
+
+ const onSubmit = (data: {
+ nickname: string
+ email: string
+ phone?: string
+ password?: string
+ }) => {
+ updateUser(data)
+ }
+
+ return (
+
+ )
+}
\ No newline at end of file