diff --git a/src/pages/table-list/publisher/index.tsx b/src/pages/table-list/publisher/index.tsx index 4685a7c..d56c494 100644 --- a/src/pages/table-list/publisher/index.tsx +++ b/src/pages/table-list/publisher/index.tsx @@ -1,10 +1,12 @@ import type { ActionType, ProColumns, ProFormInstance } from '@ant-design/pro-components'; import { ModalForm, PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components'; +import { message, Typography } from 'antd'; import '@umijs/max'; import { Select } from 'antd'; import dayjs from 'dayjs'; -import React, { useRef, useState } from 'react'; +import React, { useCallback, useRef, useState } from 'react'; +const { Text } = Typography; import { TIME_FORMAT } from '@/constants/global'; import { getPublisherList, updatePublisherInfo } from '@/services/list'; @@ -35,12 +37,37 @@ const PRIORITY_OPTIONS = [ { label: '正常处理', value: 2 }, ]; +const COPY_TIMES = '__copy_times__'; +const COPY_EXP = '__copy_exp__'; const TableList: React.FC = () => { const [updateModalOpen, handleUpdateModalOpen] = useState(false); const [currentRow, setCurrentRow] = useState(); const actionRef = useRef(); const formRef = useRef(); + const handleCopy = useCallback(() => { + const storedTimes = localStorage.getItem(COPY_TIMES); + const copyExp = localStorage.getItem(COPY_EXP); + + const now = Date.now(); + let currentTimes = 0; + + if (!copyExp || now >= parseInt(copyExp, 10)) { + currentTimes = 1; + + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); + tomorrow.setHours(0, 0, 0, 0); + + localStorage.setItem(COPY_EXP, tomorrow.getTime().toString()); + } else { + currentTimes = parseInt(storedTimes || '0', 10) + 1; + } + + localStorage.setItem(COPY_TIMES, `${currentTimes}`); + message.success(`今天已复制${currentTimes}次`); + }, []); + const columns: ProColumns[] = [ { title: '发布人昵称', @@ -52,7 +79,17 @@ const TableList: React.FC = () => { title: '发布人ID', dataIndex: 'blPublisherId', valueType: 'textarea', - copyable: true, + render(blPublisherId) { + return ( + + {blPublisherId} + + ); + }, }, { title: '优先级',