|
|
@@ -19,6 +19,11 @@ import Layout from "@/components/layout/layout";
|
|
|
import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
|
+let useNavigation;
|
|
|
+if (process.env.TARO_ENV == 'rn') {
|
|
|
+ useNavigation = require("@react-navigation/native").useNavigation
|
|
|
+}
|
|
|
+
|
|
|
export default function Component(props: any) {
|
|
|
const { t } = useTranslation()
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
@@ -40,7 +45,9 @@ export default function Component(props: any) {
|
|
|
const [setupTime, setSetupTime] = useState(0)
|
|
|
const [triggered, setTriggered] = useState(true)
|
|
|
const limitPickerRef = useRef<any>(null);
|
|
|
- const [count,setCount] = useState(0)
|
|
|
+ const [count, setCount] = useState(0)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
//未登录<->已登录 状态切换时,执行一次授权检查
|
|
|
@@ -51,7 +58,7 @@ export default function Component(props: any) {
|
|
|
const timeUntilMidnight = nextMidnight.getTime() - now.getTime();
|
|
|
|
|
|
setTimeout(() => {
|
|
|
- setCount(count+1)
|
|
|
+ setCount(count + 1)
|
|
|
}, timeUntilMidnight);
|
|
|
}, [user.isLogin])
|
|
|
|
|
|
@@ -104,7 +111,7 @@ export default function Component(props: any) {
|
|
|
return
|
|
|
}
|
|
|
Taro.navigateTo({
|
|
|
- url: '/pages/common/RecordsHistory?type=metric&refreshList=getCards&code=' + item.code + `&title=${item.name}`+'&themeColor='+item.theme_color
|
|
|
+ url: '/pages/common/RecordsHistory?type=metric&refreshList=getCards&code=' + item.code + `&title=${item.name}` + '&themeColor=' + item.theme_color
|
|
|
})
|
|
|
}
|
|
|
else {
|
|
|
@@ -222,9 +229,9 @@ export default function Component(props: any) {
|
|
|
})
|
|
|
setList(list)
|
|
|
|
|
|
- setTimeout(()=>{
|
|
|
- setCount(count+1)
|
|
|
- },31000)
|
|
|
+ setTimeout(() => {
|
|
|
+ setCount(count + 1)
|
|
|
+ }, 31000)
|
|
|
// getCards();
|
|
|
})
|
|
|
}
|
|
|
@@ -285,9 +292,9 @@ export default function Component(props: any) {
|
|
|
setList(JSON.parse(JSON.stringify(list)))
|
|
|
|
|
|
global.postBtnUpdateStatus('idle');
|
|
|
- setTimeout(()=>{
|
|
|
- setCount(count+1)
|
|
|
- },31000)
|
|
|
+ setTimeout(() => {
|
|
|
+ setCount(count + 1)
|
|
|
+ }, 31000)
|
|
|
|
|
|
})
|
|
|
}
|
|
|
@@ -310,11 +317,11 @@ export default function Component(props: any) {
|
|
|
if (item.latest_record) {
|
|
|
unit = item.schemas[0].default_unit
|
|
|
value = getValues(item.latest_record.items)
|
|
|
- desc = TimeFormatter.dateDescription(item.latest_record.timestamp,true)
|
|
|
+ desc = TimeFormatter.dateDescription(item.latest_record.timestamp, true)
|
|
|
showDetail = true
|
|
|
}
|
|
|
|
|
|
- if (!user.isLogin){
|
|
|
+ if (!user.isLogin) {
|
|
|
value = '未登录'
|
|
|
desc = '登录后可记录'
|
|
|
}
|
|
|
@@ -338,19 +345,19 @@ export default function Component(props: any) {
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
- function detailContent(){
|
|
|
- if (process.env.TARO_ENV=='rn'){
|
|
|
- return <ScrollView>
|
|
|
- {
|
|
|
- detail()
|
|
|
- }
|
|
|
- <View style={{height:150}}/>
|
|
|
- </ScrollView>
|
|
|
- }
|
|
|
+ function detailContent() {
|
|
|
+ // if (process.env.TARO_ENV=='rn'){
|
|
|
+ // return <ScrollView>
|
|
|
+ // {
|
|
|
+ // detail()
|
|
|
+ // }
|
|
|
+ // <View style={{height:150}}/>
|
|
|
+ // </ScrollView>
|
|
|
+ // }
|
|
|
return detail()
|
|
|
}
|
|
|
|
|
|
- return <View style={{ position:'relative' }}>
|
|
|
+ return <View style={{ position: 'relative' }}>
|
|
|
<Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detailContent()}
|
|
|
title={t('page.metric.title')}
|
|
|
type={TemplateType.flex}
|
|
|
@@ -419,16 +426,16 @@ export default function Component(props: any) {
|
|
|
chooseTime((picker as any).getConfirmData());
|
|
|
setIsTimePickerOpen(false);
|
|
|
}}>
|
|
|
- <LimitPickers ref={limitPickerRef}
|
|
|
- isRealTime={true} time={time} limit={limit}
|
|
|
- title={t('feature.track_something.picker_datetime')}
|
|
|
- themeColor={(metricItem as any).theme_color}
|
|
|
- limitDay={limitDay} onCancel={() => { setIsTimePickerOpen(false) }}
|
|
|
- onChange={(e) => {
|
|
|
- chooseTime(e)
|
|
|
- // pickerConfirm(e)
|
|
|
- // hidePicker()
|
|
|
- }} />
|
|
|
+ <LimitPickers ref={limitPickerRef}
|
|
|
+ isRealTime={true} time={time} limit={limit}
|
|
|
+ title={t('feature.track_something.picker_datetime')}
|
|
|
+ themeColor={(metricItem as any).theme_color}
|
|
|
+ limitDay={limitDay} onCancel={() => { setIsTimePickerOpen(false) }}
|
|
|
+ onChange={(e) => {
|
|
|
+ chooseTime(e)
|
|
|
+ // pickerConfirm(e)
|
|
|
+ // hidePicker()
|
|
|
+ }} />
|
|
|
</Modal>
|
|
|
}
|
|
|
</View>
|