feat:backup

This commit is contained in:
shixiaohua 2024-05-08 14:15:59 +08:00
parent 15960748be
commit ccfb6136c5
12 changed files with 71 additions and 54 deletions

View File

@ -1,36 +1,37 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# 任务管理小应用
平时事情不多但是容易忘记最近也在学习react便开发了这个应用。
## Getting Started
应用将任务分为两种类型来管理:任务树和[四象线](https://baike.baidu.com/item/%E5%9B%9B%E8%B1%A1%E9%99%90%E6%B3%95/4228184?fr=ge_ala)任务管理
## 任务树
1. 层级展示任务
2. 可在操作中四象线展示子任务
## 四象线
1. 向上重要
2. 向左紧急
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
## 项目启动
### 后端服务启动
1. 后端启动应用需求dockerredismysql8。
2. jar通过docker打入镜像中无需java环境。
3. 使用docker/Dockerfile-server文件构建镜像及运行容器
4. 通过docker/hosts修改自己数据库ip和redis的ip
5. 数据库端口3306,数据库名task_manager数据库用户名及密码task_manager_user/TaskMU0001redis无密码认证。此条内容目前代码写死后期修改为可配置
构建镜像
```shell
docker build -t task-manager-server -f Dockerfile-server .
```
运行
```shell
docker run -d -p 8090:8090 --restart unless-stopped -v ./hosts:/etc/hosts --name task-manager-server task-manager-server
```
### 前端项目启动
1. 前端启动应用需求docker
2. 需要在电脑hostslinux地址/etc/hosts,windows地址C:\Windows\System32\drivers\etc\hosts中配置后端运行环境地址例如添加127.0.0.1 taskmanagerserver.com
构建镜像
```shell
docker build -t task-manager-nginx .
```
运行
```shell
docker run -d -p 3001:3001 --restart unless-stopped --name task-manager-nginx task-manager-nginx
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

View File

@ -5,4 +5,4 @@ COPY out /usr/share/nginx/html
EXPOSE 3001
CMD ["nginx", "-g", "daemon off;"]
# docker build -t task-manager-nginx .
# docker run -d -p 3001:3001 --name task-manager-nginx task-manager-nginx
# docker run -d -p 3001:3001 --restart unless-stopped --name task-manager-nginx task-manager-nginx

View File

@ -5,4 +5,4 @@ EXPOSE 8090
CMD ["java", "-jar", "task-manager-server.jar"]
# 指定文件名 当前路径
# docker build -t task-manager-server -f Dockerfile-server .
# docker run -d -p 8090:8090 --name task-manager-server task-manager-server
# docker run -d -p 8090:8090 --restart unless-stopped -v ./hosts:/etc/hosts --name task-manager-server task-manager-server

3
docker/hosts Normal file
View File

@ -0,0 +1,3 @@
127.0.0.1 localhost
10.0.2.15 task-manager-server-mysql
10.0.2.15 task-manager-server-redis

View File

@ -21,15 +21,18 @@ http {
server_name localhost;
# 访问日志路径
access_log /var/log/nginx/access.log;
# 代理配置
location / {
# 站点根目录
root /usr/share/nginx/html;
# 代理配置
location / {
# 默认页面
index index.html index.htm;
try_files $uri $uri/ /index.html;
try_files $uri $uri.html $uri/ =404;
# try_files $uri $uri/ =404;
}
location /task/ {
rewrite ^/task/(.*)$ /task/$1.html break;
}
# 静态文件缓存配置
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 7d;

Binary file not shown.

View File

@ -1,6 +1,14 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,
// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
// skipTrailingSlashRedirect: true,
// Optional: Change the output directory `out` -> `dist`
// distDir: 'dist',
};
export default nextConfig;

View File

@ -41,7 +41,7 @@ export type DataType ={
action?:React.ReactNode;
expectedStartTime?:Date|string;
expectedEndTime?:Date;
expectedTimeRange?:(string|Dayjs)[];
expectedTimeRange?:(string|Dayjs|undefined)[];
actualStartTime?:Date;
actualEndTime?:Date;
actualTimeRange?:(string|Dayjs)[]

View File

@ -8,7 +8,7 @@ export async function getTaskTreeResult(requestParam:string): Promise<ResponseVO
// 使用 Axios 发送 POST 请求获取数据
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await axios.get(
'http://localhost:8090/search/task_message_tree?search='+encodeURIComponent(requestParam));
'http://taskmanagerserver.com:8090/search/task_message_tree?search='+encodeURIComponent(requestParam));
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -23,7 +23,7 @@ export async function commonUpdate(requestParam:any): Promise<ResponseVO<string>
try {
// 使用 Axios 发送 PUT 请求获取数据
const response: AxiosResponse<ResponseVO<string>> = await axios.put(
'http://localhost:8090/search/task_message_tree',requestParam);
'http://taskmanagerserver.com:8090/search/task_message_tree',requestParam);
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -38,7 +38,7 @@ export async function taskTreeResult(): Promise<ResponseVO<ResultPage<DataType>>
noStore();
try {
// 使用 Axios 发送 POST 请求获取数据
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await axios.post('http://localhost:8090/task/tree', {
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await axios.post('http://taskmanagerserver.com:8090/task/tree', {
pageSize: 10,
pageNumber: 1
});
@ -55,7 +55,7 @@ export async function getTask(id:number): Promise<ResponseVO<DataType>> {
noStore();
try {
// 使用 Axios 发送 GET 请求获取数据
const response: AxiosResponse<ResponseVO<DataType>> = await axios.get('http://localhost:8090/task/'+id);
const response: AxiosResponse<ResponseVO<DataType>> = await axios.get('http://taskmanagerserver.com:8090/task/'+id);
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -70,7 +70,7 @@ export async function addTask(task:DataType): Promise<ResponseVO<string>> {
noStore();
try {
// 使用 Axios 发送 POST 请求添加数据
const response: AxiosResponse<ResponseVO<string>> = await axios.post('http://localhost:8090/task', task);
const response: AxiosResponse<ResponseVO<string>> = await axios.post('http://taskmanagerserver.com:8090/task', task);
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -84,7 +84,7 @@ export async function updateTask(task:DataType): Promise<ResponseVO<string>> {
noStore();
try {
// 使用 Axios 发送 PUT 请求修改数据
const response: AxiosResponse<ResponseVO<string>> = await axios.put('http://localhost:8090/task', task);
const response: AxiosResponse<ResponseVO<string>> = await axios.put('http://taskmanagerserver.com:8090/task', task);
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -98,7 +98,7 @@ export async function deleteTask(id:number): Promise<ResponseVO<string>> {
noStore();
try {
// 使用 Axios 发送 DELETE 删除数据
const response: AxiosResponse<ResponseVO<string>> = await axios.delete('http://localhost:8090/task/'+id);
const response: AxiosResponse<ResponseVO<string>> = await axios.delete('http://taskmanagerserver.com:8090/task/'+id);
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -113,7 +113,7 @@ export async function editState(id:number,state:number): Promise<ResponseVO<stri
noStore();
try {
// 使用 Axios 发送 DELETE 删除数据
const response: AxiosResponse<ResponseVO<string>> = await axios.patch('http://localhost:8090/task/'+id);
const response: AxiosResponse<ResponseVO<string>> = await axios.patch('http://taskmanagerserver.com:8090/task/'+id);
// 从响应中提取数据并返回
return response.data;
} catch (error) {
@ -128,7 +128,7 @@ export async function editPriority(id:number,priority:number): Promise<ResponseV
noStore();
try {
// 使用 Axios 发送 DELETE 删除数据
const response: AxiosResponse<ResponseVO<string>> = await axios.patch('http://localhost:8090/task/'+id);
const response: AxiosResponse<ResponseVO<string>> = await axios.patch('http://taskmanagerserver.com:8090/task/'+id);
// 从响应中提取数据并返回
return response.data;
} catch (error) {

View File

@ -1,5 +1,5 @@
'use client'
import React from "react";
import React, {Fragment} from "react";
import {TitleOperation} from "@/app/ui/task/TitleOperation";
import LocalContext from "@/app/ui/LocalContent";
import dayjs from "dayjs";
@ -20,7 +20,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
console.log('taskState,expectedStartTime,refreshDataFlag', taskState, expectedStartTime, refreshDataFlag)
return (
<div>
<Fragment>
<ConfigProvider
theme={{
components: {
@ -41,6 +41,6 @@ export default function Layout({children}: { children: React.ReactNode }) {
{children}
</LocalContext.Provider>
</ConfigProvider>
</div>
</Fragment>
);
}

View File

@ -30,7 +30,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
];
return <Space style={{marginTop: 0}}>
return <Space style={{marginTop: 0 ,"height": "42px", "alignContent": "center"}}>
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务' reloadData={refreshData}/>
{usePathname().startsWith("/task/project") ?
<>

View File

@ -66,6 +66,9 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
props.handleCancel()
}
})
}else if(props.operationId === OPERATION_BUTTON_TYPE.ADD|| props.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD){
let data={'expectedTimeRange':[dayjs(), undefined]};
form.setFieldsValue(data)
}
}, [])
const normFile = (e: any) => {
@ -234,10 +237,9 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
placeholder={['开始时间', '结束时间']}
allowEmpty={[true, true]}
needConfirm={false}
defaultValue={[dayjs(), undefined]}
showTime={{
hideDisabledOptions: true,
defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('11:59:59', 'HH:mm:ss')],
defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')],
}}
// format="YYYY-MM-DD HH:mm:ss"
/>