index_time.tsx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { View, Text, Image } from "@tarojs/components";
  2. import './index_time.scss';
  3. import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
  4. import { getCommon, getDot } from "@/features/trackTimeDuration/hooks/RingData";
  5. import Rings, { RingCommon, BgRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
  6. import { useEffect, useState } from "react";
  7. import dayjs from "dayjs";
  8. let LinearGradient, useActionSheet, useNavigation
  9. if (process.env.TARO_ENV == 'rn') {
  10. LinearGradient = require('react-native-linear-gradient').default
  11. useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
  12. useNavigation = require("@react-navigation/native").useNavigation
  13. }
  14. export default function IndexTimePage() {
  15. let navigation;
  16. if (useNavigation) {
  17. navigation = useNavigation()
  18. }
  19. const [count, setCount] = useState(0)
  20. useEffect(() => {
  21. setInterval(() => {
  22. setCount(t => t + 1)
  23. }, 1000)
  24. }, [])
  25. function chooseLocation() {
  26. jumpPage('', 'map', navigation)
  27. }
  28. const common: RingCommon = {
  29. useCase: 'ChooseScenario',
  30. radius: 115,
  31. lineWidth: 26,
  32. isFast: true,
  33. status: 'WAIT_FOR_START'
  34. }
  35. const bgRing: BgRing = {
  36. color: '#EAE9E9'
  37. }
  38. function ring() {
  39. const currentDot: CurrentDot = {
  40. color: '#CACACA',
  41. lineWidth: 10,
  42. borderColor: '#ffffff',
  43. offset: 0
  44. }
  45. // var common = getCommon(null, true)
  46. // common.radius = 115;
  47. // common.lineWidth = 26;
  48. // var bgRing = getBgRing()
  49. // var realRing = getReal(record, false, false)
  50. // return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'small'} />
  51. return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'smal11l'} />
  52. }
  53. return <View className="page_container">
  54. <View style={{ position: 'relative' }}>
  55. {
  56. ring()
  57. }
  58. <View className="ring_center">
  59. <Image className="sun" src={require('@assets/index_time/sun.png')} />
  60. <Text className="time">{dayjs().format('HH:mm:ss')}</Text>
  61. <Text className="date">{dayjs().format('dddd, MMM DD')}</Text>
  62. </View>
  63. </View>
  64. <View className="location">
  65. <Image className="location_icon" src={require('@assets/index_time/pin.png')} />
  66. <Text className="location_text">Beijing</Text>
  67. </View>
  68. <Text className="timezone">UTC+8</Text>
  69. <View className="btn_bg" onClick={chooseLocation}>
  70. <Text className="btn_text">Pick Location</Text>
  71. </View>
  72. <View className="footer">
  73. <Text className="footer_text">English</Text>
  74. <Image className="footer_icon" src={require('@assets/index_time/arrow.png')} />
  75. </View>
  76. </View>
  77. }