Leon 2 лет назад
Родитель
Сommit
af7e8aeb5f
32 измененных файлов с 546 добавлено и 139 удалено
  1. 1 1
      src/app.config.ts
  2. 10 1
      src/app.scss
  3. 7 3
      src/components/input/Inputs.tsx
  4. 57 50
      src/components/input/LimitPickers.tsx
  5. 1 1
      src/components/input/PickerViews.tsx
  6. 14 5
      src/components/input/SlidngScale.tsx
  7. 1 0
      src/components/layout/Modal.scss
  8. 1 2
      src/components/layout/Modal.tsx
  9. 4 0
      src/components/layout/layout.scss
  10. 2 1
      src/components/layout/layout.tsx
  11. 3 2
      src/features/common/SpecBtns.tsx
  12. 5 3
      src/features/common/TimePicker.tsx
  13. 1 1
      src/features/trackSomething/components/Activity.tsx
  14. 3 2
      src/features/trackSomething/components/Metric.tsx
  15. 1 0
      src/features/trackTimeDuration/components/ChooseScenario.tsx
  16. 29 12
      src/features/trackTimeDuration/components/Clock.tsx
  17. 8 0
      src/features/trackTimeDuration/components/Console.tsx
  18. 9 1
      src/features/trackTimeDuration/components/Dial.tsx
  19. 200 0
      src/features/trackTimeDuration/components/More.tsx
  20. 2 1
      src/features/trackTimeDuration/components/RecordFastSleep.tsx
  21. 1 1
      src/features/trackTimeDuration/components/Rings.weapp.tsx
  22. 21 2
      src/features/trackTimeDuration/components/SetSchedule.tsx
  23. 13 7
      src/features/trackTimeDuration/components/StatusIndicator.tsx
  24. 35 5
      src/features/trackTimeDuration/components/TimelineFastSleep.tsx
  25. 3 2
      src/features/trackTimeDuration/components/TimelineStage.tsx
  26. 12 2
      src/pages/account/ChooseAuth.tsx
  27. 17 5
      src/pages/account/EditPage.tsx
  28. 25 7
      src/pages/clock/Clock.weapp.tsx
  29. 1 1
      src/services/http/api.js
  30. 3 1
      src/services/trackTimeDuration.tsx
  31. 24 19
      src/services/user.tsx
  32. 32 1
      src/utils/time_format.ts

+ 1 - 1
src/app.config.ts

@@ -60,7 +60,7 @@ const appConfig = defineAppConfig({
     "navigationBarTextStyle": "white",
     "backgroundColor": "#000000"
   },
-  darkmode: true
+  // darkmode: true
 })
 
 process.env.TARO_ENV === 'weapp' && (appConfig.tabBar = {

+ 10 - 1
src/app.scss

@@ -94,7 +94,7 @@ page {
 }
 
 ::-webkit-scrollbar {
-    display: none;
+    // display: none;
     width: 0;
     height: 0;
     color: transparent;
@@ -132,6 +132,15 @@ page {
     // background-color: pink;
 }
 
+.flex-expand{
+    position: absolute;
+    left: 0;
+    top: 0;
+    height: 1px;
+    background-color: transparent;
+    width: calc(100vw + 12px);
+}
+
 
 
 // @media only screen and (-webkit-min-device-pixel-ratio: 2.0) {

+ 7 - 3
src/components/input/Inputs.tsx

@@ -1,6 +1,6 @@
 import { Input, View } from "@tarojs/components";
 import './Inputs.scss'
-import { useState } from "react";
+import { useEffect, useState } from "react";
 import { ColorType } from "@/context/themes/color";
 import { IconClear } from "../basic/Icons";
 
@@ -31,6 +31,10 @@ export default function Component({
         onChange(newValue);
     };
 
+    useEffect(()=>{
+        setInputValue(value?value:'')
+    },[value])
+
     function clear(){
         setInputValue('')
         onChange('')
@@ -38,12 +42,12 @@ export default function Component({
     return (
         <View className="input_bg">
             <Input className={isFocus ? "input input_focus" : "input"}
-            
+                // style={{backgroundColor:'red'}}
                 placeholder={placeholder ? placeholder : ''}
                 value={inputValue}
                 secureTextEntry={isSecure ? true : false}
                 textContentType={isSecure ? 'password' : 'none'}
-                type={openType?openType:''}
+                type={openType?openType:'text'}
                 onInput={handleInputChange}
                 // onConfirm={() => onConfirm()}
                 focus

+ 57 - 50
src/components/input/LimitPickers.tsx

@@ -2,11 +2,13 @@ import { PickerView, PickerViewColumn, View, Text } from "@tarojs/components";
 import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
 import './LimitPickers.scss'
 import Taro from "@tarojs/taro";
+import React from "react";
 // export default function Component(props: { limit: number, onChange: Function, onCancel: Function,isRealTime?:boolean,limitDay?:number,time?:number,ref?:any }) {
 const Component = forwardRef((props: {
     limit: number, onChange: Function, onCancel: Function,
     isRealTime?: boolean, limitDay?: number, time?: number, themeColor?: string, title?: string
 }, ref) => {
+
     const days: string[] = [];
     const today = new Date();
     var color = props.themeColor ? props.themeColor : '#ff0000'
@@ -23,7 +25,6 @@ const Component = forwardRef((props: {
         return hexValue;
     }
 
-
     useEffect(() => {
         global.picker_time = global.set_time
         if (props.time) {
@@ -102,6 +103,7 @@ const Component = forwardRef((props: {
     }
 
     function onPickerChange(e) {
+        console.log(e.detail.value)
         var list = e.detail.value
 
         const date = new Date();
@@ -119,6 +121,7 @@ const Component = forwardRef((props: {
                 icon: 'none',
                 title: '不能更大了',
             })
+            
             setValues([list[0], (new Date(global.set_time)).getHours(), (new Date(global.set_time)).getMinutes()])
             disableConfirm()
         }
@@ -143,11 +146,11 @@ const Component = forwardRef((props: {
 
     }
 
-    function disableConfirm(){
+    function disableConfirm() {
         setIsDisableConfirm(true)
         setTimeout(() => {
             setIsDisableConfirm(false)
-        },2000);
+        }, 2000);
     }
 
     function expandZero(num: number): string {
@@ -165,7 +168,7 @@ const Component = forwardRef((props: {
         if (process.env.TARO_ENV == 'weapp') {
             e.stopPropagation()
         }
-        if (isDisableConfirm){
+        if (isDisableConfirm) {
             return;
         }
         var date = new Date();
@@ -200,57 +203,61 @@ const Component = forwardRef((props: {
         getConfirmData: getConfirmData
     }));
 
-
-
-    return <View style={{display:'flex',flexDirection:'column'}}>
-        <Text className='modal_title' style={{ color: color }}>{props.title ? props.title : '测试标题 '}</Text>
-        <View style={{ backgroundColor: 'transparent', position: 'relative' }}>
-            <PickerView value={values}
-                className="picker"
-                maskClass="picker-mask"
-                // indicatorClass = 'picker-sel'
-                onChange={onPickerChange}
-                immediateChange={true}
-                indicatorStyle='height: 50px;color:red;'>
-                <PickerViewColumn style='flex:0 0 45%'>
-                    {days.map(item => {
-                        return (
-                            <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{item}</View>
-                        );
-                    })}
-                </PickerViewColumn>
-                <PickerViewColumn>
-                    {hours.map(item => {
-                        return (
-                            <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{item < 10 ? `0${item}` : item}</View>
-                        );
-                    })}
-                </PickerViewColumn>
-                <PickerViewColumn>
-                    {minutes.map(item => {
-                        return (
-                            <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{item < 10 ? `0${item}` : item}</View>
-                        );
-                    })}
-                </PickerViewColumn>
-            </PickerView>
-
-            {/* <View className="point_bg1 ">
+    function pickerDetail() {
+        return <View style={{ display: 'flex', flexDirection: 'column' }}>
+            <Text className='modal_title' style={{ color: color }}>{props.title ? props.title : '测试标题 '}</Text>
+            <View style={{ backgroundColor: 'transparent', position: 'relative' }}>
+                <PickerView
+                    value={values}
+                    className="picker"
+                    maskClass="picker-mask"
+                    onChange={onPickerChange}
+                    immediateChange={true}
+                    indicatorStyle='height: 50px;color:red;'>
+                    <PickerViewColumn style='flex:0 0 45%'>
+                        {days.map(item => {
+                            return (
+                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{item}</View>
+                            );
+                        })}
+                    </PickerViewColumn>
+                    <PickerViewColumn>
+                        {hours.map(item => {
+                            return (
+                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{item < 10 ? `0${item}` : item}</View>
+                            );
+                        })}
+                    </PickerViewColumn>
+                    <PickerViewColumn>
+                        {minutes.map(item => {
+                            return (
+                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{item < 10 ? `0${item}` : item}</View>
+                            );
+                        })}
+                    </PickerViewColumn>
+                </PickerView>
+
+                {/* <View className="point_bg1 ">
                 <Text style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>:</Text>
             </View> */}
-        </View>
-        <View className='modal_operate'>
-            <View className='modal_btn' style={{ backgroundColor: color + alpha }} onClick={cancel}>
-                <Text className='modal_cancel_text' style={{ color: color }}>取消</Text>
-            </View>
-            <View className='btn_space' />
-            <View className='modal_btn' style={{ backgroundColor: color }} onClick={confirm}>
-                <Text className='modal_confirm_text' style={{ color: '#000' }}>确定</Text>
             </View>
+            <View className='modal_operate'>
+                <View className='modal_btn' style={{ backgroundColor: color + alpha }} onClick={cancel}>
+                    <Text className='modal_cancel_text' style={{ color: color }}>取消</Text>
+                </View>
+                <View className='btn_space' />
+                <View className='modal_btn' style={{ backgroundColor: color }} onClick={confirm}>
+                    <Text className='modal_confirm_text' style={{ color: '#000' }}>确定</Text>
+                </View>
 
 
+            </View>
         </View>
-    </View>
+    }
+
+    return pickerDetail()
+
+
 })
 
-export default Component;
+export default React.memo(Component);;

+ 1 - 1
src/components/input/PickerViews.tsx

@@ -9,7 +9,7 @@ const Component = forwardRef((props: {
     themeColor?: string, title?: string
 }, ref) => {
     const { t } = useTranslation()
-    const [v, setV] = useState([0])
+    const [v, setV] = useState(props.value)
     var color = props.themeColor ? props.themeColor : '#ff0000'
     var alpha = alphaToHex(0.4)
 

+ 14 - 5
src/components/input/SlidngScale.tsx

@@ -58,17 +58,27 @@ export default function Component(props: {
             var data = strValue as any;
             if (props.step < 1) {
                 data = parseFloat(strValue).toFixed(1);
+                if (data.indexOf('.') > 0) {
+                    const regexp = /(?:\.0*|(\.\d+?)0+)$/
+                    data = data.replace(regexp, '$1')
+                }
             }
             else {
                 data = Math.round(data);
             }
 
             setCurrent(data);
+            // setLeft((parseFloat(data+'') - props.min) * slidngWidth / props.step + 1);
 
             props.changed(data);
         }
     };
 
+    const scrollEnd = (e)=>{
+        const { scrollLeft } = e.detail;
+        setLeft(scrollLeft)
+    }
+
     return <View className="slidng">
         <View className="number_bg">
             <Text className="number">{current}</Text>
@@ -76,9 +86,8 @@ export default function Component(props: {
         </View>
 
         <View className="scroll_bg">
-
             <View className="top_line" style={{ backgroundColor: props.themeColor }} />
-            <ScrollView ref={scrollViewRef} scrollX scrollLeft={left} className="scroll" onScroll={handleScroll}>
+            <ScrollView ref={scrollViewRef} scrollX enhanced scrollLeft={left} className="scroll"  onScroll={handleScroll} onDragEnd={scrollEnd}>
                 <View className="scrollContent">
                     <View className="scrollPadding" />
                     <View className="content">
@@ -97,9 +106,9 @@ export default function Component(props: {
                 </View>
 
             </ScrollView>
-            <View className="shadow_top"/>
-            <View className="shadow_left"/>
-            <View className="shadow_right"/>
+            <View className="shadow_top" />
+            <View className="shadow_left" />
+            <View className="shadow_right" />
             <Image className="center_line" src={require('@assets/images/scale_center.png')} />
             {/* <View className="center_line" /> */}
         </View>

+ 1 - 0
src/components/layout/Modal.scss

@@ -51,6 +51,7 @@
     border-top-right-radius: 36px;
     display: flex;
     flex-direction: column;
+    z-index: 1000000;
 }
 
 .modal_title{

+ 1 - 2
src/components/layout/Modal.tsx

@@ -1,4 +1,4 @@
-import { View, Text } from '@tarojs/components'
+import { View, Text, CoverView } from '@tarojs/components'
 import './Modal.scss'
 import React from 'react';
 import { ModalType } from '@/utils/types';
@@ -50,7 +50,6 @@ export default function Modal(props: {
 
 
     return <View className='modal' catchMove >
-
         <View style={{ flex: 1, width: 375, flexShrink: 0 }} onClick={(e) => {
             if (process.env.TARO_ENV == 'weapp') {
                 e.stopPropagation()

+ 4 - 0
src/components/layout/layout.scss

@@ -36,8 +36,12 @@
 }
 
 .flex{
+    width: 750px;
+    overflow-x: hidden;
 }
 
+
+
 .scroll .wx-scroll-view {
     -webkit-overflow-scrolling: auto !important;
 }

+ 2 - 1
src/components/layout/layout.tsx

@@ -150,7 +150,7 @@ export default function Layout(props: {
             </ScrollView>
         case TemplateType.flex:
             return <View className='flex'>
-
+                {/* <View className="flex-expand" /> */}
                 {
                     process.env.TARO_ENV == 'weapp' ? pageDetail() :
                         <ScrollView onScroll={onScroll}>
@@ -162,6 +162,7 @@ export default function Layout(props: {
             </View>
         case TemplateType.customHeader:
             return <View className='flex'>
+                {/* <View className="flex-expand" /> */}
                 {
                     props.header
                 }

+ 3 - 2
src/features/common/SpecBtns.tsx

@@ -139,16 +139,17 @@ export const SetScheduleBtn = (props: { onClick: Function, title: string, isFast
     )
 }
 
-export const ChooseScenarioBtn = (props: { onClick: Function, title: string, background: string }) => {
+export const ChooseScenarioBtn = (props: { onClick: Function, title: string, background: string, disable?: boolean }) => {
     return (
         <Buttons title={props.title} type={ButtonType.elevated}
             onClick={() => { props.onClick() }}
+            disabled={props.disable}
             btnStyle={{
                 height: 50,
                 width: 300,
                 boxSizing: 'border-box',
                 borderRadius: 25,
-                backgroundColor: props.background,
+                background: props.background,
                 paddingLeft: 40,
                 paddingRight: 40,
                 color: 'black',

+ 5 - 3
src/features/common/TimePicker.tsx

@@ -34,10 +34,12 @@ export default function Component(props: { time: string, confirm: Function, canc
     }
 
     function onPickerChange(e) {
-        var strHour =parseInt( hours[e[0]]) < 10 ? '0' + hours[e[0]] : hours[e[0]]
-        var strMinute = parseInt(minutes[e[1]]) < 10 ? '0' + minutes[e[1]] : minutes[e[1]]
+        var h = parseInt( hours[e[0]])
+        var m = parseInt(minutes[e[1]])
+        var strHour =h < 10 ? '0' + h : h
+        var strMinute = m< 10 ? '0' + m : m
         props.confirm(strHour + ':' + strMinute)
     }
 
-    return <PickerViews themeColor={props.color} title={props.title} value={dt} onChange={onPickerChange} items={[hours, minutes]} onCancel={() => { props.cancel() }} />
+    return <PickerViews  themeColor={props.color} title={props.title} value={dt} onChange={onPickerChange} items={[hours, minutes]} onCancel={() => { props.cancel() }} />
 }

+ 1 - 1
src/features/trackSomething/components/Activity.tsx

@@ -277,7 +277,7 @@ export default function Component(props: any) {
             jumpPage('/pages/common/RecordsHistory?type=activity&refreshList=getCards&title=' + item.name + '&themeColor=' + item.theme_color)
         }
         else {
-            jumpPage('/pages/account/ChooseAuth')
+            jumpPage('/pages/account/ChooseAuth','ChooseAuth',navigation)
         }
 
     }

+ 3 - 2
src/features/trackSomething/components/Metric.tsx

@@ -122,7 +122,8 @@ export default function Component(props: any) {
         if (user.isLogin) {
             var now = new Date();
             var t = (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + ":" + (now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes());
-            setStrTime(t)
+            // setStrTime(t)
+            setStrTime(TimeFormatter.dateTimeFormate(now.getTime()))
             setTime(now.getTime())
             setMetricItem(item)
             openModal()
@@ -236,7 +237,7 @@ export default function Component(props: any) {
 
     function chooseTime(e) {
         setTime(e);
-        setStrTime(TimeFormatter.formatTimestamp(e))
+        setStrTime(TimeFormatter.dateTimeFormate(e))
         setIsTimePickerOpen(false)
     }
 

+ 1 - 0
src/features/trackTimeDuration/components/ChooseScenario.tsx

@@ -102,6 +102,7 @@ export default function Component() {
                 background = 'linear-gradient(to right, ' + (global.fastColor ? global.fastColor : ColorType.fast) + ', ' + (global.sleepColor ? global.sleepColor : ColorType.sleep) + ')'
                 break;
         }
+        console.log(background)
         return <View>
             <ChooseScenarioBtn title={t('feature.common.btn_next')} onClick={next} background={background} />
             {/* <Buttons title='Next' onClick={next} btnStyle={{ ...style, width: 320 }} /> */}

+ 29 - 12
src/features/trackTimeDuration/components/Clock.tsx

@@ -1,5 +1,5 @@
 import trackTimeService, { machine } from "@/store/trackTimeMachine";
-import { View, Text } from "@tarojs/components";
+import { View, Text, CoverView } from "@tarojs/components";
 import { useEffect, useState } from "react";
 import { TimeFormatter } from "@/utils/time_format";
 import Rings, { BgRing, CurrentDot, RealRing, RingCommon } from './Rings';
@@ -7,16 +7,17 @@ import { getBgRing, getCommon, getDot, getReal, getTarget } from "../hooks/RingD
 import './Clock.scss'
 import { ColorType } from "@/context/themes/color";
 import { useSelector } from "react-redux";
-export default function Component() {
+export default function Component(props: { showCoverView: boolean }) {
     const [checkData, setCheckData] = useState(null)
     const time = useSelector((state: any) => state.time);
     const user = useSelector((state: any) => state.user);
+    const [showCover, setShowCover] = useState(props.showCoverView)
 
-    useEffect(()=>{
-        if (!user.isLogin){
+    useEffect(() => {
+        if (!user.isLogin) {
             setCheckData(null)
         }
-    },[user.isLogin])
+    }, [user.isLogin])
 
     useEffect(() => {
         if (machine.context.checkData) {
@@ -32,6 +33,10 @@ export default function Component() {
         });
     }, []);
 
+    useEffect(() => {
+        setShowCover(props.showCoverView)
+    }, [props.showCoverView])
+
 
     //外环
     function bigRing() {
@@ -46,13 +51,13 @@ export default function Component() {
         var current_record = (checkData as any).current_record
         var currentDot1 = getDot((checkData as any).current_record, true)
         var targetBigRing1 = getTarget((checkData as any).current_record, true)
-        targetBigRing1.color = global.fastColor ? global.fastColor+'66' : ColorType.fast + '66'//'rgba(170,255,0,0.4)'
-        if ((checkData as any).current_record.scenario == 'SLEEP'){
-            targetBigRing1.color = global.sleepColor ? global.sleepColor+'66' : ColorType.sleep + '66'//'rgba(170,255,0,0.4)'
+        targetBigRing1.color = global.fastColor ? global.fastColor + '66' : ColorType.fast + '66'//'rgba(170,255,0,0.4)'
+        if ((checkData as any).current_record.scenario == 'SLEEP') {
+            targetBigRing1.color = global.sleepColor ? global.sleepColor + '66' : ColorType.sleep + '66'//'rgba(170,255,0,0.4)'
         }
 
         // console.log(targetBigRing1.color)
-        
+
         if (current_record.status == 'ONGOING') {
             var realRing1 = getReal((checkData as any).current_record, true, false)
 
@@ -93,18 +98,24 @@ export default function Component() {
     }
 
     if (!checkData)
-        return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%', marginTop: 20,position:'relative' }}>
+        return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%', marginTop: 20, position: 'relative', pointerEvents: 'none' }}>
             {
                 bigRing()
             }
             <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
                 {
-                    <Text className="clock_text fast_sleep_text" style={{ fontSize: 24 }}>{TimeFormatter.getCurrentHourAndMinute()}</Text>
+                    <Text className="clock_text" style={{ fontSize: 24, color: ColorType.fast }}>{TimeFormatter.getCurrentHourAndMinute()}</Text>
                 }
             </View>
+            {
+                showCover && <CoverView style={{
+                    display: 'flex', position: 'absolute',
+                    left: 0, right: 0, top: 0, bottom: 0, backgroundColor: 'transparent'
+                }} />
+            }
         </View>
     return (
-        <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%' }}>
+        <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%', pointerEvents: 'none' }}>
             <View style={{ position: 'relative', zIndex: 1 }}>
                 {
                     bigRing()
@@ -153,6 +164,12 @@ export default function Component() {
                         </Text>
                     }
                 </View>
+                {
+                    showCover && <CoverView style={{
+                        display: 'flex', position: 'absolute',
+                        left: 0, right: 0, top: 0, bottom: 0, backgroundColor: 'transparent'
+                    }} />
+                }
             </View>
 
         </View>

+ 8 - 0
src/features/trackTimeDuration/components/Console.tsx

@@ -86,11 +86,15 @@ export default function Component(props: { isNextStep?: boolean }) {
 
 
     function showPicker() {
+       
         if (global.testInfotimer) {
             return
         }
         global.set_time = new Date().getTime()
         updateNodeInfo()
+        if (!global.isDebug){
+            return
+        }
         global.testInfotimer = setInterval(() => {
             updateNodeInfo()
 
@@ -126,6 +130,9 @@ export default function Component(props: { isNextStep?: boolean }) {
         if (!user.test_user) {
             return <View />
         }
+        if (!global.isDebug){
+            return <View />
+        }
         var isStart = false;
         if (time.status == 'WAIT_FOR_START' || time.status == 'ONGOING1') {
             isStart = true
@@ -347,6 +354,7 @@ export default function Component(props: { isNextStep?: boolean }) {
     function durationPickerContent() {
         var color = getColor(time)
         var title = getDurationTitle(time, t)
+        console.log('duration',fastPickerValue)
         return <View style={{ color: '#fff', backgroundColor: 'transparent' }}>
             <PickerViews ref={durationPickerRef}
                 onChange={durationChange}

+ 9 - 1
src/features/trackTimeDuration/components/Dial.tsx

@@ -250,6 +250,9 @@ const Component = (props) => {
     }
 
     const handleTouchMove = (e: any) => {
+        if (global.disableCanvasGesture){
+            return
+        }
         const ctx = currentContext;//canvasRef.current.getContext('2d');
         if (!canStartDrag && !canEndDrag && !canRingDrag) {
             drawCanvas(ctx);
@@ -378,7 +381,9 @@ const Component = (props) => {
     }
 
     const handleClick = (e) => {
-
+        if (global.disableCanvasGesture){
+            return
+        }
         const scaleX = 1//dpr//canvasRect.width / canvasRect.width;
         const scaleY = 1//dpr//canvasRect.height / canvasRect.height;
         const canvasX = (e.touches[0].x - 0) * scaleX;
@@ -477,6 +482,9 @@ const Component = (props) => {
     }
 
     const handleTouchEnd = (e) => {
+        if (global.disableCanvasGesture){
+            return
+        }
         canStartDrag = false;
         canEndDrag = false;
         canRingDrag = false;

+ 200 - 0
src/features/trackTimeDuration/components/More.tsx

@@ -0,0 +1,200 @@
+import { View, Text } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+import { forwardRef, useEffect, useRef, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { useDispatch, useSelector } from "react-redux";
+import trackTimeService, { machine } from "@/store/trackTimeMachine"
+import { recordCheck } from "@/services/trackTimeDuration";
+import LimitPickers from "@/components/input/LimitPickers";
+import { endFast } from "../actions/TrackTimeActions";
+import Modal from "@/components/layout/Modal";
+import { setStep } from "@/store/scenario";
+import { TimeFormatter } from "@/utils/time_format";
+import { ColorType } from "@/context/themes/color";
+
+const Component = forwardRef((props, ref) => {
+    const isFastFirst = true;
+    const { t } = useTranslation()
+    const scenario = useSelector((state: any) => state.scenario);
+    const user = useSelector((state: any) => state.user);
+    const [isOpen, setIsOpen] = useState(false);
+    const [showModal, setShowModal] = useState(false);
+    const limitPickerRef = useRef<any>(null);
+    const dispatch = useDispatch();
+
+    useEffect(() => {
+        var value = trackTimeService.getSnapshot().value
+    }, [machine.context.currentStatus])
+
+    useEffect(() => {
+        trackTimeService.onTransition(state => {
+            var value = trackTimeService.getSnapshot().value
+        });
+    }, []);
+
+    function login() {
+        Taro.navigateTo({
+            url: '/pages/account/ChooseAuth'
+        })
+    }
+
+    function waitActionSheet() {
+        Taro.showActionSheet({
+            itemList: [t('feature.track_time_duration.action_sheet.change_schedule'), t('feature.track_time_duration.action_sheet.switch_scenario')]
+        })
+            .then(res => {
+                switch (res.tapIndex) {
+                    case 0:
+                        if (scenario.name == 'FAST_SLEEP') {
+                            dispatch(setStep(isFastFirst ? 'fast' : 'sleep'))
+                        }
+                        else if (scenario.name == 'SLEEP') {
+                            dispatch(setStep('sleep'))
+                        }
+                        else {
+                            dispatch(setStep('fast'))
+                        }
+                        Taro.navigateTo({
+                            url: '/pages/clock/SetSchedule'
+                        })
+                        break;
+                    case 1:
+                        Taro.navigateTo({
+                            url: '/pages/clock/ChooseScenario'
+                        })
+                        break;
+                }
+            })
+            .catch(err => {
+                console.log(err.errMsg)
+            })
+    }
+
+    function endFastActionSheet() {
+        Taro.showActionSheet({
+            itemList: [t('feature.track_time_duration.action_sheet.end_fast')]
+        })
+            .then(res => {
+                console.log(res.tapIndex)
+                switch (res.tapIndex) {
+                    case 0:
+                        {
+                            setShowModal(true)
+                            setIsOpen(true)
+                            global.set_time = new Date().getTime()
+                        }
+                        break;
+                }
+            })
+            .catch(err => {
+                console.log(err.errMsg)
+            })
+    }
+
+    function checkActionSheetData() {
+        console.log('checkActionSheetData')
+        if (!user.isLogin) {
+            return login()
+        }
+        var state = trackTimeService.getSnapshot().value
+        if ((state as any).FAST_SLEEP === 'WAIT_FOR_START' ||
+            (state as any).FAST === 'WAIT_FOR_START' ||
+            (state as any).SLEEP === 'WAIT_FOR_START') {
+            waitActionSheet()
+        }
+        else if ((state as any).FAST_SLEEP === 'ONGOING1' ||
+            (state as any).FAST_SLEEP === 'ONGOING2') {
+            endFastActionSheet()
+        }
+        else if ((state as any).FAST_SLEEP === 'ONGOING3') {
+            // Taro.showToast({
+            //     title: '暂无更多操作',
+            //     icon: 'none',
+            //     duration: 2000
+            // })
+        }
+    }
+
+    global.checkActionSheetData = checkActionSheetData
+
+    function layoutContent() {
+        var limit = global.set_time - 7 * 3600 * 1000 * 24;
+        var current_record = machine.context.checkData ? (machine.context.checkData as any).current_record : null;
+        global.limit = limit
+        if (current_record && current_record.last_real_check_time) {
+            limit = current_record.last_real_check_time
+            global.limit = limit
+            
+            //当set_time秒数<=latest_record_time秒数时,最小限制时间戳需+1分钟
+            if (new Date(global.set_time).getSeconds() <= new Date(current_record.last_real_check_time).getSeconds()) {
+                limit = limit + 60 * 1000
+            }
+        }
+
+        
+        return <LimitPickers ref={limitPickerRef}
+        title = '结束断食'
+        themeColor={global.fastColor?global.fastColor:ColorType.fast}
+        limit={limit} onCancel={() => { setIsOpen(false); setShowModal(false) }} 
+        onChange={(e) => {
+            endFast(e)
+            setIsOpen(false)
+        }} />
+
+    }
+
+    function testLayout() {
+        var current_record = machine.context.checkData ? (machine.context.checkData as any).current_record : null;
+        if (current_record == null) {
+            return <View />
+        }
+        return <View style={{ color: '#fff', paddingTop: 30, paddingLeft: 30, display: 'flex', flexDirection: 'column' }}>
+            <Text>check scenario:fast</Text>
+            <Text>check type:end</Text>
+            <Text style={{ marginTop: 30 }}>picker restriction</Text>
+            <Text style={{ marginLeft: 50 }}>min:{TimeFormatter.formatTimestamp(global.limit)}</Text>
+            <Text style={{ marginLeft: 50 }}>pick:{TimeFormatter.formatTimestamp(global.picker_time)}</Text>
+            <Text style={{ marginLeft: 50 }}>max{TimeFormatter.formatTimestamp(global.set_time)}</Text>
+
+            <Text style={{ marginTop: 30 }}>now:{TimeFormatter.formatTimestamp(new Date().getTime())}</Text>
+            <Text>elapsed:{TimeFormatter.calculateTimeDifference(global.picker_time, new Date().getTime())}</Text>
+
+            <Text style={{ marginTop: 30 }}>real start:{TimeFormatter.formatTimestamp(current_record.fast.real_start_time)}</Text>
+            <Text>real duration:{TimeFormatter.calculateTimeDifference(current_record.fast.real_start_time, new Date().getTime())}</Text>
+        </View>
+    }
+
+    return (
+        <View ref={ref} style={{ width: '100%', marginTop: 20, marginBottom: 20, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+            <Text onClick={checkActionSheetData}>More Component</Text>
+            {
+                showModal && isOpen && <Modal children={layoutContent()} dismiss={() => setIsOpen(false)}
+                    testInfo={testLayout()}
+                    confirm={() => {
+                        var picker = limitPickerRef.current;
+                        endFast((picker as any).getConfirmData());
+                        setIsOpen(false);
+                    }} />
+            }
+            {/* {
+                showModal && <AtFloatLayout
+                    isOpened={isOpen}
+                    onClose={() => {
+                        setIsOpen(false)
+                        setShowModal(false)
+                    }}
+                    title="">
+                    {
+                        layoutContent()
+                    }
+
+
+                </AtFloatLayout>
+            } */}
+
+        </View>
+    )
+}
+)
+
+export default Component;

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

@@ -48,6 +48,7 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
     }
 
     function schedules() {
+        debugger
         return <View style={{ display: 'flex', flexDirection: 'column' }}>
 {/* 
             <Text className="modalTitle1" style={{
@@ -55,7 +56,7 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
                 color: '#fff', fontWeight: 'bold',
             }}>{TimeFormatter.getDateAndWeek(props.data.first_real_check_time)}</Text> */}
             <TimelineStage data={props.data} title={t('feature.track_time_duration.record_fast_sleep.pop_title')} 
-            subTitle={TimeFormatter.getDateAndWeek(props.data.first_real_check_time)}/>
+            subTitle={TimeFormatter.getDateAndWeek(props.data.first_real_check_time)} first_real_check_time={props.data.first_real_check_time}/>
 
             {/* {
                 props.data.scenario == 'FAST_SLEEP' &&

+ 1 - 1
src/features/trackTimeDuration/components/Rings.weapp.tsx

@@ -181,7 +181,7 @@ export default function Rings(props: {
     useEffect(() => {
         drawCircle()
     }, [props.targetRing, props.currentDot,props.realRing]);
-    return <Canvas canvasId={canvasId} id={canvasId} className={canvasId} type="2d" style={{ width: (radius * 2 + lineWidth)+6, height: (radius * 2 + lineWidth)+6, zIndex: 0 }} ref={canvasRef} />
+    return <Canvas canvasId={canvasId}  id={canvasId} className={canvasId} type="2d" style={{ width: (radius * 2 + lineWidth)+6, height: (radius * 2 + lineWidth)+6, zIndex: 0 }} ref={canvasRef} />
 
 }
 

+ 21 - 2
src/features/trackTimeDuration/components/SetSchedule.tsx

@@ -4,7 +4,7 @@ import { setScenario, setStep } from "@/store/scenario";
 import { View, Text } from "@tarojs/components";
 import "./SetSchedule.scss";
 import Taro, { useDidShow, useReady } from "@tarojs/taro";
-import { useRef, useState } from "react";
+import { useEffect, useRef, useState } from "react";
 import { useDispatch, useSelector } from "react-redux";
 import Footer from "@/components/layout/Footer";
 import PickerViews from "@/components/input/PickerViews";
@@ -90,6 +90,15 @@ export default function Component() {
     // })
   })
 
+  useEffect(()=>{
+    if (isOpen || isTimeOpen){
+      global.disableCanvasGesture = true
+    }
+    else {
+      global.disableCanvasGesture = false
+    }
+  },[isOpen,isTimeOpen])
+
 
   useDidShow(() => {
     setCount(count + 1)
@@ -98,6 +107,7 @@ export default function Component() {
 
   function start() {
     if (scenario.name == 'FAST' || scenario.name == 'SLEEP') {
+      setBtnDisable(true)
       setPlan({
         scenario: scenario.name,
         schedule: scenario.name == 'FAST' ? {
@@ -112,8 +122,11 @@ export default function Component() {
           }
         }
       }).then(res => {
+        setBtnDisable(false)
         global.checkData()
         Taro.navigateBack({ delta: 3 })
+      }).catch(e=>{
+        setBtnDisable(false)
       })
     }
     else {
@@ -194,6 +207,8 @@ export default function Component() {
     setHours(durationTime(e, endTime)[0])
     setMinutes(durationTime(e, endTime)[1])
     saveTempCache(e, endTime);
+    debugger
+    console.log(e)
 
     global.updateDial(e, endTime)
   }
@@ -202,11 +217,12 @@ export default function Component() {
     setIsTimeOpen(false)
     setBeginChange(false)
     setEndTime(e)
-
     setPickerValue(durationIndex(startTime, e, common))
     setHours(durationTime(startTime, e)[0])
     setMinutes(durationTime(startTime, e)[1])
     saveTempCache(startTime, e);
+    debugger
+    console.log(e)
     global.updateDial(startTime, e)
   }
 
@@ -227,12 +243,15 @@ export default function Component() {
     setIsOpen(false)
     if (beginChange) {
       var strEnd = TimeFormatter.calculateTimeByTimeRange(count, startTime, true)
+      debugger
+
       setEndTime(strEnd);
       saveTempCache(startTime, strEnd)
       global.updateDial(startTime, strEnd)
     }
     else {
       var strStart = TimeFormatter.calculateTimeByTimeRange(count, endTime, false)
+      debugger
       setStartTime(strStart);
       saveTempCache(strStart, endTime)
       global.updateDial(strStart, endTime)

+ 13 - 7
src/features/trackTimeDuration/components/StatusIndicator.tsx

@@ -7,7 +7,7 @@ import { useEffect } from "react";
 export default function Component() {
     const time = useSelector((state: any) => state.time);
     const user = useSelector((state: any) => state.user);
-    
+
     function getFastName() {
         var strName = '断食'
         switch (time.scenario) {
@@ -73,23 +73,29 @@ export default function Component() {
         return strName
     }
 
-    if (!time.scenario){
-        return <View />
+    if (!time.scenario) {
+        return <View className='scenario'>
+            <View className='point' style={{ backgroundColor: global.fastColor ? global.fastColor : ColorType.fast }} />
+            <Text className='name'>{getFastName()}</Text>
+        </View>
     }
-    if (!user.isLogin){
-        return <View />
+    if (!user.isLogin) {
+        return <View className='scenario'>
+            <View className='point' style={{ backgroundColor: global.fastColor ? global.fastColor : ColorType.fast }} />
+            <Text className='name'>{getFastName()}</Text>
+        </View>
     }
 
     return <View className='subcontent'>
         {
             time.scenario != 'SLEEP' && <View className='scenario'>
-                <View className='point' style={{ backgroundColor: global.fastColor?global.fastColor:ColorType.fast }} />
+                <View className='point' style={{ backgroundColor: global.fastColor ? global.fastColor : ColorType.fast }} />
                 <Text className='name'>{getFastName()}</Text>
             </View>
         }
         {
             time.scenario != 'FAST' && <View className='scenario' style={{ opacity: sleepAlpha() }}>
-                <View className='point' style={{ backgroundColor: global.sleepColor?global.sleepColor:ColorType.sleep }} />
+                <View className='point' style={{ backgroundColor: global.sleepColor ? global.sleepColor : ColorType.sleep }} />
                 <Text className='name'>{getSleepName()}</Text>
             </View>
         }

+ 35 - 5
src/features/trackTimeDuration/components/TimelineFastSleep.tsx

@@ -5,7 +5,7 @@ import getStatus from "../hooks/Record";
 import { ColorType } from "@/context/themes/color";
 import { useTranslation } from "react-i18next";
 
-export default function TimelineFastSleep(props: { data: any, title?: string }) {
+export default function TimelineFastSleep(props: { data: any, title?: string,first_real_check_time?:number }) {
     const {t} = useTranslation()
     function formateTime(obj: any, isEnd: boolean) {
         if (isEnd) {
@@ -27,6 +27,36 @@ export default function TimelineFastSleep(props: { data: any, title?: string })
 
     }
 
+    function showDate(obj: any, isEnd: boolean){
+        var dt = 0
+        if (isEnd) {
+            if (obj.real_end_time) {
+                dt = obj.real_end_time
+            }
+            else {
+                dt = obj.target_end_time
+            }
+        }
+        else {
+            if (obj.real_start_time) {
+                dt = obj.real_start_time
+            }
+            else {
+                dt = obj.target_start_time
+            }
+        }
+        // debugger
+        var dt2 = props.first_real_check_time?props.first_real_check_time:0
+        var date1 = new Date(dt)
+        var date2 = new Date(dt2)
+        if (date1.getFullYear() == date2.getFullYear() &&
+        date1.getMonth()==date2.getMonth() &&
+        date1.getDate()==date2.getDate()){
+            return false
+        }
+        return true
+    }
+
     function formateDate(obj: any, isEnd: boolean) {
         if (isEnd) {
             if (obj.real_end_time) {
@@ -54,7 +84,7 @@ export default function TimelineFastSleep(props: { data: any, title?: string })
                 status: getStatus(true, true, props.data),
                 title: t('feature.track_time_duration.common.start_fast'),
                 content: formateTime(props.data.fast, false),
-                date: formateDate(props.data.fast, false),
+                date: showDate(props.data.fast, false)?formateDate(props.data.fast, false):'',
                 color:global.fastColor?global.fastColor:ColorType.fast
             }
         )
@@ -65,7 +95,7 @@ export default function TimelineFastSleep(props: { data: any, title?: string })
                 status: getStatus(false, true, props.data),
                 title: t('feature.track_time_duration.common.start_sleep'),
                 content: formateTime(props.data.sleep, false),
-                date: formateDate(props.data.sleep, false),
+                date: showDate(props.data.sleep, false)?formateDate(props.data.sleep, false):'',
                 color:global.sleepColor?global.sleepColor:ColorType.sleep
             }
         )
@@ -76,7 +106,7 @@ export default function TimelineFastSleep(props: { data: any, title?: string })
                 status: getStatus(false, false, props.data),
                 title: t('feature.track_time_duration.common.end_sleep'),
                 content: formateTime(props.data.sleep, true),
-                date: formateDate(props.data.sleep, true),
+                date: showDate(props.data.sleep, true)?formateDate(props.data.sleep, true):'',
                 color:global.sleepColor?global.sleepColor:ColorType.sleep
             }
         )
@@ -87,7 +117,7 @@ export default function TimelineFastSleep(props: { data: any, title?: string })
                 status: getStatus(true, false, props.data),
                 title: t('feature.track_time_duration.common.end_fast'),
                 content: formateTime(props.data.fast, true),
-                date: formateDate(props.data.fast, true),
+                date: showDate(props.data.fast, true)?formateDate(props.data.fast, true):'',
                 color:global.fastColor?global.fastColor:ColorType.fast
             }
         )

+ 3 - 2
src/features/trackTimeDuration/components/TimelineStage.tsx

@@ -12,7 +12,8 @@ import { jumpPage } from '../hooks/Common';
 import { rpxToPx } from '@/utils/tools';
 
 
-export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean }) {
+export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean,first_real_check_time?:number }) {
+    // debugger
     const [segmentIndex, setSegmentIndex] = useState(0)
     const permission = useSelector((state: any) => state.permission);
     const common = useSelector((state: any) => state.common);
@@ -71,7 +72,7 @@ export default function Component(props: { data: any, title?: string, subTitle?:
 
                 <View style={{ position: 'relative' }}>
                     <View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
-                        <TimelineFastSleep data={props.data} />
+                        <TimelineFastSleep data={props.data} first_real_check_time={props.first_real_check_time}/>
                     </View>
                     {props.data.scenario == 'FAST_SLEEP' && <View style={{
                         opacity: segmentIndex == 1 ? 1 : 0,

+ 12 - 2
src/pages/account/ChooseAuth.tsx

@@ -11,12 +11,15 @@ import { ColorType } from "@/context/themes/color";
 import { ChooseScenarioBtn } from "@/features/common/SpecBtns";
 import { useTranslation } from "react-i18next";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import { loginSuccess } from "@/store/user";
+
 let useNavigation;
 if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
 
 export default function Page() {
+    const [btnDisable,setBtnDisable] = useState(false)
     const dispatch = useDispatch();
     const {t} = useTranslation()
     var code = '';
@@ -54,7 +57,14 @@ export default function Page() {
     })
 
     async function login() {
-        dispatch(wxLogin(code) as any);
+        setBtnDisable(true)
+        wxLogin(code).then(res=>{
+            dispatch(loginSuccess(res));
+            setBtnDisable(false)
+        }).catch(e=>{
+            setBtnDisable(false)
+        })
+        // dispatch(wxLogin(code) as any);
         // try {
         //     const { encryptedData, iv } = await Taro.getUserProfile({
         //         desc: '获取用户信息',
@@ -77,7 +87,7 @@ export default function Page() {
         <Text className="slogan">{t('page.choose_auth.slogan')}</Text>
         {
             process.env.TARO_ENV=='weapp'?<ChooseScenarioBtn title={t('page.choose_auth.btn_wechat')} onClick={login} background={ColorType.fast} />:
-            <ChooseScenarioBtn title={t('page.choose_auth.btn_signup')} onClick={createAccount1} background={ColorType.fast} />
+            <ChooseScenarioBtn disable={btnDisable} title={t('page.choose_auth.btn_signup')} onClick={createAccount1} background={ColorType.fast} />
         }
         {/* <ChooseScenarioBtn title={t('page.choose_auth.btn_wechat')} onClick={login} background={ColorType.fast} /> */}
         {/* <View style={{ height: 100 }} /> */}

+ 17 - 5
src/pages/account/EditPage.tsx

@@ -6,16 +6,24 @@ import { update } from "@/services/user";
 import { updateSuccess } from "@/store/user";
 import { Input, View, Text } from "@tarojs/components";
 import Taro from "@tarojs/taro";
-import { useState } from "react";
+import { useEffect, useState } from "react";
 import { useTranslation } from "react-i18next";
 import { useDispatch, useSelector } from "react-redux";
 
 export default function Page() {
+
     const user = useSelector((state: any) => state.user);
-    const [value, setValue] = useState(user.nickname);
-    const {t} = useTranslation()
+    const [value, setValue] = useState('');
+    const [btnDisable, setBtnDisable] = useState(false);
+    const { t } = useTranslation()
     const dispatch = useDispatch();
 
+    useEffect(()=>{
+        setTimeout(()=>{
+            setValue(user.nickname)
+        },300)
+    },[])
+
     const handleChange = (e) => {
         setValue(e);
     };
@@ -28,8 +36,10 @@ export default function Page() {
             })
             return;
         }
+        setBtnDisable(true)
         update({ nickname: value }).then(res => {
             dispatch(updateSuccess({ nickname: value }));
+            setBtnDisable(false)
             Taro.showToast({
                 title: t('feature.common.toast.update_success'),
                 icon: 'none'
@@ -39,18 +49,20 @@ export default function Page() {
                 Taro.navigateBack()
             }, 2000)
 
+        }).catch(e => {
+            setBtnDisable(false)
         })
         // dispatch(update({nickname:value}).then() as any)
     }
 
     return <View>
-        <View style={{height:20}}></View>
+        <View style={{ height: 20 }}></View>
         {/* <Input type="nickname" placeholder="请输入昵称" style={{ color: '#fff' }} value={value} onInput={handleChange} /> */}
         <Inputs placeholder={t('feature.common.toast.input_nickname')} value={value} onChange={handleChange} onConfirm={save}
             openType="nickname"
         />
         <Footer>
-        <ChooseScenarioBtn title={t('page.user_profile.save')} onClick={save} background={ColorType.fast} />
+            <ChooseScenarioBtn disable={btnDisable} title={t('page.user_profile.save')} onClick={save} background={ColorType.fast} />
         </Footer>
         {/* <Text onClick={save} style={{ color: '#fff' }}>保存</Text> */}
     </View>

+ 25 - 7
src/pages/clock/Clock.weapp.tsx

@@ -83,7 +83,6 @@ export default function IndexPage() {
   global.dispatch = dispatch;
 
   global.checkData = () => {
-    console.log('refresh clock data')
     getCheckData()
   }
 
@@ -171,7 +170,7 @@ export default function IndexPage() {
         clearInterval(timerId);
       }
     };
-  }, [timerId]);
+  }, []);
 
   const startTimer = () => {
     // 避免重复启动定时器
@@ -180,6 +179,9 @@ export default function IndexPage() {
     }
 
     const id = setInterval(() => {
+      if (global.showModal) {
+        return
+      }
       setCounter((prevCounter) => prevCounter + 1);
       //每天0点刷新一下打卡数据
       var now = new Date()
@@ -244,10 +246,21 @@ export default function IndexPage() {
     setShowSingleFastEnd(true)
   }
 
-  function tapClock() {
+  function tapClock(e) {
+    // if (global.showModal) {
+    //   return
+    // }
+    if (process.env.TARO_ENV == 'weapp') {
+      e.stopPropagation()
+    }
     if (!user.isLogin) {
       jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
     }
+    else {
+      Taro.vibrateShort({
+        type:'medium'
+      })
+    }
   }
 
   function getCheckData() {
@@ -295,13 +308,10 @@ export default function IndexPage() {
       }
 
     }).catch(e => {
-      console.log('aaa')
       if (!checkData) {
-        console.log('this is a test')
         setErrorPage(true)
       }
       else {
-        console.log('sss')
       }
     })
   }
@@ -349,11 +359,13 @@ export default function IndexPage() {
   }
 
   global.showClockModal = (isShow: boolean, detail: any) => {
+    global.showModal = isShow
     setShowModal(isShow)
     setModalDetail(detail)
   }
 
   global.showClockModal2 = (isShow: boolean, detail: any) => {
+    global.showModal = isShow
     setShowModal2(isShow)
     setModalDetail2(detail)
   }
@@ -416,12 +428,18 @@ export default function IndexPage() {
           {
             needShowAddTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
           }
+          {/* <View style={{ width: '100%', height: 400, backgroundColor: 'gray' }}></View> */}
 
           <Box>
             <View className='clock_bg' onClick={tapClock}>
-              <Clocks />
+              <Clocks showCoverView={!global.showModal}/>
             </View>
           </Box>
+          {/* <Box>
+            <View className='clock_bg' onClick={tapClock}>
+              <Clocks />
+            </View>
+          </Box> */}
           {
             errorView()
           }

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

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

+ 3 - 1
src/services/trackTimeDuration.tsx

@@ -15,13 +15,15 @@ export const getPlans = () => {
 }
 
 export const setPlan = (params: Record<string, any> | undefined) => {
-    return new Promise((resolve) => {
+    return new Promise((resolve,reject) => {
         request({
             url: API_FAST_PLANS, method: 'POST', data: { ...params }
         }).then(res => {
             resolve(res);
             console.log(res);
             // dispatch(loginSuccess(res));
+        }).catch(e=>{
+            reject(e)
         })
     })
 }

+ 24 - 19
src/services/user.tsx

@@ -22,32 +22,35 @@ export const login = (username: string, password: string) => {
         request({
             url: API_LOGIN, method: 'POST', data: { username, password }
         }).then(res => {
-            console.log('ssss')
             resolve(res)
             // dispatch(loginSuccess(res));
-        }).catch(e=>{
-            console.log('vvvvvv')
+        }).catch(e => {
             reject(e)
         })
     })
 }
 
-export const wxLogin = (code: string/*, encryptedData: string, iv: string*/) => (dispatch: any) => {
-    request({
-        url: API_OAUTH_LOGIN, method: 'POST',
-        data: {
-            code: code,
-            type: 'WX_MP',
-            app_version: '1',
-            client_version: '1',
-            client_type: 'WX_MP',
-            // extra: {
-            //     encryptedData: encryptedData,
-            //     iv: iv
-            // }
-        }
-    }).then(res => {
-        dispatch(loginSuccess(res));
+export const wxLogin = (code: string/*, encryptedData: string, iv: string*/) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_OAUTH_LOGIN, method: 'POST',
+            data: {
+                code: code,
+                type: 'WX_MP',
+                app_version: '1',
+                client_version: '1',
+                client_type: 'WX_MP',
+                // extra: {
+                //     encryptedData: encryptedData,
+                //     iv: iv
+                // }
+            }
+        }).then(res => {
+            resolve(res)
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
     })
 };
 
@@ -109,6 +112,8 @@ export const update = (params: any) => {
         }).then(res => {
             // dispatch(updateSuccess(params));
             resolve(res)
+        }).catch(e=>{
+            reject(e)
         })
     })
 }

+ 32 - 1
src/utils/time_format.ts

@@ -1,5 +1,5 @@
 export class TimeFormatter {
-  static nowDuration = 30  
+  static nowDuration = 30
   //格式化时间
   static formatTimestamp(timestamp: number): string {
     const currentDate = new Date();
@@ -44,6 +44,35 @@ export class TimeFormatter {
     )} ${TimeFormatter.formatTime(inputDate)}`;
   }
 
+  static dateTimeFormate(timestamp: number) {
+    const currentDate = new Date();
+    const inputDate = new Date(timestamp);
+
+    // 判断是否是今天
+    if (
+      inputDate.getDate() === currentDate.getDate() &&
+      inputDate.getMonth() === currentDate.getMonth() &&
+      inputDate.getFullYear() === currentDate.getFullYear()
+    ) {
+      return `今天 ${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`;
+    }
+
+    // 判断是否是昨天
+    const yesterday = new Date();
+    yesterday.setDate(currentDate.getDate() - 1);
+
+    if (
+      inputDate.getDate() === yesterday.getDate() &&
+      inputDate.getMonth() === yesterday.getMonth() &&
+      inputDate.getFullYear() === yesterday.getFullYear()
+    ) {
+      return `昨天 ${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`;
+    }
+
+    return TimeFormatter.getDateAndWeek(timestamp)+' '+`${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`
+
+  }
+
 
   //1.只显示时间
   static timelineFormatTime(timestamp: number, isTestUser?: boolean): string {
@@ -272,6 +301,7 @@ export class TimeFormatter {
 
   //根据时间段和一个时间,推算另外一个时间
   static calculateTimeByTimeRange = (timeRange: number, strTime: string, isStart: boolean): string => {
+    console.log(timeRange, strTime, isStart)
     var list = strTime.split(':');
     var time = parseInt(list[0]) * 60 + parseInt(list[1]);
     if (isStart) {
@@ -284,6 +314,7 @@ export class TimeFormatter {
     time = time >= 24 * 60 ? time - 24 * 60 : time;
     var hour = Math.floor(time / 60);
     var minute = time % 60;
+    console.log(hour + ':' + minute)
     return `${TimeFormatter.padZero(hour)}:${TimeFormatter.padZero(minute)}`;
   }