time_record.tsx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { View, Image } from "@tarojs/components";
  2. import './time_record.scss'
  3. import Taro from "@tarojs/taro";
  4. import { rpxToPx } from "@/utils/tools";
  5. import Rings, { RingCommon, BgRing, TargetRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
  6. import { MainColorType } from "@/context/themes/color";
  7. export default function TimeRecord() {
  8. const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
  9. const navigationBarHeight = systemInfo.statusBarHeight + 44;
  10. const common: RingCommon = {
  11. useCase: 'ChooseScenario',
  12. radius: 27,
  13. lineWidth: 12,
  14. isFast: true,
  15. status: 'WAIT_FOR_START'
  16. }
  17. const bgRing: BgRing = {
  18. color: MainColorType.ringBg
  19. }
  20. function targetRing() {
  21. return {
  22. color: 'pink',
  23. startArc: 0,
  24. durationArc: 3 / 4 * Math.PI
  25. }
  26. }
  27. function realRing() {
  28. return {
  29. color: 'red',
  30. startArc: 0,
  31. durationArc: 2 / 4 * Math.PI
  32. }
  33. }
  34. function currentDot() {
  35. return {
  36. color: MainColorType.eat,
  37. lineWidth: 2,
  38. borderColor: '#F5F5F5',
  39. offset: 0
  40. }
  41. }
  42. function ring() {
  43. return <Rings common={common}
  44. bgRing={bgRing}
  45. targetRing={targetRing()}
  46. realRing={realRing()}
  47. canvasId={'smal11lsss'}
  48. currentDot={currentDot()}
  49. scale={1.0}
  50. />
  51. }
  52. return <View>
  53. <View className="navi_bar" style={{ height: navigationBarHeight }}>
  54. <View style={{
  55. position: 'absolute',
  56. left: 0,
  57. right: 0,
  58. bottom: 0,
  59. height: 44,
  60. display: 'flex',
  61. alignItems: 'center',
  62. justifyContent: 'center'
  63. }}>
  64. <Image src={require('@assets/_health/navi_back.png')} style={{
  65. position: 'absolute',
  66. width: rpxToPx(92),
  67. height: rpxToPx(64),
  68. left: 0,
  69. top: 22 - rpxToPx(32)
  70. }}
  71. onClick={() => {
  72. Taro.navigateBack()
  73. }}
  74. />
  75. <View className="h36 bold">upcoming fast</View>
  76. </View>
  77. </View>
  78. <View style={{ height: navigationBarHeight }} />
  79. {
  80. ring()
  81. }
  82. </View>
  83. }