Leon před 2 roky
rodič
revize
5e23a1fbcf

+ 9 - 5
src/app.config.ts

@@ -65,23 +65,27 @@ const appConfig = defineAppConfig({
 })
 
 process.env.TARO_ENV === 'weapp' && (appConfig.tabBar = {
-  custom: true,
+  // custom: true,
+  backgroundColor:'#000',
+  color:'#ffffff66',
+  selectedColor:'#ffffff',
+  borderStyle:'white',
   list: [
     {
       pagePath: 'pages/clock/Clock',
-      text: '首页',
+      text: '生物钟',
     },
     {
       pagePath: 'pages/metric/Metric',
-      text: '第二页',
+      text: '指标',
     },
     {
       pagePath: 'pages/activity/Activity',
-      text: '第三页',
+      text: '运动',
     },
     {
       pagePath: 'pages/account/Profile',
-      text: '第四页',
+      text: '更多',
     }
   ]
 })

+ 37 - 29
src/components/input/LimitPickers.tsx

@@ -106,8 +106,8 @@ const Component = forwardRef((props: {
     }
 
     function onPickerChange(e) {
-        // console.log('picker change')
-        // console.log(e.detail.value)
+        setValues(e.detail.value)
+        /*
         var list = e.detail.value
 
         const date = new Date();
@@ -117,16 +117,11 @@ const Component = forwardRef((props: {
         const day = date.getDate();
 
         const time = `${year}-${expandZero(month)}-${expandZero(day)}T${expandZero(hours[list[1]])}:${expandZero(minutes[list[2]])}:00`;
-        // if (getTimestamp(time) > today.getTime()) {
-        //     setValues([list[0], today.getHours(), today.getMinutes()])
-        // }
         if (getTimestamp(time) > global.set_time) {
-            // console.log('oppsu')
             Taro.showToast({
                 icon: 'none',
                 title: t('feature.common.toast.min_value'),
             })
-            // console.log(list[0], (new Date(global.set_time)).getHours(), (new Date(global.set_time)).getMinutes())
             setValues([list[0], (new Date(global.set_time)).getHours(), (new Date(global.set_time)).getMinutes()])
             disableConfirm()
         }
@@ -144,10 +139,7 @@ const Component = forwardRef((props: {
             }
 
             setValues(e.detail.value)
-
-            //把picker变动时间存储起来
-            setPickerTime();
-        }
+        }*/
 
     }
 
@@ -158,17 +150,6 @@ const Component = forwardRef((props: {
         // setCount(count+1)
     }
 
-    function disableConfirm() {
-        setIsDisableConfirm(true)
-        setTimeout(() => {
-            setIsDisableConfirm(false)
-        }, 2000);
-    }
-
-    function expandZero(num: number): string {
-        return num < 10 ? `0${num}` : `${num}`;
-    }
-
     function cancel(e) {
         if (process.env.TARO_ENV == 'weapp') {
             e.stopPropagation()
@@ -180,10 +161,37 @@ const Component = forwardRef((props: {
         if (process.env.TARO_ENV == 'weapp') {
             e.stopPropagation()
         }
-        if (isDisableConfirm) {
-            return;
-        }
+        // if (isDisableConfirm) {
+        //     return;
+        // }
+        
         var date = new Date();
+        date.setDate(today.getDate() - ((props.limitDay ? props.limitDay - 1 : 6) - values[0]));
+        const year = date.getFullYear();
+        const month = date.getMonth() + 1;
+        const day = date.getDate();
+        const time = `${year}-${expandZero(month)}-${expandZero(day)}T${expandZero(hours[values[1]])}:${expandZero(minutes[values[2]])}:00`;
+        if (getTimestamp(time) > global.set_time) {
+            Taro.showToast({
+                icon: 'none',
+                title: t('feature.common.toast.min_value'),
+            })
+            setValues([values[0], (new Date(global.set_time)).getHours(), (new Date(global.set_time)).getMinutes()])
+            return
+        }
+        else {
+            var limitDate = new Date(props.limit)
+
+            if (getTimestamp(time) < props.limit) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: t('feature.common.toast.max_value'),
+                })
+                setValues([(props.limitDay ? props.limitDay - 1 : 6) - getDaysDiff(limitDate), limitDate.getHours(), limitDate.getMinutes()])
+                return
+            }
+        }
+
         if (!props.isRealTime) {
             date = new Date(global.set_time);
         }
@@ -194,10 +202,6 @@ const Component = forwardRef((props: {
         props.onChange(date.getTime())
     }
 
-    function setPickerTime() {
-
-    }
-
     function getConfirmData() {
         var date = new Date();
         if (!props.isRealTime) {
@@ -215,6 +219,10 @@ const Component = forwardRef((props: {
         getConfirmData: getConfirmData
     }));
 
+    function expandZero(num: number): string {
+        return num < 10 ? `0${num}` : `${num}`;
+    }
+
     function pickerDetail() {
         return <View style={{ display: 'flex', flexDirection: 'column' }}>
             <Text className='modal_title' style={{ color: color }}>{props.title ? props.title : '测试标题 '}</Text>

+ 276 - 0
src/components/input/LimitPickers_backup.tsx

@@ -0,0 +1,276 @@
+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";
+import { useTranslation } from "react-i18next";
+// 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'
+    var alpha = alphaToHex(0.4)
+    const [values, setValues] = useState([props.limitDay ? props.limitDay - 1 : 6, today.getHours(), today.getMinutes()])
+    const [isDisableConfirm, setIsDisableConfirm] = useState(false)
+    const [count,setCount] = useState(0)
+    const {t} = useTranslation()
+
+    function alphaToHex(alpha) {
+        var alphaValue = Math.round(alpha * 255); // 将透明度乘以255并四舍五入
+        var hexValue = alphaValue.toString(16); // 将整数转换为十六进制字符串
+        if (hexValue.length === 1) {
+            hexValue = "0" + hexValue; // 如果十六进制字符串只有一位,补零
+        }
+        return hexValue;
+    }
+
+    useEffect(() => {
+        global.picker_time = global.set_time
+        if (props.time) {
+            var date = new Date(props.time)
+            setValues([(props.limitDay ? props.limitDay - 1 : 6) - getDaysDiff(date), date.getHours(), date.getMinutes()])
+        }
+    }, [])
+    // useEffect(() => {
+    //     setValues([6, today.getHours(), today.getMinutes()])
+    // }, [props.limit])
+
+    useEffect(() => {
+        var date = new Date();
+        if (!props.isRealTime) {
+            date = new Date(global.set_time);
+        }
+
+        date.setDate(today.getDate() - ((props.limitDay ? props.limitDay - 1 : 6) - values[0]));
+        date.setHours(values[1])
+        date.setMinutes(values[2])
+        global.picker_time = date.getTime()
+    }, [values])
+
+
+    for (let i = props.limitDay ? props.limitDay - 1 : 6; i >= 0; i--) {
+        const date = new Date();
+        date.setDate(today.getDate() - i);
+
+        const month = date.getMonth() + 1;
+        const day = date.getDate();
+        const weekday = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][date.getDay()];
+
+        const formattedDate = `${month}月${day}日 ${weekday}`;
+        if (i == 0) {
+            days.push('今天 ');
+        }
+        else if (i == 1) {
+            days.push('昨天 ');
+        }
+        else {
+            days.push(formattedDate);
+        }
+
+    }
+
+    const hours: number[] = [];
+
+
+    for (let i = 0; i <= 23; i++) {
+        hours.push(i);
+    }
+
+    const minutes: number[] = [];
+    for (let i = 0; i <= 59; i++) {
+        minutes.push(i);
+    }
+
+
+
+    function getTimestamp(dateTimeString: string): number {
+        const timestamp = Date.parse(dateTimeString);
+        return timestamp;
+    }
+
+    function getDaysDiff(date: Date): number {
+        const today = new Date();
+        today.setHours(0, 0, 0, 0);
+
+        const targetDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+        targetDate.setHours(0, 0, 0, 0);
+
+        const timeDiff = today.getTime() - targetDate.getTime();
+        const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
+
+        return daysDiff;
+    }
+
+    function onPickerChange(e) {
+        // console.log('picker change')
+        // console.log(e.detail.value)
+        var list = e.detail.value
+
+        const date = new Date();
+        date.setDate(today.getDate() - ((props.limitDay ? props.limitDay - 1 : 6) - list[0]));
+        const year = date.getFullYear();
+        const month = date.getMonth() + 1;
+        const day = date.getDate();
+
+        const time = `${year}-${expandZero(month)}-${expandZero(day)}T${expandZero(hours[list[1]])}:${expandZero(minutes[list[2]])}:00`;
+        // if (getTimestamp(time) > today.getTime()) {
+        //     setValues([list[0], today.getHours(), today.getMinutes()])
+        // }
+        if (getTimestamp(time) > global.set_time) {
+            // console.log('oppsu')
+            Taro.showToast({
+                icon: 'none',
+                title: t('feature.common.toast.min_value'),
+            })
+            // console.log(list[0], (new Date(global.set_time)).getHours(), (new Date(global.set_time)).getMinutes())
+            setValues([list[0], (new Date(global.set_time)).getHours(), (new Date(global.set_time)).getMinutes()])
+            disableConfirm()
+        }
+        else {
+            var limitDate = new Date(props.limit)
+
+            if (getTimestamp(time) < props.limit) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: t('feature.common.toast.max_value'),
+                })
+                setValues([(props.limitDay ? props.limitDay - 1 : 6) - getDaysDiff(limitDate), limitDate.getHours(), limitDate.getMinutes()])
+                disableConfirm()
+                return
+            }
+
+            setValues(e.detail.value)
+
+            //把picker变动时间存储起来
+            setPickerTime();
+        }
+
+    }
+
+    function onPickerEnd(e){
+        // console.log(e)
+        // console.log(values)
+        // setValues(values)
+        // setCount(count+1)
+    }
+
+    function disableConfirm() {
+        setIsDisableConfirm(true)
+        setTimeout(() => {
+            setIsDisableConfirm(false)
+        }, 2000);
+    }
+
+    function expandZero(num: number): string {
+        return num < 10 ? `0${num}` : `${num}`;
+    }
+
+    function cancel(e) {
+        if (process.env.TARO_ENV == 'weapp') {
+            e.stopPropagation()
+        }
+        props.onCancel()
+    }
+
+    function confirm(e) {
+        if (process.env.TARO_ENV == 'weapp') {
+            e.stopPropagation()
+        }
+        if (isDisableConfirm) {
+            return;
+        }
+        var date = new Date();
+        if (!props.isRealTime) {
+            date = new Date(global.set_time);
+        }
+
+        date.setDate(today.getDate() - ((props.limitDay ? props.limitDay - 1 : 6) - values[0]));
+        date.setHours(values[1])
+        date.setMinutes(values[2])
+        props.onChange(date.getTime())
+    }
+
+    function setPickerTime() {
+
+    }
+
+    function getConfirmData() {
+        var date = new Date();
+        if (!props.isRealTime) {
+            date = new Date(global.set_time);
+        }
+
+
+        date.setDate(today.getDate() - ((props.limitDay ? props.limitDay - 1 : 6) - values[0]));
+        date.setHours(values[1])
+        date.setMinutes(values[2])
+        return date.getTime()
+    }
+
+    useImperativeHandle(ref, () => ({
+        getConfirmData: getConfirmData
+    }));
+
+    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}
+                    onPickEnd={onPickerEnd}
+                    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>
+        </View>
+    }
+
+    return pickerDetail()
+
+
+})
+
+export default React.memo(Component);;

+ 3 - 0
src/components/input/SlidngScale.scss

@@ -137,6 +137,7 @@
     height: 120px;
     width: 375px;
     background: linear-gradient(90deg, #1C1C1C 1%, rgba(28, 28, 28, 0) 100%);
+    z-index: 1;
 }
 
 .shadow_right {
@@ -147,6 +148,7 @@
     height: 120px;
     width: 375px;
     background: linear-gradient(90deg, rgba(28, 28, 28, 0) 1%, #1C1C1C 100%);
+    z-index: 1;
 }
 
 .shadow_top {
@@ -157,6 +159,7 @@
     right: 0;
     bottom: 0;
     background: linear-gradient(180deg, rgba(182, 225, 252, 0.1) 18%, rgba(28, 28, 28, 0) 100%);
+    z-index: 1;
 }
 
 /* #endif */

+ 38 - 28
src/components/input/SlidngScale.tsx

@@ -11,6 +11,8 @@ export default function Component(props: {
     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[] = [];
@@ -18,8 +20,10 @@ export default function Component(props: {
     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) {
+    const [left, setLeft] = useState((props.default_value - minNum) * slidngWidth / props.step + 1);
+    const [showScrollView, setShowScrollView] = useState(false)
+
+    for (var i: number = minNum; i <= maxNum; 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;
@@ -36,6 +40,9 @@ export default function Component(props: {
         // var  aa = current-props.min;
         // var bb = aa/props.step*slidngWidth;
         // setLeft(bb/ratio)
+        setTimeout(() => {
+            setShowScrollView(true)
+        }, 50)
     }, [])
 
     // const dpr = Taro.pxTransform//Taro.getSystemInfoSync().pixelRatio; 
@@ -45,13 +52,13 @@ export default function Component(props: {
         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;
+        var strValue = (minNum + Math.round(count) * props.step).toFixed(1);
+        if ((strValue as any) < minNum) {
+            strValue = minNum as any;
         }
 
-        if ((strValue as any) > props.max) {
-            strValue = props.max as any;
+        if ((strValue as any) > maxNum) {
+            strValue = maxNum as any;
         }
 
         if (parseFloat(strValue) != current) {
@@ -74,7 +81,7 @@ export default function Component(props: {
         }
     };
 
-    const scrollEnd = (e)=>{
+    const scrollEnd = (e) => {
         const { scrollLeft } = e.detail;
         setLeft(scrollLeft)
     }
@@ -86,29 +93,32 @@ export default function Component(props: {
         </View>
 
         <View className="scroll_bg">
-            <View className="top_line" style={{ backgroundColor: props.themeColor }} />
-            <ScrollView ref={scrollViewRef} scrollX enhanced scrollLeft={left} className="scroll"  onScroll={handleScroll} onDragEnd={scrollEnd}>
-                <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: 2, marginRight: 8, backgroundColor: props.themeColor }} key={index}>
-                                    {
-                                        item.showBig ? <Text className="slidng_text">{item.value}</Text> : null
-                                    }
-                                </View>
-                            })
-                        }
-                    </View>
-                    {/* <View className="demo2"/> */}
-                    <View className="scrollPadding" />
-                </View>
-
-            </ScrollView>
             <View className="shadow_top" />
             <View className="shadow_left" />
             <View className="shadow_right" />
+            {showScrollView && <View className="top_line" style={{ backgroundColor: props.themeColor }} />}
+            {
+                showScrollView && <ScrollView style={{ zIndex: 0 }} ref={scrollViewRef} scrollX enhanced scrollLeft={left} className="scroll" onScroll={handleScroll} onDragEnd={scrollEnd}>
+                    <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: 2, marginRight: 8, backgroundColor: props.themeColor }} key={index}>
+                                        {
+                                            item.showBig ? <Text className="slidng_text">{item.value}</Text> : null
+                                        }
+                                    </View>
+                                })
+                            }
+                        </View>
+                        {/* <View className="demo2"/> */}
+                        <View className="scrollPadding" />
+                    </View>
+
+                </ScrollView>
+            }
+
             <Image className="center_line" src={require('@assets/images/scale_center.png')} />
             {/* <View className="center_line" /> */}
         </View>

+ 0 - 45
src/custom-tab-bar2/index.js

@@ -1,45 +0,0 @@
-const app = getApp()
-Component({
-  data: {
-    selected: null,
-    selectedColor: "#ffffff",
-    list: [{
-      title:'Clock',
-      pagePath: "/pages/clock/Clock"
-    }, {
-      title:'Metric',
-      pagePath: "/pages/metric/Metric"
-    }, {
-      title:'Activity',
-      pagePath: "/pages/activity/Activity"
-    }, {
-      title:'Profile',
-      pagePath: "/pages/account/Profile"
-    }]
-  },
-  attached() {
-    global.tabBar = this
-  },
-  methods: {
-    update(index){
-      this.setData({
-        selected:-1
-      })
-      this.setData({
-        selected: index
-      })
-
-    },
-    switchTab(e) {
-      const data = e.currentTarget.dataset
-      this.setData({
-        selected:data.index
-      })
-      const url = data.path
-      wx.switchTab({url})
-      // this.setData({
-      //   selected: null//data.index
-      // })
-    }
-  }
-})

+ 0 - 3
src/custom-tab-bar2/index.json

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

+ 0 - 0
src/custom-tab-bar/index.scss → src/custom-tab-bar2/index.scss


+ 0 - 4
src/custom-tab-bar/index.tsx → src/custom-tab-bar2/index.tsx

@@ -23,10 +23,6 @@ export default function TabBar() {
         setSelIndex(common.pageIndex)
     },[common.pageIndex])
 
-    global.updateTab = (index)=>{
-        // setSelIndex(index)
-    }
-
     function switchTab(index: number) {
         // console.log(index,common.showTabbar)
         if (!common.showTabbar){

+ 0 - 8
src/custom-tab-bar2/index.wxml

@@ -1,8 +0,0 @@
-<!--miniprogram/custom-tab-bar/index.wxml-->
-<view class="tab-bar">
-  <!-- <view class="tab-bar-border" wx:if="{{selected==1}}"></view> -->
-  <view wx:for="{{list}}" wx:key="index" class="{{index==selected?'item-sel item':'item'}}" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
-    <!-- <image class="icon" src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image> -->
-    <text >{{item.title}}</text>
-  </view>
-</view>

+ 0 - 66
src/custom-tab-bar2/index.wxss

@@ -1,66 +0,0 @@
-.tab-bar {
-  position: fixed;
-  bottom: 0;
-  left: 0;
-  right: 0;
-  height: 104px;
-  /* background: #000D1FD9; */
-  /* backdrop-filter: blur(10px); */
-  background: #000;
-  display: flex;
-  padding-bottom: env(safe-area-inset-bottom);
-  border-top-color: rgba(255, 255, 255, 0.2);
-  border-top-width: 1px;
-  border-top-style: solid;
-  z-index: 100;
-}
-
-.tab-bar-border {
-  background-color: rgba(255, 255, 255, 0.05);
-  position: absolute;
-  left: 0;
-  top: 0;
-  width: 750rpx;
-  height: 1px;
-  /* transform: scaleY(0.5); */
-}
-
-.tab-bar-item {
-  flex: 1;
-  text-align: center;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  flex-direction: column;
-}
-
-/* .tab-bar-item cover-image {
-  width: 27px;
-  height: 27px;
-} */
-
-.tab-bar-item cover-view {
-  font-size: 10px;
-}
-
-.icon {
-  width: 128rpx;
-  height: 80rpx;
-  /* background-color: pink; */
-}
-
-.item {
-  /* color: rgba($color: #ffffff, $alpha: 0.4); */
-  color: rgba(255, 255, 255, 0.4);
-  font-size: 36px;
-  padding-top: 25px;
-  display: flex;
-  flex: 1;
-  align-items: center;
-  justify-content: center;
-}
-
-.item-sel {
-  color: #ffffff;
-  font-size: 40px;
-}

+ 20 - 10
src/features/trackSomething/components/Metric.tsx

@@ -46,6 +46,8 @@ export default function Component(props: any) {
     const [orignalGroups, setOrignalGroups] = useState([])
     const [limits, setLimits] = useState(null)
     const [orders, setOrders] = useState([])
+    const [newOrders,setNewOrders] = useState([])
+    const [resultOrders,setResultOrders] = useState([])
     const [tempMetricItem, setTempMetricItem] = useState(null)
     const dispatch = useDispatch();
     let navigation;
@@ -92,10 +94,12 @@ export default function Component(props: any) {
             (res as any).cards.map(item => {
                 list.push({
                     name: item.name,
-                    code: item.code
+                    code: item.code,
+                    is_following:true
                 })
             })
             setOrders(list)
+            setResultOrders(list)
 
         }).catch(e => {
             Taro.stopPullDownRefresh()
@@ -239,7 +243,6 @@ export default function Component(props: any) {
     }
 
     function metricModalContent() {
-        debugger
         switch (modalType) {
             case MetricModalType.choose:
                 return <MetricModalChoose
@@ -248,6 +251,7 @@ export default function Component(props: any) {
                     confirm={modalConfirm}
                     array={groups}
                     orders={orders}
+                    newOrders={newOrders}
                     limit={limits}
                 />
             case MetricModalType.order:
@@ -255,7 +259,7 @@ export default function Component(props: any) {
                     themeColor={themeColor}
                     cancel={modalOrderCancel}
                     confirm={modalOrderConfirm}
-                    array={orders} />
+                    array={resultOrders} />
             case MetricModalType.add:
                 return <MetricModalAdd
                     item={tempMetricItem ? tempMetricItem : metricItem}
@@ -295,8 +299,11 @@ export default function Component(props: any) {
         onPageContainerCancel()
     }
 
-    function modalConfirm(datas) {
+    function modalConfirm(datas,newOrders,resultOrders,groups) {
         setOrders(datas)
+        setGroups(groups)
+        setNewOrders(newOrders)
+        setResultOrders(resultOrders)
         setModalType(MetricModalType.order)
     }
 
@@ -316,10 +323,10 @@ export default function Component(props: any) {
             array.push(item.code)
         })
         metricFollows({ codes: array }).then(res => {
-            // getCards()
-            // getGroups()
+            getCards()
+            getGroups()
             setList((res as any).cards)
-            setOrignalGroups(groups)
+            // setOrignalGroups(groups)
         })
         setShowPageContainer(false)
     }
@@ -378,15 +385,18 @@ export default function Component(props: any) {
 
     function onPageContainerCancel() {
         if (modalType == MetricModalType.choose || modalType == MetricModalType.order) {
+            debugger
             var array: any = [];
             list.map(item => {
                 array.push({
                     name: (item as any).name,
-                    code: (item as any).code
+                    code: (item as any).code,
+                    is_following:true
                 })
             })
             // debugger
             setOrders(array)
+            setNewOrders([])
             setGroups(JSON.parse(JSON.stringify(orignalGroups)))
             // setGroups(orignalGroups)
         }
@@ -411,8 +421,8 @@ export default function Component(props: any) {
             show={showPageContainer} round={true} overlay={true} position='bottom'
             onClickOverlay={onPageContainerCancel}
             onAfterLeave={() => { setShowPageContainer(false); setModalType(MetricModalType.none) }}
-            onBeforeEnter={() => { dispatch(setTabbarStatus(false)) }}
-            onBeforeLeave={() => { dispatch(setTabbarStatus(true)) }}
+            onBeforeEnter={() => { dispatch(setTabbarStatus(false));Taro.hideTabBar() }}
+            onBeforeLeave={() => { dispatch(setTabbarStatus(true));Taro.showTabBar() }}
         >
             {
                 metricModalContent()

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

@@ -59,7 +59,7 @@
     height: 80px;
     border-bottom-color: #121212;
     border-bottom-style: solid;
-    border-bottom-width: 1px;
+    border-bottom-width: 2px;
     align-items: center;
 }
 

+ 77 - 44
src/features/trackSomething/components/MetricModalChoose.tsx

@@ -6,67 +6,94 @@ import { useEffect, useState } from 'react'
 import { IconRadio, IconRadioCheck } from '@/components/basic/Icons'
 import Taro from '@tarojs/taro'
 
-export default function Component(props: { themeColor: string, cancel: Function, confirm: Function, array: any, limit: any, orders: any }) {
+export default function Component(props: {
+    themeColor: string, cancel: Function, confirm: Function, array: any, limit: any,
+    orders: any, newOrders: any
+}) {
+    debugger
     const color = props.themeColor ? props.themeColor : '#ff0000'
     const [list, setList] = useState(props.array)
-    const [orderList, setOrderList] = useState(props.orders)
+    const [oldList, setOldList] = useState(props.orders)
+    const [newList, setNewList] = useState(props.newOrders)
     const min = props.limit.min
     const max = props.limit.max
     const { t } = useTranslation()
     var alpha = alphaToHex(0.4)
 
-    useEffect(()=>{
-        setList(props.array)
-        setOrderList(props.orders)
-    },[props.array,props.orders])
-
     function cancel() {
         props.cancel()
     }
 
     function confirm() {
-        // var datas: any = []
-        // list.map(item => {
-        //     item.items.map(data => {
-        //         if (data.is_following) {
-        //             datas.push(data as any)
-        //         }
-        //     })
-        // })
-
-        if (min > orderList.length) {
-            Taro.showToast({
-                icon: 'none',
-                title: t('feature.common.toast.min_value'),
-            })
-            return
+        // props.confirm(orderList)
+        var array: any = []
+        for (var i = 0; i < oldList.length; i++) {
+            if (oldList[i].is_following) {
+                array.push(oldList[i])
+            }
         }
-        if (max < orderList.length) {
-            Taro.showToast({
-                icon: 'none',
-                title: t('feature.common.toast.max_value'),
-            })
-            return
+        for (var i = 0; i < newList.length; i++) {
+            array.push(newList[i])
         }
-
-        props.confirm(orderList)
+        console.log(oldList,newList,array)
+        debugger
+        props.confirm(oldList,newList,array,list)
     }
 
     function tapItem(obj) {
         var check = !obj.is_following
+        var count = 0;
+        oldList.map(item => {
+            if (item.is_following) {
+                count++;
+            }
+        })
+        newList.map(item => {
+            if (item.is_following) {
+                count++;
+            }
+        })
+
         if (check) {
-            orderList.push({
-                name: obj.name,
-                code: obj.code
-            })
+            if (max == count) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: t('feature.common.toast.max_value'),
+                })
+                return
+            }
         }
         else {
-            for (var i = 0; i < orderList.length; i++) {
-                if (orderList[i].code == obj.code) {
-                    orderList.splice(i, 1)
+            if (min == count) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: t('feature.common.toast.min_value'),
+                })
+                return
+            }
+        }
+
+        var isFind = false;
+        oldList.map(item => {
+            if (obj.code == item.code) {
+                isFind = true;
+                item.is_following = check
+            }
+            return item
+        })
+        if (!isFind) {
+            if (check) {
+                obj.is_following = true
+                newList.push(obj)
+            } else {
+                for (var i = 0; i < newList.length; i++) {
+                    if (newList[i].code == obj.code) {
+                        newList.splice(i, 1)
+                    }
                 }
             }
         }
+
         for (var i = 0; i < list.length; i++) {
             for (var j = 0; j < list[i].items.length; j++) {
                 var temp = list[i].items[j]
@@ -77,13 +104,19 @@ export default function Component(props: { themeColor: string, cancel: Function,
         }
 
         setList(JSON.parse(JSON.stringify(list)))
-        setOrderList(JSON.parse(JSON.stringify(orderList)))
+        setOldList(JSON.parse(JSON.stringify(oldList)))
+        setNewList(JSON.parse(JSON.stringify(newList)))
     }
 
-    function codeIndex(code){
-        for (var i=0;i<orderList.length;i++){
-            if (orderList[i].code == code){
-                return i+1;
+    function codeIndex(code) {
+        for (var i = 0; i < oldList.length; i++) {
+            if (oldList[i].code == code) {
+                return i + 1;
+            }
+        }
+        for (var i = 0; i < oldList.length; i++) {
+            if (newList[i].code == code) {
+                return i + 1 + oldList.length;
             }
         }
         return ''
@@ -109,8 +142,8 @@ export default function Component(props: { themeColor: string, cancel: Function,
                                         }
 
                                         <Text className='modal_item_text' style={{ color: color, marginLeft: 10 }}>{obj.name}</Text>
-                                        <View style={{flex:1}}/>
-                                        <Text>{obj.is_following?'序号:'+codeIndex(obj.code):''}</Text>
+                                        <View style={{ flex: 1 }} />
+                                        <Text>{obj.is_following ? '序号:' + codeIndex(obj.code) : ''}</Text>
                                     </View>
                                 })
                             }

+ 129 - 0
src/features/trackSomething/components/MetricModalChoose_backup.tsx

@@ -0,0 +1,129 @@
+import { View, Text, ScrollView } from '@tarojs/components'
+import './MetricModalChoose.scss'
+import { alphaToHex } from '@/utils/tools'
+import { useTranslation } from 'react-i18next'
+import { useEffect, useState } from 'react'
+import { IconRadio, IconRadioCheck } from '@/components/basic/Icons'
+import Taro from '@tarojs/taro'
+
+export default function Component(props: { themeColor: string, cancel: Function, confirm: Function, array: any, limit: any, orders: any }) {
+    const color = props.themeColor ? props.themeColor : '#ff0000'
+    const [list, setList] = useState(props.array)
+    const [orderList, setOrderList] = useState(props.orders)
+    const min = props.limit.min
+    const max = props.limit.max
+    const { t } = useTranslation()
+    var alpha = alphaToHex(0.4)
+
+    useEffect(()=>{
+        setList(props.array)
+        setOrderList(props.orders)
+    },[props.array,props.orders])
+
+    function cancel() {
+        props.cancel()
+    }
+
+    function confirm() {
+        props.confirm(orderList)
+    }
+
+    function tapItem(obj) {
+        var check = !obj.is_following
+
+        if (check){
+            if (max == orderList.length) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: t('feature.common.toast.max_value'),
+                })
+                return
+            }
+        }
+        else {
+            if (min==orderList.length){
+                Taro.showToast({
+                    icon: 'none',
+                    title: t('feature.common.toast.min_value'),
+                })
+                return
+            }
+        }
+        if (check) {
+            orderList.push({
+                name: obj.name,
+                code: obj.code
+            })
+        }
+        else {
+            for (var i = 0; i < orderList.length; i++) {
+                if (orderList[i].code == obj.code) {
+                    orderList.splice(i, 1)
+                }
+            }
+        }
+        for (var i = 0; i < list.length; i++) {
+            for (var j = 0; j < list[i].items.length; j++) {
+                var temp = list[i].items[j]
+                if (obj.code == temp.code) {
+                    temp.is_following = check
+                }
+            }
+        }
+
+        setList(JSON.parse(JSON.stringify(list)))
+        setOrderList(JSON.parse(JSON.stringify(orderList)))
+    }
+
+    function codeIndex(code){
+        for (var i=0;i<orderList.length;i++){
+            if (orderList[i].code == code){
+                return i+1;
+            }
+        }
+        return ''
+    }
+
+
+    return <View className='modal_content'>
+        <View className='modal_title_view'>
+            <Text className='modal_title1'>{t('feature.track_something.metric.choose_metric')}</Text>
+            <Text className='modal_subtitle'>按需选择自己常用的指标</Text>
+        </View>
+        <ScrollView className='modal_detail' scrollY>
+            <View>
+                {
+                    list.map((item, index) => {
+                        return <View className='modal_group' key={index}>
+                            <Text className='modal_group_title'>{item.name}</Text>
+                            {
+                                item.items.map((obj, i) => {
+                                    return <View className='modal_item' onClick={() => tapItem(obj)}>
+                                        {
+                                            obj.is_following ? <IconRadioCheck width={16} color='#fff' /> : <IconRadio width={16} color='#fff' />
+                                        }
+
+                                        <Text className='modal_item_text' style={{ color: color, marginLeft: 10 }}>{obj.name}</Text>
+                                        <View style={{flex:1}}/>
+                                        <Text>{obj.is_following?'序号:'+codeIndex(obj.code):''}</Text>
+                                    </View>
+                                })
+                            }
+                        </View>
+                    })
+                }
+            </View>
+        </ScrollView>
+        <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>
+}

+ 2 - 2
src/features/trackSomething/components/MoveOrderList.scss

@@ -23,7 +23,7 @@
     align-items: center;
     justify-content: space-between;
     // background-color: pink;
-    border-bottom: solid 1px #999;
+    border-bottom: solid 2px #1c1c1c;
     margin-left: 46px;
     margin-right: 46px;
     box-sizing: border-box;
@@ -36,7 +36,7 @@
     align-items: center;
     justify-content: space-between;
     // background-color: pink;
-    border-bottom: solid 1px #999;
+    border-bottom: solid 2px #1c1c1c;
     margin-left: 26px;
     margin-right: 26px;
 }

+ 2 - 1
src/features/trackSomething/components/MoveOrderList.tsx

@@ -175,7 +175,8 @@ export default function Component(props: { array: any, itemHeight: number, color
         }
     }
 
-    return <View id="myScrollView" ref={ref} style={{ maxHeight: 400, overflow: 'scroll' }} catchMove>
+    console.log(list)
+    return <View id="myScrollView" ref={ref} style={{height:'100%',  overflow: canScroll?'scroll':'hidden' }} catchMove>
         <MovableArea style={{ height: list.length * props.itemHeight, width: '100vw' }}>
             {list.map((item, index) => {
                 return <View style={{ opacity: changedIndex == index && hiddenContent ? 0 : 1, height: props.itemHeight, width: '100vw' }}

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

@@ -569,13 +569,6 @@ export default function Component(props: { isNextStep?: boolean }) {
                     }
                 </View>
             </View>
-            <PageContainer 
-                // overlayStyle='background:transparent'
-                show={showPageContainer} round={true} overlay={true} position='bottom' onAfterLeave={() => setShowPageContainer(false)}>
-                {
-                    pageContainerDetail()
-                }
-            </PageContainer>
         </Box>
     )
 }

+ 1 - 1
src/pages/account/Profile.tsx

@@ -51,7 +51,7 @@ export default function Page() {
     }
 
     useDidShow(() => {
-        global.updateTab(3)
+        // global.updateTab(3)
     })
 
     function reset() {

+ 1 - 1
src/pages/activity/Activity.tsx

@@ -22,7 +22,7 @@ export default function Page() {
       }
 
     useDidShow(() => {
-        global.updateTab(2)
+        // global.updateTab(2)
     })
 
     function refresh() {

+ 1 - 1
src/pages/clock/Clock.rn.tsx

@@ -209,7 +209,7 @@ export default function IndexPage() {
 
     useDidShow(() => {
         if (process.env.TARO_ENV == 'weapp') {
-            global.updateTab(0)
+            // global.updateTab(0)
             if (user.isLogin) {
                 checkWXPubFollow()
             }

+ 5 - 3
src/pages/clock/Clock.weapp.tsx

@@ -236,7 +236,7 @@ export default function IndexPage() {
   })
 
   useDidShow(() => {
-    global.updateTab(0)
+    // global.updateTab(0)
     if (user.isLogin) {
       checkWXPubFollow()
       // getCheckData();
@@ -500,10 +500,12 @@ export default function IndexPage() {
           custom-style='background-color:#1c1c1c'
           closeOnSlideDown={false}
           onBeforeEnter={()=>{
-            dispatch(setTabbarStatus(false))
+            dispatch(setTabbarStatus(false));
+            Taro.hideTabBar();
           }}
           onBeforeLeave={()=>{
-            dispatch(setTabbarStatus(true))
+            dispatch(setTabbarStatus(true));
+            Taro.showTabBar();
           }}
           onAfterLeave={() => { setShowModal(false); setShowModal2(false) }}
           show={showModal || showModal2} round={true} overlay={true} position='bottom'

+ 0 - 3
src/pages/metric/Metric.tsx

@@ -13,9 +13,6 @@ export default function Page() {
             }
         })
     }
-    useDidShow(() => {
-        global.updateTab(1)
-    })
 
     usePullDownRefresh(() => {