feat: 更新文章功能和相关依赖
- 新增文章详情页面,支持根据文章 ID 加载和展示文章内容 - 添加文章卡片组件,展示推荐文章的标题、封面和阅读量 - 更新文章服务,支持获取文章列表和根据 ID 获取文章详情 - 集成腾讯云 COS SDK,支持文件上传功能 - 优化打卡功能,支持按日期加载和展示打卡记录 - 更新相关依赖,确保项目兼容性和功能完整性 - 调整样式以适应新功能的展示和交互
This commit is contained in:
@@ -6,7 +6,7 @@ import { addExercise, syncCheckin } from '@/store/checkinSlice';
|
||||
import { EXERCISE_LIBRARY, getCategories, searchExercises } from '@/utils/exerciseLibrary';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import * as Haptics from 'expo-haptics';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { useLocalSearchParams, useRouter } from 'expo-router';
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Animated, FlatList, LayoutAnimation, Modal, Platform, SafeAreaView, StyleSheet, Text, TextInput, TouchableOpacity, UIManager, View } from 'react-native';
|
||||
|
||||
@@ -20,7 +20,9 @@ function formatDate(d: Date) {
|
||||
export default function SelectExerciseScreen() {
|
||||
const dispatch = useAppDispatch();
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams<{ date?: string }>();
|
||||
const today = useMemo(() => formatDate(new Date()), []);
|
||||
const currentDate = (typeof params?.date === 'string' && params.date) ? params.date : today;
|
||||
const theme = (useColorScheme() ?? 'light') as 'light' | 'dark';
|
||||
const colorTokens = Colors[theme];
|
||||
|
||||
@@ -70,7 +72,7 @@ export default function SelectExerciseScreen() {
|
||||
const handleAdd = () => {
|
||||
if (!selected) return;
|
||||
dispatch(addExercise({
|
||||
date: today,
|
||||
date: currentDate,
|
||||
item: {
|
||||
key: selected.key,
|
||||
name: selected.name,
|
||||
@@ -79,11 +81,11 @@ export default function SelectExerciseScreen() {
|
||||
reps: reps && reps > 0 ? reps : undefined,
|
||||
},
|
||||
}));
|
||||
console.log('addExercise', today, selected.key, sets, reps);
|
||||
console.log('addExercise', currentDate, selected.key, sets, reps);
|
||||
// 同步到后端(读取最新 store 需要在返回后由首页触发 load,或此处直接上报)
|
||||
// 简单做法:直接上报新增项(其余项由后端合并/覆盖)
|
||||
dispatch(syncCheckin({
|
||||
date: today,
|
||||
date: currentDate,
|
||||
items: [
|
||||
{
|
||||
key: selected.key,
|
||||
|
||||
Reference in New Issue
Block a user