|
|
@@ -4,7 +4,10 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import { getCommon, getDot } from "@/features/trackTimeDuration/hooks/RingData";
|
|
|
import Rings, { RingCommon, BgRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
|
|
|
import { useEffect, useState } from "react";
|
|
|
+import DeviceInfo from 'react-native-device-info';
|
|
|
import dayjs from "dayjs";
|
|
|
+import Modal from "@/components/layout/Modal.weapp";
|
|
|
+import { loginAnonymous } from "./services/net";
|
|
|
|
|
|
let LinearGradient, useActionSheet, useNavigation
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
@@ -20,14 +23,25 @@ export default function IndexTimePage() {
|
|
|
}
|
|
|
|
|
|
const [count, setCount] = useState(0)
|
|
|
+ const [showLanguage, setShowLanguage] = useState(false)
|
|
|
+ const [showDst, setShowDst] = useState(false)
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ login()
|
|
|
setInterval(() => {
|
|
|
setCount(t => t + 1)
|
|
|
}, 1000)
|
|
|
}, [])
|
|
|
|
|
|
+ function login(){
|
|
|
+ loginAnonymous(DeviceInfo.getDeviceSync()).then(res=>{
|
|
|
+ console.log('login success',res)
|
|
|
+ }).catch(e=>{
|
|
|
+ console.log('login error',e)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
function chooseLocation() {
|
|
|
jumpPage('', 'map', navigation)
|
|
|
}
|
|
|
@@ -62,6 +76,58 @@ export default function IndexTimePage() {
|
|
|
return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'smal11l'} />
|
|
|
}
|
|
|
|
|
|
+ function languageModalContent() {
|
|
|
+ return <View className="modal_bg">
|
|
|
+ <View className="language_content">
|
|
|
+ <View className="language_item">
|
|
|
+ <Text className="language_text">English</Text>
|
|
|
+ <Image className="check" src={require('@assets/index_time/check.png')} />
|
|
|
+ </View>
|
|
|
+ <View className="line" />
|
|
|
+ <View className="language_item">
|
|
|
+ <Text className="language_text">中文</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
+ function dstModalContent() {
|
|
|
+ return <View className="modal_bg">
|
|
|
+ <View className="dst_content">
|
|
|
+ <View className="dst_item">
|
|
|
+ <View className="dst_card">
|
|
|
+ <Text className="month">{dayjs().format('MMMM')}</Text>
|
|
|
+ <Text className="day">{dayjs().format('D')}</Text>
|
|
|
+ <Text className="week">{dayjs().format('dddd')}</Text>
|
|
|
+ <Text className="year">{dayjs().format('YYYY')}</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View style={{flex:1}}>
|
|
|
+ <Text className="dst_title">Last change</Text>
|
|
|
+ <Text className="dst_desc">Summer time started</Text>
|
|
|
+ <Text className="dst_note"> Time was set forward 1 hour from 02:00 to 03:00.
|
|
|
+ Time zone changed to UTC-7, Pacific Daylight Time (PDT).</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View className="dst_content">
|
|
|
+ <View className="dst_item">
|
|
|
+ <View className="dst_card">
|
|
|
+ <Text className="month">{dayjs().format('MMMM')}</Text>
|
|
|
+ <Text className="day">{dayjs().format('D')}</Text>
|
|
|
+ <Text className="week">{dayjs().format('dddd')}</Text>
|
|
|
+ <Text className="year">{dayjs().format('YYYY')}</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View style={{flex:1}}>
|
|
|
+ <Text className="dst_title">Last change</Text>
|
|
|
+ <Text className="dst_desc">Summer time started</Text>
|
|
|
+ <Text className="dst_note"> Time was set forward 1 hour from 02:00 to 03:00.
|
|
|
+ Time zone changed to UTC-7, Pacific Daylight Time (PDT).</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
return <View className="page_container">
|
|
|
<View style={{ position: 'relative' }}>
|
|
|
{
|
|
|
@@ -79,14 +145,45 @@ export default function IndexTimePage() {
|
|
|
<Text className="location_text">Beijing</Text>
|
|
|
</View>
|
|
|
|
|
|
- <Text className="timezone">UTC+8</Text>
|
|
|
+ <View style={{ flexDirection: 'row', marginTop: 10, alignItems: 'center' }} onClick={() => setShowDst(true)}>
|
|
|
+ <Text className="timezone">UTC+8</Text>
|
|
|
+ <Image className="location_icon" src={require('@assets/index_time/arrow_right.png')} />
|
|
|
+ </View>
|
|
|
+
|
|
|
|
|
|
<View className="btn_bg" onClick={chooseLocation}>
|
|
|
<Text className="btn_text">Pick Location</Text>
|
|
|
+ <Image className="more" src={require('@assets/index_time/more.png')} />
|
|
|
</View>
|
|
|
- <View className="footer">
|
|
|
+ <View className="footer" onClick={() => setShowLanguage(true)}>
|
|
|
<Text className="footer_text">English</Text>
|
|
|
<Image className="footer_icon" src={require('@assets/index_time/arrow.png')} />
|
|
|
</View>
|
|
|
+ {
|
|
|
+ showLanguage && <Modal
|
|
|
+ testInfo={null}
|
|
|
+ themeIsWhite={true}
|
|
|
+ dismiss={() => {
|
|
|
+ setShowLanguage(false)
|
|
|
+ }}
|
|
|
+ confirm={() => { }}>
|
|
|
+ {
|
|
|
+ languageModalContent()
|
|
|
+ }
|
|
|
+ </Modal>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ showDst && <Modal
|
|
|
+ testInfo={null}
|
|
|
+ themeIsWhite={true}
|
|
|
+ dismiss={() => {
|
|
|
+ setShowDst(false)
|
|
|
+ }}
|
|
|
+ confirm={() => { }}>
|
|
|
+ {
|
|
|
+ dstModalContent()
|
|
|
+ }
|
|
|
+ </Modal>
|
|
|
+ }
|
|
|
</View>
|
|
|
}
|