|
|
@@ -2,6 +2,8 @@ import { View, Text, Image } from "@tarojs/components";
|
|
|
import './MetricItem.scss'
|
|
|
import { RecordMetricBtn } from "@/features/common/SpecBtns";
|
|
|
import { rpxToPx } from "@/utils/tools";
|
|
|
+import { useEffect, useState } from "react";
|
|
|
+import { useSelector } from "react-redux";
|
|
|
|
|
|
export default function Component(props: {
|
|
|
title: string,
|
|
|
@@ -22,6 +24,7 @@ export default function Component(props: {
|
|
|
special?: string
|
|
|
}) {
|
|
|
|
|
|
+ const user = useSelector((state: any) => state.user);
|
|
|
function clickBtn() {
|
|
|
if (props.isDisabled) {
|
|
|
return
|
|
|
@@ -42,20 +45,20 @@ export default function Component(props: {
|
|
|
function valueContent() {
|
|
|
if (props.special && props.special == 'FT_IN') {
|
|
|
|
|
|
- return <View className="metric_value_bg" onClick={() => props.onClickDetail()}>
|
|
|
- <Text className="metric_value">{parseInt(props.value / 12 + '')}</Text>
|
|
|
- <Text className="metric_unit" style={{ marginBottom: 3, marginLeft: 2, marginRight: 2 }}>ft</Text>
|
|
|
- <Text className="metric_value">{props.value % 12}</Text>
|
|
|
- <Text className="metric_unit" style={{ marginBottom: 3, marginLeft: 2, marginRight: 2 }}>in</Text>
|
|
|
+ return <View className="metric_value_bg" style={{ backgroundColor: user.is_debug ? 'red' : 'transparent' }} onClick={() => props.onClickDetail()}>
|
|
|
+ <Text className="metric_value" style={{ backgroundColor: user.is_debug ? 'blue' : 'transparent' }}>{parseInt(props.value / 12 + '')}</Text>
|
|
|
+ <Text className="metric_unit" style={{ marginLeft: 2, marginRight: 2, backgroundColor: user.is_debug ? 'gray' : 'transparent' }}>ft</Text>
|
|
|
+ <Text className="metric_value" style={{ backgroundColor: user.is_debug ? 'blue' : 'transparent' }}>{props.value % 12}</Text>
|
|
|
+ <Text className="metric_unit" style={{ marginLeft: 2, marginRight: 2, backgroundColor: user.is_debug ? 'gray' : 'transparent' }}>in</Text>
|
|
|
|
|
|
</View>
|
|
|
}
|
|
|
- return <View className="metric_value_bg" onClick={() => props.onClickDetail()}>
|
|
|
+ return <View className="metric_value_bg" style={{ backgroundColor: user.is_debug ? 'red' : 'transparent' }} onClick={() => props.onClickDetail()}>
|
|
|
{
|
|
|
- props.valueView ? props.valueView : <Text className="metric_value">{props.value}</Text>
|
|
|
+ props.valueView ? props.valueView : <Text className="metric_value" style={{ backgroundColor: user.is_debug ? 'blue' : 'transparent' }}>{props.value}</Text>
|
|
|
}
|
|
|
{
|
|
|
- !props.valueView && <Text className="metric_unit" style={{ marginBottom: 3 }}>{props.unit}</Text>
|
|
|
+ !props.valueView && <Text className="metric_unit" style={{ backgroundColor: user.is_debug ? 'gray' : 'transparent' }}>{props.unit}</Text>
|
|
|
}
|
|
|
</View>
|
|
|
}
|