diff --git a/src/pages-operate/file/index.vue b/src/pages-operate/file/index.vue index 6ede297..428f5e0 100644 --- a/src/pages-operate/file/index.vue +++ b/src/pages-operate/file/index.vue @@ -18,12 +18,13 @@ - + - - {{item.time}} - - + + {{ item.time }} + + {{item.depart.length > 19 ? item.depart.substring(0, 18) + '...': item.depart}} @@ -117,7 +118,11 @@ zdmc: formatSearchkey() }).then((res) => { if (res.success) { - list.value = [...list.value, ...formatObj(res.result.records, 'zdmc', 'updateTime2', 'zbbm', + const recordsWithColor = res.result.records.map(item => ({ + ...item, + color: DateDiff(item.updateTime2) // 假设 updateTime2 是时间字段 + })); + list.value = [...list.value, ...formatObj(recordsWithColor, 'zdmc', 'updateTime2', 'zbbm', 'sszd')] } loading = false @@ -151,7 +156,11 @@ flfgmc: formatSearchkey() }).then((res) => { if (res.success) { - list.value = [...list.value, ...formatObj(res.result.records, 'flfgmc', 'updateTime2', + const recordsWithColor = res.result.records.map(item => ({ + ...item, + color: DateDiff(item.updateTime2) // 假设 updateTime2 是时间字段 + })); + list.value = [...list.value, ...formatObj(recordsWithColor, 'flfgmc', 'updateTime2', 'fabubumen', 'mingcheng')] } loading = false @@ -187,6 +196,21 @@ list.value = [] getList(1) } + + const DateDiff = (time) => { + var today = new Date(); + time = new Date(time); + var days = parseInt((today - time) / 1000 / 60 / 60 / 24); //当前时间-更新时间 + if (days < 90) { //三个月内 + return '#ff0000'; // red + } else if (days > 90 && days < 180) { + return '#aa00ff'; // purple + } else if (days > 180 && days < 365) { + return '#00c861'; // green + } else { + return ''; // black + } + } onReachBottom(() => { if (loading) return @@ -238,11 +262,6 @@ display: flex; align-items: center; font-size: 12px; - color: #666; - - .meta-text { - margin-left: 4px; - } } } diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 472dec8..1b981c6 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -9,7 +9,7 @@