diff --git a/src/pages/sampleComparison/index.tsx b/src/pages/sampleComparison/index.tsx index bfd1da2..6639e3a 100644 --- a/src/pages/sampleComparison/index.tsx +++ b/src/pages/sampleComparison/index.tsx @@ -76,8 +76,11 @@ export default () => { setBlueToothColorTwo('') setTime('') setTime('') + setData('') + setResult('') } const [data, setData] = useState('') + const [result, setResult] = useState('') const { fetchData } = productabsorbcontrast() const handTake = async () => { if (searchField.l1 === '') { @@ -99,7 +102,17 @@ export default () => { } const res = await fetchData(query) if (res.data) { - + setData(res.data) + let diffarray = [ + res.data.reddish && "偏红", + res.data.yellowish && "偏黄", + res.data.greenish && "偏绿", + res.data.bluish && "偏蓝", + res.data.whitish && "偏亮", + res.data.darker && "偏暗", + ]; + let resCont = diffarray.filter(item => item).join(","); + setResult(resCont) } } return ( @@ -155,8 +168,15 @@ export default () => { 测量结果 - {/* 不合格 */} - 合格 + { + (data as any).ciede_2000 >= 1 && + 不合格 + } + { + (data as any).ciede_2000 <= 1 && + 合格 + } + { data === '' && @@ -166,7 +186,14 @@ export default () => { data && 色差值: {(data as any).ciede_2000} - 无明显色差 + { + !(data as any).reddish && !(data as any).yellowish && !(data as any).greenish && !(data as any).bluish && !(data as any).whitish && !(data as any).darker && + 无明显色差 + } + { + result && + {result} + } }