diff --git a/docker/nginx-yun.conf b/docker/nginx-yun.conf index b62c73a..42dec47 100644 --- a/docker/nginx-yun.conf +++ b/docker/nginx-yun.conf @@ -57,6 +57,14 @@ http { add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type,Authorization,Origin,source-client' always; # 缓存时间 add_header 'Access-Control-Max-Age' 1728000 always; + # 安全头部 + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + + # 确保不会重定向到带端口的URL + add_header X-Forwarded-Host $host; + add_header X-Forwarded-Port 443; + add_header X-Forwarded-Proto https; # 预检请求的处理 if ($request_method = 'OPTIONS') { return 204; @@ -83,7 +91,7 @@ http { index index.html index.htm; # 正确的文件查找逻辑:所有路由都返回 index.html - try_files $uri $uri/ /todo/index.html; + try_files $uri $uri.html $uri/ /todo/index.html; # 安全头部 add_header X-Frame-Options "SAMEORIGIN" always; diff --git a/public/static/favicon.ico b/public/static/favicon.ico new file mode 100644 index 0000000..9bf720c Binary files /dev/null and b/public/static/favicon.ico differ diff --git a/public/static/pc-Web.jpg b/public/static/pc-Web.jpg new file mode 100644 index 0000000..2cf3e03 Binary files /dev/null and b/public/static/pc-Web.jpg differ diff --git a/public/背景19-1733751214093.jpg b/public/背景19-1733751214093.jpg deleted file mode 100644 index 5e40629..0000000 Binary files a/public/背景19-1733751214093.jpg and /dev/null differ diff --git a/src/app/task/drag/layout.tsx b/src/app/task/drag/layout.tsx index 14dcd0a..55c1b78 100644 --- a/src/app/task/drag/layout.tsx +++ b/src/app/task/drag/layout.tsx @@ -40,8 +40,8 @@ export default function Layout({children}: { children: React.ReactNode }) { data: {state: data.taskState,pid:pid,treeList:true,treeOrList:false,treeFilter:true}, sortList:[{property:"sort_no",direction:"ASC"}] } - if (data.expectedStartTime.length>0){ - const parse = JSON.parse(data.expectedStartTime); + if (data.expectedStartTime!.length>0){ + const parse = JSON.parse(data.expectedStartTime!); requestParam.data.expectedStartTimeStart=parse[0].value; requestParam.data.expectedStartTimeEnd=parse[1].value; } diff --git a/src/app/task/four/layout.tsx b/src/app/task/four/layout.tsx index 655064f..40729b4 100644 --- a/src/app/task/four/layout.tsx +++ b/src/app/task/four/layout.tsx @@ -30,10 +30,10 @@ export default function Layout({children}: { children: React.ReactNode }) { {name:'ALL-CHILD',value:"true",operateType: "ALL-CHILD"}, ); }else { - if (data.taskState.length>0){ + if (data.taskState && data.taskState.length>0){ leftUp.push({name:"state",value:data.taskState,operateType:"IN"}); } - if (data.expectedStartTime.length>0){ + if (data.expectedStartTime && data.expectedStartTime.length>0){ const parse = JSON.parse(data.expectedStartTime); leftUp.push(...parse); } diff --git a/src/app/task/layout.tsx b/src/app/task/layout.tsx index 92b86e0..2cd37c0 100644 --- a/src/app/task/layout.tsx +++ b/src/app/task/layout.tsx @@ -6,55 +6,120 @@ import dayjs from "dayjs"; import 'dayjs/locale/zh-cn'; import {ConfigProvider} from "antd"; import locale from "antd/locale/zh_CN"; +import {BackgroundProvider, useBackground} from "@/ui/BackgroundContext"; +import Cookies from "js-cookie"; -export default function Layout({children}: { children: React.ReactNode }) { +function BodyWithBackground({children}: { children: React.ReactNode }) { dayjs.locale('zh-cn'); - const [taskState, setTaskState] = React.useState('8,9,10') + // 背景色 start + const {backgroundColor} = useBackground(); + // 背景色 end + + // 查询参数获取 start + const { + taskState: taskStateCookies, taskTypeList: taskTypeListCookies, + refreshDataFlag: refreshDataFlagCookies, + expectedStartTime: expectedStartTimeCookies + } = JSON.parse(Cookies.get('platform-setting') || "{}") + console.log(taskStateCookies || '8,9,10',{taskStateCookies}) + const [taskState, setTaskState] = + React.useState(taskStateCookies ?? '8,9,10') + let expectStartTimeList = []; expectStartTimeList.push({'name': "expectedStartTime", 'value': dayjs().subtract(7, 'day'), 'operateType': ">="}); expectStartTimeList.push({'name': "expectedStartTime", 'value': dayjs().add(7, 'day'), 'operateType': "<"}) - const [expectedStartTime, setExpectedStartTime] = React.useState(JSON.stringify(expectStartTimeList)) - const [taskTypeList,setTaskTypeList] = React.useState(["0,1,2,3","4"]) - const [refreshDataFlag, setRefreshDataFlag] = React.useState(true) + const [expectedStartTime, setExpectedStartTime] = React.useState(JSON.stringify(expectedStartTimeCookies ?? expectStartTimeList)) + + const [taskTypeList, setTaskTypeList] = React.useState(taskTypeListCookies ?? ["0,1,2,3", "4"]) + + const [refreshDataFlag, setRefreshDataFlag] = React.useState(refreshDataFlagCookies || true) + + console.log('taskState,expectedStartTime,refreshDataFlag', taskState, expectedStartTime, refreshDataFlag) + // 查询参数获取 end + + // 设置参数 start + const updateCookies = (date: {}) => { + try { + const platform = Cookies.get('platform-setting'); + const currentSettings = platform ? JSON.parse(platform) : {}; + const updatedSettings = { + ...currentSettings, + ...date + }; + + Cookies.set('platform-setting', JSON.stringify(updatedSettings), { + expires: 365, // 1年有效期 + path: '/', + secure: process.env.NODE_ENV === 'production' + }); + } catch (error) { + console.error('获取设置失败:', error); + } + } + + // 设置参数 end function refreshData() { setRefreshDataFlag(!refreshDataFlag) } - console.log('taskState,expectedStartTime,refreshDataFlag', taskState, expectedStartTime, refreshDataFlag) + return ( + + + { + console.log({taskTypeList}) + setTaskState(taskState); + updateCookies({taskState}) + }} + setExpectedStartTime={(expectedStartTime) => { + console.log({taskTypeList}) + setExpectedStartTime(expectedStartTime); + updateCookies({updateCookies}); + }} + setTaskTypeList={(taskTypeList) => { + console.log({taskTypeList}) + setTaskTypeList(taskTypeList); + updateCookies({taskTypeList}); + }} + refreshData={refreshData}/> +
+ {children} +
+
+
+ ); +} + +export default function Layout({children}: { children: React.ReactNode }) { return ( - - - -
- {children} -
-
-
+ + {children} +
); } diff --git a/src/app/task/project/page.tsx b/src/app/task/project/page.tsx index e567371..1283a74 100644 --- a/src/app/task/project/page.tsx +++ b/src/app/task/project/page.tsx @@ -2,9 +2,7 @@ import TreeTablePro from "@/ui/task/project/TreeTablePro"; const Page: React.FC = () => { return ( - <> - ); }; diff --git a/src/components/ShareOption.tsx b/src/components/ShareOption.tsx index 1ebef67..30691f2 100644 --- a/src/components/ShareOption.tsx +++ b/src/components/ShareOption.tsx @@ -102,9 +102,9 @@ const ShareOption = (props: { taskId: string }) => { {buttonIndex == 1 &&
微信小程序二维码
- + + onClick={() => doDownload("/static/pc-Web.jpg", '微信小程序马上行计划管理.png')}>下载
小程序扫描二维码,有效期1天
diff --git a/src/components/TeamMember.tsx b/src/components/TeamMember.tsx index 9bb48ef..917869e 100644 --- a/src/components/TeamMember.tsx +++ b/src/components/TeamMember.tsx @@ -12,6 +12,7 @@ import { quitTeamAPI, removeTeamAPI } from "@/components/service/Share"; +import Cookies from "js-cookie"; const TeamMember = (props: { taskId: string, closeOpen?: () => void, reloadData?: () => void }) => { const [open, setOpen] = useState(false); @@ -54,7 +55,10 @@ const TeamMember = (props: { taskId: string, closeOpen?: () => void, reloadData? // 处理管理员数据 if (adminRes.data?.status?.success) { - const message = localStorage.getItem('user-message'); + let message = localStorage.getItem('user-message'); + if (!message){ + message = Cookies.get('user-message')||"" + } if (message) { try { const { username } = JSON.parse(message); diff --git a/src/lib/PlatformSettingModel.d.ts b/src/lib/PlatformSettingModel.d.ts new file mode 100644 index 0000000..1c83499 --- /dev/null +++ b/src/lib/PlatformSettingModel.d.ts @@ -0,0 +1,7 @@ +export interface PlatformSettingModel { + colorBgBase?:string, + taskState?:string, + expectedStartTime?:string, + refreshData?:boolean, + taskTypeList?:string[] +} \ No newline at end of file diff --git a/src/ui/BackgroundContext.tsx b/src/ui/BackgroundContext.tsx new file mode 100644 index 0000000..b3cee2c --- /dev/null +++ b/src/ui/BackgroundContext.tsx @@ -0,0 +1,72 @@ +// contexts/BackgroundContext.tsx +'use client'; + +import React, {createContext, useContext, useState, ReactNode} from 'react'; +import Cookies from "js-cookie"; + +interface BackgroundContextType { + backgroundColor: string; + setBackgroundColor: (color: string) => void; +} + +const BackgroundContext = createContext(undefined); + +// 导出 hook +export const useBackground = () => { + const context = useContext(BackgroundContext); + if (context === undefined) { + throw new Error('useBackground must be used within a BackgroundProvider'); + } + return context; +}; + +// 导出 Provider +interface BackgroundProviderProps { + children: ReactNode; +} + +export const BackgroundProvider: React.FC = ({children}) => { + + + const [backgroundColor, setBackgroundColor] = useState(() => { + try { + const platform = Cookies.get('platform-setting'); + if (!platform) return '#fff'; + + const settings = JSON.parse(platform); + return settings?.colorBgBase || '#fff'; + + } catch (error) { + console.error('获取设置失败:', error); + return '#fff'; // 确保有默认值 + } + }); + + const setBackgroundColorCookies = (color: string) => { + setBackgroundColor(color) + try { + const platform = Cookies.get('platform-setting'); + const currentSettings = platform ? JSON.parse(platform) : {}; + + const updatedSettings = { + ...currentSettings, + colorBgBase: color + }; + + Cookies.set('platform-setting', JSON.stringify(updatedSettings), { + expires: 365, // 1年有效期 + path: '/', + secure: process.env.NODE_ENV === 'production' + }); + } catch (error) { + console.error('获取设置失败:', error); + } + } + + + return ( + + {children} + + ); +}; \ No newline at end of file diff --git a/src/ui/LocalContent.tsx b/src/ui/LocalContent.tsx index e21f867..4c110c1 100644 --- a/src/ui/LocalContent.tsx +++ b/src/ui/LocalContent.tsx @@ -1,6 +1,6 @@ import React from 'react'; +import {PlatformSettingModel} from "@/lib/PlatformSettingModel"; -const LocalContext = React.createContext({'taskState':'','expectedStartTime':'','refreshData':true, -'taskTypeList':[""]}); +const LocalContext = React.createContext({}); export default LocalContext; diff --git a/src/ui/login/XcxLoginPage.tsx b/src/ui/login/XcxLoginPage.tsx index 5bd5a1f..fc2b1fa 100644 --- a/src/ui/login/XcxLoginPage.tsx +++ b/src/ui/login/XcxLoginPage.tsx @@ -10,6 +10,7 @@ import {LoginObject} from "@/lib/login/definitions"; import {useRouter} from 'next/navigation' import {v4 as uuidv4} from 'uuid'; import {askLoginAPI, generateQrcodeAPI} from "@/lib/login/service"; +import Cookies from "js-cookie"; // import Cookies from "js-cookie"; export default function XcxLoginPage() { @@ -81,6 +82,11 @@ export default function XcxLoginPage() { localStorage.setItem('user-message', JSON.stringify(res.data.data[0],(key, value) => { return key === 'password' ? undefined : value; })) + Cookies.set('platform-security', res.data.data[0].token,{ + expires: 365, // 1年有效期 + path: '/', + secure: process.env.NODE_ENV === 'production' + }) // 删除名为 'platform-security' 的Cookie // Cookies.remove('platform-security'); // 设置一个有效期为7天的Cookie @@ -148,7 +154,7 @@ export default function XcxLoginPage() { { qrCodeShow ? : - + }
: } diff --git a/src/ui/task/TitleOperation.tsx b/src/ui/task/TitleOperation.tsx index 58c60e1..1431c3d 100644 --- a/src/ui/task/TitleOperation.tsx +++ b/src/ui/task/TitleOperation.tsx @@ -1,6 +1,17 @@ 'use client' import React, {Fragment, useContext, useEffect, useState} from "react"; -import {Button, Checkbox, CheckboxOptionType, DatePicker, MenuProps, message, Popconfirm, Select, Space} from "antd"; +import { + Button, + Checkbox, + CheckboxOptionType, + ColorPicker, + DatePicker, + MenuProps, + message, + Popconfirm, + Select, + Space +} from "antd"; import {usePathname, useRouter} from "next/navigation"; import {DetailModelForm} from "@/ui/task/project/DetailModelForm"; import {deleteTask, OPERATION_BUTTON_TYPE, taskStateList} from "@/lib/task/project/data"; @@ -11,7 +22,12 @@ import dayjs, {Dayjs} from "dayjs"; import {useSearchParams} from "next/dist/client/components/navigation"; import Dropdown from "antd/es/dropdown/dropdown"; import {QuestionCircleOutlined} from "@ant-design/icons"; +import { theme } from 'antd'; +import type {Color} from "antd/es/color-picker/color"; +import {useBackground} from "@/ui/BackgroundContext"; +import Cookies from "js-cookie"; +const { useToken } = theme; interface TitleOperationProps { setTaskState: (value: string) => void; setTaskTypeList: (value: string[]) => void; @@ -28,16 +44,16 @@ export const TitleOperation: React.FC = ({ const {replace} = useRouter(); const searchParams = useSearchParams(); const pathname = usePathname(); - + const { token } = useToken(); const [pathParam, setPathParam] = useState(searchParams.toString()); const [pathName, setPathName] = useState(pathname); - + const { backgroundColor, setBackgroundColor } = useBackground(); console.log('usePathname()', pathname); console.log('useSearchParams()', searchParams.toString(), searchParams.get('pName'), searchParams.get('pid')); const data = useContext(LocalContext); const {RangePicker} = DatePicker; - const expectStartTimeParseResult: RequestDateType[] = data.expectedStartTime.length > 0 ? JSON.parse(data.expectedStartTime) : [undefined, undefined] + const expectStartTimeParseResult: RequestDateType[] = data.expectedStartTime!.length > 0 ? JSON.parse(data.expectedStartTime!) : [undefined, undefined] expectStartTimeParseResult.map(item => item && item.value ? dayjs(item.value.toString()) : undefined) const defaultExpectStartTime: [start: Dayjs | null | undefined, end: Dayjs | null | undefined] = [ expectStartTimeParseResult[0] && expectStartTimeParseResult[0].value ? dayjs(expectStartTimeParseResult[0].value.toString()) : undefined, @@ -62,6 +78,9 @@ export const TitleOperation: React.FC = ({ useEffect(() => { let userMessage = localStorage.getItem('user-message'); + if (!userMessage){ + userMessage = Cookies.get('user-message')||"" + } if (userMessage) { let parse = JSON.parse(userMessage); setNickName(parse.nickname) @@ -79,6 +98,16 @@ export const TitleOperation: React.FC = ({ } }; + const changeBackGroundColor = (value: Color, hex: string) =>{ + console.log({value},{hex},value.toHexString()) + // setBackgroundColor(typeof value === 'string' ? value : value!.toHexString()) + setBackgroundColor(value.toHexString()) + } + + const clearBackGroundColor = ()=>{ + setBackgroundColor("#fff") + } + const items: MenuProps['items'] = [ { label: = ({ >退出登录, key: '1', }, + { + label: + 背景 + , + key:3 + }, ]; const itemsPid: MenuProps['items'] = [ { @@ -110,14 +147,23 @@ export const TitleOperation: React.FC = ({ >退出登录, key: '1', }, + { + label: + 背景 + , + key:3 + }, { label: '从顶级任务查看', key: '2', }, ]; - return
- + return
+ { @@ -163,7 +209,7 @@ export const TitleOperation: React.FC = ({ allowClear style={{minWidth: '100px'}} placeholder="任务状态" - defaultValue={data.taskState != '' && data.taskState.split(",").length > 0 ? data.taskState.split(",") : []} + defaultValue={data.taskState != '' && data.taskState!.split(",").length > 0 ? data.taskState!.split(",") : []} onChange={(value) => { console.log('onChange', {value}) if (value.length == 0) { diff --git a/src/ui/task/calendar/CalShow.tsx b/src/ui/task/calendar/CalShow.tsx index 0d091db..a534951 100644 --- a/src/ui/task/calendar/CalShow.tsx +++ b/src/ui/task/calendar/CalShow.tsx @@ -315,7 +315,7 @@ const CalShow: React.FC = () => { if (existing !== undefined && filtered !== undefined) { result = [...filtered, {...existing, state: "7"}]; } - let strings = state == "" ? [] : state.split(","); + let strings = !state||state == "" ? [] : state.split(","); console.log('result', result, strings) return result.filter((ev: TaskEvent) => !ev.state || strings.length == 0 || strings.indexOf(ev.state.toString()) >= 0); }) diff --git a/src/ui/task/drag/DroppableTable.tsx b/src/ui/task/drag/DroppableTable.tsx index ed21953..8c0186b 100644 --- a/src/ui/task/drag/DroppableTable.tsx +++ b/src/ui/task/drag/DroppableTable.tsx @@ -2,7 +2,7 @@ import React, {CSSProperties} from "react"; import {Draggable, Droppable} from "react-beautiful-dnd"; -import {ConfigProvider, Tooltip} from "antd"; +import {ConfigProvider, theme, Tooltip} from "antd"; import {DataType} from "@/lib/definitions"; import './index.modules.css' import dayjs from "dayjs"; @@ -21,6 +21,8 @@ interface DroppableTableProps { } export const DroppableTable = React.memo((props: DroppableTableProps) => { + const { useToken } = theme; + const { token } = useToken(); const stateName = React.useMemo(() => { switch (props.tableCode) { case '0': @@ -38,7 +40,7 @@ export const DroppableTable = React.memo((props: DroppableTableProps) => { const getItemStyle = React.useCallback((isDragging: boolean, draggableStyle: any): CSSProperties => ({ userSelect: "none", - background: isDragging ? "lightgreen" : "white", + background: isDragging ? "lightgreen" : token.colorBgBase, position: 'relative', zIndex: isDragging ? 2147483647 : 'auto', ...draggableStyle, @@ -47,13 +49,13 @@ export const DroppableTable = React.memo((props: DroppableTableProps) => { verticalAlign: 'middle', textAlign: 'center', borderColor:taskPriorityList.find((item) => item.code === props.tableCode)?.color - }), []); + }), [token]); const getListStyle = React.useCallback((isDraggingOver: boolean) => ({ - background: isDraggingOver ? "lightblue" : "white", + background: isDraggingOver ? "lightblue" : token.colorBgBase, height: 'calc((100vh - 42px)/2)', width: '50vw' - }), []); + }), [token]); const headerStyle = React.useMemo(() => ({ backgroundColor: taskPriorityList.find((item) => item.code === props.tableCode)?.color, diff --git a/src/ui/task/drag/TreeTable.tsx b/src/ui/task/drag/TreeTable.tsx index 5be6669..97374fc 100644 --- a/src/ui/task/drag/TreeTable.tsx +++ b/src/ui/task/drag/TreeTable.tsx @@ -61,16 +61,16 @@ const TreeTable: React.FC = (props) => { dataIndex: 'state', width: '10%', key: 'state', - filtered: checkLocal&&dataLocalContext.taskState.length > 0, - defaultFilteredValue: dataLocalContext.taskState.split(','), + filtered: checkLocal&&dataLocalContext.taskState!.length > 0, + defaultFilteredValue: dataLocalContext.taskState!.split(','), onFilter: (text, record) => { // console.log('&record.priority.toString()===props.priority',record.priority,text,props.priority) // &record.priority.toString()===props.priority 不重要紧急 0 0 - if (dataLocalContext.taskState.length === 0) { + if (dataLocalContext.taskState!.length === 0) { return true; } - var dataLocalContextTaskStateList = dataLocalContext.taskState.split(","); - console.log('dataLocalContextTaskStateList', dataLocalContext.taskState.length > 0, dataLocalContextTaskStateList); + var dataLocalContextTaskStateList = dataLocalContext.taskState!.split(","); + console.log('dataLocalContextTaskStateList', dataLocalContext.taskState!.length > 0, dataLocalContextTaskStateList); return taskStateList.filter(taskState => dataLocalContextTaskStateList.includes(taskState.code)) .find(taskState => taskState.name === record.state) != undefined; } @@ -100,14 +100,14 @@ const TreeTable: React.FC = (props) => { dataIndex: 'expectedStartTime', width: '10%', key: 'expectedStartTime', - filtered: checkLocal&&dataLocalContext.expectedStartTime.length > 0, + filtered: checkLocal&&dataLocalContext.expectedStartTime!.length > 0, // defaultFilteredValue: JSON.parse(dataLocalContext.expectedStartTime), onFilter: (text, record) => { console.log('dataLocalContext.expectedStartTime',dataLocalContext.expectedStartTime) - if (dataLocalContext.expectedStartTime.length === 0) { + if (dataLocalContext.expectedStartTime!.length === 0) { return true; } - const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime); + const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime!); console.log('expectStartTimeParseResult',expectStartTimeParseResult) if (expectStartTimeParseResult[0]!=undefined){ let le:boolean; @@ -155,10 +155,10 @@ const TreeTable: React.FC = (props) => { resultDataType.action= - if (dataLocalContext.expectedStartTime.length === 0) { + if (dataLocalContext.expectedStartTime!.length === 0) { return true; } - const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime); + const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime!); if (expectStartTimeParseResult[0]!=undefined){ let le:boolean; if (expectStartTimeParseResult[0].operateType==='<='){ diff --git a/src/ui/task/four/TreeTable.tsx b/src/ui/task/four/TreeTable.tsx index 15e511a..8c177f4 100644 --- a/src/ui/task/four/TreeTable.tsx +++ b/src/ui/task/four/TreeTable.tsx @@ -62,16 +62,16 @@ const TreeTable: React.FC = (props) => { dataIndex: 'state', width: '10%', key: 'state', - filtered: checkLocal&&dataLocalContext.taskState.length > 0, - defaultFilteredValue: dataLocalContext.taskState.split(','), + filtered: checkLocal&&dataLocalContext.taskState!.length > 0, + defaultFilteredValue: dataLocalContext.taskState!.split(','), onFilter: (text, record) => { // console.log('&record.priority.toString()===props.priority',record.priority,text,props.priority) // &record.priority.toString()===props.priority 不重要紧急 0 0 - if (dataLocalContext.taskState.length === 0) { + if (dataLocalContext.taskState!.length === 0) { return true; } - var dataLocalContextTaskStateList = dataLocalContext.taskState.split(","); - console.log('dataLocalContextTaskStateList', dataLocalContext.taskState.length > 0, dataLocalContextTaskStateList); + var dataLocalContextTaskStateList = dataLocalContext.taskState!.split(","); + console.log('dataLocalContextTaskStateList', dataLocalContext.taskState!.length > 0, dataLocalContextTaskStateList); return taskStateList.filter(taskState => dataLocalContextTaskStateList.includes(taskState.code)) .find(taskState => taskState.name === record.state) != undefined; }, @@ -101,14 +101,14 @@ const TreeTable: React.FC = (props) => { dataIndex: 'expectedStartTime', width: '13%', key: 'expectedStartTime', - filtered: checkLocal&&dataLocalContext.expectedStartTime.length > 0, + filtered: checkLocal&&dataLocalContext.expectedStartTime!.length > 0, // defaultFilteredValue: JSON.parse(dataLocalContext.expectedStartTime), onFilter: (text, record) => { console.log('dataLocalContext.expectedStartTime',dataLocalContext.expectedStartTime) - if (dataLocalContext.expectedStartTime.length === 0) { + if (dataLocalContext.expectedStartTime!.length === 0) { return true; } - const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime); + const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime!); console.log('expectStartTimeParseResult',expectStartTimeParseResult) if (expectStartTimeParseResult[0]!=undefined){ let le:boolean; @@ -169,10 +169,10 @@ const TreeTable: React.FC = (props) => { resultDataType.action= - if (dataLocalContext.expectedStartTime.length === 0) { + if (dataLocalContext.expectedStartTime!.length === 0) { return true; } - const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime); + const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime!); if (expectStartTimeParseResult[0]!=undefined){ let le:boolean; if (expectStartTimeParseResult[0].operateType==='<='){ diff --git a/src/ui/task/project/TreeTablePro.tsx b/src/ui/task/project/TreeTablePro.tsx index bb6e786..011f567 100644 --- a/src/ui/task/project/TreeTablePro.tsx +++ b/src/ui/task/project/TreeTablePro.tsx @@ -22,6 +22,7 @@ import {useSearchParams} from "next/navigation"; import {TaskWebSelectVO} from "@/lib/task/project/definitions"; import TaskNameAndIcon from "@/components/TaskNameAndIcon"; import {copyToClipboard} from "@/lib/copyToClipboard"; +import LocalContext from "@/ui/LocalContent"; const TreeTablePro: React.FC = (props: { joinId?: string }) => { // 刷新表格 @@ -33,6 +34,7 @@ const TreeTablePro: React.FC = (props: { joinId?: string }) => { // 页码信息 const [current, setCurrent] = React.useState(1); const [pageSize, setPageSize] = React.useState(10); + const {taskState: state} = useContext(LocalContext); // 获取路径参数pid const pathPid = useSearchParams().get('pid'); const pid = pathPid ? pathPid : '0'; @@ -111,9 +113,9 @@ const TreeTablePro: React.FC = (props: { joinId?: string }) => { dataIndex: 'state', valueType: 'select', order: 3, - initialValue: ['8', '9'], + initialValue: state =="" ?undefined:state!.split(','), fieldProps: { - defaultValue: ['8', '9'], + defaultValue: state =="" ?undefined:state!.split(','), mode: "tags", options: taskStateList.map(item => { return {label: item.name, value: item.code} diff --git a/src/utils/axiosReq.ts b/src/utils/axiosReq.ts index 7799e55..6b63162 100644 --- a/src/utils/axiosReq.ts +++ b/src/utils/axiosReq.ts @@ -1,6 +1,7 @@ import axios, {AxiosInterceptorOptions, CancelTokenSource} from "axios"; import {message} from "antd"; import {refreshTokenAPI} from "@/lib/login/service"; +import Cookies from "js-cookie"; export const httpReq = axios.create({ @@ -21,7 +22,10 @@ httpReq.defaults.headers.common['Accept'] = 'application/json'; httpReq.interceptors.request.use((config) => { console.log("config.url", config.url) // 从本地存储中获取 token - const token = localStorage.getItem('platform-security'); + let token = localStorage.getItem('platform-security'); + if (!token){ + token=Cookies.get("platform-security")||"" + } if (token) { config.headers.Authorization = `Bearer ${token}`; if (config.url && config.url.indexOf("refreshToken") == -1 && @@ -76,6 +80,11 @@ function reduceToken(token: string) { refreshTokenAPI().then(res => { if (res.data.status.success) { localStorage.setItem('platform-security', res.data.data) + Cookies.set('platform-security', res.data.data,{ + expires: 365, // 1年有效期 + path: '/', + secure: process.env.NODE_ENV === 'production' + }) } }) } diff --git a/tsconfig.json b/tsconfig.json index b046be4..ae54618 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,7 +32,8 @@ "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", - "docker/out/types/**/*.ts" + "docker/out/types/**/*.ts", + "docker/outd/types/**/*.ts" ], "exclude": [ "node_modules" diff --git a/可能用到的技术栈.md b/开发记录/可能用到的技术栈.md similarity index 87% rename from 可能用到的技术栈.md rename to 开发记录/可能用到的技术栈.md index f8753fd..73c9f9b 100644 --- a/可能用到的技术栈.md +++ b/开发记录/可能用到的技术栈.md @@ -1,6 +1,4 @@ # 可能用到的技术栈 -## Next -https://nextjs.org/docs/app/api-reference/cli/next#next-build-options ## 面向开发者的 Web 技术 https://developer.mozilla.org/zh-CN/docs/Web/API/Window/scrollX ## 富文本 diff --git a/开发记录/开发记录.md b/开发记录/开发记录.md new file mode 100644 index 0000000..37424eb --- /dev/null +++ b/开发记录/开发记录.md @@ -0,0 +1,17 @@ +## next +https://nextjs.org/docs/app/guides/static-exports + +## ant定制主题 +https://ant.design/docs/react/customize-theme-cn +https://ant.design/theme-editor-cn#Color +## react-big-calendar +演示 +https://jquense.github.io/react-big-calendar/examples/index.html?path=/docs/about-big-calendar--page +github +https://github.com/jquense/react-big-calendar +## LunarCalendar +https://www.npmjs.com/package/lunar-calendar +https://github.com/zzyss86/LunarCalendar + +## umi +https://umijs.org/docs/introduce/faq \ No newline at end of file