|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Text,ScrollView } from "@tarojs/components";
|
|
|
|
|
|
|
+import { View, Text, ScrollView } from "@tarojs/components";
|
|
|
import './Metric.scss'
|
|
import './Metric.scss'
|
|
|
import { setAuth } from "../hooks/werun";
|
|
import { setAuth } from "../hooks/werun";
|
|
|
import { useDidShow, useReady } from "@tarojs/taro";
|
|
import { useDidShow, useReady } from "@tarojs/taro";
|
|
@@ -8,12 +8,16 @@ import Taro from "@tarojs/taro";
|
|
|
import { activityCards, uploadSteps } from "@/services/trackSomething";
|
|
import { activityCards, uploadSteps } from "@/services/trackSomething";
|
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
|
import MetricItem from "./MetricItem";
|
|
import MetricItem from "./MetricItem";
|
|
|
|
|
+import Layout from '@/context/locales/layout'
|
|
|
import NoData from "@/components/NoData";
|
|
import NoData from "@/components/NoData";
|
|
|
import { ResultType, checkFail, checkRetry, checkStart, checkSuccess, resetStatus, setResult } from "@/store/action_results";
|
|
import { ResultType, checkFail, checkRetry, checkStart, checkSuccess, resetStatus, setResult } from "@/store/action_results";
|
|
|
import { uploadSessionKey } from "@/services/common";
|
|
import { uploadSessionKey } from "@/services/common";
|
|
|
import RequestType, { thirdPartRequest } from "@/services/thirdPartRequest";
|
|
import RequestType, { thirdPartRequest } from "@/services/thirdPartRequest";
|
|
|
|
|
+import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
|
|
|
|
|
+import { useTranslation } from "react-i18next";
|
|
|
|
|
|
|
|
export default function Component(props: any) {
|
|
export default function Component(props: any) {
|
|
|
|
|
+ const { t } = useTranslation()
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
|
const checkResult = useSelector((state: any) => state.checkResult);
|
|
const checkResult = useSelector((state: any) => state.checkResult);
|
|
|
const [allowRun, setAllowRun] = useState(false)
|
|
const [allowRun, setAllowRun] = useState(false)
|
|
@@ -78,7 +82,7 @@ export default function Component(props: any) {
|
|
|
}
|
|
}
|
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
|
setTriggered(false)
|
|
setTriggered(false)
|
|
|
- if (list.length==0){
|
|
|
|
|
|
|
+ if (list.length == 0) {
|
|
|
setErrorPage(true)
|
|
setErrorPage(true)
|
|
|
}
|
|
}
|
|
|
// console.log('请求超时')
|
|
// console.log('请求超时')
|
|
@@ -121,7 +125,7 @@ export default function Component(props: any) {
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
Taro.navigateTo({
|
|
Taro.navigateTo({
|
|
|
- url: '/pages/ChooseAuth'
|
|
|
|
|
|
|
+ url: '/pages/account/ChooseAuth'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -244,18 +248,18 @@ export default function Component(props: any) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- function goDetail() {
|
|
|
|
|
|
|
+ function goDetail(item) {
|
|
|
if (user.isLogin) {
|
|
if (user.isLogin) {
|
|
|
if (!allowRun) {
|
|
if (!allowRun) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
Taro.navigateTo({
|
|
Taro.navigateTo({
|
|
|
- url: '/pages/RecordsHistory?type=activity&refreshList=getCards'
|
|
|
|
|
|
|
+ url: '/pages/common/RecordsHistory?type=activity&refreshList=getCards&title='+item.name
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
Taro.navigateTo({
|
|
Taro.navigateTo({
|
|
|
- url: '/pages/ChooseAuth'
|
|
|
|
|
|
|
+ url: '/pages/account/ChooseAuth'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -371,7 +375,7 @@ export default function Component(props: any) {
|
|
|
btnText={btnTitle}
|
|
btnText={btnTitle}
|
|
|
isDisabled={!isEnable}
|
|
isDisabled={!isEnable}
|
|
|
themeColor={item.theme_color}
|
|
themeColor={item.theme_color}
|
|
|
- onClickDetail={goDetail}
|
|
|
|
|
|
|
+ onClickDetail={()=>{goDetail(item)}}
|
|
|
showBadge={showErrorBadge && checkResult.type == 'idle'}
|
|
showBadge={showErrorBadge && checkResult.type == 'idle'}
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
tapBtn()
|
|
tapBtn()
|
|
@@ -383,12 +387,20 @@ export default function Component(props: any) {
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return <ScrollView style={{ backgroundColor: '#000',flex:1 }} scrollY refresherEnabled={true}
|
|
|
|
|
- refresherThreshold={100} refresherBackground="#000"
|
|
|
|
|
- refresherDefaultStyle="white" onRefresherRefresh={getCards}
|
|
|
|
|
- refresherTriggered={triggered}>
|
|
|
|
|
- {showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
|
|
|
|
|
- </ScrollView>
|
|
|
|
|
|
|
+ // return <ScrollView style={{ backgroundColor: '#000',flex:1 }} scrollY refresherEnabled={true}
|
|
|
|
|
+ // refresherThreshold={100} refresherBackground="#000"
|
|
|
|
|
+ // refresherDefaultStyle="white" onRefresherRefresh={getCards}
|
|
|
|
|
+ // refresherTriggered={triggered}>
|
|
|
|
|
+ // {showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
|
|
|
|
|
+ // </ScrollView>
|
|
|
// return showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()
|
|
// return showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()
|
|
|
|
|
+ return <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
|
|
|
|
|
+ title={t('page.activity.title')}
|
|
|
|
|
+ type={TemplateType.grid}
|
|
|
|
|
+ refresh={() => { getCards() }}
|
|
|
|
|
+ triggered={triggered}
|
|
|
|
|
+ more={() => { getCards() }}
|
|
|
|
|
+ titleShowStyle={NaviBarTitleShowType.scrollToShow}
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
}
|
|
}
|