Leon vor 1 Jahr
Ursprung
Commit
d5a49ec463

+ 1 - 1
config/env.ts

@@ -1,4 +1,4 @@
 
 export const APP_VERSION = '1.0.2'
 export const ANDROID_VERSION = '1.0.0'
-export const WX_VERSION = '1.4.8'
+export const WX_VERSION = '1.4.9'

+ 2 - 2
src/_health/components/choose_date_time.tsx

@@ -103,13 +103,13 @@ export default function ChooseDateTime(props: {
         if (dayjs(props.targetTimestamp!).format('YYYY-MM-DD HH:mm') == props.date + ' ' + props.time) {
             return <View style={{ display: 'flex', flexDirection: 'row' }} onClick={reset}>
                 <View className="h26 g02">{t('health.select_schedule')}</View>
-                <View className="h26" style={{ color: MainColorType.link, marginLeft: rpxToPx(8) }}>{t('health.reset')}</View>
+                <View className="h26" style={{ color: MainColorType.link, marginLeft: rpxToPx(16) }}>{t('health.reset')}</View>
             </View>
         }
         if (new Date().getTime() > props.targetTimestamp!) {
             return <View style={{ display: 'flex', flexDirection: 'row' }} onClick={tapTarget}>
                 <View className="h26 g02">{t('health.schedule_for', { time: targetDate()+dayjs(props.targetTimestamp).format('HH:mm') })}</View>
-                <View className="h26" style={{ color: MainColorType.link, marginLeft: rpxToPx(8) }}>{t('health.select')}</View>
+                <View className="h26" style={{ color: MainColorType.link, marginLeft: rpxToPx(16) }}>{t('health.select')}</View>
             </View>
         }
         else {

+ 3 - 3
src/_health/components/post_moment_time.tsx

@@ -189,7 +189,7 @@ export default function PostMomentTime(props: {
 
                 // footerTitle={scheduleTime()}
                 enterTimestamp={global.set_time}
-                targetTimestamp={props.moment && props.moment.target ? props.moment.target.timestamp : new Date().getTime()}
+                targetTimestamp={props.moment && props.moment.target ? props.moment.target.timestamp : null}
 
                 // tapFooter={() => {
                 //     if (time == dayjs(props.moment.target.timestamp).format('HH:mm')) {
@@ -271,14 +271,14 @@ export default function PostMomentTime(props: {
 
         </Card> */}
         <View style={{ marginTop: rpxToPx(36), display: 'flex', flexDirection: 'column', alignItems: showMore ? 'flex-start' : 'center' }}>
-            {
+            {/* {
                 showMore ? durationContent() :
                     <NewButton
                         onClick={() => setShowMore(true)}
                         type={NewButtonType.link}
                         title={global.language == 'en' ? 'Show More' : '查看更多'}
                     />
-            }
+            } */}
 
         </View>
     </NewModal>

+ 13 - 2
src/_health/components/schedule_item.tsx

@@ -172,6 +172,17 @@ export default function ScheduleItem(props: {
         </View>
     }
 
+    function disableDelete(){
+        if (props.obj.window == 'FAST' || props.obj.window == 'SLEEP'){
+            return true;
+        }
+        if (props.disable) return true;
+        if (props.obj.window == 'EAT' || props.obj.window == 'ACTIVE'){
+            return false
+        }
+        return true;
+    }
+
     return <View key={props.key}>
         <View className="ss" style={{
             borderTopLeftRadius: props.index == 0 ? rpxToPx(26) : 0,
@@ -182,7 +193,7 @@ export default function ScheduleItem(props: {
             <AtSwipeAction
                 isOpened={false}
                 autoClose
-                disabled={(props.obj.window != 'EAT' && props.obj.window != 'ACTIVE' && !props.disable) || props.obj.window == 'FAST' || props.obj.window == 'SLEEP'}
+                disabled={disableDelete()}
                 options={[
                     {
                         text: t('health.delete'),
@@ -264,7 +275,7 @@ export default function ScheduleItem(props: {
                             </View>
                         }
                         {
-                            props.disable && <View className="schedule_border" style={{ borderColor: 'transparent' }}>
+                            props.obj.specific_time &&props.disable && <View className="schedule_border" style={{ borderColor: 'transparent' }}>
                                 <View className="edit_item_time" style={{ backgroundColor: 'transparent', color: props.gray ? MainColorType.g02 : '#000' }}>{props.obj.time}</View>
                             </View>
                         }

+ 43 - 3
src/_health/pages/guide_active.tsx

@@ -66,15 +66,26 @@ export default function GuideActive() {
             setHighlight(false)
         }, 2000)
 
-        timer = setInterval(() => {
-            setCount(count => count + 1)
-        }, 1000)
+
 
         return () => {
             clearInterval(timer)
         }
     }, [])
 
+    useEffect(() => {
+        var items = list.filter(item => item.window == 'ACTIVE')
+        if (items.length > 0) {
+            clearInterval(timer)
+        }
+        else {
+            clearInterval(timer)
+            timer = setInterval(() => {
+                setCount(count => count + 1)
+            }, 1000)
+        }
+    }, [list])
+
     function check(array, tapDone = false) {
         if (tapDone) {
             if (posting) return
@@ -127,6 +138,7 @@ export default function GuideActive() {
     }
 
     function isDisable(obj) {
+        if (highlight) return true
         if ((obj.window == 'SLEEP') && !obj.is_conflict) {
             return true
         }
@@ -179,6 +191,7 @@ export default function GuideActive() {
             }
             {
                 items.map((obj, i) => {
+
                     return <ScheduleItem
                         index={i}
                         count={items.length + 1}
@@ -192,6 +205,33 @@ export default function GuideActive() {
                         gray={isDisable(obj)}
                         days={obj.plus_days != 0 ? obj.plus_days : null}
                         hideReminderIcon={true}
+                        tapSpecificTime={(detail) => {
+                            // debugger
+                            // obj.time = detail.time
+                            // obj.specific_time = !detail.is_full_day
+                            // obj.time_label = detail.label
+
+
+                            var array = JSON.parse(JSON.stringify(list))
+                            var index = -1
+                            array.map((temp, j) => {
+                                if (obj.id == temp.id){
+                                    index = j
+                                }
+                                else if (obj.title==temp.title){
+                                    index = j
+                                }
+                            })
+                            if (index >= 0) {
+                                array[index].time = detail.time
+                                array[index].specific_time = !detail.is_full_day
+                                array[index].time_label = detail.label
+                                array[index].op_ms = new Date().getTime()
+                                setList(array)
+                            }
+
+                            // checkData(array)
+                        }}
                         onDelete={() => {
                             const scenario = getScenario(health.windows, 'ACTIVE')
                             if (scenario.access.min >= items.length) {

+ 28 - 0
src/_health/pages/guide_eat.tsx

@@ -145,6 +145,7 @@ export default function GuideEat() {
     }
 
     function isDisable(obj) {
+        if (highlight) return true
         if ((obj.window == 'FAST' || obj.window == 'SLEEP') && !obj.is_conflict) {
             return true
         }
@@ -190,6 +191,33 @@ export default function GuideEat() {
                         gray={isDisable(obj)}
                         days={obj.plus_days != 0 ? obj.plus_days : null}
                         hideReminderIcon={true}
+                        tapSpecificTime={(detail) => {
+                            // debugger
+                            // obj.time = detail.time
+                            // obj.specific_time = !detail.is_full_day
+                            // obj.time_label = detail.label
+
+
+                            var array = JSON.parse(JSON.stringify(list))
+                            var index = -1
+                            array.map((temp, j) => {
+                                if (obj.id == temp.id){
+                                    index = j
+                                }
+                                else if (obj.title==temp.title){
+                                    index = j
+                                }
+                            })
+                            if (index >= 0) {
+                                array[index].time = detail.time
+                                array[index].specific_time = !detail.is_full_day
+                                array[index].time_label = detail.label
+                                array[index].op_ms = new Date().getTime()
+                                setList(array)
+                            }
+
+                            // checkData(array)
+                        }}
                         onDelete={() => {
                             const scenario = getScenario(health.windows, 'EAT')
                             if (scenario.access.min >= items.length) {

+ 11 - 1
src/_health/pages/log_time.tsx

@@ -931,6 +931,16 @@ export default function LogTime() {
         if (conflicts.includes(schedule_id)) {
             showError = true
         }
+
+        function getTimestamp(){
+            if (router.params.longfast){
+                if (health.long_fast.timeline&& health.long_fast.timeline.length>0 && health.long_fast.timeline[1].target){
+                    return health.long_fast.timeline[1].target.timestamp
+                }
+                return null
+            }
+            return timeline.target.timestamp
+        }
         return <ChooseDateTime
             title={isSingle ? null : <StatusIndicator
                 type={showError ? StatusType.img : StatusType.normal}
@@ -947,7 +957,7 @@ export default function LogTime() {
             disable={array[index].disable}
             showError={showError}
             showLine={showLine}
-            targetTimestamp={router.params.longfast?health.long_fast.timeline[1].target.timestamp:timeline.target.timestamp}
+            targetTimestamp={getTimestamp()}
             enterTimestamp={enterTime}
             color={iFast ? MainColorType.fast : MainColorType.sleep}
             minTimestamp={min}

+ 1 - 1
src/_health/pages/move_schedule.tsx

@@ -145,7 +145,7 @@ export default function MoveSchedule() {
             {
                 hours.length == 0 && <View style={{ display: 'flex', flex: 1, flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(110) }}>
                     <Image src={require('@assets/_health/sleep2.png')} style={{ width: rpxToPx(64), height: rpxToPx(64) }} />
-                    <Text style={{ marginTop: rpxToPx(24), fontSize: rpxToPx(50), fontWeight: 'bold', color: '#B2B2B2' }}>睡个好觉</Text>
+                    <Text style={{ marginTop: rpxToPx(24), fontSize: rpxToPx(50), fontWeight: 'bold', color: '#B2B2B2' }}>{t('health.sleep_well')}</Text>
                 </View>
             }
             <Card>

+ 14 - 5
src/_health/pages/move_setting_time.tsx

@@ -63,7 +63,7 @@ export default function MoveSettingTime() {
                                 showLine={true}
                                 fullLine={false}
                                 description={`${item.time}-${item.end_time}`}
-                                title={selIndex != index ? `Hit ${item.goal} Steps` : null}
+                                title={selIndex != index ? t('health.hit_steps2',{steps:item.goal}) : null}
                                 titleComponent={selIndex == index ? <Input className='item_name h34' style={{ flex: 1, height: rpxToPx(46), marginLeft: rpxToPx(32) }}
                                     // value={item.goal}
                                     autoFocus={true}
@@ -71,12 +71,21 @@ export default function MoveSettingTime() {
                                     type="number"
                                     // cursor={item.goal.length}
                                     onBlur={() => {
+                                        // console.log('sss')
                                         setSelIndex(-1)
+                                        var array:any = []
+                                        detail.schedules.map((item)=>{
+                                            array.push({
+                                                id:item.id,
+                                                goal:item.goal
+                                            })
+                                        })
                                         createSchedule({
-                                            schedules: [{
-                                                id: item.id,
-                                                goal: item.goal
-                                            }],
+                                            schedules:array
+                                            // schedules: [{
+                                            //     id: item.id,
+                                            //     goal: item.goal
+                                            // }],
                                         }).then(res => {
                                             if (global.refreshWindow) {
                                                 global.refreshWindow()

+ 1 - 0
src/_health/pages/post_result.tsx

@@ -259,6 +259,7 @@ export default function PostResult() {
                     text={statusText()}
                     type={StatusType.normal}
                     color={getThemeColor(data.current_window)}
+                    fontSize={rpxToPx(26)}
                     fontColor={MainColorType.g01} />
             </View>
 

+ 1 - 0
src/_health/pages/schedules.tsx

@@ -463,6 +463,7 @@ export default function Schedules() {
                                     key={i * 100}
                                     obj={obj}
                                     highlight={highlight && selMode == obj.window}
+                                    disable={highlight}
                                     hideReminderIcon={errors.length > 0}
                                     showLine={i < list.length - 1}
                                     errors={errors}

+ 3 - 3
src/_health/pages/schedules_edit.tsx

@@ -243,7 +243,7 @@ export default function SchedulesEdit() {
             !(editIndex.row == index && editIndex.index == i)) {
             return <View style={{ marginRight: rpxToPx(12) }}>
                 <NewButton type={NewButtonType.link}
-                    title="更改"
+                    title={global.language=='en'?'Change':"更改"}
                     onClick={() => {
                         setSelItem(obj)
                         setEditIndex({
@@ -260,7 +260,7 @@ export default function SchedulesEdit() {
     function detail() {
         return <View className='schedule_list_bg'>
             <ScrollView enableFlex style={{ height: Taro.getWindowInfo().screenHeight - 220 }} scrollY>
-                <NewHeader title="日程设置" type={NewHeaderType.left} />
+                <NewHeader title={t('health.edit_name')} type={NewHeaderType.left} />
                 <Card>
                     <View style={{ display: 'flex', flexDirection: 'column' }}>
                         {
@@ -366,7 +366,7 @@ export default function SchedulesEdit() {
     }
 
     return <View>
-        <Layout title='批量编辑'
+        <Layout title={t('health.edit_name')}
             titleShowStyle={NaviBarTitleShowType.scrollToShow}
             type={TemplateType.customHeader}
         // header={headerView()}

+ 4 - 2
src/_health/pages/schedules_order.tsx

@@ -15,6 +15,7 @@ import Card from "../components/card";
 import { orderSchedules } from "@/services/health";
 import Taro from "@tarojs/taro";
 import ScheduleMoveList from "../components/schedule_move_list";
+import { useTranslation } from "react-i18next";
 
 let useRoute;
 let useNavigation;
@@ -40,6 +41,7 @@ export default function SchedulesOrder() {
 
     const health = useSelector((state: any) => state.health);
     const [list, setList] = useState(JSON.parse(router.params.list))
+    const {t} = useTranslation()
 
     function items() {
         var array: any = []
@@ -90,7 +92,7 @@ export default function SchedulesOrder() {
     }
 
     return <View >
-        <NewHeader title="日程设置" type={NewHeaderType.left} />
+        <NewHeader title={t('health.edit_order')} type={NewHeaderType.left} />
         <Card>
             {/* <MoveList itemHeight={rpxToPx(128)} components={items()} array={list} color="#fff" update={array => {
                 setList(array)
@@ -102,7 +104,7 @@ export default function SchedulesOrder() {
         <View className="main_footer">
             <NewButton
                 type={NewButtonType.fill}
-                title="完成"
+                title={t('health.done')}
                 color={MainColorType.active}
                 width={rpxToPx(670)}
                 height={rpxToPx(96)}

+ 8 - 59
src/_health/pages/streak_calendar.tsx

@@ -211,57 +211,6 @@ export default function StreakCalendar() {
         return scenario.current_streak.days
     }
 
-    function content() {
-        return <View className="calendar_main2">
-            <View className="calendar_header">
-
-                <NewButton type={NewButtonType.img} onClick={() => {
-                    const date = new Date(year, month - 1); // month - 1 因为月份是从 0 开始
-                    date.setMonth(date.getMonth() - 1);
-                    setYear(date.getFullYear())
-                    setMonth(date.getMonth() + 1)
-                }}>
-                    <Image src={require('@assets/_health/pre.png')} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
-                </NewButton>
-                <Text style={{ width: rpxToPx(236), textAlign: 'center' }}>{`${year}年${month}月`}</Text>
-
-                <NewButton type={NewButtonType.img} onClick={() => {
-                    const date = new Date(year, month + 1); // month - 1 因为月份是从 0 开始
-                    date.setMonth(date.getMonth() - 1);
-                    setYear(date.getFullYear())
-                    setMonth(date.getMonth() + 1)
-                }}>
-                    <Image src={require('@assets/_health/next.png')} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
-                </NewButton>
-            </View>
-            <View className="calendar_body">
-                <View className="calendar_weekly">
-                    {
-                        weeks.map((item, index) => {
-                            return <View className="week_item" key={index}>{item}</View>
-                        })
-                    }
-                </View>
-                <View className="calendar_main3">
-                    {
-                        spaces.map((item, i) => {
-                            return <View className="calendar_item" style={{ width: rpxToPx(90) }} key={i * 10} />
-                        })
-                    }
-                    {
-                        days.map((item, index) => {
-                            return <View className={itemClass(item)} style={{ width: rpxToPx(90), backgroundColor: bgColor(item) }} key={index}>
-                                <Text className={itemTextClass(item)} style={{ color: textColor(item) }}>{item.day}</Text>
-                            </View>
-                        })
-                    }
-                </View>
-            </View>
-            <View className="calendar_footer">
-
-            </View>
-        </View>
-    }
 
     function detail() {
         return <View style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
@@ -273,8 +222,8 @@ export default function StreakCalendar() {
                         style={{ backgroundColor: mode == 'EAT' ? getThemeColor('EAT') + '1A' : 'transparent' }}
                     >
                         <Text className={mode == 'EAT' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>Eat </Text>
-                        <Text className="h20" style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01 }}>{currentCount('EAT')}</Text>
+                            style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>{t('health.eat')}</Text>
+                        {/* <Text className="h20" style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01 }}>{currentCount('EAT')}</Text> */}
                     </View>
                 </NewButton>
 
@@ -283,8 +232,8 @@ export default function StreakCalendar() {
                         style={{ backgroundColor: mode == 'ACTIVE' ? getThemeColor('ACTIVE') + '1A' : 'transparent' }}
                     >
                         <Text className={mode == 'ACTIVE' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>Active</Text>
-                        <Text className="h20" style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01 }}> {currentCount('ACTIVE')}</Text>
+                            style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>{t('health.active')}</Text>
+                        {/* <Text className="h20" style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01 }}> {currentCount('ACTIVE')}</Text> */}
                     </View>
                 </NewButton>
                 <NewButton type={NewButtonType.img} onClick={() => setMode('FAST')}>
@@ -292,8 +241,8 @@ export default function StreakCalendar() {
                         style={{ backgroundColor: mode == 'FAST' ? getThemeColor('FAST') + '1A' : 'transparent' }}
                     >
                         <Text className={mode == 'FAST' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>Fast</Text>
-                        <Text className="h20" style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01 }}> {currentCount('FAST')}</Text>
+                            style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>{t('health.fast')}</Text>
+                        {/* <Text className="h20" style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01 }}> {currentCount('FAST')}</Text> */}
                     </View>
                 </NewButton>
                 <NewButton type={NewButtonType.img} onClick={() => setMode('SLEEP')}>
@@ -301,8 +250,8 @@ export default function StreakCalendar() {
                         style={{ backgroundColor: mode == 'SLEEP' ? getThemeColor('SLEEP') + '1A' : 'transparent' }}
                     >
                         <Text className={mode == 'SLEEP' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>Sleep</Text>
-                        <Text className="h20" style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01 }}> {currentCount('SLEEP')}</Text>
+                            style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>{t('health.sleep')}</Text>
+                        {/* <Text className="h20" style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01 }}> {currentCount('SLEEP')}</Text> */}
                     </View>
                 </NewButton>
                 <View style={{ width: rpxToPx(40), flexShrink: 0 }} />

+ 5 - 2
src/context/locales/en.js

@@ -1025,7 +1025,7 @@ export default {
 
         select: 'Select',
         reset: 'Reset',
-        select_schedule: 'Selected as Schedules',
+        select_schedule: 'Selected as Scheduled',
         schedule_for: 'Scheduled for {{time}}',
         log_moment: 'Log Moment',
         log_moments: 'Log Moments',
@@ -1162,7 +1162,7 @@ export default {
 
         keep_at_least: 'Keep at least {{number}} {{type}}',
         no_vip_title: 'Become a Member',
-        no_vip_desc: 'Add unlimited meals or activities to your daily schedule',
+        no_vip_desc: 'Add unlimited meals or activities to your schedule',
 
         long_fast_alert_title: 'Long Fast in Progress',
         long_fast_alert_desc: 'During Long Fast, Fast with Sleep is temporarily unavailable, but you can still log your sleep under \'Sleep\' tab.',
@@ -1203,5 +1203,8 @@ export default {
         hour_step_goal:'Hourly Step Goal',
         avg_total_steps:'Average {{avg}} steps, Total {{total}} steps',
         conflict_resolve:'Time Conflict Resolved',
+
+        edit_my_name:'Edit my name',
+        enter_my_name:'Enter my name',
     }
 }

+ 8 - 5
src/context/locales/zh.js

@@ -1026,8 +1026,8 @@ export default {
 
         select: '选择',
         reset: '重置',
-        select_schedule: '已选为预订时间',
-        schedule_for: '预订时间为{{time}}',
+        select_schedule: '已选为计划时间',
+        schedule_for: '计划时间{{time}}',
 
         log_moment: '记录时刻',
         log_moments: '记录时刻',
@@ -1164,7 +1164,7 @@ export default {
 
         keep_at_least: '需保留至少{{number}}个{{type}}',
         no_vip_title: '成为会员',
-        no_vip_desc: '在您每天的日程中,添加无限多个餐次或活动',
+        no_vip_desc: '在日程中可以添加无限数量的餐次或活动',
         long_fast_alert_title: '长断食进行中',
         long_fast_alert_desc: '长断食期间,“断食与睡眠”功能暂不可用。不过您仍可在“睡眠”窗口下记录您的睡眠。',
         got_it: '我知道了',
@@ -1185,10 +1185,10 @@ export default {
         if_progress_desc:'要将它转换为长断食吗?',
 
         save_as_if_title:'保存为间歇性断食',
-        save_as_if_desc:'持续时间不足24小时的断食将被为间歇性断食',
+        save_as_if_desc:'持续时间不足24小时的断食将被保存为间歇性断食',
         save_as_if_toast:'已保存至“断食/最近”',
         save_as_lf_title:'保存为长断食',
-        save_as_lf_desc:'持续24小时或更长时间的断食将被为长断食',
+        save_as_lf_desc:'持续24小时或更长时间的断食将被保存为长断食',
         save_as_lf_toast:'已保存至“长断食/最近”',
 
         sleep_well:'睡个好觉',
@@ -1204,5 +1204,8 @@ export default {
         hour_step_goal:'每小时步数目标',
         avg_total_steps:'平均 {{avg}} 步,全天 {{total}} 步',
         conflict_resolve:'时间冲突已解决',
+
+        edit_my_name:'编辑名字',
+        enter_my_name:'取个名字',
     }
 }

+ 1 - 1
src/pages/account/EditPage.config.ts

@@ -3,6 +3,6 @@ export default definePageConfig({
         // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
         // 'demo':'../../components/demo'
     },
-    "navigationBarTitleText": "编辑名字",
+    // "navigationBarTitleText": "编辑名字",
     "navigationBarBackgroundColor":"#f5f5f5"
 })

+ 3 - 0
src/pages/account/EditPage.tsx

@@ -42,6 +42,9 @@ export default function Page() {
 
 
     useEffect(() => {
+        Taro.setNavigationBarTitle({
+            title:t('health.edit_my_name')
+        })
         if (process.env.TARO_ENV == 'rn') {
             setValue(router.params.name as any)
 

+ 26 - 7
src/pages/account/Profile.tsx

@@ -1,6 +1,6 @@
 import Buttons from "@/components/basic/Buttons";
 import { delSession } from "@/services/common";
-import { clear, getInfo, getPerm, logout, resetInfo, uploadPerm } from "@/services/user";
+import { clear, getInfo, getPerm, logout, resetInfo, uploadPerm, userAccess } from "@/services/user";
 import { View, Text, Image, Switch } from "@tarojs/components";
 import Taro, { useDidShow, usePullDownRefresh, useShareAppMessage } from "@tarojs/taro";
 import { useDispatch, useSelector } from "react-redux";
@@ -22,6 +22,7 @@ import { MainColorType } from "@/context/themes/color";
 import NewHeader, { NewHeaderType } from "@/_health/components/new_header";
 import { IconArrow, IconCellArrow, IconVip } from "@/components/basic/Icons";
 import IconTitleCell from "@/_health/components/icon_title_cell";
+import { setAccessData } from "@/store/access";
 
 let useNavigation, SwitchRN;
 if (process.env.TARO_ENV == 'rn') {
@@ -45,6 +46,12 @@ export default function Page() {
         navigation = useNavigation()
     }
 
+    useEffect(()=>{
+        if (user.isLogin){
+            checkBalance()
+        }
+    },[user.isLogin])
+
     useDidShow(()=>{
         Taro.setNavigationBarTitle({
             title:naviTitle
@@ -99,6 +106,18 @@ export default function Page() {
 
     }
 
+    function checkBalance(){
+        userAccess().then(res => {
+            // global.offsetTimestamp = 0;
+            // const { server_timestamp } = res as any
+            // if (server_timestamp) {
+            //     global.offsetTimestamp = new Date().getTime() - server_timestamp
+            // }
+            dispatch(setAccessData(res))
+
+        })
+    }
+
     function switchChanged(e) {
         setSwitchOn(e.detail.value)
         Taro.setStorageSync('isDebug', e.detail.value)
@@ -236,7 +255,6 @@ export default function Page() {
     function refresh() {
         setTriggered(true)
         getInfo().then(res => {
-            console.log(res)
             Taro.stopPullDownRefresh()
             dispatch(getInfoSuccess(res))
             setTriggered(false)
@@ -281,17 +299,18 @@ export default function Page() {
     }
 
     function isMember() {
+        console.log('member info',accessObj)
         if (!user.isLogin || !accessObj || !accessObj.access) {
             return false;
         }
-        console.log(accessObj.access)
+        
+        console.log('member info',accessObj.access)
         switch (accessObj.access.member.subscription_status) {
             case 'INITIAL':
             case 'INACTIVE':
             case 'INACTIVE_EXPIRED':
                 return false;
         }
-        console.log('bbbbb')
         return true;
     }
 
@@ -404,15 +423,15 @@ export default function Page() {
             <IconTitleCell
                 onClick={goCalendar}
                 title={t('health.streaks')}
-                showLine
+                // showLine
                 icon={<Image src={require('@assets/_health/setting_streak.png')} className="profile_cell_icon" />}
             />
-            <IconTitleCell
+            {/* <IconTitleCell
                 onClick={goWeekly}
                 title={t('health.windows')}
                 showLine
                 icon={<Image src={require('@assets/_health/setting_chart.png')} className="profile_cell_icon" />}
-            />
+            /> */}
 
             <View className="profile_cell_space" />
             <IconTitleCell

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

@@ -173,7 +173,7 @@ export default function Page() {
 
         <View onClick={editNickname}>
             <TableCell onClick={editNickname} title={t('page.user_profile.nickname')} showArrow={true} showMarginBottom={true}>
-                <Text style={{ opacity: 0.8, color: MainColorType.g01 }}>{router.params.newuser == '1' ? (user.nickname == name ? '取个名字' : user.nickname) : user.nickname}</Text>
+                <Text style={{ opacity: 0.8, color: MainColorType.g01 }}>{router.params.newuser == '1' ? (user.nickname == name ? t('health.enter_my_name') : user.nickname) : user.nickname}</Text>
             </TableCell>
         </View>
         <View style={{ flex: 1 }} />

+ 20 - 11
src/pages/account/Setting.tsx

@@ -63,7 +63,7 @@ export default function Page() {
         if (lg.length > 0) {
             switch (lg) {
                 case 'wechat':
-                    setLanguageType(process.env.TARO_ENV=='weapp'?t('health.follow_wechat'):t('health.follow_system'))
+                    setLanguageType(process.env.TARO_ENV == 'weapp' ? t('health.follow_wechat') : t('health.follow_system'))
                     break
                 case 'zh':
                     setLanguageType('中文')
@@ -74,7 +74,7 @@ export default function Page() {
             }
         }
         else {
-            setLanguageType(process.env.TARO_ENV=='weapp'?t('health.follow_wechat'):t('health.follow_system'))
+            setLanguageType(process.env.TARO_ENV == 'weapp' ? t('health.follow_wechat') : t('health.follow_system'))
         }
     }
 
@@ -91,9 +91,9 @@ export default function Page() {
         // var showDayRing = await getStorage('showedDisqualifiedAlert') || false;
         showAlert({
             title: t('health.log_out_title'),
-            content:'',
-            cancelText:t('health.cancel'),
-            confirmText:t('health.log_out'),
+            content: '',
+            cancelText: t('health.cancel'),
+            confirmText: t('health.log_out'),
             showCancel: true,
             confirm: () => {
                 logout().then(res => {
@@ -120,8 +120,13 @@ export default function Page() {
                     // }
 
                     if (process.env.TARO_ENV == 'weapp') {
+                        const isZh = Taro.getAppBaseInfo().language == 'zh_CN'
+                        global.language = isZh ? 'zh' : 'en'
+                        Taro.setStorageSync('language', 'wechat')
+                        i18n.changeLanguage(isZh ? 'zh' : 'en')
+
                         Taro.reLaunch({
-                            url:'/pages/clock/Clock'
+                            url: '/pages/clock/Clock'
                         })
                         // Taro.switchTab({
                         //     url: '/pages/clock/Clock'
@@ -172,8 +177,12 @@ export default function Page() {
     function delUser() {
         dispatch(clear() as any);
         setTimeout(() => {
+            const isZh = Taro.getAppBaseInfo().language == 'zh_CN'
+            global.language = isZh ? 'zh' : 'en'
+            Taro.setStorageSync('language', 'wechat')
+            i18n.changeLanguage(isZh ? 'zh' : 'en')
             Taro.reLaunch({
-                url:'/pages/clock/Clock'
+                url: '/pages/clock/Clock'
             })
         }, 1500)
     }
@@ -181,9 +190,9 @@ export default function Page() {
     function changeLanguage() {
         showActionSheet({
             // alertText: '更改语言',
-            itemList: ['中文', 'English', process.env.TARO_ENV=='weapp'?t('health.follow_wechat'):t('health.follow_system')],
+            itemList: ['中文', 'English', process.env.TARO_ENV == 'weapp' ? t('health.follow_wechat') : t('health.follow_system')],
             success: function (res) {
-                
+
                 switch (res) {
                     case 0:
                         global.language = 'zh'
@@ -203,12 +212,12 @@ export default function Page() {
                         global.language = isZh ? 'zh' : 'en'
                         Taro.setStorageSync('language', 'wechat')
                         i18n.changeLanguage(isZh ? 'zh' : 'en')
-                        setLanguageType(process.env.TARO_ENV=='weapp'?t('health.follow_wechat'):t('health.follow_system'))
+                        setLanguageType(process.env.TARO_ENV == 'weapp' ? t('health.follow_wechat') : t('health.follow_system'))
                         break;
                 }
                 if (res != -1) {
                     Taro.reLaunch({
-                        url:'/pages/clock/Clock'
+                        url: '/pages/clock/Clock'
                     })
                     // global.refreshWindow()
                     // if (global.refreshHistory) {

+ 3 - 5
src/pages/clock/ClockNew.tsx

@@ -260,17 +260,15 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
     }
 
     async function checkVersionUpdate() {
-        console.log('9527')
         if (!user.isLogin) {
             return
         }
-        console.log('9528')
 
 
-        const showAlert1 = await getStorage('148alert') || false;
-        Taro.setStorage({ key: '148alert', data: true })
+        const showAlert1 = await getStorage('149alert') || false;
+        Taro.setStorage({ key: '149alert', data: true })
+
 
-        console.log('9529', showAlert1, health.finish_setup)
 
 
         if (!showAlert1 && !health.finish_setup) {

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

@@ -1,4 +1,4 @@
-const online = process.env.TARO_ENV == 'weapp' ? false : false;
+const online = process.env.TARO_ENV == 'weapp' ? true : false;
 
 import { WX_VERSION as _WX_VERSION, APP_VERSION as _APP_VERSION, ANDROID_VERSION as _ANDROID_VERSION } from "../../../config/env";