diff --git a/code/allapp/allapp-rn/src/app/(tabs)/chat.tsx b/code/allapp/allapp-rn/src/app/(tabs)/chat.tsx index 66c7abf8..a2ca591a 100644 --- a/code/allapp/allapp-rn/src/app/(tabs)/chat.tsx +++ b/code/allapp/allapp-rn/src/app/(tabs)/chat.tsx @@ -1,29 +1,34 @@ +import { useRouter } from 'expo-router' import { Text, View } from 'react-native' import { ScrollView } from 'react-native-gesture-handler' import { AButton, ACell, ACellGroup } from '@/components/common/ao' +import EmptyState from '@/components/common/EmptyStatus' import { Grid, GridItem } from '@/components/ui/grid' import { useMoneyCategoryStore } from '@/store/moneyCategory' +import { useSpaceStore } from '@/store/space' export default function Demo() { - const moneyCategoryStore = useMoneyCategoryStore() + const router = useRouter() + const spaceStore = useSpaceStore() - function getCategories() { - console.log(moneyCategoryStore.categories) - } - - async function resetCategory() { - moneyCategoryStore.setCategories([]) - await moneyCategoryStore.init() + function NoSpaceTip() { + return ( + 创建 / 加入 空间 + } + /> + ) } return ( - - - - - - - - + + { + spaceStore.inSpace() + ? () + : + } + ) } diff --git a/code/allapp/allapp-rn/src/request/index.ts b/code/allapp/allapp-rn/src/request/index.ts index 1288fff7..2f5e9787 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, diff --git a/code/allapp/allapp-rn/src/store/space.ts b/code/allapp/allapp-rn/src/store/space.ts index 2d5540cf..91d6ba3d 100644 --- a/code/allapp/allapp-rn/src/store/space.ts +++ b/code/allapp/allapp-rn/src/store/space.ts @@ -4,6 +4,7 @@ interface SpaceState { userSpace: UserSpace | null setUserSpace: (space: UserSpace | null) => void clear: () => void + inSpace: () => boolean } export const useSpaceStore = create((set, get) => ({ @@ -14,4 +15,8 @@ export const useSpaceStore = create((set, get) => ({ userSpace: null, }) }, + inSpace: () => { + const userSpace = get().userSpace + return userSpace !== null && userSpace.id !== 0 + }, })) diff --git a/code/allapp/allapp-rn/test.html b/code/allapp/allapp-rn/test.html index 25bd9b0c..c349ed0d 100644 --- a/code/allapp/allapp-rn/test.html +++ b/code/allapp/allapp-rn/test.html @@ -1,94 +1,201 @@ - + + - WebSocket Test + IM 列表 + + + +
+
+

IM 列表

+ +
+
-

WebSocket Test

-
- - - + +
+
+
+ 头像 +
+
+

张三

+

你好,最近怎么样?

+
+
+

2分钟前

+
3
+
+
+ +
+
+ 头像 +
+
+

李四

+

好的,明天见!

+
+
+

昨天

+
0
+
+
+ +
-
-

Messages:

-
+ +
+
- - + + \ No newline at end of file