Leon 2 лет назад
Родитель
Сommit
9688eafa6f

+ 1 - 0
src/components/input/LimitPickers.tsx

@@ -182,6 +182,7 @@ const Component = forwardRef((props: {
             var limitDate = new Date(props.limit)
 
             if (getTimestamp(time) < props.limit) {
+                debugger
                 Taro.showToast({
                     icon: 'none',
                     title: t('feature.common.toast.max_time_value'),

+ 19 - 34
src/components/input/SlidngScale.tsx

@@ -10,14 +10,13 @@ var timerA = null
 export default function Component(props: {
     step: number, min: number,
     max: number, default_value: number, changed: Function, unit: string
-    themeColor: string
+    themeColor: string,
+    updateStatus: Function
 }) {
     const scrollViewRef = useRef<any>();
     const minNum: number = props.min;//props.step < 1 ?props.default_value-2:props.default_value-20//
     const maxNum: number = props.max;//props.step < 1 ?props.default_value+2:props.default_value+20//
 
-    const [timer, setTimer] = useState(null)
-    const [leftData, setLeftData] = useState(0)
     const stepNum: number = props.step * 10;
     const jingdu: number = props.step < 1 ? 10 : 1;
     const list: any[] = [];
@@ -27,7 +26,7 @@ export default function Component(props: {
     const [current, setCurrent] = useState(props.default_value)
     const [left, setLeft] = useState((props.default_value - minNum) * slidngWidth / props.step + 1);
     const [isDraging, setIsDraging] = useState(false)
-    const [timeoutId, setTimeoutId] = useState(null);
+    const [isEnd, setIsEnd] = useState(true)
 
     // const [showScrollView, setShowScrollView] = useState(false)
 
@@ -44,56 +43,42 @@ export default function Component(props: {
 
     }
 
-    // useEffect(() => {
-    //     setTimeout(() => {
-    //         setShowScrollView(true)
-    //     }, 200)
-    // }, [])
-
-    // const dpr = Taro.pxTransform//Taro.getSystemInfoSync().pixelRatio; 
-
     useEffect(() => {
-        let timeoutId;
-
-
-    }, [])
+        if (isEnd && !isDraging)
+            props.updateStatus(true)
+    }, [isEnd, isDraging])
 
     function scrollContent(e) {
         if (timerA)
             clearTimeout(timerA);
 
         timerA = setTimeout(() => {
+
             update(e)
-        }, 90) as any
+            setIsDraging(false)
+        }, 250) as any
     }
 
     const handleScroll = throttle((e) => {
 
         console.log(e)
-        if (timer) {
-            clearTimeout(timer)
-            setTimer(null)
-        }
 
-        if (leftData != e.detail && !isDraging) {
-            setLeftData(e.detail)
-            var timer2 = setTimeout(() => {
-                console.log('aaa')
-                update(e)
-            }, 90)
-            setTimer(timer2 as any)
-        }
+        update(e)
 
 
 
-    },200);
+    }, 500);
 
     function dragStart(e) {
+        setIsEnd(false)
         setIsDraging(true)
+        props.updateStatus(false)
     }
 
     function dragEnd(e) {
-        setIsDraging(false)
+        setIsEnd(true)
+        console.log('end')
+        // setIsDraging(false)
     }
 
     function update(e) {
@@ -125,7 +110,7 @@ export default function Component(props: {
 
 
             setCurrent(data);
-            props.changed(data);
+            // props.changed(data);
         }
     }
 
@@ -146,7 +131,7 @@ export default function Component(props: {
     }
 
     return <View className="slidng">
-        <View className="number_bg">
+        <View className="number_bg" style={{ opacity: (isDraging || !isEnd) ? 0.4 : 1 }}>
             <Text className="number">{current}</Text>
             <Text className="unit">{props.unit}</Text>
         </View>
@@ -164,7 +149,7 @@ export default function Component(props: {
                 onScrollEnd={scrollEnd}
                 onDragEnd={dragEnd}
                 onDragStart={dragStart}
-                onScroll={handleScroll}
+                onScroll={scrollContent}
                 enhanced
             >
                 <View className="scrollContent">

+ 20 - 3
src/features/trackSomething/components/MetricModalAdd.tsx

@@ -7,6 +7,8 @@ import { useEffect, useState } from 'react'
 
 export default function Component(props: { item: any, strTime: string, showPicker: Function, cancel: Function, confirm: Function }) {
     const [metricItem, setMetricItem] = useState(props.item)
+    const [enable,setEnable] = useState(true)
+    // const [disableCode,setDisableCode] = useState(0)
     const { t } = useTranslation()
 
     
@@ -24,13 +26,24 @@ export default function Component(props: { item: any, strTime: string, showPicke
                             {
                                 (metricItem as any).schemas.length > 1 && <Text style={{
                                     textAlign: 'center', width: '100%', display: 'flex',
-                                    justifyContent: 'center', color: (metricItem as any).theme_color
+                                    justifyContent: 'center', color: (metricItem as any).theme_color,
+                                    // opacity:item.code==disableCode?0.4:1
                                 }}>{item.name}</Text>
                             }
                             <SlidngScale step={item.step} min={item.min} max={item.max} default_value={item.default_value}
                                 unit={item.default_unit}
                                 themeColor={(metricItem as any).theme_color}
-                                changed={(e) => { item.tempValue = e }} />
+                                changed={(e) => { item.tempValue = e }} 
+                                updateStatus={(isEnable)=>{
+                                    setEnable(isEnable)
+                                    // if (isEnable){
+                                    //     setDisableCode(0)
+                                    // }
+                                    // else {
+                                    //     setDisableCode(item.code)
+                                    //     console.log(item.code)
+                                    // }
+                                }}/>
                         </View>
                     })
                 }
@@ -48,7 +61,11 @@ export default function Component(props: { item: any, strTime: string, showPicke
                     }</Text>
                 </View>
                 <View className='btn_space' />
-                <View className='modal_btn' style={{ backgroundColor: (metricItem as any).theme_color }} onClick={() => props.confirm(metricItem)}>
+                <View className='modal_btn' style={{ backgroundColor: (metricItem as any).theme_color,opacity:enable?1:0.4 }} onClick={() => {
+                    if (enable){
+                        props.confirm(metricItem)
+                    }
+                }}>
                     <Text className='modal_confirm_text' style={{ color: '#000' }}>{
                         t('feature.common.picker_confirm_btn')
                     }</Text>

+ 2 - 1
src/features/trackTimeDuration/components/Console.tsx

@@ -197,7 +197,8 @@ export default function Component(props: { isNextStep?: boolean }) {
             limit = time.last_real_check_time
             global.limit = limit
             //当set_time秒数<=latest_record_time秒数时,最小限制时间戳需+1分钟
-            if (new Date(global.set_time).getSeconds() <= new Date(time.last_real_check_time).getSeconds()) {
+            if (new Date(global.set_time).getSeconds() <= new Date(time.last_real_check_time).getSeconds() && global.set_time-time.last_real_check_time>60000) {
+                debugger
                 limit = limit + 60 * 1000
             }
         }

+ 1 - 1
src/services/http/api.js

@@ -1,4 +1,4 @@
-let online = true;
+let online = false;
 export let baseUrl = online ? 'https://api.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';
 export let imgUrl = online
     ? 'https://api.fast.liveplus.fun/static/image/'