diff --git a/code/allapp/allapp-go/.idea/data_source_mapping.xml b/code/allapp/allapp-go/.idea/data_source_mapping.xml index 1c9b86ee..79158e4f 100644 --- a/code/allapp/allapp-go/.idea/data_source_mapping.xml +++ b/code/allapp/allapp-go/.idea/data_source_mapping.xml @@ -2,6 +2,7 @@ + diff --git a/code/allapp/allapp-rn/src/app/(tabs)/_layout.tsx b/code/allapp/allapp-rn/src/app/(tabs)/_layout.tsx index 63db88c6..c957c68d 100644 --- a/code/allapp/allapp-rn/src/app/(tabs)/_layout.tsx +++ b/code/allapp/allapp-rn/src/app/(tabs)/_layout.tsx @@ -3,6 +3,7 @@ import type { NavItem } from '@/store/navigation' import { Slot, usePathname, useRouter } from 'expo-router' import { useCallback, useEffect, useState } from 'react' import { Text, TouchableOpacity, View } from 'react-native' +import { KeyboardAvoidingView } from 'react-native-keyboard-controller' import Animated, { useAnimatedRef } from 'react-native-reanimated' import Sortable from 'react-native-sortables' import { ADrawer, LucideIcon } from '@/components/common/ao' @@ -71,7 +72,14 @@ export default function TabsLayout() { return ( - + + + `Item ${index + 1}`) - -export default function CustomHandleExample() { - const renderItem = useCallback( - ({ item }: { item: string }) => ( - - {item} - - - :: - - - - ), - [], - ) +import React from 'react' +import { + StyleSheet, + Text, + TextInput, + TouchableOpacity, + View, +} from 'react-native' +import { KeyboardAvoidingView } from 'react-native-keyboard-controller' +export default function KeyboardAvoidingViewExample() { return ( - - - + + + Header + + + + + + Submit + + + ) } const styles = StyleSheet.create({ - card: { - alignItems: 'center', - backgroundColor: '#2e8555', - borderRadius: 12, - flexDirection: 'row', - justifyContent: 'center', + content: { + flex: 1, + maxHeight: 600, + }, + heading: { + fontSize: 36, + marginBottom: 48, + fontWeight: '600', + }, + inner: { padding: 24, + flex: 1, + justifyContent: 'space-between', }, - container: { - padding: 16, + textInput: { + height: 45, + borderColor: '#000000', + borderWidth: 1, + borderRadius: 10, + marginBottom: 36, + paddingLeft: 10, }, - handle: { - backgroundColor: 'rgba(0,0,0,0.2)', - borderRadius: 5, - padding: 10, - }, - handleText: { - color: 'white', - fontWeight: 'bold', + button: { + marginTop: 12, + height: 45, + borderRadius: 10, + backgroundColor: 'rgb(40, 64, 147)', + justifyContent: 'center', + alignItems: 'center', }, text: { + fontWeight: '500', + fontSize: 16, color: 'white', - flex: 1, - fontWeight: 'bold', }, }) diff --git a/code/allapp/allapp-rn/src/app/_layout.tsx b/code/allapp/allapp-rn/src/app/_layout.tsx index a8d68d41..720087ee 100644 --- a/code/allapp/allapp-rn/src/app/_layout.tsx +++ b/code/allapp/allapp-rn/src/app/_layout.tsx @@ -4,7 +4,6 @@ import { Stack, usePathname } from 'expo-router' import * as SplashScreen from 'expo-splash-screen' import { StatusBar } from 'expo-status-bar' import { useEffect } from 'react' -import { Modal, View } from 'react-native' import { GestureHandlerRootView } from 'react-native-gesture-handler' import { KeyboardProvider } from 'react-native-keyboard-controller' import { MenuProvider } from 'react-native-popup-menu' diff --git a/code/allapp/allapp-rn/src/app/space/manage/components/SettingActions.tsx b/code/allapp/allapp-rn/src/app/space/manage/components/SettingActions.tsx index cf99c891..bca281c5 100644 --- a/code/allapp/allapp-rn/src/app/space/manage/components/SettingActions.tsx +++ b/code/allapp/allapp-rn/src/app/space/manage/components/SettingActions.tsx @@ -1,8 +1,10 @@ import type { UserSpace } from '@/types/space' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { Text, View } from 'react-native' +import { KeyboardAvoidingView } from 'react-native-keyboard-controller' +import Animated, { useAnimatedStyle } from 'react-native-reanimated' import { toast } from 'sonner-native' -import { LucideIcon } from '@/components/common/ao' +import { AButton, LucideIcon } from '@/components/common/ao' import { AInput, AModal } from '@/components/common/ao/index' import { Actionsheet, @@ -14,7 +16,7 @@ import { ActionsheetItem, ActionsheetItemText, } from '@/components/ui/actionsheet' -import { dissolveSpaceApi } from '@/request/api/space' +import { dissolveSpaceApi, updateSpaceNameApi } from '@/request/api/space' import { useUserStore } from '@/store/user' interface SettingActionsProps { @@ -31,20 +33,25 @@ export default function SettingActions( isOpen, onClose, space, - onActionSuccess + onActionSuccess, }: SettingActionsProps, ) { const userStore = useUserStore() - + const inputRef = useRef(null) const [localSpace, setLocalSpace] = useState(space) const [showNameModal, setShowNameModal] = useState(false) - const [showMemberNameModal, setShowMemberNameModal] = useState(false) - useEffect(() => { setLocalSpace(space) }, [space]) + + useEffect(() => { + if (showNameModal) { + inputRef.current?.focus() + } + }, [showNameModal]) + return ( <> { if (res.isSuccess) { toast.success('空间已解散') - onActionSuccess?. + onActionSuccess?.() } }, ) @@ -133,47 +140,36 @@ export default function SettingActions( - - - 空间名称 - { - setLocalSpace(prev => prev - ? ({ - ...prev, - name: val, - }) - : null) - }} - className="flex-1" - /> - - ) - } + { - setShowNameModal(false) - setLocalSpace(space) - }} onClose={() => { setShowNameModal(false) - setLocalSpace(space) - }} - onConfirm={async () => { - // 更新名称 - if (!localSpace?.name) { - toast.warning('请输入空间名称') - } }} > - + + + + + + + + + + 空间名称 + + + + + + + 保存 + + + + ) } diff --git a/code/allapp/allapp-rn/src/app/space/manage/index.tsx b/code/allapp/allapp-rn/src/app/space/manage/index.tsx index 3703e318..f0c1f574 100644 --- a/code/allapp/allapp-rn/src/app/space/manage/index.tsx +++ b/code/allapp/allapp-rn/src/app/space/manage/index.tsx @@ -39,6 +39,7 @@ export default function AuthSpace() { function listUserSpaces() { listUserSpacesApi().then((res) => { if (res.isSuccess) { + console.log(res.data) setSpaces(res.data.spaces) } }) @@ -55,8 +56,8 @@ export default function AuthSpace() { style={{ height: ITEM_HEIGHT, }} - className={`rounded-md flex-row items-center justify-between px-4 py-3 border - ${item.space_id === selectedId ? 'border-gray-700' : 'border-gray-300'}`} + className={`bg-[#f9f9f9] rounded-md flex-row items-center justify-between px-4 py-3 border + ${item.space_id === selectedId ? 'border-gray-700' : 'border-gray-200'}`} > @@ -211,6 +212,9 @@ export default function AuthSpace() { : ( { + return String(item.space_id) + }} activeItemScale={1} columns={1} data={spaces} diff --git a/code/allapp/allapp-rn/src/app/space/manage/sub-page/settings.tsx b/code/allapp/allapp-rn/src/app/space/manage/sub-page/settings.tsx new file mode 100644 index 00000000..d32fe0a8 --- /dev/null +++ b/code/allapp/allapp-rn/src/app/space/manage/sub-page/settings.tsx @@ -0,0 +1,13 @@ +import { View } from 'react-native' + +import CustomHeader from '@/components/custom/Header' + +export default function Settings() { + return ( + + + + + + ) +} diff --git a/code/allapp/allapp-rn/src/request/api/space/index.ts b/code/allapp/allapp-rn/src/request/api/space/index.ts index c35a0dfc..cb83e3f9 100644 --- a/code/allapp/allapp-rn/src/request/api/space/index.ts +++ b/code/allapp/allapp-rn/src/request/api/space/index.ts @@ -14,20 +14,27 @@ import type { RemoveSpaceMemberResult, UpdateSpaceMemberRoleParams, UpdateSpaceMemberRoleResult, + UpdateSpaceNameParams, } from '@/types/space' import alovaInstance from '../../index' const API_PREFIX = '/space' -// Create Space API +// 创建空间 export function createSpaceApi(params: CreateSpaceParams) { return alovaInstance.Post>(`${API_PREFIX}/create`, params) } +// 查询用户下的空间列表 export function listUserSpacesApi() { return alovaInstance.Post>(`${API_PREFIX}/list`) } +// 修改空间名称 +export function updateSpaceNameApi(params: UpdateSpaceNameParams) { + return alovaInstance.Post>(`${API_PREFIX}/name`, params) +} + // Join Space API export function joinSpaceApi(params: JoinSpaceParams) { return alovaInstance.Post>(`${API_PREFIX}/join`, params) diff --git a/code/allapp/allapp-rn/src/request/index.ts b/code/allapp/allapp-rn/src/request/index.ts index 6f234895..d52bee1f 100644 --- a/code/allapp/allapp-rn/src/request/index.ts +++ b/code/allapp/allapp-rn/src/request/index.ts @@ -28,8 +28,8 @@ function isWhiteListed(url: string) { } const alovaInstance = createAlova({ - // baseURL: 'http://192.168.5.6:8086/app', - baseURL: 'http://192.168.1.137:8086/app', + baseURL: 'http://192.168.5.6:8086/app', + // baseURL: 'http://192.168.1.137:8086/app', requestAdapter: axiosRequestAdapter(), timeout: 5000, cacheFor: null, @@ -44,7 +44,7 @@ const alovaInstance = createAlova({ } if (resData.code === HttpCode.Unauthorized) { - toast.error('登录状态已过期,请重新登录') + toast.error('登录状态已过期,请重新登录') useUserStore.getState().clear() useNavStore.getState().navigateToAuth() return result diff --git a/code/allapp/allapp-rn/src/types/space/index.ts b/code/allapp/allapp-rn/src/types/space/index.ts index ec924083..e423beb7 100644 --- a/code/allapp/allapp-rn/src/types/space/index.ts +++ b/code/allapp/allapp-rn/src/types/space/index.ts @@ -34,6 +34,12 @@ export interface DissolveSpaceParams { export interface DissolveSpaceResult { } +// 更新名称 +export interface UpdateSpaceNameParams { + space_id: number + space_name: string +} + // 加入空间 export interface JoinSpaceParams { invite_code: string diff --git a/code/allapp/allapp-rn/test.html b/code/allapp/allapp-rn/test.html index 5868e873..009aa6d1 100644 --- a/code/allapp/allapp-rn/test.html +++ b/code/allapp/allapp-rn/test.html @@ -1,67 +1,82 @@ -import { useCallback } from 'react'; -import { StyleSheet, Text, View } from 'react-native'; -import Sortable from 'react-native-sortables'; - -const DATA = Array.from({ length: 4 }, (_, index) => `Item ${index + 1}`); - -export default function CustomHandleExample() { - const renderItem = useCallback( - ({ item }: { item: string }) => ( - - {item} - {/* Wraps the handle component */} - {/* highlight-next-line */} - - - :: - - {/* highlight-next-line */} - - - ), - [] - ); - - return ( - - - - ); + + + + + +空间状态演示 + + + -const styles = StyleSheet.create({ - card: { - alignItems: 'center', - backgroundColor: '#2e8555', - borderRadius: 12, - flexDirection: 'row', - justifyContent: 'center', - padding: 24 - }, - container: { - padding: 16 - }, - handle: { - backgroundColor: 'rgba(0,0,0,0.2)', - borderRadius: 5, - padding: 10 - }, - handleText: { - color: 'white', - fontWeight: 'bold' - }, - text: { - color: 'white', - flex: 1, - fontWeight: 'bold' - } -}); + +
+
+
+ 工作空间 + 当前 + 默认 +
+
张三 · 5人
+
+
⋯
+
+ + +
+
+
+ 家庭账本 + 默认 +
+
张三 · 3人
+
+
⋯
+
+ + +
+
+
+ 副业空间 +
+
张三 · 2人
+
+
⋯
+
+ + + \ No newline at end of file