Leon il y a 2 ans
Parent
commit
b0170707a1

+ 2 - 1
src/app.config.ts

@@ -1,6 +1,8 @@
 const appConfig = defineAppConfig({
   pages: [
     'pages/Clock',
+    'pages/demo',
+    
     'pages/index/index',
     'pages/Login',
     'pages/Auth',
@@ -59,7 +61,6 @@ process.env.TARO_ENV === 'weapp' && (appConfig.tabBar = {
     {
       pagePath: 'pages/Clock',
       text: '首页',
-
     },
     {
       pagePath: 'pages/Metric',

+ 103 - 0
src/components/SlidngScale.scss

@@ -0,0 +1,103 @@
+.slidng{
+    position: relative;
+}
+
+.value{
+    width: 750px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    color: black;
+    font-size: 50px;
+    height: 50px;
+    text-align: center;
+}
+
+.scroll{
+    width: 750px;
+    height: 300px;
+    background-color: pink;
+    position: relative;
+}
+
+.scrollContent{
+    display: flex;
+    flex-direction: row;
+}
+
+.scrollPadding{
+    width: 375px;
+    height: 30px;
+    background-color: white;
+    flex-shrink: 0;
+}
+
+.content{
+    height: 30px;
+    background-color: blue;
+    flex-shrink: 0;
+    display: flex;
+    flex-direction: row;
+}
+
+.slidng_item{
+    display: flex;
+    flex-shrink: 0;
+    box-sizing: border-box;
+    // width: 2px;
+    height: 15px;
+    background-color: white;
+    // margin-right: 18px;
+}
+
+.slidng_item_big{
+    display: flex;
+    flex-shrink: 0;
+    box-sizing: border-box;
+    // width: 2px;
+    height: 30px;
+    background-color: white;
+    // margin-right: 18px;
+    position: relative;
+}
+
+.slidng_item_middle{
+    display: flex;
+    flex-shrink: 0;
+    box-sizing: border-box;
+    // width: 2px;
+    height: 25px;
+    background-color: white;
+    // margin-right: 18px;
+    position: relative;
+}
+.slidng_text{
+    position: absolute;
+    left: -25px;
+    width: 50px;
+    // right: 30px;
+    top: 30px;
+    text-align: center;
+    color: black;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    background-color: oldlace;
+    font-size: 20px;
+}
+
+.center_line{
+    width: 2px;
+    height: 50px;
+    background-color: red;
+    position: absolute;
+    left: 374px;
+    top: 50px;
+}
+
+.demo2{
+    width: 750px;
+    height: 40px;
+    background-color: pink;
+    flex-shrink: 0;
+}

+ 95 - 0
src/components/SlidngScale.tsx

@@ -0,0 +1,95 @@
+import { ScrollView, View, Text } from "@tarojs/components";
+import './SlidngScale.scss'
+import { useEffect, useRef, useState } from "react";
+import Taro from "@tarojs/taro";
+
+export default function Component(props:{step:number,min:number,max:number,default_value:number,changed:Function}) {
+    const scrollViewRef = useRef<any>();
+    const minNum: number = props.min;
+    const maxNum: number = props.max;
+    const stepNum: number = props.step*10;
+    const jingdu: number = props.step<1?10:1;
+    const list: any[] = [];
+
+    // console.log(750/Taro.getSystemInfoSync().screenWidth)
+    // const ratio = 2//750.0/Taro.getSystemInfoSync().screenWidth;
+
+    const slidngWidth = 10
+
+    const [current, setCurrent] = useState(props.default_value)
+    const [left, setLeft] = useState((props.default_value-props.min)*slidngWidth/props.step+1);
+    for (var i: number = props.min; i <= props.max; i += props.step) {
+        var value: number = parseFloat(i.toFixed(1));
+        var isBig: boolean = Math.round((value - minNum) * jingdu) % Math.round(stepNum * jingdu) == 0;
+        var isMiddle:boolean = (Math.round((value - minNum) * jingdu)*2) % Math.round(stepNum * jingdu) == 0;
+
+        list.push({
+            value: props.step<1?value:Math.round(value),
+            showBig: isBig && i >= minNum && i <= maxNum,
+            showMiddle: isMiddle && !isBig && i >= minNum && i <= maxNum
+        })
+        
+    }
+
+    useEffect(() => {
+        // var  aa = current-props.min;
+        // var bb = aa/props.step*slidngWidth;
+        // setLeft(bb/ratio)
+    }, [])
+
+    // const dpr = Taro.pxTransform//Taro.getSystemInfoSync().pixelRatio; 
+
+    
+    const handleScroll = (e) => {
+        const { scrollLeft } = e.detail;
+
+        var count = scrollLeft / slidngWidth;
+        var strValue = (props.min + Math.round(count) * props.step).toFixed(1);
+        if ((strValue as any) < props.min) {
+            strValue = props.min as any;
+        }
+
+        if ((strValue as any) > props.max) {
+            strValue = props.max as any;
+        }
+
+        if (parseFloat(strValue) != current) {
+            var data = strValue as any;
+            if (props.step<1) {
+                data = parseFloat(strValue).toFixed(1);
+            }
+            else {
+                data = Math.round(data);
+            }
+            
+            setCurrent(data);
+
+            props.changed(data);
+        }
+    };
+
+    return <View className="slidng">
+        <Text className="value">{current}</Text>
+        <ScrollView ref={scrollViewRef} scrollX scrollLeft={left} className="scroll" onScroll={handleScroll}>
+            <View className="scrollContent">
+                <View className="scrollPadding" />
+                <View className="content">
+                    {
+                        list.map((item, index) => {
+                            return <View className={item.showBig ? 'slidng_item_big' : item.showMiddle?'slidng_item_middle':'slidng_item'} style={{width:1,marginRight:9}} key={index}>
+                                {
+                                    item.showBig ? <Text className="slidng_text">{item.value}</Text> : null
+                                }
+                            </View>
+                        })
+                    }
+                </View>
+                {/* <View className="demo2"/> */}
+                <View className="scrollPadding" />
+            </View>
+
+        </ScrollView>
+        <View className="center_line" />
+        
+    </View>
+}

+ 0 - 4
src/components/demo.json

@@ -1,4 +0,0 @@
-{
-  "component": true,
-  "usingComponents": {}
-}

+ 0 - 39
src/components/demo.ts

@@ -1,39 +0,0 @@
-// components/demo.ts
-Component({
-  /**
-   * Component properties
-   */
-  properties: {
-    content:{
-      type:String,
-      value:'111'
-    },
-    detail:{
-      type:Object
-    },
-    func:{
-      type:Function
-    }
-  },
-
-  
-
-  /**
-   * Component initial data
-   */
-  data: {
-
-  },
-
-  /**
-   * Component methods
-   */
-  methods: {
-    hello(){
-      console.log('hello')
-      this.triggerEvent('apple',{name:'hello'})
-      // debugger
-      // this.data.func({name:'hello'})
-    },
-  }
-})

+ 0 - 5
src/components/demo.wxml

@@ -1,5 +0,0 @@
-<!--components/demo.wxml-->
-<view class='demo'>
-<text>components/demo.wxml</text>
-<text  bindtap="hello">oppsu{{content}}  zzz</text>
-</view>

+ 0 - 5
src/components/demo.wxss

@@ -1,5 +0,0 @@
-/* components/demo.wxss */
-.demo{
-    display: flex;
-  flex-direction: column;
-}

+ 5 - 0
src/features/trackSomething/components/Activity.tsx

@@ -265,6 +265,11 @@ export default function Component(props: any) {
                     desc = '开启步数仅自己可见'
                 }
 
+                if (!user.isLogin){
+                    value = '未登录'
+                    desc = '登录后可开启打卡'
+                }
+
                 return <MetricItem title={item.name}
                     // value={allowRun ? stepInfo ? (stepInfo as any).step : '' : '未开启'}
                     value={value}

+ 1 - 0
src/features/trackSomething/components/ActivityHistory.tsx

@@ -45,6 +45,7 @@ export default function Component(props: { records: any[] }) {
                                 <View className="status_bg">
                                     <Text className="status_text">{record.type == 'total' ? '总计' : record.type == 'sync' ? '同步' : '打卡'}</Text>
                                 </View>
+                                <View style={{width:12}}/>
                                 <Text className="value">{record.items[0].value}</Text>
                                 <Text className="unit">步</Text>
                                 <View style={{ flex: 1 }} />

+ 54 - 52
src/features/trackSomething/components/Metric.tsx

@@ -12,6 +12,7 @@ import { get } from "http";
 import Modal from "@/components/Modal";
 import PickerViews from "@/components/PickerViews";
 import LimitPickers from "@/components/LimitPickers";
+import SlidngScale from "@/components/SlidngScale";
 
 export default function Component(props: any) {
     const user = useSelector((state: any) => state.user);
@@ -80,20 +81,13 @@ export default function Component(props: any) {
     function record(item: any) {
 
         if (user.isLogin) {
-            setMetricItem(item)
             var now = new Date();
             var t = (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + ":" + (now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes());
             setStrTime(t)
             setTime(now.getTime())
-            if (item.schemas[0].type == 'DECIMAL') {
-                pointPicker(item.schemas[0])
-            }
-            else if (item.schemas.length > 1) {
-
-            }
-            else {
-                singlePicker(item.schemas[0])
-            }
+            setMetricItem(item)
+            openModal()
+            console.log(item)
         }
         else {
             Taro.navigateTo({
@@ -198,12 +192,46 @@ export default function Component(props: any) {
         setIsTimePickerOpen(true)
     }
 
-    function chooseTime(e){
+    function chooseTime(e) {
         setTime(e);
         setStrTime(TimeFormatter.formatTimestamp(e))
         setIsTimePickerOpen(false)
     }
 
+    function cancelModal() {
+        (metricItem as any).schemas.map((item, index) => {
+            item.tempValue = ''
+        })
+        closeModal()
+    }
+
+    function confirmModal() {
+        closeModal()
+        var date = new Date(time)
+        var strDate = (date.getFullYear() + '') + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
+        
+        var array:any[] = [];
+        (metricItem as any).schemas.map((item, index) => {
+            array.push({
+                code:item.code,
+                value:item.tempValue&&item.tempValue.length>0?item.tempValue:item.default_value
+            })
+        })
+        var params = {
+            code: (metricItem as any).code,
+            timestamp: time,
+            date: strDate,
+            items: array
+        }
+        uploadMetric(params).then(res => {
+            getCards();
+            (metricItem as any).schemas.map((item, index) => {
+                item.tempValue = ''
+            })
+
+        })
+    }
+
     const limit = new Date().getTime() - 180 * 3600 * 1000 * 24;
 
     return <View className="metric_container">
@@ -235,22 +263,22 @@ export default function Component(props: any) {
                 <View style={{
                     backgroundColor: 'white',
                     display: 'flex', flexDirection: 'column',
-                    width: '100%', height: '50%', color: '#000'
+                    width: '100%', paddingBottom: 50, color: '#000'
                 }}>
                     <Text style={{ textAlign: 'center' }}>{(metricItem as any).name}</Text>
-                    <Text style={{ textAlign: 'center', paddingTop: 10, paddingBottom: 10 }} onClick={showTimePicker}>{strTime}</Text>
+                    <Text style={{ textAlign: 'center', paddingTop: 10, paddingBottom: 10, color: 'black' }} onClick={showTimePicker}>{strTime}</Text>
                     <View style={{ position: 'relative' }}>
-                        <PickerViews onChange={pickerChanged}
-                            items={pickerItems}
-                            value={pickerValue}
-                            height={200} showBtns={true}
-                            onCancel={closeModal} />
-                        {isPoint && <View style={{
-                            position: 'absolute', width: '20%', height: 50, backgroundColor: 'transparent', left: '40%', top: 75,
-                            display: 'flex', alignItems: 'center', justifyContent: 'center'
-                        }}>
-                            <Text style={{ color: '#000', fontSize: 16, fontWeight: 'bold' }}>.</Text>
-                        </View>}
+                        {
+                            (metricItem as any).schemas.map((item, index) => {
+                                return <View key={index}>
+                                    <SlidngScale step={item.step} min={item.min} max={item.max} default_value={item.default_value} changed={(e) => { item.tempValue = e }} />
+                                </View>
+                            })
+                        }
+                    </View>
+                    <View style={{ marginBottom: 20, marginTop: 20, display: 'flex', flexDirection: 'row', width: '100%' }}>
+                        <Text style={{ flex: 1, textAlign: 'center', height: 50 }} onClick={cancelModal}>取消</Text>
+                        <Text style={{ flex: 1, textAlign: 'center', height: 50 }} onClick={confirmModal}>确认</Text>
                     </View>
 
                 </View>
@@ -268,32 +296,6 @@ export default function Component(props: any) {
         }
     </View>
 
-    /*
-    return <MetricItem title="行走"
-        value={allowRun ? stepInfo ? (stepInfo as any).step : '' : '未开启'}
-        unit={(allowRun && stepInfo) ? '步' : ''}
-        desc={allowRun ? stepInfo ? TimeFormatter.formatTimestamp(lastTime) : '' : '开启步数仅自己可见'}
-        btnText={allowRun ? isCheking ? '打卡中...' : '打卡' : '开启'}
-        isDisabled={isCheking}
-        themeColor='#EEC01F'
-        onClickDetail={goDetail}
-        onClick={checkout}
-    />*/
-
-    return <View className="metric_bg">
-        <Text className="metric_title">行走</Text>
-        {
-            !allowRun && <Text className="metric_value">未开启</Text>
-        }
-        {
-            !allowRun && <Text className="mteric_desc">开启步数仅自己可见</Text>
-        }
-        {
-            allowRun && stepInfo && <Text className="metric_value">{(stepInfo as any).step}<Text className="metric_unit">步</Text></Text>
-        }
-        {
-            allowRun && stepInfo && <Text className="mteric_desc">{TimeFormatter.formatTimestamp(lastTime)}</Text>
-        }
-        <View className="operate" onClick={checkout}>{allowRun ? '打卡' : '开启'}</View>
-    </View>
+
+
 }

+ 1 - 1
src/features/trackSomething/components/MetricHistory.scss

@@ -47,7 +47,7 @@
 }
 .value{
     font-size: 48px;
-    margin-left: 24px;
+    // margin-left: 24px;
     color: #fff;
     font-weight: 500;
 }

+ 7 - 0
src/features/trackSomething/components/MetricHistory.tsx

@@ -49,7 +49,14 @@ export default function Component(props: { records: any[] }) {
                                 <View className="status_bg">
                                     {/* <Text className="status_text">{record.type == 'total' ? '总计' : record.type == 'sync' ? '同步' : '打卡'}</Text> */}
                                 </View>
+                                <View style={{width:12}}/>
                                 <Text className="value">{record.items[0].value}</Text>
+                                {
+                                    record.items.length>1 && <Text className="value">/{record.items[1].value}</Text>
+                                }
+                                {
+                                    record.items.length>2 && <Text className="value">/{record.items[2].value}</Text>
+                                }
                                 <Text className="unit"></Text>
                                 <View style={{ flex: 1 }} />
                                 <Text className="time">{formateHourMinutes(record.timestamp)}</Text>

+ 300 - 0
src/features/trackSomething/components/Metric_backup.tsx

@@ -0,0 +1,300 @@
+import { View, Text } from "@tarojs/components";
+import './Metric.scss'
+import { setAuth } from "../hooks/werun";
+import { useReady } from "@tarojs/taro";
+import { useSelector } from "react-redux";
+import { useEffect, useState } from "react";
+import Taro from "@tarojs/taro";
+import { metricCards, uploadMetric, uploadSteps } from "@/services/trackSomething";
+import { TimeFormatter } from "@/utils/time_format";
+import MetricItem from "./MetricItem";
+import { get } from "http";
+import Modal from "@/components/Modal";
+import PickerViews from "@/components/PickerViews";
+import LimitPickers from "@/components/LimitPickers";
+import  SlidngScale from "@/components/SlidngScale";
+
+export default function Component(props: any) {
+    const user = useSelector((state: any) => state.user);
+    const [list, setList] = useState([])
+
+    const [isModalOpen, setIsModalOpen] = useState(false);
+    const [isTimePickerOpen, setIsTimePickerOpen] = useState(false);
+    const [pickerValue, setPickerValue] = useState([]);
+    const [pickerItems, setPickerItems] = useState([]);
+    const [isPoint, setIsPoint] = useState(false)
+
+    const [metricItem, setMetricItem] = useState({})
+
+    const [strTime, setStrTime] = useState('')
+    const [time, setTime] = useState(0)
+
+    //未登录<->已登录 状态切换时,执行一次授权检查
+    useEffect(() => {
+        getCards();
+    }, [user.isLogin])
+
+    useReady(() => {
+        getCards();
+    })
+
+    const openModal = () => {
+        setIsModalOpen(true);
+    };
+
+    const closeModal = () => {
+        setIsModalOpen(false);
+    };
+
+    function getCards() {
+        metricCards().then(res => {
+            setList((res as any).cards)
+        })
+    }
+
+    //ts 把数组items: [{code: "_walk", value: 2180},{code: "_walk", value: 4444}]中的value取出来,/分割,组成字符串,如2180/4444
+    function getValues(items) {
+        var values = ''
+        items.map((item, index) => {
+            if (index == 0) {
+                values = item.value
+            }
+            else {
+                values = values + '/' + item.value
+            }
+        })
+        return values
+    }
+    function goDetail(item) {
+        if (user.isLogin) {
+            Taro.navigateTo({
+                url: '/pages/RecordsHistory?type=metric&code=' + item.code
+            })
+        }
+        else {
+            Taro.navigateTo({
+                url: '/pages/ChooseAuth'
+            })
+        }
+    }
+
+    function record(item: any) {
+
+        if (user.isLogin) {
+            setMetricItem(item)
+            var now = new Date();
+            var t = (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + ":" + (now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes());
+            setStrTime(t)
+            setTime(now.getTime())
+            if (item.schemas[0].type == 'DECIMAL') {
+                pointPicker(item.schemas[0])
+            }
+            else if (item.schemas.length > 1) {
+
+            }
+            else {
+                singlePicker(item.schemas[0])
+            }
+        }
+        else {
+            Taro.navigateTo({
+                url: '/pages/ChooseAuth'
+            })
+        }
+    }
+
+    function pointPicker(item: any) {
+        var min = item.min
+        var max = item.max
+        var step = item.step
+        var value = item.default_value
+        console.log(value)
+        var items: number[] = []
+        var items2: number[] = []
+
+        var value0Index = 0
+        var value1Index = 0
+
+        for (var i = min; i <= max; i++) {
+            if (i == Math.floor(value)) {
+                value0Index = i - min
+            }
+            items.push(i)
+            // items2.push(i)
+        }
+
+        for (var i = 0; i <= 9; i++) {
+            items2.push(i)
+        }
+        value1Index = Math.round(10 * (value - Math.floor(value)));
+        console.log(value1Index)
+
+        setPickerValue([value0Index, value1Index] as any)
+        setPickerItems([items, items2] as any)
+        setIsPoint(true)
+
+        openModal()
+    }
+
+    function singlePicker(item: any) {
+        var min = item.min
+        var max = item.max
+        var step = 1//item.step
+        var value = item.default_value
+
+        var items: number[] = []
+        for (var i = min; i <= max; i += step) {
+            if (i == value) {
+                setPickerValue([i - min] as any)
+            }
+            items.push(i)
+        }
+
+        setPickerItems([items] as any)
+        setIsPoint(false)
+
+        openModal()
+    }
+
+    function pickerChanged(e) {
+        closeModal();
+        var params = {}
+        var date = new Date(time)
+        var strDate = (date.getFullYear() + '') + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
+
+        if ((metricItem as any).schemas[0].type == 'DECIMAL') {
+            var array = pickerItems;
+            var value = array[0][e[0]] + '.' + array[1][e[1]]
+            console.log(value)
+
+
+            params = {
+                code: (metricItem as any).code,
+                timestamp: time,
+                date: strDate,
+                items: [{ code: (metricItem as any).schemas[0].code, value: value }]
+            }
+        }
+        else if ((metricItem as any).schemas.length > 1) {
+
+        }
+        else {
+            var array = pickerItems;
+            var value = array[0][e[0]] + ''
+            console.log(value)
+            params = {
+                code: (metricItem as any).code,
+                timestamp: time,
+                date: strDate,
+                items: [{ code: (metricItem as any).schemas[0].code, value: value }]
+            }
+        }
+
+        uploadMetric(params).then(res => {
+            getCards();
+        })
+    }
+
+    function showTimePicker() {
+        setIsTimePickerOpen(true)
+    }
+
+    function chooseTime(e){
+        setTime(e);
+        setStrTime(TimeFormatter.formatTimestamp(e))
+        setIsTimePickerOpen(false)
+    }
+
+    const limit = new Date().getTime() - 180 * 3600 * 1000 * 24;
+
+    return <View className="metric_container">
+        {
+            list.map((item: any, index: number) => {
+                var unit = ''
+                var value = '无记录'
+                var desc = '记录解锁趋势'
+                if (item.latest_record) {
+                    unit = item.schemas[0].default_unit
+                    value = getValues(item.latest_record.items)
+                    desc = TimeFormatter.formatTimestamp(item.latest_record.timestamp)
+                }
+                return <MetricItem title={item.name}
+                    value={value}
+                    unit={unit}
+                    desc={desc}
+                    btnText='记录'
+                    isDisabled={false}
+                    themeColor={item.theme_color}
+                    onClickDetail={() => { goDetail(item) }}
+                    onClick={() => { record(item) }}
+                />
+            })
+        }
+        <View className="space_width" />
+        {
+            isModalOpen && <Modal dismiss={closeModal}>
+                <View style={{
+                    backgroundColor: 'white',
+                    display: 'flex', flexDirection: 'column',
+                    width: '100%', height: '50%', color: '#000'
+                }}>
+                    <Text style={{ textAlign: 'center' }}>{(metricItem as any).name}</Text>
+                    <Text style={{ textAlign: 'center', paddingTop: 10, paddingBottom: 10 }} onClick={showTimePicker}>{strTime}</Text>
+                    <View style={{ position: 'relative' }}>
+                        <PickerViews onChange={pickerChanged}
+                            items={pickerItems}
+                            value={pickerValue}
+                            height={200} showBtns={true}
+                            onCancel={closeModal} />
+                        {isPoint && <View style={{
+                            position: 'absolute', width: '20%', height: 50, backgroundColor: 'transparent', left: '40%', top: 75,
+                            display: 'flex', alignItems: 'center', justifyContent: 'center'
+                        }}>
+                            <Text style={{ color: '#000', fontSize: 16, fontWeight: 'bold' }}>.</Text>
+                        </View>}
+                    </View>
+
+                </View>
+            </Modal>
+        }
+        {
+
+            isTimePickerOpen && <Modal dismiss={() => setIsTimePickerOpen(false)}>
+                <LimitPickers isRealTime={true} time={time} limit={limit} limitDay={180} onCancel={() => { setIsTimePickerOpen(false) }} onChange={(e) => {
+                    chooseTime(e)
+                    //  pickerConfirm(e)
+                    //  hidePicker()
+                }} />
+            </Modal>
+        }
+    </View>
+
+    /*
+    return <MetricItem title="行走"
+        value={allowRun ? stepInfo ? (stepInfo as any).step : '' : '未开启'}
+        unit={(allowRun && stepInfo) ? '步' : ''}
+        desc={allowRun ? stepInfo ? TimeFormatter.formatTimestamp(lastTime) : '' : '开启步数仅自己可见'}
+        btnText={allowRun ? isCheking ? '打卡中...' : '打卡' : '开启'}
+        isDisabled={isCheking}
+        themeColor='#EEC01F'
+        onClickDetail={goDetail}
+        onClick={checkout}
+    />*/
+
+    return <View className="metric_bg">
+        <Text className="metric_title">行走</Text>
+        {
+            !allowRun && <Text className="metric_value">未开启</Text>
+        }
+        {
+            !allowRun && <Text className="mteric_desc">开启步数仅自己可见</Text>
+        }
+        {
+            allowRun && stepInfo && <Text className="metric_value">{(stepInfo as any).step}<Text className="metric_unit">步</Text></Text>
+        }
+        {
+            allowRun && stepInfo && <Text className="mteric_desc">{TimeFormatter.formatTimestamp(lastTime)}</Text>
+        }
+        <View className="operate" onClick={checkout}>{allowRun ? '打卡' : '开启'}</View>
+    </View>
+}

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

@@ -94,9 +94,15 @@ export default function Component() {
     function getScheduleTarget(isFast: boolean) {
         for (var i = 0; i < scenarios.length; i++) {
             if (isFast && scenarios[i].name == 'FAST') {
+                if (global.schedule_fast){
+                    return global.schedule_fast
+                }
                 return scenarios[i].schedule.fast
             }
             else if (!isFast && scenarios[i].name == 'SLEEP') {
+                if (global.schedule_sleep){
+                    return global.schedule_sleep
+                }
                 return scenarios[i].schedule.sleep
             }
 

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

@@ -136,7 +136,7 @@ export default function Component() {
         if (current_record && current_record.last_real_check_time)
             limit = current_record.last_real_check_time
         return <View style={{backgroundColor:'#fff'}}>
-            <LimitPickers limit={limit} onCancel={hidePicker} onChange={(e) => {
+            <LimitPickers limit={limit} limitDay={7} onCancel={hidePicker} onChange={(e) => {
                 console.log(new Date(e))
                 pickerConfirm(e)
                 hidePicker()

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

@@ -465,7 +465,6 @@ export default function Component(props: { type?: string, data?: any, delSuccess
                 }
                 else if (record.sleep.status == 'COMPLETED') {
                     realRing = getReal(record, false, true)
-                    debugger
                     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
                 }
                 return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} />

+ 10 - 0
src/pages/demo.tsx

@@ -0,0 +1,10 @@
+import { View,Text } from "@tarojs/components";
+import SlidngScale from "@components/SlidngScale";
+
+
+export default function Page(){
+    return <View style={{color:'#fff'}}>
+        <Text>SlidngScale Demo</Text>
+        {/* <SlidngScale /> */}
+    </View>
+}

+ 1 - 1
src/pages/index/index.config.ts

@@ -2,6 +2,6 @@ export default definePageConfig({
   navigationBarTitleText: '首页',
   usingComponents:{
     // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
-    'demo':'../../components/demo'
+    // 'demo':'../../components/demo'
   }
 })