|
|
@@ -20,6 +20,7 @@ export default function Component(props: any) {
|
|
|
const [isCheking, setIsChecking] = useState(false)
|
|
|
const [list, setList] = useState([])
|
|
|
const dispatch = useDispatch();
|
|
|
+ const [returnLoginData,setReturnLoginData] = useState(false)
|
|
|
// const [title, setTitle] = useState('打卡')
|
|
|
|
|
|
//未登录<->已登录 状态切换时,执行一次授权检查
|
|
|
@@ -40,6 +41,12 @@ export default function Component(props: any) {
|
|
|
|
|
|
function getCards() {
|
|
|
activityCards().then(res => {
|
|
|
+ if (user.isLogin){
|
|
|
+ setReturnLoginData(true)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ setReturnLoginData(false)
|
|
|
+ }
|
|
|
setList((res as any).cards)
|
|
|
})
|
|
|
}
|
|
|
@@ -246,6 +253,7 @@ export default function Component(props: any) {
|
|
|
list.map((item: any, index) => {
|
|
|
var value = '0'
|
|
|
var desc = ''
|
|
|
+ var unit = ''
|
|
|
if (item.latest_record) {
|
|
|
value = item.latest_record.items[0].value
|
|
|
if (item.latest_record.timestamp == 0) {
|
|
|
@@ -263,17 +271,22 @@ export default function Component(props: any) {
|
|
|
if (!allowRun) {
|
|
|
value = '0'
|
|
|
desc = '开启步数仅自己可见'
|
|
|
+ unit = ''
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ unit = '步'
|
|
|
}
|
|
|
|
|
|
- if (!user.isLogin){
|
|
|
+ if (!user.isLogin || !returnLoginData){
|
|
|
value = '未登录'
|
|
|
desc = '登录后可开启打卡'
|
|
|
+ unit = ''
|
|
|
}
|
|
|
|
|
|
return <MetricItem title={item.name}
|
|
|
// value={allowRun ? stepInfo ? (stepInfo as any).step : '' : '未开启'}
|
|
|
value={value}
|
|
|
- unit={allowRun ? '步' : ''}
|
|
|
+ unit={unit}
|
|
|
desc={desc}
|
|
|
btnText={btnTitle}
|
|
|
isDisabled={!isEnable}
|