Working.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import Layout from "@/components/layout/layout";
  2. import WorkoutContent from "@/features/workout/WorkoutContent";
  3. import WorkoutStopWatch from "@/features/workout/WorkoutStopWatch";
  4. import WorkoutTimer from "@/features/workout/WorkoutTimer";
  5. import { NaviBarTitleShowType, TemplateType, WorkoutType } from "@/utils/types";
  6. import { View } from "@tarojs/components";
  7. import { useRouter } from "@tarojs/taro";
  8. import { useSelector } from "react-redux";
  9. export default function Page() {
  10. const workout = useSelector((state: any) => state.workout);
  11. const router = useRouter();
  12. function detail() {
  13. return <View>
  14. {
  15. router.params.type == 'timer' && <WorkoutTimer />
  16. }
  17. {
  18. router.params.type == 'stop_watch' && <WorkoutStopWatch targetCount={router.params.count ?? 0} end={(e) => { }} />
  19. }
  20. {
  21. router.params.type == 'content' && <WorkoutContent />
  22. }
  23. </View>
  24. }
  25. return <Layout children={detail()}
  26. title={workout.item.name}
  27. type={TemplateType.customHeader}
  28. titleShowStyle={NaviBarTitleShowType.scrollToShow}
  29. />
  30. }