diff --git a/code/allapp/allapp-rn/assets/icon.png b/code/allapp/allapp-rn/assets/icon.png index 173c4e27..feca22ee 100644 Binary files a/code/allapp/allapp-rn/assets/icon.png and b/code/allapp/allapp-rn/assets/icon.png differ diff --git a/code/allapp/allapp-rn/src/app/(tabs)/finance/components/CategorySheet.tsx b/code/allapp/allapp-rn/src/app/(tabs)/finance/components/CategorySheet.tsx index 7f57bd5e..4bbfc4f8 100644 --- a/code/allapp/allapp-rn/src/app/(tabs)/finance/components/CategorySheet.tsx +++ b/code/allapp/allapp-rn/src/app/(tabs)/finance/components/CategorySheet.tsx @@ -46,7 +46,6 @@ export default function CategorySheet({ const handleSelect = useCallback( (item: FinanceCategory) => { - console.log(item) onSelect?.(item) onClose?.() }, diff --git a/code/allapp/allapp-rn/src/app/(tabs)/finance/index.tsx b/code/allapp/allapp-rn/src/app/(tabs)/finance/index.tsx index 1761f2e0..9e56f863 100644 --- a/code/allapp/allapp-rn/src/app/(tabs)/finance/index.tsx +++ b/code/allapp/allapp-rn/src/app/(tabs)/finance/index.tsx @@ -1,7 +1,7 @@ import type { DateMorePickerMode } from '@/components/common/ao/DateMorePicker' import type { FinanceCategory } from '@/types/finance/category' import { useFocusEffect, useRouter } from 'expo-router' -import React, { useCallback, useState } from 'react' +import React, { useCallback, useEffect, useState } from 'react' import { Image, Text, TouchableOpacity, View } from 'react-native' import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' import { toast } from 'sonner-native' @@ -9,6 +9,7 @@ import { ADateMorePicker, ADrawer, AListItem, LucideIcon } from '@/components/co import { resolveDateRange } from '@/components/common/ao/DateMorePicker' import { Fab, FabIcon } from '@/components/ui/fab' import { AddIcon } from '@/components/ui/icon' +import { listFinanceCategoriesApi } from '@/request/api/finance/category' import { deleteFinanceRecordApi, listFinanceRecordsApi } from '@/request/api/finance/record' import { useFinanceStore } from '@/store/finance' import { getCurrentYearMonth } from '@/utils/time' @@ -79,9 +80,22 @@ export default function Money() { }) } + async function fetchFinanceCategories() { + if (financeStore.categories.length > 0) { + return + } + const res = await listFinanceCategoriesApi() + if (res.isSuccess) { + financeStore.setCategories(res.data.categories) + } + } + + useEffect(() => { + fetchFinanceCategories() + }, []) + useFocusEffect( useCallback(() => { - financeStore.ensureCategoriesLoaded() fetchFinanceRecords() }, [searchParams.startTime, searchParams.endTime, searchParams.category]), ) @@ -272,7 +286,6 @@ export default function Money() { setShowCategorySheet(false) }} onSelect={(category) => { - console.log(category) setSearchParams(prev => ({ ...prev, category, diff --git a/code/allapp/allapp-rn/src/app/auth/index.tsx b/code/allapp/allapp-rn/src/app/auth/index.tsx index dedc9f6e..841ae19a 100644 --- a/code/allapp/allapp-rn/src/app/auth/index.tsx +++ b/code/allapp/allapp-rn/src/app/auth/index.tsx @@ -93,7 +93,6 @@ export default function Auth() { await ExpoQQ.sendGetUserInfoReq() } catch (e) { - console.error('QQ 登录未完成', e) setLoading(false) } } @@ -114,8 +113,6 @@ export default function Auth() { avatar: onGetUserInfo.figureurlQq_2 || onGetUserInfo.figureurl_2, }) - console.log(loginRes) - if (loginRes.isSuccess) { userStore.setUserInfo({ token: loginRes.data.token, diff --git a/code/allapp/allapp-rn/src/app/finance/category/index.tsx b/code/allapp/allapp-rn/src/app/finance/category/index.tsx index 86ac2dfe..7e220738 100644 --- a/code/allapp/allapp-rn/src/app/finance/category/index.tsx +++ b/code/allapp/allapp-rn/src/app/finance/category/index.tsx @@ -224,7 +224,6 @@ export default function MoneyCategorySetting() { updateFinanceCategorySortNumberApi({ categories: updateData, }).then((res) => { - console.log(res) }) } }} diff --git a/code/allapp/allapp-rn/src/store/app.ts b/code/allapp/allapp-rn/src/store/app.ts index 9010a463..4aaf154c 100644 --- a/code/allapp/allapp-rn/src/store/app.ts +++ b/code/allapp/allapp-rn/src/store/app.ts @@ -1,5 +1,6 @@ import { create } from 'zustand' import { enterDefaultSpaceApi } from '@/request/api/space' +import { useFinanceStore } from './finance' import { useNavStore } from './navigation' import { useSpaceStore } from './space' import { useUserStore } from './user' @@ -42,5 +43,6 @@ export const useAppStore = create((set, get) => ({ reset: () => { useUserStore.getState().clear() useSpaceStore.getState().clear() + useFinanceStore.getState().clear() }, })) diff --git a/code/allapp/allapp-rn/src/store/finance.ts b/code/allapp/allapp-rn/src/store/finance.ts index 55e068cf..5b9ccf21 100644 --- a/code/allapp/allapp-rn/src/store/finance.ts +++ b/code/allapp/allapp-rn/src/store/finance.ts @@ -28,6 +28,9 @@ interface FinanceState { getTotalBalance: () => string setRecords: (records: FinanceRecord[]) => void getRecordById: (id: number) => FinanceRecord | null + + // 清空 + clear: () => void } function recomputeGroups(records: FinanceRecord[]) { @@ -260,8 +263,9 @@ export const useFinanceStore = create()( }), ensureCategoriesLoaded: async () => { - if (get().categories.length > 0) + if (get().categories.length > 0) { return + } const res = await listFinanceCategoriesApi() if (res.isSuccess) { set({ categories: res.data.categories }) @@ -358,5 +362,12 @@ export const useFinanceStore = create()( return null }, // ================= 记录 ================= + + clear: () => { + set({ + categories: [], + records: [], + }) + }, }), ) diff --git a/code/allapp/allapp-rn/src/store/navigation.ts b/code/allapp/allapp-rn/src/store/navigation.ts index bd6310ef..6f33898e 100644 --- a/code/allapp/allapp-rn/src/store/navigation.ts +++ b/code/allapp/allapp-rn/src/store/navigation.ts @@ -22,8 +22,8 @@ const DEFAULT_NAV_MENUS: NavItem[] = [ { label: '记账', path: '/finance', icon: 'CircleDollarSign' }, // { label: '恋爱记', path: '/love', icon: 'Heart' }, // { label: '聊天', path: '/chat', icon: 'MessageCircle' }, - { label: '个人中心', path: '/user', icon: 'CircleUserRound' }, { label: '空间管理', path: '/space', icon: 'Earth' }, + { label: '个人中心', path: '/user', icon: 'CircleUserRound' }, ] export const useNavStore = create()( diff --git a/code/allapp/allapp-rn/test.html b/code/allapp/allapp-rn/test.html index 3c17f341..fd4d82f0 100644 --- a/code/allapp/allapp-rn/test.html +++ b/code/allapp/allapp-rn/test.html @@ -1,207 +1,86 @@ - - -家庭菜单 - + + EasyUI Grid Demo + + + + + + + -
家庭做饭助手
+

EasyUI Grid 简单示例

- -
-

菜谱

-
-
+ + + + + + + + + + +
ID姓名年龄邮箱编辑 | ' + + '删除'; + }">操作
- -
-

下单

-
-
- - -
-

库存

- - - -
-
- -
-
菜谱
-
下单
-
库存
+ + \ No newline at end of file