Leon hai 1 ano
pai
achega
26ecffdb8a

+ 1 - 0
src/features/trackSomething/components/DayNightCard.scss

@@ -26,6 +26,7 @@
 .day_night_card_footer{
     display: flex;
     flex-direction: row;
+    justify-content: space-between;
     align-items: center;
     padding-top: 20px;
     margin-top: 20px;

+ 36 - 16
src/features/trackSomething/components/DayNightCard.tsx

@@ -12,7 +12,12 @@ import { systemLocation } from '@/services/common'
 import { updateMember } from '@/store/day_night'
 import Modal from '@/components/layout/Modal.weapp'
 import { rpxToPx } from '@/utils/tools'
+import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
 
+let useNavigation;
+if (process.env.TARO_ENV == 'rn') {
+    useNavigation = require("@react-navigation/native").useNavigation
+}
 export default function DayNightCard(props: { isNight: boolean, switchChanged: Function }) {
     const [expand, setExpand] = useState(false)
     const user = useSelector((state: any) => state.user);
@@ -24,6 +29,10 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
     const [showDetailModal, setShowDetailModal] = useState(false)
     const dispatch = useDispatch();
     const { t } = useTranslation()
+    let navigation;
+    if (useNavigation) {
+        navigation = useNavigation()
+    }
 
     useEffect(() => {
         if (user.isLogin) {
@@ -84,26 +93,32 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
 
     function footer() {
         return <View className='day_night_card_footer'>
-            <Text style={{color:'#9E9E9E',fontSize:rpxToPx(20)}}>{
+            <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }}>{
                 // !isMember ? t('feature.track_time_duration.third_ring.member_desc') :
                 authInfo ? t('feature.track_time_duration.third_ring.base_location_desc') :
                     t('feature.track_time_duration.third_ring.enter_location_desc')
             }</Text>
+            {
+                authInfo && <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }} onClick={auth}>Edit Location</Text>
+            }
         </View>
     }
 
     function tapCard(e) {
         if (!user.isLogin) {
+            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            return
+        }
+        if (!expand) {
             return
         }
+        var list = ['Current location Info',
+            'Choose a new location']
+            if (user.test_user){
+                list.push('clear location data')
+            }
         Taro.showActionSheet({
-            itemList: [
-                'Current location Info',
-                'Choose a new location',
-                'clear location data'
-                //t('feature.track_time_duration.action_sheet.switch_scenario'),
-                //t('feature.track_time_duration.action_sheet.change_schedule')
-            ]
+            itemList: list
         }).then(res => {
             switch (res.tapIndex) {
                 case 0:
@@ -336,7 +351,7 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
             <View>
                 <View className='day_night_top'>
                     <Text className='day_night_title'>{props.isNight ? 'Overnight' : 'Day'}</Text>
-                    <View className='free'>限时免费</View>
+                    <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>限时免费</View>
                     <View style={{ flex: 1 }} />
                     <Switch checked={expand}
                         color={props.isNight ? ColorType.night : ColorType.day}
@@ -368,15 +383,20 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
                         }}
                     />
                 </View>
-                <View style={{ display: 'flex', flexDirection: 'column' }}>
-                    <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}` : `${sunriseTime} - ${sunsetTime}`}</Text>
-                    <Text>{props.isNight ? 'Sunset to Sunrise' : 'Sunrise to Sunset'}</Text>
-                    <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
-                    <Text>{timeDesc()}</Text>
-                </View>
                 {
-                    footer()
+                    expand && <View>
+                        <View style={{ display: 'flex', flexDirection: 'column' }}>
+                            <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}` : `${sunriseTime} - ${sunsetTime}`}</Text>
+                            <Text>{props.isNight ? 'Sunset to Sunrise' : 'Sunrise to Sunset'}</Text>
+                            <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
+                            <Text>{timeDesc()}</Text>
+                        </View>
+                        {
+                            footer()
+                        }
+                    </View>
                 }
+
             </View>
         </Box>
         {

+ 3 - 3
src/features/trackTimeDuration/components/IndexItem.tsx

@@ -234,7 +234,7 @@ export default function Component(props: { type: string, data: any, time: any, s
                 </View>
             }
             {
-                !props.showStage && user.isLogin && global.showNightRing === true && <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
+                !props.showStage && global.showNightRing === true && <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
                     {
                         dayRing()
                     }
@@ -402,11 +402,11 @@ export default function Component(props: { type: string, data: any, time: any, s
             }
             <View className="duration_bg">
                 {
-                     !props.showStage && user.isLogin && global.showNightRing === true &&
+                     !props.showStage  && global.showNightRing === true &&
                     <Text className="duration_title">{t('feature.common.overnight')}</Text>
                 }
                 {
-                     !props.showStage && user.isLogin && global.showNightRing === true &&
+                     !props.showStage  && global.showNightRing === true &&
                     <Text className="duration_value" style={{ color: ColorType.night }}>{nightDuration()}</Text>
                 }
                 {

+ 1 - 1
src/pages/clock/Index.tsx

@@ -424,7 +424,7 @@ export default function Page() {
 
                 {
                     user.isLogin && <View>
-                        <Text className="discovery">周统计</Text>
+                        <Text className="discovery" style={{marginTop:rpxToPx(20)}}>周统计</Text>
                         <WeekCalendar />
                     </View>
                 }