leon 1 年間 前
コミット
20a4a7b3d2

+ 37 - 9
src/app/time_of_day/index_time.tsx

@@ -2,7 +2,7 @@ import { View, Text, Image } from "@tarojs/components";
 import './index_time.scss';
 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 Rings, { RingCommon, BgRing,TargetRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
 import { useEffect, useState } from "react";
 import DeviceInfo from 'react-native-device-info';
 import dayjs from "dayjs";
@@ -71,6 +71,13 @@ export default function IndexTimePage() {
         setShowLanguage(false)
         dayjs.locale(isEnglish ? 'en' : 'zh-cn');
         moment.locale(isEnglish ? 'en' : 'zh-cn');
+
+        if (current) {
+            chooseLocation({
+                lat: current.geo.lat,
+                lng: current.geo.lng
+            })
+        }
     }
 
     function login() {
@@ -130,6 +137,21 @@ export default function IndexTimePage() {
         color: '#EAE9E9'
     }
 
+    function getArc(){
+        var hour = new Date().getHours()
+        var minute = new Date().getMinutes()
+        var second = new Date().getSeconds()
+        if (current) {
+            var strHour = moment().tz(current.time.timezone.id).format('H')
+            hour = parseInt(strHour)
+            var strMin = moment().tz(current.time.timezone.id).format('m')
+            minute = parseInt(strMin)
+            var strSecond = moment().tz(current.time.timezone.id).format('s')
+            second = parseInt(strSecond)
+        }
+
+        return (hour*3600+minute*60+second)/(24*3600)*2*Math.PI
+    }
 
     function ring() {
         const currentDot: CurrentDot = {
@@ -138,7 +160,13 @@ export default function IndexTimePage() {
             borderColor: '#ffffff',
             offset: 0
         }
-        return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'smal11l'} />
+        const targetRing: TargetRing = {
+            color: '#CACACA',
+            startArc: -Math.PI/2,
+            durationArc: getArc()
+        }
+
+        return <Rings common={common} bgRing={bgRing} targetRing={targetRing}  currentDot={currentDot} canvasId={'smal11l'} />
     }
 
     function languageModalContent() {
@@ -194,22 +222,22 @@ export default function IndexTimePage() {
         return t('time_of_day.index.winter_starts')
     }
 
-    function dstNote(item:any){
+    function dstNote(item: any) {
         var str = moment(item.timestamp).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
-        var str2 = moment(item.timestamp-1).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
-        console.log(str,str2)
+        var str2 = moment(item.timestamp - 1).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
+        console.log(str, str2)
         debugger
         return 'Time was set forward 1 hour from 02:00 to 03:00.\nTime zone changed to UTC-7, Pacific Daylight Time (PDT).'
     }
 
-    function isNight(){
+    function isNight() {
         var hour = new Date().getHours()
         if (current) {
             var strHour = moment().tz(current.time.timezone.id).format('H')
             hour = parseInt(strHour)
         }
-        
-        if (hour>=18 || hour<6){
+
+        if (hour >= 18 || hour < 6) {
             return true
         }
         return false
@@ -246,7 +274,7 @@ export default function IndexTimePage() {
                 ring()
             }
             <View className="ring_center">
-                <Image className="sun" src={isNight()?require('@assets/index_time/moon.png'):require('@assets/index_time/sun.png')} />
+                <Image className="sun" src={isNight() ? require('@assets/index_time/moon.png') : require('@assets/index_time/sun.png')} />
                 <Text className="time">{formatTime('HH:mm:ss')}</Text>
                 <Text className="date">{global.language == 'en' ? formatTime('dddd, MMM DD') : formatTime('MMMD dddd')}</Text>
             </View>

+ 1 - 1
src/pages/map/map.tsx

@@ -39,7 +39,7 @@ export default function map() {
             headerTitle: 'Choose Location',
             headerRight: () => {
                 return <View>
-                    <Text onClick={confirmChoose} style={{ color: '#fff', marginRight: 15 }}>Done</Text>
+                    <Text onClick={confirmChoose} style={{ color: (router.params! as any).source == 'time_of_day'?'#000':'#fff', marginRight: 15 }}>Done</Text>
                 </View>
             }
         });

+ 4 - 3
src/pages/rn/RNMain.tsx

@@ -24,7 +24,7 @@ import Explore from '../explore/Index';
 import StreakDetail from '@/pages/clock/StreakDetail';
 import H5 from '@/pages/common/H5';
 import NotificationSetting from '@/pages/notification/setting';
-import { Image, PixelRatio } from 'react-native';
+import { Image, PixelRatio, StatusBar } from 'react-native';
 import ProductList from '../store/product_list';
 import map from '../map/map';
 import { kIsAndroid, kIsIOS } from '@/utils/tools';
@@ -83,7 +83,7 @@ export default function RNMain() {
   if (kIsAndroid || kIsIOS) {
     // return <IndexTimePage />
     return <NavigationContainer theme={{
-      dark: false,
+      dark: true,
       colors: {
         text: 'white',
         primary: 'white',
@@ -93,9 +93,10 @@ export default function RNMain() {
         notification: 'red'
       }
     }}>
+      <StatusBar barStyle='dark-content' backgroundColor="#000" />
       <Stack.Navigator screenOptions={({ route }) => ({
         headerStyle: {
-          backgroundColor: 'black',
+          backgroundColor: 'white',
           borderBottomWidth: 0, // 隐藏导航条底部边框
           borderBottomColor: 'red'
         },

+ 1 - 1
src/services/http/request.ts

@@ -83,7 +83,7 @@ export async function request<T>(param: RequestParam): Promise<T> {
 
 
         header['X-Platform'] = Taro.getSystemInfoSync().platform == 'ios' ? 'IOS' : 'ANDROID'; //IOS ANDROID
-        header['X-Lang'] = process.env.TARO_ENV == 'rn' ? 'en' : 'zh' //zh en
+        header['X-Lang'] = process.env.TARO_ENV == 'rn' ? global.language : 'zh' //zh en
         header['X-Client-Type'] = process.env.TARO_ENV == 'rn' ? 'APP' : 'WX_APP' //WX_APP APP
         header['X-Client-Version'] = process.env.TARO_ENV == 'rn' ? APP_VERSION : WX_VERSION
         header['X-Day'] = dayjs().format('YYYYMMDD')