|
@@ -24,8 +24,8 @@ export default function Component(props: { records: any[] }) {
|
|
|
|
|
|
|
|
}, [props.records])
|
|
}, [props.records])
|
|
|
|
|
|
|
|
- global.dimissSel = ()=>{
|
|
|
|
|
- setSelIndex([-1,-1])
|
|
|
|
|
|
|
+ global.dimissSel = () => {
|
|
|
|
|
+ setSelIndex([-1, -1])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function formateHourMinutes(timestamp: number) {
|
|
function formateHourMinutes(timestamp: number) {
|
|
@@ -80,18 +80,18 @@ export default function Component(props: { records: any[] }) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function changeUnit(index){
|
|
|
|
|
|
|
+ function changeUnit(index) {
|
|
|
var data = global.selMetricItem;
|
|
var data = global.selMetricItem;
|
|
|
var unit = data.schemas[0].unit_options[index].unit;
|
|
var unit = data.schemas[0].unit_options[index].unit;
|
|
|
const indexs = selIndex;
|
|
const indexs = selIndex;
|
|
|
var temps = JSON.parse(JSON.stringify(list))
|
|
var temps = JSON.parse(JSON.stringify(list))
|
|
|
var array = temps[indexs[0]]
|
|
var array = temps[indexs[0]]
|
|
|
var selItem = array.records[indexs[1]]
|
|
var selItem = array.records[indexs[1]]
|
|
|
- const {id} = selItem
|
|
|
|
|
- metricRecord(id,{show_unit:unit}).then(res=>{
|
|
|
|
|
|
|
+ const { id } = selItem
|
|
|
|
|
+ metricRecord(id, { show_unit: unit }).then(res => {
|
|
|
temps[indexs[0]].records[indexs[1]] = res
|
|
temps[indexs[0]].records[indexs[1]] = res
|
|
|
setList(temps)
|
|
setList(temps)
|
|
|
- setSelIndex([-1,-1])
|
|
|
|
|
|
|
+ setSelIndex([-1, -1])
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -146,10 +146,9 @@ export default function Component(props: { records: any[] }) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var lastYearStr = '2050年'
|
|
var lastYearStr = '2050年'
|
|
|
- return <View style={{ display: 'flex', flexDirection: 'column' }} onClick={()=>{setSelIndex([-1,-1])}}>
|
|
|
|
|
|
|
+ return <View style={{ display: 'flex', flexDirection: 'column' }} onClick={() => { setSelIndex([-1, -1]) }}>
|
|
|
{
|
|
{
|
|
|
user.test_user && <Text style={{ color: '#fff', position: 'absolute', right: 50, top: 0 }} onClick={() => {
|
|
user.test_user && <Text style={{ color: '#fff', position: 'absolute', right: 50, top: 0 }} onClick={() => {
|
|
|
- debugger
|
|
|
|
|
global.clearHistory()
|
|
global.clearHistory()
|
|
|
}}>删除全部</Text>
|
|
}}>删除全部</Text>
|
|
|
}
|
|
}
|
|
@@ -160,44 +159,27 @@ export default function Component(props: { records: any[] }) {
|
|
|
(list as any).map((item, index) => {
|
|
(list as any).map((item, index) => {
|
|
|
var showYear = lastYearStr != TimeFormatter.getYearByDate(item.date)
|
|
var showYear = lastYearStr != TimeFormatter.getYearByDate(item.date)
|
|
|
lastYearStr = TimeFormatter.getYearByDate(item.date)
|
|
lastYearStr = TimeFormatter.getYearByDate(item.date)
|
|
|
- return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
|
|
|
|
+ return <View style={{ display: 'flex', flexDirection: 'column', paddingBottom: index < list.length - 1 ? 0 : 80,zIndex:0 }}>
|
|
|
{
|
|
{
|
|
|
showYear && <Text className="year" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getYearByDate(item.date)}</Text>
|
|
showYear && <Text className="year" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getYearByDate(item.date)}</Text>
|
|
|
}
|
|
}
|
|
|
<Text className="operate_day" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getMonthAndDayByDate(item.date)}</Text>
|
|
<Text className="operate_day" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getMonthAndDayByDate(item.date)}</Text>
|
|
|
{
|
|
{
|
|
|
item.records.map((record, j) => {
|
|
item.records.map((record, j) => {
|
|
|
- return <RecordItem delete={() => deleteRecord(record)}>
|
|
|
|
|
|
|
+ return <View style={{ position: 'relative' }} key={j}><RecordItem delete={() => deleteRecord(record)}>
|
|
|
<View className="operate_item1" onClick={(e) => {
|
|
<View className="operate_item1" onClick={(e) => {
|
|
|
- if (process.env.TARO_ENV=='weapp'){
|
|
|
|
|
|
|
+ if (process.env.TARO_ENV == 'weapp') {
|
|
|
e.stopPropagation()
|
|
e.stopPropagation()
|
|
|
}
|
|
}
|
|
|
tapItem(index, j)
|
|
tapItem(index, j)
|
|
|
- }} style={{ position: 'relative' }}>
|
|
|
|
|
- {
|
|
|
|
|
- index == selIndex[0] && j == selIndex[1] && <View style={{ position: 'absolute', right: 20, zIndex: 1000000 }}>
|
|
|
|
|
- <View style={{ display: 'flex', flexDirection: 'column', position: 'absolute', top: 30, right: 0, backgroundColor: 'red' }}>
|
|
|
|
|
- {
|
|
|
|
|
- global.selMetricItem.schemas[0].unit_options.map((obj, k) => {
|
|
|
|
|
- return <View key={k * 1000} onClick={() => {
|
|
|
|
|
-
|
|
|
|
|
- changeUnit(k)
|
|
|
|
|
- setSelIndex([-1,-1])
|
|
|
|
|
- }}>
|
|
|
|
|
- <Text>{obj.unit}</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ }} style={{ position: 'relative', zIndex: 100 }}>
|
|
|
|
|
|
|
|
- </View>
|
|
|
|
|
- }
|
|
|
|
|
{
|
|
{
|
|
|
record.items[0].special == 'FT_IN' ?
|
|
record.items[0].special == 'FT_IN' ?
|
|
|
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-end' }}>
|
|
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-end' }}>
|
|
|
- <Text className="value" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{parseInt(record.items[0].value/12+'')}</Text>
|
|
|
|
|
|
|
+ <Text className="value" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{parseInt(record.items[0].value / 12 + '')}</Text>
|
|
|
<Text className="unit" style={{ marginBottom: 3, marginLeft: 3, marginRight: 3 }}>ft</Text>
|
|
<Text className="unit" style={{ marginBottom: 3, marginLeft: 3, marginRight: 3 }}>ft</Text>
|
|
|
- <Text className="value" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{record.items[0].value%12}</Text>
|
|
|
|
|
|
|
+ <Text className="value" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{record.items[0].value % 12}</Text>
|
|
|
<Text className="unit" style={{ marginBottom: 3, marginLeft: 3 }}>in</Text>
|
|
<Text className="unit" style={{ marginBottom: 3, marginLeft: 3 }}>in</Text>
|
|
|
</View> :
|
|
</View> :
|
|
|
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-end' }}>
|
|
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-end' }}>
|
|
@@ -208,7 +190,7 @@ export default function Component(props: { records: any[] }) {
|
|
|
{
|
|
{
|
|
|
record.type == 'basic' && record.items.length > 2 && <Text className="value">/{record.items[2].value}</Text>
|
|
record.type == 'basic' && record.items.length > 2 && <Text className="value">/{record.items[2].value}</Text>
|
|
|
}
|
|
}
|
|
|
- <Text className="unit" style={{ marginBottom: 3,marginLeft:3 }}>{record.type == 'composite' ? record.unit ? record.unit : '' : record.items[0].unit}</Text>
|
|
|
|
|
|
|
+ <Text className="unit" style={{ marginBottom: 3, marginLeft: 3 }}>{record.type == 'composite' ? record.unit ? record.unit : '' : record.items[0].unit}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -218,6 +200,44 @@ export default function Component(props: { records: any[] }) {
|
|
|
|
|
|
|
|
</View>
|
|
</View>
|
|
|
</RecordItem>
|
|
</RecordItem>
|
|
|
|
|
+ {
|
|
|
|
|
+ index == selIndex[0] && j == selIndex[1] &&
|
|
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column',zIndex:10000, position: 'absolute', alignItems: 'center', top: rpxToPx(125), left: 30 }}>
|
|
|
|
|
+ <Image src={require('@assets/images/pointer.png')} style={{ width: 32, height: 12, marginBottom: -2 }} />
|
|
|
|
|
+ <View style={{
|
|
|
|
|
+ backgroundColor: '#505050',
|
|
|
|
|
+ width: 82,
|
|
|
|
|
+ borderRadius: 12,
|
|
|
|
|
+ boxSizing: 'border-box',
|
|
|
|
|
+ flexDirection: 'column',
|
|
|
|
|
+ display: 'flex'
|
|
|
|
|
+ }}>
|
|
|
|
|
+ {
|
|
|
|
|
+ global.selMetricItem.schemas[0].unit_options.map((obj, k) => {
|
|
|
|
|
+ return <View key={k * 1000} style={{
|
|
|
|
|
+ height: 28,
|
|
|
|
|
+ display: 'flex',
|
|
|
|
|
+ flexDirection: 'row',
|
|
|
|
|
+ alignItems: 'center',
|
|
|
|
|
+ borderBottomWidth: 1,
|
|
|
|
|
+ borderBottomColor: k < global.selMetricItem.schemas[0].unit_options.length - 1 ? '#FFFFFF33' : 'transparent',
|
|
|
|
|
+ borderBottomStyle: 'solid'
|
|
|
|
|
+ }} onClick={() => {
|
|
|
|
|
+ changeUnit(k)
|
|
|
|
|
+ setSelIndex([-1, -1])
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <View style={{ width: 12 }} />
|
|
|
|
|
+ <Image style={{ width: 12, height: 9, marginRight: 7, opacity: record.items[0].unit == obj.unit ? 1 : 0 }} src={require('@assets/images/check_white.png')} />
|
|
|
|
|
+ <Text style={{ color: '#fff', fontSize: 12 }}>{obj.special == 'FT_IN' ? 'ft in' : obj.unit}</Text>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
</View>
|
|
</View>
|