Compare commits
4 Commits
2cc85e67dc
...
5eaf84df48
Author | SHA1 | Date |
---|---|---|
|
5eaf84df48 | |
|
252b3f1478 | |
|
ae11147281 | |
|
34b85a177c |
|
@ -1,2 +1,2 @@
|
|||
NEXT_PUBLIC_TODO_REQUEST_URL=https://www.huaruyu.com/todo-server
|
||||
NEXT_PUBLIC_SECURITY_REQUEST_URL=https://www.huaruyu.com/security-server
|
||||
NEXT_PUBLIC_TODO_REQUEST_URL=/todoWeb
|
||||
NEXT_PUBLIC_SECURITY_REQUEST_URL=/securityWeb
|
|
@ -1,14 +1,15 @@
|
|||
```shell
|
||||
scp -r out/ shixiaohua@10.104.11.99:/home/shixiaohua/docker/todo-web
|
||||
scp -r cert/ shixiaohua@10.104.11.99:/home/shixiaohua/docker/todo-web
|
||||
scp nginx.conf shixiaohua@10.104.11.99:/home/shixiaohua/docker/todo-web
|
||||
scp Dockerfile shixiaohua@10.104.11.99:/home/shixiaohua/docker/todo-web
|
||||
scp -r out/ shixiaohua@10.104.11.101:/home/shixiaohua/docker/todo-web
|
||||
scp -r cert/ shixiaohua@10.104.11.101:/home/shixiaohua/docker/todo-web
|
||||
scp nginx.conf shixiaohua@10.104.11.101:/home/shixiaohua/docker/todo-web
|
||||
scp Dockerfile shixiaohua@10.104.11.101:/home/shixiaohua/docker/todo-web
|
||||
ssh shixiaohua@10.104.11.99
|
||||
```
|
||||
|
||||
|
||||
docker操作
|
||||
```shell
|
||||
scp nginx.conf shixiaohua@10.104.11.101:/home/shixiaohua/docker/todo-web
|
||||
docker stop task-manager-nginx
|
||||
docker rm task-manager-nginx
|
||||
docker rmi task-manager-nginx
|
||||
|
@ -30,4 +31,9 @@ docker run -d -p 3001:80 -p 3002:443 --network task-manager --restart unless-sto
|
|||
# 复制证书到云服务器
|
||||
scp -r cert/ root@121.36.71.28:/usr/local/software/nginx-1.28.0/
|
||||
|
||||
|
||||
scp -r out/ root@121.36.71.28:/usr/share/nginx/html
|
||||
|
||||
cp -rf ./* ../
|
||||
|
||||
```
|
|
@ -13,6 +13,11 @@ events {
|
|||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
limit_req_zone $binary_remote_addr zone=general_limit:10m rate=20r/s;
|
||||
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=5r/s;
|
||||
log_format blocked '$time_local|$remote_addr|$request|$status|$http_referer';
|
||||
|
||||
# HTTPS 服务器监听端口
|
||||
# 443
|
||||
# HTTP 服务器监听端口
|
||||
|
@ -67,7 +72,28 @@ http {
|
|||
try_files $uri $uri.html $uri/ =404;
|
||||
# try_files $uri $uri/ =404;
|
||||
}
|
||||
# 第二个页面的配置
|
||||
location /todo {
|
||||
# 关键配置:禁用重定向中的端口和绝对路径
|
||||
absolute_redirect off;
|
||||
port_in_redirect off;
|
||||
|
||||
# 指定根目录
|
||||
alias /usr/share/nginx/html/todo;
|
||||
index index.html index.htm;
|
||||
|
||||
# 正确的文件查找逻辑:所有路由都返回 index.html
|
||||
try_files $uri $uri/ /todo/index.html;
|
||||
|
||||
# 安全头部
|
||||
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;
|
||||
}
|
||||
# 第二个页面的配置
|
||||
location ^~ /mobile/ {
|
||||
# index index.html index.htm;
|
||||
|
@ -90,6 +116,9 @@ http {
|
|||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
|
||||
|
||||
location ^~ /security-server/ {
|
||||
# 预检请求的处理
|
||||
if ($request_method = 'OPTIONS') {
|
||||
|
@ -103,6 +132,20 @@ http {
|
|||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
|
||||
}
|
||||
location ^~ /securityWeb/ {
|
||||
# 预检请求的处理
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
# rewrite ^/security-server/(.*)$ /$1 break;
|
||||
proxy_pass http://localhost:8091/;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
|
||||
}
|
||||
location /task/ {
|
||||
# 预检请求的处理
|
||||
|
|
|
@ -13,6 +13,11 @@ events {
|
|||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
limit_req_zone $binary_remote_addr zone=general_limit:10m rate=20r/s;
|
||||
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=5r/s;
|
||||
log_format blocked '$time_local|$remote_addr|$request|$status|$http_referer';
|
||||
|
||||
# HTTPS 服务器监听端口
|
||||
# 443
|
||||
# HTTP 服务器监听端口
|
||||
|
@ -90,6 +95,19 @@ http {
|
|||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
location ^~ /todoWeb/ {
|
||||
# 预检请求的处理
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
# rewrite ^/todo-server/(.*)$ /$1 break;
|
||||
proxy_pass http://huayu-platform-todo:8092/;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
location ^~ /security-server/ {
|
||||
# 预检请求的处理
|
||||
if ($request_method = 'OPTIONS') {
|
||||
|
@ -103,6 +121,20 @@ http {
|
|||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
|
||||
}
|
||||
location ^~ /securityWeb/ {
|
||||
# 预检请求的处理
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
# rewrite ^/security-server/(.*)$ /$1 break;
|
||||
proxy_pass http://huayu-platform-security:8091/;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
|
||||
}
|
||||
location /task/ {
|
||||
# 预检请求的处理
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
const nextConfig = {
|
||||
// 核心配置:构建前清空输出目录
|
||||
cleanDistDir: true,
|
||||
basePath: isProduction ? "/todo" : '',
|
||||
// 静态文件前缀
|
||||
assetPrefix: isProduction ? "/todo" : '',
|
||||
// Middleware cannot be used with "output: export".
|
||||
output: 'export',
|
||||
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
|
||||
|
@ -7,11 +13,15 @@ const nextConfig = {
|
|||
|
||||
// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
|
||||
// skipTrailingSlashRedirect: true,
|
||||
|
||||
// Optional: Change the output directory `out` -> `dist`
|
||||
distDir: 'docker/out',
|
||||
distDir: 'docker/outd',
|
||||
// 严格模式下react-beautiful-dnd无法使用
|
||||
reactStrictMode:false,
|
||||
eslint: {
|
||||
// Warning: This allows production builds to successfully complete even if
|
||||
// your project has ESLint errors.
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"axios": "^1.6.8",
|
||||
"dayjs": "^1.11.13",
|
||||
"js-cookie": "^3.0.5",
|
||||
"lunar-calendar": "^0.1.4",
|
||||
"next": "14.2.29",
|
||||
"postcss": "8.4.31",
|
||||
"react": "^18",
|
||||
|
@ -4840,6 +4841,14 @@
|
|||
"node": "14 || >=16.14"
|
||||
}
|
||||
},
|
||||
"node_modules/lunar-calendar": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmmirror.com/lunar-calendar/-/lunar-calendar-0.1.4.tgz",
|
||||
"integrity": "sha512-5r87vbg5yg56z/jkf3A+Ur+ZggUTiJw1VATT9P7RELQgWcTNhfJ+OLkNYroSna6r65bMqyaAgapo9vRN40L75A==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/luxon": {
|
||||
"version": "3.4.4",
|
||||
"resolved": "https://registry.npmmirror.com/luxon/-/luxon-3.4.4.tgz",
|
||||
|
@ -11500,6 +11509,11 @@
|
|||
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.2.0.tgz",
|
||||
"integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q=="
|
||||
},
|
||||
"lunar-calendar": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmmirror.com/lunar-calendar/-/lunar-calendar-0.1.4.tgz",
|
||||
"integrity": "sha512-5r87vbg5yg56z/jkf3A+Ur+ZggUTiJw1VATT9P7RELQgWcTNhfJ+OLkNYroSna6r65bMqyaAgapo9vRN40L75A=="
|
||||
},
|
||||
"luxon": {
|
||||
"version": "3.4.4",
|
||||
"resolved": "https://registry.npmmirror.com/luxon/-/luxon-3.4.4.tgz",
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
"axios": "^1.6.8",
|
||||
"dayjs": "^1.11.13",
|
||||
"js-cookie": "^3.0.5",
|
||||
"lunar-calendar": "^0.1.4",
|
||||
"next": "14.2.29",
|
||||
"postcss": "8.4.31",
|
||||
"react": "^18",
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import type {Metadata} from "next";
|
||||
import "@/ui/globals.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "马上行计划管理",
|
||||
description: "马上行计划管理",
|
||||
};
|
||||
/**
|
||||
* Root Layout (Required)
|
||||
* @param children
|
||||
|
@ -20,7 +15,7 @@ export default function RootLayout({
|
|||
<head>
|
||||
<title>马上行计划管理</title>
|
||||
<link rel="icon" href="/favicon.ico"/>
|
||||
<script src="/static/iconfont.js"></script>
|
||||
<script src="/static/iconfont.js" async ></script>
|
||||
{/*FOUC,Flash of Unstyled Content*/}
|
||||
{/*<link rel="preload" href="https://cdn.jsdelivr.net/npm/antd/dist/antd.min.css" as="style"/>*/}
|
||||
{/*<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd/dist/antd.min.css"/>*/}
|
||||
|
|
|
@ -5,9 +5,9 @@ import {useEffect} from "react";
|
|||
export default function Home() {
|
||||
|
||||
const {replace} = useRouter();
|
||||
const pathName = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
useEffect(()=>{
|
||||
const pathName = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
console.log({pathName},{searchParams})
|
||||
if(localStorage.getItem('platform-security')){
|
||||
if (!pathName){
|
||||
|
@ -17,11 +17,13 @@ export default function Home() {
|
|||
}else {
|
||||
replace("/task/project")
|
||||
}
|
||||
}else if (pathName =="/"){
|
||||
replace("/task/project")
|
||||
}
|
||||
}else {
|
||||
replace("/login")
|
||||
}
|
||||
},[])
|
||||
},)
|
||||
dayjs.locale('zh-cn')
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col p-6">
|
||||
|
|
|
@ -30,7 +30,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
|||
const [spinning,setSpinning]=useState(false);
|
||||
useEffect(() => {
|
||||
selectData()
|
||||
}, [data])
|
||||
}, [data,pid])
|
||||
|
||||
function selectData() {
|
||||
setSpinning(true)
|
||||
|
|
|
@ -66,7 +66,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
|||
// @ts-ignore
|
||||
document.getElementById('tenLeft').style.fontSize = divHeight/6*4 + 'px';
|
||||
refreshDate()
|
||||
}, [useContext(LocalContext)]);
|
||||
}, [data]);
|
||||
return (
|
||||
<div>
|
||||
<div className='firstRow' style={{display: 'flex'}}>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import React from 'react';
|
||||
import {DateHeaderProps} from "react-big-calendar";
|
||||
import {lunarDateShow} from "@/utils/timeFormatUtil";
|
||||
|
||||
// 定义为 React 函数组件
|
||||
const CalHeader: React.FC<DateHeaderProps> = ({date, label, drilldownView, onDrillDown}) => {
|
||||
if (!drilldownView) {
|
||||
return <span>{label}</span>
|
||||
}
|
||||
return (
|
||||
<div className="rbc-button-link " style={{display: "flex", justifyContent: "space-between"}}
|
||||
onClick={onDrillDown}>
|
||||
<div>{label}</div>
|
||||
<div>{lunarDateShow(date)}</div>
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
export default CalHeader;
|
|
@ -1,5 +1,5 @@
|
|||
import {Button, Form, message, Popconfirm} from "antd";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import {
|
||||
ModalForm,
|
||||
ProFormDateTimeRangePicker,
|
||||
|
@ -17,7 +17,6 @@ import dayjs, {UnitTypeShort} from "dayjs";
|
|||
import {onceConsumerRead} from "@/utils/codeToReadName";
|
||||
import {betweenTime} from "@/utils/timeFormatUtil";
|
||||
import {QuestionCircleOutlined} from "@ant-design/icons";
|
||||
import {deleteTask} from "@/lib/task/project/data";
|
||||
|
||||
interface ClickRecordProps {
|
||||
openClickRecord?: boolean;
|
||||
|
@ -67,6 +66,7 @@ const ClickRecord: React.FC<ClickRecordProps> = ({
|
|||
form.setFieldsValue(data)
|
||||
}
|
||||
}, [recordId]);
|
||||
|
||||
return (
|
||||
|
||||
<ModalForm<TaskScheduleRecordForm>
|
||||
|
@ -139,8 +139,11 @@ const ClickRecord: React.FC<ClickRecordProps> = ({
|
|||
} else {
|
||||
await clickRecordAPI(values);
|
||||
}
|
||||
console.log("before reloadData")
|
||||
reloadData?.();
|
||||
console.log("after reloadData")
|
||||
// 然后在onFinish中使用
|
||||
setOpenClickRecord?.(false)
|
||||
reloadData?.()
|
||||
return true
|
||||
}catch (e){
|
||||
console.error(e)
|
||||
|
|
|
@ -159,7 +159,7 @@ const DiaryOption = (props: SelectDiary) => {
|
|||
})
|
||||
})
|
||||
setDiaryReduceList(returnResult.reverse());
|
||||
}, [diaryList, currentIndex]);
|
||||
}, [diaryList, currentIndex,props.taskId]);
|
||||
|
||||
const listRef = useRef<ListRef>(null);
|
||||
const onScroll = (e: React.UIEvent<HTMLElement, UIEvent>) => {
|
||||
|
|
|
@ -183,7 +183,7 @@ const CronGenerator: React.FC<CronGeneratorProps> = ({setCronFunction,setExpecte
|
|||
console.log({fullCronExpression})
|
||||
setCanReadCron(cronToChinese(fullCronExpression))
|
||||
}
|
||||
}, [fullCronExpression]);
|
||||
}, [fullCronExpression,cron]);
|
||||
|
||||
const onClickConfirmCron = () => {
|
||||
if (fullCronExpression) {
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
import {TaskMessage} from "@/lib/definitions";
|
||||
import React, {Fragment} from "react";
|
||||
import {SmileOutlined} from "@ant-design/icons";
|
||||
import {CopyOutlined, SmileOutlined} from "@ant-design/icons";
|
||||
import {copyToClipboard} from "@/lib/copyToClipboard";
|
||||
|
||||
const TaskNameAndIcon = (props: {task:TaskMessage}) => {
|
||||
const TaskNameAndIcon = (props: { task: TaskMessage }) => {
|
||||
return (<Fragment>
|
||||
<CopyOutlined onClick={(e) => {
|
||||
e.preventDefault(); // 阻止默认行为(如果有)
|
||||
e.stopPropagation(); // 阻止事件冒泡
|
||||
copyToClipboard(props.task.name)
|
||||
}}/>
|
||||
{props.task.fId &&
|
||||
<svg className="icon" aria-hidden="true">
|
||||
<use xlinkHref="#icon-tuandui"></use>
|
||||
|
@ -19,7 +25,7 @@ const TaskNameAndIcon = (props: {task:TaskMessage}) => {
|
|||
<use xlinkHref="#icon-dingshi"></use>
|
||||
</svg>
|
||||
}
|
||||
{props.task.taskType == '4' && <SmileOutlined className="icon"/>
|
||||
{props.task.taskType == '4' && <SmileOutlined className="icon"/>
|
||||
}
|
||||
<span>{props.task.name}</span>
|
||||
</Fragment>)
|
||||
|
|
|
@ -206,7 +206,7 @@ const TaskRemindComponent = (props: ITaskRemind) => {
|
|||
) : (
|
||||
props.remindTypeList.map((remindType, index) => (
|
||||
// <div key={index}>{remindType.split(",").join(", ")}</div>
|
||||
<Fragment>
|
||||
<Fragment key={remindType}>
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
components: {
|
||||
|
|
|
@ -103,7 +103,7 @@ const TeamMember = (props: { taskId: string, closeOpen?: () => void, reloadData?
|
|||
return () => {
|
||||
isMounted = false;
|
||||
};
|
||||
}, [open])
|
||||
}, [open,props.taskId])
|
||||
const removeTeam = (teamMember: TeamMemberVO) => {
|
||||
removeTeamAPI(teamMember).then(res => {
|
||||
if (res.data.status.success) {
|
||||
|
|
|
@ -13,5 +13,5 @@ export const askLoginAPI = (data:{}):Promise<AxiosResponse<ResponseVO<AskLoginRe
|
|||
}
|
||||
|
||||
export const refreshTokenAPI = ():Promise<AxiosResponse<ResponseVO<string>>> =>{
|
||||
return httpReq.get(process.env.NEXT_PUBLIC_SECURITY_REQUEST_URL + "/V2/wx/login/refreshToken")
|
||||
return httpReq.post(process.env.NEXT_PUBLIC_SECURITY_REQUEST_URL + "/V2/wx/login/refreshToken")
|
||||
}
|
|
@ -5,4 +5,5 @@ export interface TaskEvent extends Event {
|
|||
state?:any;
|
||||
taskType?:string;
|
||||
priority?:any;
|
||||
description?:string;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
declare module 'lunar-calendar' {
|
||||
export interface LunarDate {
|
||||
lunarYear: number;
|
||||
lunarMonth: number;
|
||||
lunarDay: number;
|
||||
zodiac: string;
|
||||
ganZhiYear: string;
|
||||
ganZhiMonth: string;
|
||||
ganZhiDay: string;
|
||||
lunarMonthName: string;
|
||||
lunarDayName: string;
|
||||
solarTerm: string;
|
||||
// 其他农历字段...
|
||||
// 二十四节气
|
||||
term:string;
|
||||
// 农历节日
|
||||
lunarFestival:string;
|
||||
// 公历节日
|
||||
solarFestival:string;
|
||||
}
|
||||
|
||||
export function solarToLunar(
|
||||
year: number,
|
||||
month: number,
|
||||
day: number
|
||||
): LunarDate;
|
||||
|
||||
// 其他可能的方法...
|
||||
}
|
|
@ -118,7 +118,7 @@ class OperationButton extends React.Component<OperationButtonProps, OperationMod
|
|||
deleteTask(this.props.itemId).then((response => {
|
||||
console.log('response', response)
|
||||
if (response.status.success) {
|
||||
message.success("删除任务成功:" + response.data)
|
||||
message.success("删除任务成功")
|
||||
this.props.refreshDate?.()
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -52,7 +52,7 @@ const RightOption: React.FC<OperationButtonProps> = (props) => {
|
|||
deleteTask(props.itemId).then((response => {
|
||||
console.log('response', response)
|
||||
if (response.status.success) {
|
||||
message.success("删除任务成功:" + response.data)
|
||||
message.success("删除任务成功")
|
||||
props.refreshDate?.()
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
'use client'
|
||||
import React, {Fragment, useContext, useEffect, useState} from "react";
|
||||
import {Button, Checkbox, CheckboxOptionType, DatePicker, MenuProps, message, Select, Space} from "antd";
|
||||
import {Button, Checkbox, CheckboxOptionType, DatePicker, MenuProps, message, Popconfirm, Select, Space} from "antd";
|
||||
import {usePathname, useRouter} from "next/navigation";
|
||||
import {DetailModelForm} from "@/ui/task/project/DetailModelForm";
|
||||
import {OPERATION_BUTTON_TYPE, taskStateList} from "@/lib/task/project/data";
|
||||
import {deleteTask, OPERATION_BUTTON_TYPE, taskStateList} from "@/lib/task/project/data";
|
||||
import style from '@/ui/task/TitleOperation.module.css'
|
||||
import LocalContext from "@/ui/LocalContent";
|
||||
import {RequestDateType} from "@/ui/task/RequestDateType";
|
||||
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";
|
||||
|
||||
interface TitleOperationProps {
|
||||
setTaskState: (value: string) => void;
|
||||
|
@ -42,7 +43,7 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
|||
expectStartTimeParseResult[0] && expectStartTimeParseResult[0].value ? dayjs(expectStartTimeParseResult[0].value.toString()) : undefined,
|
||||
expectStartTimeParseResult[1] && expectStartTimeParseResult[1].value ? dayjs(expectStartTimeParseResult[1].value.toString()) : undefined
|
||||
];
|
||||
const [nickName,setNickName]=useState("微信用户")
|
||||
const [nickName, setNickName] = useState("微信用户")
|
||||
const typeList: CheckboxOptionType<string>[] = [
|
||||
{label: '计划', value: '0,1,2,3'},
|
||||
{label: '打卡', value: '4'},
|
||||
|
@ -61,7 +62,7 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
|||
|
||||
useEffect(() => {
|
||||
let userMessage = localStorage.getItem('user-message');
|
||||
if (userMessage){
|
||||
if (userMessage) {
|
||||
let parse = JSON.parse(userMessage);
|
||||
setNickName(parse.nickname)
|
||||
}
|
||||
|
@ -69,24 +70,44 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
|||
|
||||
const onClick: MenuProps['onClick'] = ({key}) => {
|
||||
if (key == "1") {
|
||||
localStorage.removeItem('platform-security')
|
||||
replace(`/login`)
|
||||
// localStorage.removeItem('platform-security')
|
||||
// replace(`/login`)
|
||||
} else if (key == "2") {
|
||||
replace(pathName)
|
||||
setPathParam(undefined)
|
||||
refreshData()
|
||||
// refreshData()
|
||||
}
|
||||
};
|
||||
|
||||
const items: MenuProps['items'] = [
|
||||
{
|
||||
label: '退出登录',
|
||||
label: <Popconfirm
|
||||
title="退出登录"
|
||||
description="确认要退出登录?"
|
||||
icon={<QuestionCircleOutlined style={{color: 'red'}}/>}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
onConfirm={() => {
|
||||
localStorage.removeItem('platform-security')
|
||||
replace(`/login`)
|
||||
}}
|
||||
><a>退出登录</a></Popconfirm>,
|
||||
key: '1',
|
||||
},
|
||||
];
|
||||
const itemsPid: MenuProps['items'] = [
|
||||
{
|
||||
label: '退出登录',
|
||||
label: <Popconfirm
|
||||
title="退出登录"
|
||||
description="确认要退出登录?"
|
||||
icon={<QuestionCircleOutlined style={{color: 'red'}}/>}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
onConfirm={() => {
|
||||
localStorage.removeItem('platform-security')
|
||||
replace(`/login`)
|
||||
}}
|
||||
><a>退出登录</a></Popconfirm>,
|
||||
key: '1',
|
||||
},
|
||||
{
|
||||
|
@ -142,16 +163,16 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
|||
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){
|
||||
console.log('onChange', {value})
|
||||
if (value.length == 0) {
|
||||
setTaskState("")
|
||||
}else {
|
||||
} else {
|
||||
setTaskState(value.join(','))
|
||||
}
|
||||
}}
|
||||
onClear={()=>{
|
||||
onClear={() => {
|
||||
console.log('onChange,点击了清除无效果')
|
||||
setTaskState("")
|
||||
}}
|
||||
|
@ -209,8 +230,8 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
|||
}
|
||||
</Space>
|
||||
<Dropdown menu={{items: pathParam ? itemsPid : items, onClick}}>
|
||||
<div style={{display:"flex", height: "32px", alignItems: "center"}}>
|
||||
<svg style={{ height: "32px",width: "32px",marginRight:"0.5rem" }} className="icon" aria-hidden="true">
|
||||
<div style={{display: "flex", height: "32px", alignItems: "center"}}>
|
||||
<svg style={{height: "32px", width: "32px", marginRight: "0.5rem"}} className="icon" aria-hidden="true">
|
||||
<use xlinkHref="#icon-user__easyico"></use>
|
||||
</svg>
|
||||
<span>{nickName}</span>
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
'use client'
|
||||
import React, {Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState} from "react";
|
||||
import {Calendar, dateFnsLocalizer, dayjsLocalizer, Event, SlotInfo, View} from 'react-big-calendar'
|
||||
import {
|
||||
Calendar,
|
||||
Culture,
|
||||
dateFnsLocalizer,
|
||||
DateLocalizer,
|
||||
dayjsLocalizer,
|
||||
Event,
|
||||
SlotInfo,
|
||||
View
|
||||
} from 'react-big-calendar'
|
||||
import dayjs, {Dayjs} from 'dayjs'
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import 'react-big-calendar/lib/css/react-big-calendar.css'
|
||||
|
@ -20,7 +29,11 @@ import {TaskWebSelectVO} from "@/lib/task/project/definitions";
|
|||
import {message, Modal, Spin} from "antd";
|
||||
import ClickRecord from "@/components/ClickRecord";
|
||||
import {editClickRecordRangeAPI} from "@/components/service/ScheduleTask";
|
||||
import {ExclamationCircleFilled, LoadingOutlined} from "@ant-design/icons";
|
||||
import {CopyOutlined, ExclamationCircleFilled, LoadingOutlined} from "@ant-design/icons";
|
||||
import {copyToClipboard} from "@/lib/copyToClipboard";
|
||||
import {solarToLunar} from "lunar-calendar";
|
||||
import CalHeader from "@/components/CalHeader";
|
||||
import {lunarDateShow} from "@/utils/timeFormatUtil";
|
||||
|
||||
const {confirm} = Modal;
|
||||
/**
|
||||
|
@ -28,6 +41,7 @@ const {confirm} = Modal;
|
|||
* @constructor
|
||||
*/
|
||||
const localizer = dayjsLocalizer(dayjs)
|
||||
|
||||
const DragAndDropCalendar = withDragAndDrop(Calendar)
|
||||
const CalShow: React.FC = () => {
|
||||
dayjs.locale('zh-cn')
|
||||
|
@ -64,7 +78,9 @@ const CalShow: React.FC = () => {
|
|||
expectedEndTime: range.end
|
||||
}
|
||||
})
|
||||
|
||||
const dateFormat = (date: Date, culture?: Culture, localizer?: DateLocalizer) => {
|
||||
return `${date.getDate()}/${lunarDateShow(date)}`;
|
||||
};
|
||||
const handleViewChange = (newView: View) => {
|
||||
setView(newView);
|
||||
};
|
||||
|
@ -75,19 +91,23 @@ const CalShow: React.FC = () => {
|
|||
clickRef && typeof clickRef.current === 'number' && !isNaN(clickRef.current) && isFinite(clickRef.current) && window.clearTimeout(clickRef.current)
|
||||
}
|
||||
|
||||
/**
|
||||
* 会触发范围变化
|
||||
* @param newDate
|
||||
*/
|
||||
const handleNavigate = (newDate: Date) => {
|
||||
console.log('handleNavigate', newDate)
|
||||
setDate(newDate);
|
||||
const searchList: SearchObject[] = []
|
||||
if (pid != null) {
|
||||
searchList.push({name: "pid", value: pid, operateType: "="},
|
||||
{name: 'ALL-CHILD', value: "true", operateType: "ALL-CHILD"},
|
||||
{name: 'TREE-FILTER', value: "true", operateType: "TREE-FILTER"},
|
||||
);
|
||||
searchObject.data.pid = pid
|
||||
setSearchObject({...searchObject})
|
||||
}
|
||||
loadData(searchList);
|
||||
// const searchList: SearchObject[] = []
|
||||
// if (pid != null) {
|
||||
// searchList.push({name: "pid", value: pid, operateType: "="},
|
||||
// {name: 'ALL-CHILD', value: "true", operateType: "ALL-CHILD"},
|
||||
// {name: 'TREE-FILTER', value: "true", operateType: "TREE-FILTER"},
|
||||
// );
|
||||
// searchObject.data.pid = pid
|
||||
// setSearchObject({...searchObject})
|
||||
// }
|
||||
// loadData();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -102,6 +122,10 @@ const CalShow: React.FC = () => {
|
|||
// );
|
||||
searchObject.data.pid = pid
|
||||
setSearchObject({...searchObject})
|
||||
} else {
|
||||
const {pid, ...search} = searchObject.data
|
||||
searchObject.data = search
|
||||
setSearchObject({...searchObject})
|
||||
}
|
||||
// searchListE.push({name: 'expectedStartTime', value: range.start, operateType: ">="})
|
||||
// searchListE.push({name: 'expectedStartTime', value: range.end, operateType: "<="})
|
||||
|
@ -115,7 +139,7 @@ const CalShow: React.FC = () => {
|
|||
return () => {
|
||||
clearClickTimeout()
|
||||
}
|
||||
}, [state, taskTypeList, refreshData, range]);
|
||||
}, [state, taskTypeList, refreshData, range, pid]);
|
||||
const calMessages = {
|
||||
week: '周',
|
||||
work_week: '工作周',
|
||||
|
@ -135,6 +159,7 @@ const CalShow: React.FC = () => {
|
|||
noEventsInRange: '暂无计划',
|
||||
}
|
||||
const loadData = (searchList?: SearchObject[]) => {
|
||||
console.log("loadData")
|
||||
setSpinning(true)
|
||||
searchObject.data.state = state
|
||||
searchObject.data.taskTypeList = taskTypeList
|
||||
|
@ -145,10 +170,19 @@ const CalShow: React.FC = () => {
|
|||
if (responseD.status.success) {
|
||||
let result: TaskEvent[] = responseD.data.content.map<TaskEvent>(taskState => {
|
||||
return {
|
||||
start: dayjs(taskState.expectedStartTime).toDate(),
|
||||
end: dayjs(taskState.expectedEndTime).toDate(),
|
||||
title: <Fragment><TaskNameAndIcon task={taskState}/>
|
||||
<div>{taskState.description}</div>
|
||||
start: taskState.expectedStartTime ? dayjs(taskState.expectedStartTime).toDate() : dayjs(taskState.expectedEndTime).startOf('day').toDate(),
|
||||
end: taskState.expectedEndTime ? dayjs(taskState.expectedEndTime).toDate() : dayjs(taskState.expectedStartTime).endOf('day').toDate(),
|
||||
title: <Fragment>
|
||||
<div>
|
||||
<TaskNameAndIcon task={taskState}/>
|
||||
</div>
|
||||
<div>
|
||||
{view != 'month' && taskState.description && <CopyOutlined onClick={(e) => {
|
||||
e.preventDefault(); // 阻止默认行为(如果有)
|
||||
e.stopPropagation(); // 阻止事件冒泡
|
||||
copyToClipboard(taskState.description)
|
||||
}}/>} {view != 'month' && taskState.description}
|
||||
</div>
|
||||
</Fragment>,
|
||||
// style: {
|
||||
// backgroundColor: 'green',
|
||||
|
@ -159,7 +193,8 @@ const CalShow: React.FC = () => {
|
|||
id: taskState.id,
|
||||
state: taskState.state,
|
||||
priority: taskState.priority,
|
||||
taskType: taskState.taskType
|
||||
taskType: taskState.taskType,
|
||||
description:taskState.description
|
||||
}
|
||||
});
|
||||
console.log('responseD.data.content:', result)
|
||||
|
@ -198,9 +233,13 @@ const CalShow: React.FC = () => {
|
|||
// }
|
||||
// })
|
||||
}
|
||||
/**
|
||||
* from表单使用,打卡记录新建使用
|
||||
*/
|
||||
const reloadData = () => {
|
||||
setOpen(false)
|
||||
handleNavigate(date)
|
||||
loadData();
|
||||
// handleNavigate(date)
|
||||
}
|
||||
const handleSelectSlot = useCallback(
|
||||
({start, end}: SlotInfo) => {
|
||||
|
@ -246,7 +285,7 @@ const CalShow: React.FC = () => {
|
|||
message.error("计划双击完成,非计划双击无效果。")
|
||||
return;
|
||||
}
|
||||
if (event.state=='7'){
|
||||
if (event.state == '7') {
|
||||
message.error("任务已经完成")
|
||||
return;
|
||||
}
|
||||
|
@ -276,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.split(",");
|
||||
console.log('result', result, strings)
|
||||
return result.filter((ev: TaskEvent) => !ev.state || strings.length == 0 || strings.indexOf(ev.state.toString()) >= 0);
|
||||
})
|
||||
|
@ -340,39 +379,49 @@ const CalShow: React.FC = () => {
|
|||
console.log("rangeChange:", rangeLet, (current ? current : view))
|
||||
// view 为天的时候类型为数组,index:0为当天
|
||||
if ((current ? current : view) === "day" && Array.isArray(rangeLet)) {
|
||||
if (range.start.valueOf() > rangeLet[0].valueOf()) {
|
||||
// setRange({...range, start: rangeLet[0]})
|
||||
range.start=rangeLet[0];
|
||||
} else if (range.end.valueOf() < rangeLet[0].valueOf()) {
|
||||
// setRange({...range, end: rangeLet[0]})
|
||||
range.end=rangeLet[0]
|
||||
}
|
||||
// if (range.start.valueOf() > rangeLet[0].valueOf()) {
|
||||
range.start = rangeLet[0];
|
||||
// }
|
||||
// if (range.end.valueOf() < rangeLet[0].valueOf()) {
|
||||
range.end = dayjs(rangeLet[0]).add(1, 'd').toDate()
|
||||
// }
|
||||
}
|
||||
// 为周的时候类型为数组,周一到周日七天
|
||||
if ((current ? current : view) === "week" && Array.isArray(rangeLet)) {
|
||||
if (range.start.valueOf() > rangeLet[0].valueOf()) {
|
||||
// setRange({...range, start: rangeLet[0]})
|
||||
range.start=rangeLet[0];
|
||||
}
|
||||
if (range.end.valueOf() < rangeLet[6].valueOf()) {
|
||||
// setRange({...range, end: rangeLet[6]})
|
||||
range.end=rangeLet[6]
|
||||
}
|
||||
// if (range.start.valueOf() > rangeLet[0].valueOf()) {
|
||||
range.start = rangeLet[0];
|
||||
// }
|
||||
// if (range.end.valueOf() < rangeLet[6].valueOf()) {
|
||||
range.end = dayjs(rangeLet[6]).add(1, 'd').toDate()
|
||||
// }
|
||||
}
|
||||
// 为月的时候类型为对象
|
||||
if ((current ? current : view) === "month" && rangeLet && !Array.isArray(rangeLet)) {
|
||||
if (range.start.valueOf() > rangeLet.start.valueOf()) {
|
||||
// setRange({...range, start: rangeLet.start})
|
||||
range.start = rangeLet.start
|
||||
}
|
||||
if (range.end.valueOf() < rangeLet.end.valueOf()) {
|
||||
// setRange({...range, end: rangeLet.end})
|
||||
range.end = rangeLet.end
|
||||
// if (range.start.valueOf() > rangeLet.start.valueOf()) {
|
||||
range.start = rangeLet.start
|
||||
// }
|
||||
// if (range.end.valueOf() < rangeLet.end.valueOf()) {
|
||||
range.end = dayjs(rangeLet.end).add(1, 'd').toDate()
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
setRange({...range})
|
||||
}
|
||||
|
||||
const toolTipShow = (event:TaskEvent) =>{
|
||||
console.log("toolTipShow", event)
|
||||
let result=""
|
||||
if (view!='month'){
|
||||
result += "\n"
|
||||
}
|
||||
result += "计划:"+event.name
|
||||
if (event.description){
|
||||
result += "\n描述:"+event.description
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
return <div className="App" style={{height: '90vh'}}>
|
||||
{open && <DetailModelForm operationId={operationId}
|
||||
description={description}
|
||||
|
@ -388,9 +437,23 @@ const CalShow: React.FC = () => {
|
|||
reloadData={loadData}/>}
|
||||
<Spin spinning={spinning} indicator={<LoadingOutlined style={{fontSize: 48}} spin/>} fullscreen/>
|
||||
<DragAndDropCalendar
|
||||
|
||||
// 本地设置
|
||||
localizer={localizer}
|
||||
messages={calMessages}
|
||||
formats={{
|
||||
dayFormat: dateFormat,
|
||||
// dateFormat: dateFormat,
|
||||
monthHeaderFormat: (solarDate) => {
|
||||
const lunarDate = solarToLunar(
|
||||
solarDate.getFullYear(),
|
||||
solarDate.getMonth() + 1,
|
||||
1
|
||||
);
|
||||
return `${solarDate.getFullYear()}年${solarDate.getMonth() + 1}月 (农历${lunarDate.lunarMonthName})`;
|
||||
},
|
||||
dayHeaderFormat: dateFormat
|
||||
}}
|
||||
// 修改style
|
||||
eventPropGetter={eventPropGetter}
|
||||
events={events}
|
||||
|
@ -417,6 +480,14 @@ const CalShow: React.FC = () => {
|
|||
resizable
|
||||
onEventResize={moveEvent}
|
||||
onEventDrop={moveEvent}
|
||||
// 组件设置
|
||||
components={
|
||||
{
|
||||
month: {
|
||||
dateHeader: CalHeader
|
||||
}
|
||||
}}
|
||||
tooltipAccessor={toolTipShow}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -18,3 +18,26 @@
|
|||
background-color: green !important;
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
/* 修改计划展示,先展示描述后展示时间 start */
|
||||
.rbc-addons-dnd-resizable{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.rbc-event-label{
|
||||
/*设置顺序*/
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.rbc-day-slot .rbc-event-content{
|
||||
flex-grow: 0;
|
||||
min-height:unset;
|
||||
}
|
||||
.rbc-day-slot .rbc-event-content{
|
||||
/* 不自动增长 */
|
||||
flex-grow: 0;
|
||||
/* 移除组件内属性 min-height */
|
||||
min-height:unset;
|
||||
}
|
||||
|
||||
/* 修改计划展示,先展示描述后展示时间 end */
|
|
@ -123,7 +123,7 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
|||
if (props.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD) {
|
||||
addTask(request).then(response => {
|
||||
console.log('response', response)
|
||||
if (response.status.success) {
|
||||
if (response.data.status.success) {
|
||||
message.success("添加任务成功:" + response.data)
|
||||
props.handleCancel()
|
||||
}
|
||||
|
@ -140,11 +140,11 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
|||
}
|
||||
updateTask(request).then(response => {
|
||||
console.log('response', response)
|
||||
if (response.status.success) {
|
||||
if (response.data.status.success) {
|
||||
message.success("修改任务成功:" + response.data)
|
||||
props.handleCancel()
|
||||
}else {
|
||||
message.error(response.status.message)
|
||||
message.error(response.data.status.message)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -10,6 +10,8 @@ import {getTaskState, taskPriorityList, taskStateList} from "@/lib/task/project/
|
|||
import 'react-virtualized/styles.css';
|
||||
import RightOption from "@/ui/task/RightOption";
|
||||
import TaskNameAndIcon from "@/components/TaskNameAndIcon";
|
||||
import {copyToClipboard} from "@/lib/copyToClipboard";
|
||||
import {CopyOutlined} from "@ant-design/icons";
|
||||
|
||||
|
||||
interface DroppableTableProps {
|
||||
|
@ -99,9 +101,13 @@ export const DroppableTable = React.memo((props: DroppableTableProps) => {
|
|||
<div className='displayFlexRow'> <TaskNameAndIcon task={record}/></div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div style={{width: '45%', boxSizing: 'border-box', minWidth: 0}}
|
||||
className='displayFlexRow'>
|
||||
<Tooltip placement="topLeft" title={record.description}>
|
||||
<div style={{width: '45%', boxSizing: 'border-box', minWidth: 0,display: 'flex',justifyContent:"start"}}
|
||||
>
|
||||
<Tooltip placement="topLeft" title={record.description} className="displayFlexRow">
|
||||
{record.description && <CopyOutlined onClick={(e) => {
|
||||
e.preventDefault();
|
||||
copyToClipboard(record.description)
|
||||
}}/>}
|
||||
<div className='displayFlexRow text-ellipsis'>{record.description}</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
|
|
@ -364,7 +364,7 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
deleteTask(props.itemId).then((response => {
|
||||
console.log('response', response)
|
||||
if (response.status.success) {
|
||||
message.success("删除任务成功:" + response.data)
|
||||
message.success("删除任务成功")
|
||||
initData()
|
||||
props.reloadData?.()
|
||||
}
|
||||
|
@ -481,8 +481,6 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
}
|
||||
);
|
||||
} else {
|
||||
|
||||
|
||||
await addTask(values).then(response => {
|
||||
console.log('response', response)
|
||||
if (response.data.status.success) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client'
|
||||
import {
|
||||
CheckSquareFilled,
|
||||
CheckSquareFilled, CopyOutlined,
|
||||
QuestionCircleOutlined
|
||||
} from '@ant-design/icons';
|
||||
import type {ActionType, FormInstance, ProColumns, ProFormInstance} from '@ant-design/pro-components';
|
||||
|
@ -21,6 +21,7 @@ import '@/ui/task/project/TreeTablePro.modules.css'
|
|||
import {useSearchParams} from "next/navigation";
|
||||
import {TaskWebSelectVO} from "@/lib/task/project/definitions";
|
||||
import TaskNameAndIcon from "@/components/TaskNameAndIcon";
|
||||
import {copyToClipboard} from "@/lib/copyToClipboard";
|
||||
|
||||
const TreeTablePro: React.FC = (props: { joinId?: string }) => {
|
||||
// 刷新表格
|
||||
|
@ -64,9 +65,15 @@ const TreeTablePro: React.FC = (props: { joinId?: string }) => {
|
|||
title: '任务描述',
|
||||
dataIndex: 'description',
|
||||
render: (_, record) => {
|
||||
return <Tooltip placement="topLeft" title={record.description}>
|
||||
<div className='text-ellipsis'>{record.description}</div>
|
||||
</Tooltip>
|
||||
return <Fragment>
|
||||
|
||||
<Tooltip placement="topLeft" title={record.description}>
|
||||
<div className='text-ellipsis'>{record.description && <CopyOutlined onClick={(e) => {
|
||||
e.preventDefault();
|
||||
copyToClipboard(record.description)
|
||||
}}/>}{record.description}</div>
|
||||
</Tooltip>
|
||||
</Fragment>
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -246,16 +253,16 @@ const TreeTablePro: React.FC = (props: { joinId?: string }) => {
|
|||
name: params.name,
|
||||
description: params.description,
|
||||
}
|
||||
// 列表展示
|
||||
// 列表展示
|
||||
if (!switchChecked) {
|
||||
search.treeOrList=false;
|
||||
search.treeList=true;
|
||||
search.treeFilter=true;
|
||||
}else {
|
||||
search.treeOrList = false;
|
||||
search.treeList = true;
|
||||
search.treeFilter = true;
|
||||
} else {
|
||||
// 树展示
|
||||
search.treeOrList=true;
|
||||
search.treeList=true;
|
||||
search.treeFilter=filterChecked;
|
||||
search.treeOrList = true;
|
||||
search.treeList = true;
|
||||
search.treeFilter = filterChecked;
|
||||
}
|
||||
if (params.state) {
|
||||
search.state = params.state.join(',');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import axios, {CancelTokenSource} from "axios";
|
||||
import axios, {AxiosInterceptorOptions, CancelTokenSource} from "axios";
|
||||
import {message} from "antd";
|
||||
import {refreshTokenAPI} from "@/lib/login/service";
|
||||
|
||||
|
@ -19,11 +19,17 @@ const cancelTokenSource: CancelTokenSource = axios.CancelToken.source();
|
|||
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');
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
reduceToken(token)
|
||||
if (config.url && config.url.indexOf("refreshToken") == -1 &&
|
||||
config.url.indexOf("/ask/login") == -1 &&
|
||||
config.url.indexOf("/generate/qrcode") == -1
|
||||
) {
|
||||
reduceToken(token);
|
||||
}
|
||||
}
|
||||
config.headers.set("source-client", "web")
|
||||
return config;
|
||||
|
@ -32,6 +38,9 @@ httpReq.interceptors.request.use((config) => {
|
|||
console.info("interceptors错误提示.request" + error)
|
||||
return Promise.reject(error);
|
||||
})
|
||||
httpReq.interceptors.response.use((onFulfilled) => {
|
||||
return onFulfilled;
|
||||
})
|
||||
|
||||
function reduceToken(token: string) {
|
||||
if (!token || token.split('.').length !== 3) {
|
||||
|
@ -62,10 +71,10 @@ function reduceToken(token: string) {
|
|||
console.log("updateToken:decodedToken:", decodedToken);
|
||||
const endTime = decodedToken.exp;
|
||||
console.log('距离过期' + (((endTime as number) - (Date.now() / 1000)) / 60 / 60 + '小时'))
|
||||
if (((endTime as number) - (Date.now() / 1000)) / 60 / 60 / 24 < 3) {
|
||||
if (((endTime as number) - (Date.now() / 1000)) / 60 / 60 < 3) {
|
||||
// 小于3小时更新toke3小时或12小时不动过期、内不动
|
||||
refreshTokenAPI().then(res=>{
|
||||
if (res.data.status.success){
|
||||
refreshTokenAPI().then(res => {
|
||||
if (res.data.status.success) {
|
||||
localStorage.setItem('platform-security', res.data.data)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import dayjs, { Dayjs, isDayjs } from "dayjs";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import {solarToLunar} from "lunar-calendar";
|
||||
dayjs.extend(utc)
|
||||
const DATE_FORMAT = "YYYY-MM-DD"
|
||||
// 到秒没啥意义
|
||||
|
@ -236,8 +237,26 @@ function dayjsWeek(day: Dayjs): string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
function lunarDateShow(date:Date){
|
||||
const lunarDate = solarToLunar(
|
||||
date.getFullYear(),
|
||||
date.getMonth() + 1,
|
||||
date.getDate()
|
||||
);
|
||||
if(lunarDate.term){
|
||||
return lunarDate.term;
|
||||
}
|
||||
if(lunarDate.lunarFestival && lunarDate.lunarMonthName.indexOf("闰")==-1){
|
||||
return lunarDate.lunarFestival;
|
||||
}
|
||||
if(lunarDate.solarFestival){
|
||||
return lunarDate.solarFestival
|
||||
}
|
||||
return lunarDate.lunarMonthName+lunarDate.lunarDayName;
|
||||
}
|
||||
export {
|
||||
DATE_TIME_FORMAT, DATE_FORMAT, DATE_TIME_FORMAT_SIMPLE,
|
||||
dayStartUtcFormat, nextDayStartUtcFormat, betweenTime,
|
||||
dateStartUtcFormat, nextDateStartUtcFormat, cronToChinese, dayjsWeek
|
||||
dateStartUtcFormat, nextDateStartUtcFormat, cronToChinese, dayjsWeek,lunarDateShow
|
||||
}
|
Loading…
Reference in New Issue