Leon há 2 anos atrás
pai
commit
efa34d2424

+ 4 - 0
src/app.scss

@@ -92,4 +92,8 @@ page {
 .btn_space {
 
     width: 90px;
+}
+
+wx-scroll-view {
+    -webkit-overflow-scrolling: auto !important;
 }

+ 13 - 1
src/components/basic/Buttons.tsx

@@ -39,14 +39,26 @@ export default function Buttons(props: {
     if (props.type == ButtonType.outline) {
         mainClass = 'outlined'
         textClass = 'outlined_text'
+
+        return (
+            <View className={mainClass} style={{ ...props.btnStyle,opacity:props.lowLight?0.4:1 }}>
+                <Text
+                    onClick={onClick}
+                    style={{
+                        color: props.btnStyle.color,
+                        fontSize: props.btnStyle.fontSize
+                    }}>{props.title}</Text>
+            </View>
+        )
     }
     else {
         mainClass = 'puretext'
         textClass = 'puretext_text'
     }
     return (
-        <View className={mainClass} style={{...props.btnStyle}}>
+        <View className={mainClass} style={{ ...props.btnStyle }}>
             <Text
+                onClick={onClick}
                 style={{
                     color: props.btnStyle.color,
                     fontSize: props.btnStyle.fontSize

+ 2 - 1
src/components/layout/Box.scss

@@ -6,7 +6,8 @@
     margin-right: 46px;
     display: flex;
     flex-direction: column;
-    position: relative;
+    margin-bottom: 20px;
+    // position: relative;
 }
 
 .box-title{

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

@@ -1,11 +1,20 @@
-
-.layout_container{
+.layout_container {
     display: flex;
     flex: 1;
     height: 100vh;
     flex-direction: column;
+    -webkit-overflow-scrolling: auto !important;
+}
+
+.layout_container::-webkit-scrollbar {
+    width: 0;
+    height: 0;
+    color: transparent;
+    display: none;
 }
-.layout_title{
+
+.layout_title {
+    flex-shrink: 0;
     color: #fff;
     margin-left: 46px;
     font-size: 72px;
@@ -15,7 +24,15 @@
     font-weight: 500;
 }
 
-.grid_bg{
+.grid_bg {
     margin-left: 46px;
     margin-right: 46px;
 }
+
+.scroll .wx-scroll-view {
+    -webkit-overflow-scrolling: auto !important;
+}
+
+.wx-scroll-view {
+    -webkit-overflow-scrolling: auto !important;
+}

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

@@ -41,13 +41,14 @@ export default function Layout(props: {
     switch (type) {
         case TemplateType.list:
             return <ScrollView className="layout_container"
+                style={{WebkitOverflowScrolling:'auto'}}
                 onScroll={onScroll}
                 scrollY refresherEnabled={true}
                 refresherThreshold={100} refresherBackground="#000"
                 refresherDefaultStyle="white"
                 onRefresherRefresh={() => { props.refresh!() }}
                 upperThreshold={50}
-                onScrollToLower={() => { props.more!() }}
+                onScrollToLower={() => { props.more!()}}
                 refresherTriggered={triggered}>
                 {
                     props.title && <Text className='layout_title'>{props.title}</Text>
@@ -58,6 +59,7 @@ export default function Layout(props: {
             return <ScrollView className="layout_container"
                 enableFlex={true}
                 onScroll={onScroll}
+                style={{WebkitOverflowScrolling:'auto'}}
                 scrollY refresherEnabled={true}
                 refresherThreshold={100} refresherBackground="#000"
                 refresherDefaultStyle="white"

+ 39 - 0
src/custom-tab-bar/index.js

@@ -0,0 +1,39 @@
+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){
+      console.log(index)
+      this.setData({
+        selected: index
+      })
+    },
+    switchTab(e) {
+      const data = e.currentTarget.dataset
+      const url = data.path
+      wx.switchTab({url})
+      // this.setData({
+      //   selected: null//data.index
+      // })
+    }
+  }
+})

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

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

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

@@ -0,0 +1,8 @@
+<!--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>

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

@@ -0,0 +1,66 @@
+.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;
+}

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


+ 2 - 1
src/custom-tab-bar/index.tsx → src/custom-tab-bar1/index.tsx

@@ -10,8 +10,9 @@ export default function TabBar() {
 
     const pages = Taro.getCurrentPages();
     const currentPage = pages[0];
-
+    console.log(currentPage)
     useEffect(() => {
+        console.log(global.index+'aaaa')
         setSelIndex(global.index?global.index:0)
       }, [global.index])
 

+ 0 - 0
src/features/common/DurationPicker.tsx


+ 69 - 0
src/features/common/SpecBtns.tsx

@@ -21,4 +21,73 @@ export const StartFastBtn = (props: { onClick: Function }) => {
             }}
         />
     )
+}
+
+export const StartSleepBtn = (props: { onClick: Function }) => {
+    return (
+        <Buttons title="开始睡眠" type={ButtonType.elevated}
+            onClick={() => { props.onClick() }}
+            btnStyle={{
+                height: 50, 
+                borderRadius: 25,
+                backgroundColor: '#00FFFF',
+                paddingLeft: 40,
+                paddingRight: 40,
+                color:'black',
+                fontSize:20,
+                display:'flex',
+                alignItems:'center',
+                justifyContent:'center',
+                // lineHeight:20
+            }}
+        />
+    )
+}
+
+export const EndSleepBtn = (props: { onClick: Function,lowLight?:boolean }) => {
+    return (
+        <Buttons title="结束睡眠" type={ButtonType.outline}
+            onClick={() => { props.onClick() }}
+            lowLight={props.lowLight?props.lowLight:false}
+            btnStyle={{
+                height: 50, 
+                borderRadius: 25,
+                borderColor: '#00FFFF',
+                borderWidth:1,
+                borderStyle:'solid',
+                paddingLeft: 40,
+                paddingRight: 40,
+                color:'#00FFFF',
+                fontSize:20,
+                display:'flex',
+                alignItems:'center',
+                justifyContent:'center',
+                // lineHeight:20
+            }}
+        />
+    )
+}
+
+export const EndFastBtn = (props: { onClick: Function,lowLight?:boolean }) => {
+    return (
+        <Buttons title="结束断食" type={ButtonType.outline}
+            onClick={() => { props.onClick() }}
+            lowLight={props.lowLight?props.lowLight:false}
+            btnStyle={{
+                height: 50, 
+                borderRadius: 25,
+                borderColor: '#AAFF00',
+                borderWidth:1,
+                borderStyle:'solid',
+                paddingLeft: 40,
+                paddingRight: 40,
+                color:'#AAFF00',
+                fontSize:20,
+                display:'flex',
+                alignItems:'center',
+                justifyContent:'center',
+                // lineHeight:20
+            }}
+        />
+    )
 }

+ 0 - 0
src/features/common/TimePicker.tsx


+ 8 - 3
src/features/trackSomething/components/ActivityHistory.tsx

@@ -3,12 +3,14 @@ import './MetricHistory.scss'
 import RecordItem from "@/features/common/RecordItem";
 import { deleteActivityRecord } from "@/services/trackSomething";
 import { useEffect, useState } from "react";
+import { useSelector } from "react-redux";
 
 export default function Component(props: { records: any[] }) {
+    const user = useSelector((state: any) => state.user);
     const [list, setList] = useState(props.records)
-    useEffect(()=>{
+    useEffect(() => {
         setList(props.records)
-    },[props.records])
+    }, [props.records])
     function formateDate(date: string) {
         //yyyyMMdd转换成日期,如果是今天,返回今天,如果是昨天,返回昨天,如果是昨天之前,返回日期
         const dt = new Date(date.substring(0, 4) + '/' +
@@ -51,6 +53,9 @@ export default function Component(props: { records: any[] }) {
     }
 
     return <View style={{ display: 'flex', flexDirection: 'column' }}>
+        {
+            user.test_user && <Text style={{ color: '#fff', position: 'absolute', right: 50, top: 0 }} onClick={()=>global.clearHistory()}>删除全部</Text>
+        }
         {/* <View className="operate_view">
             <Text>时间倒序</Text>
             <Text style={{ marginLeft: 5, marginRight: 5 }}> | </Text>
@@ -63,7 +68,7 @@ export default function Component(props: { records: any[] }) {
                     <Text className="operate_day">{formateDate(item.date + '')}</Text>
                     {
                         item.records.map(record => {
-                            return <RecordItem delete={()=>deleteRecord(record)}>
+                            return <RecordItem delete={() => deleteRecord(record)}>
                                 <View className="operate_item">
                                     <View className="status_bg">
                                         <Text className="status_text">{record.type == 'total' ? '总计' : record.type == 'sync' ? '同步' : '打卡'}</Text>

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

@@ -3,8 +3,10 @@ import './MetricHistory.scss'
 import RecordItem from "@/features/common/RecordItem";
 import { deleteMetricRecord } from "@/services/trackSomething";
 import { useEffect, useState } from "react";
+import { useSelector } from "react-redux";
 
 export default function Component(props: { records: any[] }) {
+    const user = useSelector((state: any) => state.user);
     const [list, setList] = useState(props.records)
     useEffect(()=>{
         setList(props.records)
@@ -55,6 +57,9 @@ export default function Component(props: { records: any[] }) {
     }
 
     return <View style={{ display: 'flex', flexDirection: 'column' }}>
+        {
+            user.test_user && <Text style={{ color: '#fff', position: 'absolute', right: 50, top: 0 }} onClick={()=>global.clearHistory()}>删除全部</Text>
+        }
         {/* <View className="operate_view">
             <Text>时间倒序</Text>
             <View style={{ marginLeft: 5, marginRight: 5, display: 'flex', height: '100%' }}>
@@ -68,6 +73,7 @@ export default function Component(props: { records: any[] }) {
                     <Text className="operate_day">{formateDate(item.date + '')}</Text>
                     {
                         item.records.map(record => {
+                            debugger
                             return <RecordItem delete={() => deleteRecord(record)}>
                                 <View className="operate_item">
                                     <View className="status_bg">

+ 23 - 20
src/features/trackTimeDuration/components/Console.tsx

@@ -12,7 +12,7 @@ import { durationDatas, durationIndex, pickerDurations } from "../hooks/Console"
 import PickerViews from "@/components/input/PickerViews";
 import Modal from "@/components/layout/Modal";
 import Stepper from "@/components/input/Stepper";
-import { StartFastBtn } from "@/features/common/SpecBtns";
+import { EndFastBtn, EndSleepBtn, StartFastBtn, StartSleepBtn } from "@/features/common/SpecBtns";
 
 export default function Component() {
     const scenario = useSelector((state: any) => state.scenario);
@@ -137,6 +137,9 @@ export default function Component() {
     }
 
     function testLayout() {
+        if (!user.test_user) {
+            return <View />
+        }
         var current_record = machine.context.checkData ? (machine.context.checkData as any).current_record : null;
         if (current_record == null) {
             return <View />
@@ -150,7 +153,7 @@ export default function Component() {
             case 'WAIT_FOR_START':
             case 'ONGOING':
                 {
-                    isFast = (scenario.name == 'FAST'||scenario.name == 'FAST_SLEEP')
+                    isFast = (scenario.name == 'FAST' || scenario.name == 'FAST_SLEEP')
                 }
                 break;
             case 'ONGOING1':
@@ -186,37 +189,34 @@ export default function Component() {
         </View>
     }
 
-    
+
     function layoutContent() {
         var limit = global.set_time - 7 * 3600 * 1000 * 24;
         global.limit = limit
         var current_record = machine.context.checkData ? (machine.context.checkData as any).current_record : null;
-        if (current_record && current_record.last_real_check_time){
+        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()){
+            if (new Date(global.set_time).getSeconds() <= new Date(current_record.last_real_check_time).getSeconds()) {
                 limit = limit + 60 * 1000
             }
         }
-            
-        
+
+
         return <LimitPickers ref={limitPickerRef} limit={limit} limitDay={8} onCancel={hidePicker} onChange={(e) => {
-            console.log(new Date(e))
             pickerConfirm(e)
             hidePicker()
         }} />
     }
 
     function pickerConfirm(t: number) {
-        console.log(t)
         var date = new Date(t)
         var setDate = new Date(global.set_time);
         date.setMilliseconds(setDate.getMilliseconds());
         date.setSeconds(setDate.getSeconds());
 
         t = date.getTime();
-        console.log(t);
 
         if (isFast) {
             if (value == 'WAIT_FOR_START') {
@@ -239,37 +239,40 @@ export default function Component() {
     }
 
     function mixedBtns() {
-        return <View style={{display:'flex'}}>
+        var checkData = machine.context.checkData;
+        var current = (checkData as any).current_record
+        return <View style={{ display: 'flex', marginTop: 22 }}>
             {
                 (value == 'WAIT_FOR_START' || value == 'DONE') &&
                 <StartFastBtn onClick={showPicker} />
                 // <Text style={{ color: '#AAFF00' }} onClick={showPicker}>Start Fast</Text>
             }
             {
-                (value == 'ONGOING'/* ||value == 'ONGOING1' || value == 'ONGOING2'*/ || value == 'ONGOING3') &&
-                <Text style={{ color: '#AAFF00' }} onClick={showPicker}>End Fast</Text>
+                (value == 'ONGOING' || value == 'ONGOING3') &&
+                <EndFastBtn onClick={showPicker} lowLight={current.fast.target_end_time > new Date().getTime()} />
             }
             {
-                value == 'ONGOING1' && <Text style={{ color: '#00ffff' }} onClick={showPicker}>Start Sleep</Text>
+                value == 'ONGOING1' && <StartSleepBtn onClick={showPicker} />
             }
             {
-                value == 'ONGOING2' && <Text style={{ color: '#00ffff' }} onClick={showPicker}>End Sleep</Text>
+                value == 'ONGOING2' && <EndSleepBtn onClick={showPicker} lowLight={current.sleep.target_end_time > new Date().getTime()}/>
 
             }
         </View>
     }
 
     function fastBtns() {
-        return <View>
-            <Text style={{ color: '#AAFF00' }} onClick={showPicker}>{value == 'ONGOING' ? 'End Fast' : 'Start Fast'}</Text>
+        return <View style={{ display: 'flex', marginTop: 22 }}>
+            {
+                value == 'ONGOING' ? <EndSleepBtn onClick={showPicker} /> : <StartFastBtn onClick={showPicker} />
+            }
         </View>
     }
 
     function sleepBtns() {
-        return <View>
+        return <View style={{ display: 'flex', marginTop: 22 }}>
             {
-                value == 'ONGOING' ? <Text style={{ color: '#00ffff' }} onClick={showPicker}>End Sleep</Text> :
-                    <Text style={{ color: '#00ffff' }} onClick={showPicker}>Start Sleep</Text>
+                value == 'ONGOING' ? <EndSleepBtn onClick={showPicker} /> : <StartSleepBtn onClick={showPicker} />
             }
         </View>
     }

+ 16 - 5
src/features/trackTimeDuration/components/Schedule.tsx

@@ -586,12 +586,12 @@ export default function Component(props: { type?: string, data?: any, delSuccess
             {
                 props.type != 'record' && props.type != 'latest' && key == 'FAST_SLEEP' && (value == 'WAIT_FOR_START' ? <Text onClick={showStage}>Duration goals by stage</Text> : <Text onClick={showStage}>Current stage</Text>)
             }
-            {
+            {/* {
                 key == 'FAST_SLEEP' && isOpen && props.type != 'record' && checkData && <Modal children={layoutContent()} dismiss={() => setIsOpen(false)} confirm={() => { }} />
-            }
-            {
+            } */}
+            {/* {
                 key == 'FAST_SLEEP' && isOpen && props.type == 'record' && props.data.scenario == 'FAST_SLEEP' && <Modal children={layoutContent()} dismiss={() => setIsOpen(false)} confirm={() => { }} />
-            }
+            } */}
 
             {
                 props.type == 'record' && <Text style={{ position: 'absolute', right: 20, top: 20 }} onClick={more}>More</Text>
@@ -617,7 +617,18 @@ export default function Component(props: { type?: string, data?: any, delSuccess
     }
 
     function showDetail(record) {
-        setShowDetailModal(true)
+        if (props.type == 'latest'){
+            setShowDetailModal(true)
+            return;
+        }
+        // 
+        var node = (<Modal children={schedules()}
+            modalType={ModalType.center}
+            dismiss={() => {
+                global.showModal(false,null)
+            }}
+            confirm={() => { }} />);
+        global.showModal(true, node);
     }
 
     function recordDetail() {

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

@@ -64,7 +64,7 @@ export default function Page() {
     return <View className="container choose_container">
         <Texts text='App name' type={TextType.big} />
         <View style={{ height: 100 }} />
-        <Buttons title='WeChat' onClick={login} style={{ width: 289, marginBottom: 30 }} />
-        <Buttons title='Create account' type={ButtonType.outline} onClick={createAccount} style={{ width: 289, marginBottom: 30 }} />
+        <Buttons title='WeChat' onClick={login} btnStyle={{ width: 289, marginBottom: 30 }} />
+        <Buttons title='Create account' type={ButtonType.outline} onClick={createAccount} btnStyle={{ width: 289, marginBottom: 30 }} />
     </View>;
 }

+ 18 - 14
src/pages/account/Profile.tsx

@@ -1,8 +1,8 @@
 import Buttons from "@/components/basic/Buttons";
 import { delSession } from "@/services/common";
 import { clear, logout } from "@/services/user";
-import { View, Text,Image } from "@tarojs/components";
-import Taro from "@tarojs/taro";
+import { View, Text, Image } from "@tarojs/components";
+import Taro, { useDidShow } from "@tarojs/taro";
 import { useDispatch, useSelector } from "react-redux";
 import './Profile.scss'
 
@@ -16,6 +16,10 @@ export default function Page() {
         })
     }
 
+    useDidShow(() => {
+        global.tabBar.update(3)
+    })
+
     function reset() {
         Taro.showModal({
             title: '重置session',
@@ -26,11 +30,11 @@ export default function Page() {
                 }
             }
         })
-        
+
     }
 
     function tapProfile() {
-        if (user.isLogin){
+        if (user.isLogin) {
             Taro.navigateTo({
                 url: '/pages/account/ProfileSetting'
             })
@@ -43,7 +47,7 @@ export default function Page() {
     }
 
     function tapBalance() {
-        if (user.isLogin){
+        if (user.isLogin) {
 
         }
         else {
@@ -51,27 +55,27 @@ export default function Page() {
                 url: '/pages/account/ChooseAuth'
             })
         }
-        
+
     }
 
-    function goSetting(){
+    function goSetting() {
         Taro.navigateTo({
             url: '/pages/account/Setting'
         })
     }
 
     return <View className="container">
-        <View style={{height:20}}/>
+        <View style={{ height: 20 }} />
         <View className="profile_card card" onClick={tapProfile}>
             <View className="avatar" style={{ opacity: user.isLogin ? 1 : 0.4 }}>
                 {
-                    user.isLogin?<Image src={user.avatar} className="avatar" />:<Image src={require('@/assets/images/user.png')} className="avatar_placeholder" />
+                    user.isLogin ? <Image src={user.avatar} className="avatar" /> : <Image src={require('@/assets/images/user.png')} className="avatar_placeholder" />
                 }
             </View>
             <Text className="nickname">{user.isLogin ? user.nickname : '未登录'}</Text>
             <Text className="username">{user.isLogin ? '用户名未设置' : ''}</Text>
         </View>
-        <View  className="card" onClick={tapBalance}>
+        <View className="card" onClick={tapBalance}>
             <Text className="title">逆龄石</Text>
             <Text className="desc">{'会员体系升级中,期间指标记录限时免逆龄石记录\n敬请期待'}</Text>
         </View>
@@ -79,14 +83,14 @@ export default function Page() {
             <Text className="title">设置</Text>
         </View>}
         {
-            user.isLogin && <Text>用户名:{user.nickname}</Text>
+            user.isLogin && user.test_user && <Text>用户名:{user.nickname}</Text>
         }
         {
-            user.isLogin && <Text>id:{user.id}</Text>
+            user.isLogin && user.test_user && <Text>id:{user.id}</Text>
         }
-        
+
         {
-            user.isLogin && <Buttons title='重置session' onClick={reset} style={{ width: 289, marginBottom: 30 }} />
+            user.isLogin && user.test_user && <Buttons title='重置session' onClick={reset} btnStyle={{ width: 289, marginBottom: 30 }} />
         }
 
     </View>

+ 12 - 9
src/pages/account/Setting.tsx

@@ -1,11 +1,12 @@
 import Buttons from "@/components/basic/Buttons";
 import { clear, logout } from "@/services/user";
-import { View,Text,Button } from "@tarojs/components";
+import { View, Text, Button } from "@tarojs/components";
 import Taro from "@tarojs/taro";
-import { useDispatch } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
 
-export default function Page(){
+export default function Page() {
     const dispatch = useDispatch();
+    const user = useSelector((state: any) => state.user);
     function logoutF() {
         Taro.showModal({
             title: '退出登录',
@@ -16,7 +17,7 @@ export default function Page(){
                 }
             }
         })
-        
+
     }
 
     function clearF() {
@@ -29,13 +30,15 @@ export default function Page(){
                 }
             }
         })
-        
+
     }
-    
-    return <View>
-        <Buttons title='退出登录' onClick={logoutF} style={{ width: 289, marginBottom: 30 }} />
 
-        <Buttons title='注销账号' onClick={clearF} style={{ width: 289, marginBottom: 30 }} />
+    return <View style={{ color: '#fff' }}>
+        <Buttons title='退出登录' onClick={logoutF} btnStyle={{ width: 289, marginBottom: 30 }} />
+
+        {
+            user.test_user && <Buttons title='注销账号' onClick={clearF} btnStyle={{ width: 289, marginBottom: 30 }} />
+        }
 
 
     </View>

+ 9 - 5
src/pages/activity/Activity.tsx

@@ -1,16 +1,20 @@
-import { View,Text } from "@tarojs/components";
+import { View, Text } from "@tarojs/components";
 import Activity from '@/features/trackSomething/components/Activity'
-import { useReady } from "@tarojs/taro";
+import { useDidShow, useReady } from "@tarojs/taro";
 import { activityCards } from "@/services/trackSomething";
 
-export default function Page(){
+export default function Page() {
     // useReady(()=>{
     //     activityCards().then(res=>{
-            
+
     //     })
     // })
 
-    function refresh(){
+    useDidShow(() => {
+        global.tabBar.update(2)
+    })
+
+    function refresh() {
         console.log('refresh')
     }
     return (

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

@@ -151,6 +151,7 @@ export default function IndexPage() {
   }
 
   useDidShow(() => {
+    global.tabBar.update(0)
     if (user.isLogin) {
       checkWXPubFollow()
       getCheckData();

+ 39 - 11
src/pages/common/RecordsHistory.tsx

@@ -10,6 +10,7 @@ import Taro from "@tarojs/taro";
 import Layout from "@/components/layout/layout";
 import NoData from "@/components/view/NoData";
 import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
+import { useSelector } from "react-redux";
 
 export default function Page() {
     const router = useRouter();
@@ -21,6 +22,16 @@ export default function Page() {
     const [showErrorPage, setShowErrorPage] = useState(false)
     const { refreshList } = router.params
     const [triggered, setTriggered] = useState(false)
+    const [showModal, setShowModal] = useState(false)
+    const [modalDetail, setModalDetail] = useState<any>({})
+    const [total, setTotal] = useState(0)
+    const [isLoading, setIsLoading] = useState(false)
+
+
+    global.showModal = (isShow: boolean, detail: any) => {
+        setShowModal(isShow)
+        setModalDetail(detail)
+    }
 
     useEffect(() => {
         startTimer();
@@ -61,19 +72,24 @@ export default function Page() {
     // })
 
     function refresh() {
+        setIsLoading(true)
         setPageIndex(1)
         getHistory(1)
     }
 
     function more() {
+        if (total <= records.length || isLoading) {
+            return;
+        }
+        setIsLoading(true)
         var page = pageIndex + 1
         setPageIndex(page)
         getHistory(page)
     }
 
     function getHistory(page = pageIndex) {
-        // debugger
-        setTriggered(true)
+        if (page == 1)
+            setTriggered(true)
         if (router.params.type == 'time') {
             getClockRecords({
                 page: page,
@@ -81,11 +97,13 @@ export default function Page() {
                 only_finished: true
             }).then(res => {
                 setTriggered(false)
+                setTotal((res as any).total)
                 if (page == 1) {
                     setRecords((res as any).data)
                 } else {
                     setRecords(records.concat((res as any).data))
                 }
+                setIsLoading(false)
             })
         }
         else if (router.params.type == 'activity') {
@@ -97,11 +115,13 @@ export default function Page() {
                 }
             ).then(res => {
                 setTriggered(false)
+                setTotal((res as any).total)
                 if (page == 1) {
                     setRecords((res as any).data)
                 } else {
                     setRecords(records.concat((res as any).data))
                 }
+                setIsLoading(false)
             })
         }
         else if (router.params.type == 'metric') {
@@ -113,11 +133,13 @@ export default function Page() {
                 }
             ).then(res => {
                 setTriggered(false)
+                setTotal((res as any).total)
                 if (page == 1) {
                     setRecords((res as any).data)
                 } else {
                     setRecords(records.concat((res as any).data))
                 }
+                setIsLoading(false)
             })
         }
 
@@ -127,7 +149,7 @@ export default function Page() {
         setRecords(records.filter(i => i.id != item.id))
     }
 
-    function clear() {
+    global.clearHistory = () => {
         // var page = Taro.getCurrentPages()[0]
         // debugger
         // page.refresh()
@@ -183,14 +205,20 @@ export default function Page() {
         }
     }
 
-    return <Layout children={showErrorPage ? <NoData refresh={() => { refresh() }} /> : detail()}
-        title={router.params.title}
-        type={TemplateType.list}
-        refresh={() => { refresh() }}
-        triggered={triggered}
-        more={() => { more() }}
-        titleShowStyle={NaviBarTitleShowType.scrollToShow}
-    />
+    return <View style={{ position: 'relative' }}>
+        <Layout children={showErrorPage ? <NoData refresh={() => { refresh() }} /> : detail()}
+            title={router.params.title}
+            type={TemplateType.list}
+            refresh={() => { refresh() }}
+            triggered={triggered}
+            more={() => { more() }}
+            titleShowStyle={NaviBarTitleShowType.scrollToShow}
+        />
+
+        {
+            showModal && modalDetail
+        }
+    </View>
 
     // return <View className="container">
 

+ 4 - 1
src/pages/metric/Metric.tsx

@@ -1,8 +1,11 @@
 import { View, Text } from "@tarojs/components";
 import Metric from "@/features/trackSomething/components/Metric";
+import { useDidShow } from "@tarojs/taro";
 
 export default function Page() {
-
+    useDidShow(() => {
+        global.tabBar.update(1)
+      })
     return <View className="container">
         <Metric />
     </View>

+ 10 - 3
src/store/user.tsx

@@ -7,6 +7,7 @@ interface UserState {
     token: string | null;
     scenario_select_count: number |  0;
     isLogin: boolean;
+    test_user:boolean;
 }
 
 
@@ -18,6 +19,7 @@ const initialState: UserState = {
     avatar: null,
     scenario_select_count: 0,
     token: null,
+    test_user:false,
 }
 
 const userSlice = createSlice({
@@ -25,24 +27,26 @@ const userSlice = createSlice({
     initialState,
     reducers: {
         loginSuccess(state, action: PayloadAction<any>) {
-            const { id,nickname, avatar, token,scenario_select_count } = action.payload;
+            const { id,nickname, avatar, token,scenario_select_count,test_user } = action.payload;
             state.id = id;
             state.nickname = nickname;
             state.avatar = avatar;
             state.token = token;
             state.scenario_select_count = scenario_select_count;
             state.isLogin = true;
+            state.test_user = test_user;
             global.token = token;
             Taro.setStorage({ key: 'userData', data: JSON.stringify(action.payload) });
         },
         registerSuccess(state, action: PayloadAction<any>) {
-            const { id,nickname, avatar, token,scenario_select_count } = action.payload;
+            const { id,nickname, avatar, token,scenario_select_count,test_user } = action.payload;
             state.id = id;
             state.nickname = nickname;
             state.avatar = avatar;
             state.token = token;
             state.scenario_select_count =  scenario_select_count;
             state.isLogin = true;
+            state.test_user = test_user;
             global.token = token;
             Taro.setStorage({ key: 'userData', data: JSON.stringify(action.payload) });
         },
@@ -52,6 +56,7 @@ const userSlice = createSlice({
             state.avatar = null;
             state.token = null;
             state.isLogin = false;
+            state.test_user = false;
             state.scenario_select_count = 0;
             global.token = '';
             Taro.clearStorage();
@@ -62,18 +67,20 @@ const userSlice = createSlice({
             state.avatar = null;
             state.token = null;
             state.isLogin = false;
+            state.test_user = false;
             state.scenario_select_count = 0;
             global.token = '';
             Taro.clearStorage();
         },
         getInfoSuccess(state, action: PayloadAction<any>) {
-            const {id, nickname, avatar, token,scenario_select_count } = action.payload;
+            const {id, nickname, avatar, token,scenario_select_count,test_user } = action.payload;
             state.id = id;
             state.nickname = nickname;
             state.avatar = avatar;
             state.token = token;
             state.scenario_select_count = scenario_select_count;
             state.isLogin = true;
+            state.test_user = test_user;
             global.token = token;
             Taro.setStorage({ key: 'userData', data: JSON.stringify(action.payload) });
         },