Browse Source

url encode

Leon 1 năm trước cách đây
mục cha
commit
cdaf13b8e2

+ 1 - 1
src/features/trackTimeDuration/components/TimelineFastSleep.tsx

@@ -153,7 +153,7 @@ export default function TimelineFastSleep(props: {
     */
     if (props.data.fast && props.data.scenario != 'SLEEP') {
         var timeZone = ''
-        if (props.data.fast.real_start_timezone.gmt) {
+        if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.gmt) {
             timeZone = ' ' + props.data.fast.real_start_timezone.gmt
         }
         var desc = props.data.status == 'WAIT_FOR_START' ? '' : multTimeZone ? timeZone : ''

+ 6 - 6
src/pages/clock/Clock.tsx

@@ -124,12 +124,12 @@ export default function Page() {
     }
 
     useEffect(() => {
-        // if (process.env.TARO_ENV=='weapp'){
-        // showAlert({
-        //     title:'date',
-        //     content:new Date().toString()
-        // })
-        // }
+        if (process.env.TARO_ENV=='weapp'){
+        showAlert({
+            title:'date',
+            content:new Date().toString()
+        })
+        }
         if (process.env.TARO_ENV == 'rn') {
             const test = require('@/utils/push').default
             test()

+ 2 - 9
src/services/http/request.ts

@@ -74,18 +74,11 @@ export async function request<T>(param: RequestParam): Promise<T> {
 
         header['content-type'] = 'application/json'
 
-        // console.log({
-        //     id:getTimezoneId(),
-        //     name:timeZoneName?timeZoneName:'',
-        //     gmt:timeZoneFormatted
-        // })
-        // debugger
-
-        header['X-Timezone'] = JSON.stringify({
+        header['X-Timezone'] = encodeURIComponent(JSON.stringify({
             id:getTimezoneId(),
             name:timeZoneName?timeZoneName:'',
             gmt:timeZoneFormatted
-        })
+        }))
 
 
 

+ 3 - 2
src/utils/tools.ts

@@ -119,7 +119,8 @@ export  function getTimezoneId(){
         return '';
     }
     else {
-        var getTimeZone = require('react-native-localize').getTimeZone
-        return getTimeZone()
+        return 'Asia/Shanghai'
+        // var getTimeZone = require('react-native-localize').getTimeZone
+        // return getTimeZone()
     }
 }