|
@@ -64,10 +64,12 @@ export default function Component(props: any) {
|
|
|
setTriggered(true)
|
|
setTriggered(true)
|
|
|
console.log('get Cards')
|
|
console.log('get Cards')
|
|
|
metricCards().then(res => {
|
|
metricCards().then(res => {
|
|
|
|
|
+ Taro.stopPullDownRefresh()
|
|
|
setErrorPage(false)
|
|
setErrorPage(false)
|
|
|
setList((res as any).cards)
|
|
setList((res as any).cards)
|
|
|
setTriggered(false)
|
|
setTriggered(false)
|
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
|
|
|
+ Taro.stopPullDownRefresh()
|
|
|
if (list.length == 0) {
|
|
if (list.length == 0) {
|
|
|
setErrorPage(true)
|
|
setErrorPage(true)
|
|
|
}
|
|
}
|
|
@@ -249,7 +251,7 @@ export default function Component(props: any) {
|
|
|
(metricItem as any).schemas.map((item, index) => {
|
|
(metricItem as any).schemas.map((item, index) => {
|
|
|
array.push({
|
|
array.push({
|
|
|
code: item.code,
|
|
code: item.code,
|
|
|
- value: item.tempValue && item.tempValue.length > 0 ? item.tempValue : item.default_value
|
|
|
|
|
|
|
+ value: item.tempValue && item.tempValue > 0 ? item.tempValue : item.default_value
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
var params = {
|
|
var params = {
|
|
@@ -272,7 +274,8 @@ export default function Component(props: any) {
|
|
|
|
|
|
|
|
list.map((item, index) => {
|
|
list.map((item, index) => {
|
|
|
if ((item as any).code == (res as any).code) {
|
|
if ((item as any).code == (res as any).code) {
|
|
|
- (item as any).latest_record = (res as any).latest_record
|
|
|
|
|
|
|
+ (item as any).latest_record = (res as any).latest_record;
|
|
|
|
|
+ (item as any).schemas = (res as any).schemas;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
setList(JSON.parse(JSON.stringify(list)))
|
|
setList(JSON.parse(JSON.stringify(list)))
|
|
@@ -294,10 +297,12 @@ export default function Component(props: any) {
|
|
|
var unit = ''
|
|
var unit = ''
|
|
|
var value = '无记录'
|
|
var value = '无记录'
|
|
|
var desc = '记录解锁趋势'
|
|
var desc = '记录解锁趋势'
|
|
|
|
|
+ var showDetail = false;
|
|
|
if (item.latest_record) {
|
|
if (item.latest_record) {
|
|
|
unit = item.schemas[0].default_unit
|
|
unit = item.schemas[0].default_unit
|
|
|
value = getValues(item.latest_record.items)
|
|
value = getValues(item.latest_record.items)
|
|
|
desc = TimeFormatter.formatTimestamp(item.latest_record.timestamp)
|
|
desc = TimeFormatter.formatTimestamp(item.latest_record.timestamp)
|
|
|
|
|
+ showDetail = true
|
|
|
}
|
|
}
|
|
|
return <MetricItem title={item.name}
|
|
return <MetricItem title={item.name}
|
|
|
value={value}
|
|
value={value}
|
|
@@ -305,6 +310,7 @@ export default function Component(props: any) {
|
|
|
desc={desc}
|
|
desc={desc}
|
|
|
btnText={'记录'}
|
|
btnText={'记录'}
|
|
|
isDisabled={false}
|
|
isDisabled={false}
|
|
|
|
|
+ showDetail={showDetail}
|
|
|
themeColor={item.theme_color}
|
|
themeColor={item.theme_color}
|
|
|
onClickDetail={() => { goDetail(item) }}
|
|
onClickDetail={() => { goDetail(item) }}
|
|
|
onClick={() => { record(item) }}
|
|
onClick={() => { record(item) }}
|
|
@@ -320,10 +326,10 @@ export default function Component(props: any) {
|
|
|
|
|
|
|
|
// return showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()
|
|
// return showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()
|
|
|
|
|
|
|
|
- return <View style={{ display: 'flex', flex: 1, height: '100%' }}>
|
|
|
|
|
|
|
+ return <View style={{ position:'relative' }}>
|
|
|
<Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
|
|
<Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
|
|
|
title={t('page.metric.title')}
|
|
title={t('page.metric.title')}
|
|
|
- type={TemplateType.grid}
|
|
|
|
|
|
|
+ type={TemplateType.flex}
|
|
|
refresh={() => { getCards() }}
|
|
refresh={() => { getCards() }}
|
|
|
triggered={triggered}
|
|
triggered={triggered}
|
|
|
titleShowStyle={NaviBarTitleShowType.scrollToShow}
|
|
titleShowStyle={NaviBarTitleShowType.scrollToShow}
|
|
@@ -336,7 +342,7 @@ export default function Component(props: any) {
|
|
|
display: 'flex', flexDirection: 'column',
|
|
display: 'flex', flexDirection: 'column',
|
|
|
width: '100%', color: '#000'
|
|
width: '100%', color: '#000'
|
|
|
}}>
|
|
}}>
|
|
|
- <Text className='modal_title' style={{ color: (metricItem as any).theme_color }}>{props.title ? props.title : '测试标题 '}</Text>
|
|
|
|
|
|
|
+ <Text className='modal_title' style={{ color: (metricItem as any).theme_color }}>{(metricItem as any).name ? (metricItem as any).name : '测试标题 '}</Text>
|
|
|
<View style={{ position: 'relative' }}>
|
|
<View style={{ position: 'relative' }}>
|
|
|
{
|
|
{
|
|
|
(metricItem as any).schemas.map((item, index) => {
|
|
(metricItem as any).schemas.map((item, index) => {
|