From 664d902b779aa27f90969d9d13bd2fdbffaa79bc Mon Sep 17 00:00:00 2001 From: Jimmy Liow <18777396951@163.com> Date: Tue, 30 May 2023 16:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=EF=BC=9B=E5=A2=9E=E5=8A=A0=E6=9C=AA=E5=88=86=E9=85=8D=E5=AF=BC?= =?UTF-8?q?=E6=B8=B8=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/global.css | 5 +++++ src/views/Login.jsx | 2 +- src/views/reservation/Newest.jsx | 20 ++++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/assets/global.css b/src/assets/global.css index 327b392..c668291 100644 --- a/src/assets/global.css +++ b/src/assets/global.css @@ -5,6 +5,11 @@ background: rgba(255, 255, 255, 0.3); } +.reservation-highlight { + color: rgba(255, 255, 255, 1); + background-color: rgba(255, 0, 0, 0.6); +} + #error-page { display: flex; flex-direction: column; diff --git a/src/views/Login.jsx b/src/views/Login.jsx index 99db392..1dff00b 100644 --- a/src/views/Login.jsx +++ b/src/views/Login.jsx @@ -108,7 +108,7 @@ function Login() { }} > diff --git a/src/views/reservation/Newest.jsx b/src/views/reservation/Newest.jsx index 06468fd..a7aacda 100644 --- a/src/views/reservation/Newest.jsx +++ b/src/views/reservation/Newest.jsx @@ -3,7 +3,9 @@ import { useState, useEffect } from 'react'; import { observer } from "mobx-react"; import { toJS } from "mobx"; import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Radio, Modal, App, Select } from 'antd'; +import dayjs from "dayjs"; import { useStore } from '@/stores/StoreContext.js'; +import { formatDate, isEmpty } from "@/utils/commons"; import { DATE_PRESETS } from "@/config"; const { Title } = Typography; @@ -14,12 +16,19 @@ function Newest() { title: 'Reference number', dataIndex: 'referenceNumber', key: 'Reference number', - render: (text, record) => {text}, + render: (text, record) => { + const requiredHighlight = dayjs(record.arrivalDate).add(2, 'day').isBefore(dayjs(), 'day') && isEmpty(record.guide); + const linkClassName = requiredHighlight ? 'reservation-highlight' : ''; + return ( + {text} + ) + }, }, { title: 'Arrival date', dataIndex: 'arrivalDate', key: 'Arrival date', + render: (text, record) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD')), }, { title: 'Pax', @@ -34,7 +43,8 @@ function Newest() { { title: 'Res. sending date', key: 'Reservation date', - dataIndex: 'reservationDate' + dataIndex: 'reservationDate', + render: (text, record) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD')), }, { title: 'Guide', @@ -100,6 +110,12 @@ function Newest() { } }); + // console.info(dayjs('2023-5-27').add(3, 'day')); + // console.info(dayjs().isSame(dayjs('2023-5-27').add(3, 'day'), 'day')); + // console.info(dayjs().isBefore(dayjs('2023-5-27').add(3, 'day'), 'day')); + // console.info(dayjs('2023-5-28').add(3, 'day')); + // console.info(dayjs().isBefore(dayjs('2023-5-28').add(3, 'day'), 'day')); + useEffect (() => { if (location.search !== '?back') { // 第一页,未确认计划