system-copyright-react/src/route/index/Index.tsx

877 lines
41 KiB
TypeScript
Raw Normal View History

2024-03-27 18:56:48 +08:00
import './index.css';
2024-05-07 17:00:32 +08:00
// import { MouseEvent, Reducer, useEffect, useReducer, useState, useContext } from "react";
import { MouseEvent, Reducer, useEffect, useReducer, useState } from "react";
2024-07-31 16:00:30 +08:00
import { useSelector, useDispatch } from 'react-redux'
2024-05-07 17:00:32 +08:00
import { useNavigate, useSearchParams, Outlet } from "react-router-dom";
import { IMenuListItem, IMenuWithTopButton } from "../../interfaces/menu/IMenuWithTopButton.ts";
2024-03-27 18:56:48 +08:00
import MenuWithTopButton from "../../components/menu/MenuWithTopButton.tsx";
2024-07-22 17:22:35 +08:00
// import MenuWithBottomButtom from '../../components/menu/MenuWithBottomButton.tsx'
2024-07-31 16:00:30 +08:00
// import MenuTreeWithTopButton from "../../components/menu/MenuTreeWithTopButton.tsx";
2024-05-07 17:00:32 +08:00
// import ListProj from "../../components/list/ListProj.tsx";
// import ListProjAgent from "../../components/list/ListProjAgent.tsx";
2024-07-31 16:00:30 +08:00
import {
MenuProps, Select,
Button,
Pagination,
Empty
} from 'antd';
2024-03-27 18:56:48 +08:00
import {
IndexListContext,
IndexListDataType,
IndexListDispatchContext,
ListAction,
2024-04-01 20:39:22 +08:00
ListData,
2024-03-27 18:56:48 +08:00
} from "../../context/IndexListContext.ts";
2024-07-31 16:00:30 +08:00
import {
MenuFoldOutlined,
ClearOutlined
} from '@ant-design/icons';
2024-05-07 17:00:32 +08:00
import { useLocation } from 'react-router-dom';
2024-07-31 16:00:30 +08:00
import { get } from '../../util/AjaxUtils.ts'
2024-05-07 17:00:32 +08:00
import gpsImg from '../../static/right/gps.png'
import backImg from '../../static/right/back.png'
2024-07-31 17:07:19 +08:00
// import { Link } from "react-router-dom";
2024-07-31 18:41:25 +08:00
import {
Input,
2024-07-31 17:07:19 +08:00
// Breadcrumb,
2024-07-31 18:41:25 +08:00
message
} from 'antd';
2024-05-07 17:00:32 +08:00
const { Search } = Input;
2024-03-27 18:56:48 +08:00
export default function Index() {
2024-07-31 18:41:25 +08:00
// 选项数组
const [tagArray, setTagArray] = useState([])
// 获取标签
const getTag = () => {
get({
messageApi,
url: `/api/proj/tag/list-tag`,
onBefore() {
},
onSuccess(data: any) {
// console.log('标签信息', data);
const newarrty: any = (data.data).map((item: any) => ({
value: item.key,
label: item.value
}));
setTagArray(newarrty)
},
onFinally() {
}
})
}
2024-07-31 16:00:30 +08:00
const dispath = useDispatch()
//redux的belongArray
const redxuState: any = useSelector(state => state)
const belongArray = redxuState.belongArray
// 获取所属者表格储存至redux 更新表格
const getProjOwnerList = () => {
get({
messageApi,
url: `/api/proj-owner/list/self`,
onBefore() {
},
onSuccess(data: any) {
// console.log('所属者表格', data.data);
// setBelongPeopleArray(data.data)
// 存redux的belongArray
dispath({
type: 'uparray',
val: data.data
})
},
onFinally() {
}
})
}
// 更新数据
// const upBelongArray = () => {
// get({
// messageApi,
// url: `/api/proj-owner/list/self`,
// onBefore() {
// },
// onSuccess(data: any) {
// // console.log('所属者表格', data.data);
// setBelongPeopleArray(data.data)
// },
// onFinally() {
// }
// })
// }
// 监听redux的belongArray
// useEffect(()=>{
// },[belongArray])
const [messageApi, contextHolder] = message.useMessage();
// 临时关键字 (过度)
const [nowKeyword, setNowKeyWord] = useState('')
2024-07-15 16:58:47 +08:00
// 关键字
const [keywords, setKeywords] = useState('');
2024-07-31 16:00:30 +08:00
const [type, setType] = useState<string | null>(null)
const [chargeAdditionals, setchargeAdditionals] = useState<string | null>(null)
2024-07-31 18:41:25 +08:00
const [tagDataId, settagDataId] = useState<string | null>(null)
2024-07-31 16:00:30 +08:00
const [authorId, setauthorId] = useState('')
2024-05-07 17:00:32 +08:00
// const indexListContext = useContext(IndexListContext);
2024-07-31 16:00:30 +08:00
// 所属者信息
// const [belongPeopleArray, setBelongPeopleArray] = useState<any[]>([])
const [currentPage, setCurrentPage] = useState(1);
const itemsPerPage = 5;
// 计算总页数
const totalItems = belongArray.length;
const totalPages = Math.ceil(totalItems / itemsPerPage);
// 计算当前页数据的起始和结束索引
const startIndex = (currentPage - 1) * itemsPerPage;
const endIndex = Math.min(startIndex + itemsPerPage, totalItems);
// 提取当前页的数据
const currentPageData = belongArray.slice(startIndex, endIndex);
// 处理页码切换
const handlePageChange = (page: number) => {
if (page >= 1 && page <= totalPages) {
setCurrentPage(page);
}
};
// // 初始化搜索条件
const init = () => {
setNowKeyWord('')
setKeywords('')
setType(null)
setchargeAdditionals(null)
2024-07-31 18:41:25 +08:00
settagDataId(null)
2024-07-31 16:00:30 +08:00
}
2024-05-07 17:00:32 +08:00
2024-03-27 18:56:48 +08:00
const nav = useNavigate();
2024-03-28 19:35:54 +08:00
const [searchParams] = useSearchParams();
2024-03-27 18:56:48 +08:00
const listReducer = (state: ListData, action: ListAction) => {
2024-04-01 20:39:22 +08:00
if (action.type == IndexListDataType.PROJ) {
2024-03-27 18:56:48 +08:00
state.type = IndexListDataType.PROJ;
2024-04-01 20:39:22 +08:00
state.status = action.value as string;
} else if (action.type == IndexListDataType.AGENT) {
2024-03-27 18:56:48 +08:00
state.type = IndexListDataType.AGENT;
2024-04-01 20:39:22 +08:00
state.status = action.value as string;
} else if (action.type == IndexListDataType.CATEGORY) {
state.categorys = action.value as MenuProps['items'];
2024-04-02 18:45:46 +08:00
state.categoryChangeCount++;
2024-04-01 20:39:22 +08:00
} else if (action.type == IndexListDataType.CATEGORY_CHANGE) {
2024-04-02 18:45:46 +08:00
state.category = action.value as string;
state.categoryChangeCount++;
} else if (action.type == IndexListDataType.CATEGORY_DELETE) {
state.categorys = action.value as MenuProps['items'];
state.category = '';
state.categoryChangeCount++;
2024-03-27 18:56:48 +08:00
}
return {
...state
};
}
const [listData, dispatch] = useReducer<Reducer<ListData, ListAction>>(listReducer, {
2024-04-02 18:45:46 +08:00
type: IndexListDataType.PROJ,
categoryChangeCount: 0
2024-03-27 18:56:48 +08:00
});
2024-04-01 20:39:22 +08:00
const [projMenu, setProjMenu] = useState<IMenuWithTopButton>({
2024-03-27 18:56:48 +08:00
button: {
2024-04-29 17:22:26 +08:00
name: '项目',
2024-03-27 18:56:48 +08:00
handle() {
nav('/proj-create')
}
},
list: [
2024-05-07 17:00:32 +08:00
{ id: 'ALL', name: '全部项目', active: true },
{ id: 'PROCESSING', name: '进行中的' },
{ id: 'COMPLETE', name: '已完成的' }
2024-03-27 18:56:48 +08:00
],
2024-04-01 20:39:22 +08:00
handleListItem(_e, _index, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
2024-05-21 11:21:34 +08:00
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
2024-04-01 20:39:22 +08:00
item.active = true;
setProjMenu({
...projMenu
})
2024-03-27 18:56:48 +08:00
dispatch({
type: IndexListDataType.PROJ,
2024-05-07 17:00:32 +08:00
value: item.id,
// keywords: ''
2024-03-27 18:56:48 +08:00
})
2024-04-29 17:22:26 +08:00
},
2024-03-27 18:56:48 +08:00
2024-05-07 17:00:32 +08:00
});
2024-05-21 11:21:34 +08:00
// const [agentMenu, setAgentMenu] = useState<IMenuWithTopButton>({
// button: {
// name: '代理服务',
// handle() {
// dispatch({
// type: IndexListDataType.PROJ,
// value: 'COMPLETE',
// })
// }
// },
// list: [
// { id: 'ALL', name: '全部项目' },
// { id: 'PROCESSING', name: '进行中的' },
// { id: 'COMPLETE', name: '已完成的' },
// ],
// handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
// projMenu.list.forEach(item => item.active = false);
// agentMenu.list.forEach(item => item.active = false);
// item.active = true;
// setAgentMenu({
// ...agentMenu
// })
// dispatch({
// type: IndexListDataType.AGENT,
// value: item.id,
// })
// }
// })
const [sellMenu, setSellMenu] = useState<IMenuWithTopButton>({
2024-03-27 18:56:48 +08:00
button: {
2024-05-21 11:21:34 +08:00
name: '我要卖',
2024-03-27 18:56:48 +08:00
handle() {
2024-05-21 11:21:34 +08:00
// dispatch({
// type: IndexListDataType.PROJ,
// value: 'COMPLETE',
// })
2024-03-27 18:56:48 +08:00
}
},
list: [
2024-05-21 11:21:34 +08:00
{ id: '1', name: '商品发布', path: '/product-release' },
{ id: '2', name: '交易订单', path: '/transaction-order' },
// { id: 'COMPLETE', name: '已完成的' },
2024-03-27 18:56:48 +08:00
],
handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
2024-04-01 20:39:22 +08:00
projMenu.list.forEach(item => item.active = false);
2024-05-21 11:21:34 +08:00
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
2024-04-01 20:39:22 +08:00
item.active = true;
2024-05-21 11:21:34 +08:00
setSellMenu({
...sellMenu
2024-04-01 20:39:22 +08:00
})
2024-05-21 11:21:34 +08:00
// dispatch({
// type: IndexListDataType.AGENT,
// value: item.id,
2024-05-12 07:45:51 +08:00
2024-05-21 11:21:34 +08:00
// })
}
})
const [buyMenu, setBuyMenu] = useState<IMenuWithTopButton>({
button: {
name: '我要买',
handle() {
// dispatch({
// type: IndexListDataType.PROJ,
// value: 'COMPLETE',
// })
}
},
list: [
{ id: '1', name: '著作权商品', path: '/copyright-goods' },
{ id: '2', name: '交易商品', path: '/trading-goods' },
// { id: 'COMPLETE', name: '已完成的' },
],
handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
item.active = true;
setBuyMenu({
...buyMenu
2024-03-27 18:56:48 +08:00
})
2024-05-21 11:21:34 +08:00
// dispatch({
// type: IndexListDataType.AGENT,
// value: item.id,
// })
2024-03-27 18:56:48 +08:00
}
2024-04-01 20:39:22 +08:00
})
2024-05-21 11:21:34 +08:00
2024-05-07 17:00:32 +08:00
const location = useLocation()
2024-05-12 07:45:51 +08:00
const [now, setNow] = useState<string>('首页')
// 编辑项目路由名
// const [editname,setEditname] = useState('')
// 新建项目路由名字
// const [newname,setNewname] = useState('')
2024-07-31 17:07:19 +08:00
// const [pathArray, setPathArray] = useState<any>([])
2024-07-17 14:19:28 +08:00
const [showSearchBox, setShowSearchBox] = useState(true)
2024-07-31 16:00:30 +08:00
2024-05-12 07:45:51 +08:00
useEffect(() => {
2024-05-07 17:00:32 +08:00
// const nowname = sessionStorage.getItem('now')
2024-05-12 07:45:51 +08:00
if (location.pathname.includes('/home')) {
2024-05-07 17:00:32 +08:00
setNow('首页')
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: '首页' }])
2024-07-15 16:58:47 +08:00
setShowSearchBox(true)
2024-05-12 07:45:51 +08:00
} else if (location.pathname.includes('/proj-create')) {
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-07 17:00:32 +08:00
setNow('创建项目')
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: '创建项目' }])
2024-05-22 16:18:38 +08:00
// /config-mod-list /config-menu-list /config-mod-show
2024-06-03 14:56:19 +08:00
} else if (location.pathname.includes('/proj-edit') && !location.pathname.includes('/config-mod-show') && !location.pathname.includes('/config-mod-edit') && !location.pathname.includes('/step') && !location.pathname.includes('/config-loginpage') && !location.pathname.includes('/config-mod-save') && !location.pathname.includes('/config-mod-list') && !location.pathname.includes('/config-menu-list')) {
2024-05-12 07:45:51 +08:00
setNow('编辑项目')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-12 07:45:51 +08:00
// setEditname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: '编辑项目' }])
2024-05-12 07:45:51 +08:00
} else if (location.pathname.includes('/proj-new')) {
setNow('新建项目')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-12 07:45:51 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: '新建项目' }])
2024-05-15 18:00:20 +08:00
} else if (location.pathname.includes('/proj-efree')) {
2024-05-12 07:45:51 +08:00
setNow('编辑项目')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-12 07:45:51 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: '编辑项目' }])
2024-05-15 18:00:20 +08:00
} else if (location.pathname.includes('/proj-eall')) {
2024-05-08 17:54:01 +08:00
setNow('编辑项目')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-12 07:45:51 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页 </Link> }, { title: '编辑项目' }])
2024-05-15 18:00:20 +08:00
} else if (location.pathname.includes('/proj-edit/step1')) {
2024-05-12 07:45:51 +08:00
setNow('标题简介')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-12 07:45:51 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '标题简介' }])
2024-05-15 18:00:20 +08:00
} else if (location.pathname.includes('/proj-edit/step2')) {
2024-05-12 07:45:51 +08:00
setNow('标题简介')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-12 07:45:51 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '基本信息' }])
2024-05-21 11:21:34 +08:00
} else if (location.pathname.includes('/proj-edit/config-loginpage')) {
2024-05-16 18:00:57 +08:00
setNow('登录界面设置')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-16 18:00:57 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '登录界面设置' }])
2024-06-03 14:56:19 +08:00
} else if (location.pathname.includes('/proj-edit/config-mod-list')) {
2024-05-21 11:21:34 +08:00
setNow('系统菜单管理')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-21 11:21:34 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '系统菜单管理' }])
2024-06-03 14:56:19 +08:00
} else if (location.pathname.includes('/proj-edit/config-menu-list')) {
2024-05-21 11:21:34 +08:00
setNow('系统菜单顺序')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-21 11:21:34 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '系统菜单顺序' }])
2024-06-03 14:56:19 +08:00
} else if (location.pathname.includes('/step3')) {
2024-05-21 11:21:34 +08:00
setNow('软件功能特点')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-05-21 11:21:34 +08:00
// setNewname(location.pathname)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '软件功能特点' }])
2024-06-03 14:56:19 +08:00
} else if (location.pathname.includes('/proj-edit/config-mod-save')) {
2024-05-21 11:21:34 +08:00
setNow('添加菜单')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '添加菜单' }])
2024-06-03 14:56:19 +08:00
} else if (location.pathname.includes('/proj-edit/config-mod-edit')) {
2024-05-21 11:21:34 +08:00
setNow('编辑菜单')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-2) }}>编辑项目</a> }, { title: <a onClick={() => { nav(-1) }}>系统菜单管理</a> }, { title: '编辑菜单' }])
2024-06-03 14:56:19 +08:00
// /config-mod-edit /config-mod-show
} else if (location.pathname.includes('/proj-edit/config-mod-show')) {
2024-05-22 16:18:38 +08:00
setNow('查看菜单')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-2) }}>编辑项目</a> }, { title: <a onClick={() => { nav(-1) }}>系统菜单管理</a> }, { title: '查看菜单' }])
2024-06-03 14:56:19 +08:00
// /config-mod-edit
} else if (location.pathname.includes('/product-release')) {
2024-05-28 18:00:42 +08:00
setNow('首页')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: '首页' }])
2024-06-11 17:45:40 +08:00
// /config-mod-edit /product-release /transaction-order
2024-06-14 15:50:34 +08:00
} else if (location.pathname.includes(' /transaction-order')) {
2024-06-11 17:45:40 +08:00
setNow('首页')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: '首页' }])
2024-06-11 17:45:40 +08:00
// /config-mod-edit /product-release /transaction-order
2024-06-14 15:50:34 +08:00
} else if (location.pathname.includes(' /copyright-goods')) {
2024-06-11 17:45:40 +08:00
setNow('首页')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: '首页' }])
2024-06-11 17:45:40 +08:00
// /config-mod-edit /product-release /transaction-order
2024-06-14 15:50:34 +08:00
} else if (location.pathname.includes(' /trading-goods')) {
2024-06-11 17:45:40 +08:00
setNow('首页')
2024-07-15 16:58:47 +08:00
setShowSearchBox(false)
2024-07-31 17:07:19 +08:00
// setPathArray([{ title: '首页' }])
2024-06-11 17:45:40 +08:00
// /config-mod-edit /product-release /transaction-order
2024-05-07 17:00:32 +08:00
}
2024-05-12 07:45:51 +08:00
}, [location.pathname])
2024-03-28 19:35:54 +08:00
useEffect(() => {
2024-05-21 11:21:34 +08:00
// nav('/home')
// sessionStorage.setItem('pathArray', JSON.stringify([{ title: <Link to={'/home'}>首页</Link> }]));
// sessionStorage.setItem('now', '首页');
2024-04-01 20:39:22 +08:00
if (searchParams.get('type') == 'agent') {
2024-03-28 19:35:54 +08:00
dispatch({
type: IndexListDataType.AGENT,
2024-05-07 17:00:32 +08:00
value: 'ALL',
2024-03-28 19:35:54 +08:00
})
2024-05-07 17:00:32 +08:00
2024-03-28 19:35:54 +08:00
}
2024-07-31 16:00:30 +08:00
getProjOwnerList()
2024-07-31 18:41:25 +08:00
getTag()
2024-03-28 19:35:54 +08:00
}, []);
2024-07-17 14:19:28 +08:00
useEffect(() => {
2024-07-31 18:41:25 +08:00
// console.log('监听', '类型:', type, '关键字:', keywords, '额外付费:', chargeAdditionals,'进度:',tagDataId);
2024-07-31 16:00:30 +08:00
// console.log(Boolean(keywords));
// if (location.pathname.includes('/home')) {
2024-08-01 11:15:33 +08:00
// if (!keywords && !type && !chargeAdditionals && !tagDataId) {
// setKeywords('')
// setType(null)
// setchargeAdditionals(null)
// settagDataId(null)
// }
// if (location.pathname.includes('/home')) {
// nav('/home', {
// state: {
// keyword: keywords,
// name: type,
// chargeAdditionals: chargeAdditionals,
// tagDataId: tagDataId,
// authorId: authorId
// }
// })
// }
// console.log('监听',Boolean(authorId));
2024-07-18 14:49:14 +08:00
if (location.pathname.includes('/home')) {
2024-08-01 13:25:33 +08:00
// if (!keywords && !type && !chargeAdditionals && !tagDataId && !authorId) {
// init()
// nav('/home', {
// state: {
// keyword: '',
// name: '',
// chargeAdditionals: '',
// tagDataId: '',
// authorId: ''
// }
// })
2024-08-12 14:43:58 +08:00
2024-08-01 13:25:33 +08:00
// } else {
// nav('/home', {
// state: {
// keyword: keywords,
// name: type,
// chargeAdditionals: chargeAdditionals,
// tagDataId: tagDataId,
// authorId: authorId
// }
// })
// }
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId
}
})
2024-07-18 14:49:14 +08:00
}
2024-07-31 16:00:30 +08:00
// }
2024-08-01 13:29:44 +08:00
// console.log('type',type);
// console.log('chargeAdditionals',chargeAdditionals);
2024-08-12 14:43:58 +08:00
2024-07-31 18:41:25 +08:00
}, [type, chargeAdditionals, keywords, tagDataId, authorId]);
2024-05-07 17:00:32 +08:00
const handleSearch = (value: string) => {
2024-07-31 16:00:30 +08:00
// console.log(value);
2024-07-15 16:58:47 +08:00
setKeywords(value)
2024-05-12 07:45:51 +08:00
nav('/home', {
state: {
2024-07-15 16:58:47 +08:00
keyword: value,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 16:00:30 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 16:00:30 +08:00
authorId: authorId
2024-07-29 17:22:42 +08:00
2024-05-12 07:45:51 +08:00
}
})
2024-05-07 17:00:32 +08:00
}
2024-07-18 14:49:14 +08:00
const handleChange = (e: any) => {
2024-07-31 16:00:30 +08:00
setNowKeyWord(e.target.value)
// console.log(e.target.value);
2024-07-18 14:49:14 +08:00
if (e.target.value == '') {
2024-07-17 14:21:59 +08:00
setKeywords('')
2024-07-17 14:19:28 +08:00
nav('/home', {
state: {
keyword: '',
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 16:00:30 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 16:00:30 +08:00
authorId: authorId
2024-07-17 14:19:28 +08:00
}
})
}
}
2024-03-27 18:56:48 +08:00
return (
<>
2024-04-29 17:22:26 +08:00
{/* <Breadcrumb
2024-03-27 18:56:48 +08:00
items={[
{title: <Link to={'/'}></Link>}
]}
2024-04-29 17:22:26 +08:00
/> */}
2024-07-31 16:00:30 +08:00
{contextHolder}
2024-05-07 17:00:32 +08:00
<IndexListContext.Provider value={listData} >
2024-03-27 18:56:48 +08:00
<IndexListDispatchContext.Provider value={dispatch}>
<div className="index">
2024-06-03 14:56:19 +08:00
<div className='leftbox'>
<div className="left" >
<div style={{ height: '15px', width: '230px', background: 'white' }}></div>
<MenuWithTopButton
button={projMenu.button}
list={projMenu.list}
handleListItem={projMenu.handleListItem}
2024-07-31 16:00:30 +08:00
keywords={keywords}
type={type ? type : ""}
chargeAdditionals={chargeAdditionals ? chargeAdditionals : ""}
2024-07-31 18:41:25 +08:00
tagDataId={tagDataId ? tagDataId : ""}
2024-07-31 17:07:19 +08:00
authorId={authorId ? authorId : ""}
2024-06-03 14:56:19 +08:00
/>
2024-07-31 16:00:30 +08:00
<div className='belongPeopleMenu'>
<div className='belongPeopleMenu-title'>
<MenuFoldOutlined style={{ marginLeft: 10, marginRight: 10 }} />
</div>
<div style={{ display: belongArray.length > 0 ? 'block' : 'none' }}>
<div className='belongPeopleMenu-box'>
{
currentPageData.map((item: any) => {
return (
<div className='belongpeopleName' key={item.projOwnerId} onClick={() => {
if (authorId == item.projOwnerId) {
setauthorId('')
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 16:00:30 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 16:00:30 +08:00
authorId: ''
}
})
} else {
setauthorId(item.projOwnerId)
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 16:00:30 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 16:00:30 +08:00
authorId: item.projOwnerId
}
})
}
}}
style={{ background: authorId == item.projOwnerId ? '#FF9F08' : '', color: authorId == item.projOwnerId ? '#FFF' : '' }}
2024-07-31 17:07:19 +08:00
title={item.name} // 添加 title 属性以显示完整文本
2024-07-31 16:00:30 +08:00
>
2024-08-02 09:23:23 +08:00
{item.name}
2024-07-31 16:00:30 +08:00
</div>
)
})
}
</div>
{/* 分页控件 */}
{/* <div className='pagination-controls'>
<Button
type="primary"
onClick={() => handlePageChange(currentPage - 1)}
disabled={currentPage === 1}
>
</Button>
<Button
type="primary"
onClick={() => handlePageChange(currentPage + 1)}
disabled={currentPage === totalPages}
style={{ marginLeft: 10 }}
>
</Button>
</div> */}
<div className='belong-pagination'>
<Pagination
2024-08-12 14:43:58 +08:00
showSizeChanger={false}
2024-07-31 16:00:30 +08:00
current={currentPage}
total={totalItems}
pageSize={itemsPerPage}
onChange={handlePageChange} // 页码改变时的回调
className="custom-pagination"
/>
</div>
</div>
<div style={{ display: belongArray.length > 0 ? 'none' : 'block', height: 230 }}>
2024-07-31 17:07:19 +08:00
<div style={{ width: 230, height: 230, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
2024-07-31 16:00:30 +08:00
<Empty
description="暂无数据"
/>
</div>
</div>
</div>
{/* <MenuTreeWithTopButton /> */}
2024-06-03 14:56:19 +08:00
{/* <MenuWithBottomButtom
2024-05-15 18:00:20 +08:00
button={agentMenu.button}
list={agentMenu.list}
handleListItem={agentMenu.handleListItem}
/> */}
2024-07-22 17:22:35 +08:00
{/* <MenuWithBottomButtom
2024-06-03 14:56:19 +08:00
button={sellMenu.button}
list={sellMenu.list}
handleListItem={sellMenu.handleListItem}
/>
<MenuWithBottomButtom
button={buyMenu.button}
list={buyMenu.list}
handleListItem={buyMenu.handleListItem}
2024-07-31 17:07:19 +08:00
/> */}
2024-06-14 15:50:34 +08:00
</div>
2024-03-27 18:56:48 +08:00
</div>
<div className="right">
2024-05-07 17:00:32 +08:00
<div>
<div className="top">
{/* 标签 */}
{/* {renderStatus()} */}
<div className='gps'>
<img src={gpsImg} alt="" />
2024-05-12 07:45:51 +08:00
<div>:{now}</div>
2024-05-07 17:00:32 +08:00
</div>
2024-06-14 15:50:34 +08:00
<div className='line' style={{
2024-07-17 14:19:28 +08:00
display: showSearchBox ? 'block' : 'none',
2024-06-14 15:50:34 +08:00
}} ></div>
<div
style={{
width: 1,
height: 23,
marginLeft: 33,
marginRight: 31,
2024-07-15 16:58:47 +08:00
display: showSearchBox ? 'none' : 'block'
2024-06-14 15:50:34 +08:00
}}
></div>
2024-07-17 14:19:28 +08:00
<Search placeholder="输入项目名称"
2024-07-31 16:00:30 +08:00
value={nowKeyword}
2024-07-17 14:19:28 +08:00
onSearch={handleSearch}
onChange={handleChange}
style={{
width: '253px',
height: '31px',
display: showSearchBox ? 'block' : 'none'
}}
/>
2024-07-15 16:58:47 +08:00
<Select
2024-07-31 16:00:30 +08:00
value={type}
2024-07-17 14:19:28 +08:00
style={{ height: '31px', width: '183px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
2024-07-15 16:58:47 +08:00
onChange={(value: string) => {
setType(value)
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: value,
2024-07-31 16:00:30 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 16:00:30 +08:00
authorId: authorId
2024-07-15 16:58:47 +08:00
}
})
}}
options={[
2024-07-31 17:07:19 +08:00
2024-07-15 16:58:47 +08:00
{ value: 'FREE', label: '免费试用' },
{ value: 'MATERIAL', label: '写材料' },
{ value: 'ALL', label: '全托管' },
]}
2024-07-31 17:07:19 +08:00
placeholder='选择类型'
2024-07-29 17:22:42 +08:00
/>
2024-07-31 16:00:30 +08:00
<Select
value={chargeAdditionals}
2024-07-29 17:22:42 +08:00
style={{ height: '31px', width: '183px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
// console.log(`selected ${value}`);
setchargeAdditionals(value)
// alert(`selected ${value}`)
// lyp
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 16:00:30 +08:00
chargeAdditionals: value,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 16:00:30 +08:00
authorId: authorId
2024-07-29 17:22:42 +08:00
}
})
}}
options={[
2024-07-31 16:00:30 +08:00
// { value: '', label: '全部项目' },
2024-07-29 17:22:42 +08:00
{ value: 'PKG', label: '安装包' },
{ value: 'VIDEO_DEMO', label: '演示视频' },
{ value: 'URGENT', label: '加急' },
]}
2024-07-31 16:00:30 +08:00
// defaultValue=""
placeholder={'选择拓展收费'}
/>
<Select
2024-07-31 18:41:25 +08:00
value={tagDataId}
2024-07-31 16:00:30 +08:00
style={{ height: '31px', width: '183px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
// console.log(`selected ${value}`);
2024-07-31 18:41:25 +08:00
settagDataId(value)
2024-07-31 16:00:30 +08:00
// alert(`selected ${value}`)
// lyp
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 16:00:30 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: value,
2024-07-31 16:00:30 +08:00
authorId: authorId
}
})
}}
2024-07-31 18:41:25 +08:00
options={
// [
// { value: 'PRODUCTION', label: '正在制作中' },
// { value: 'SUBMIT_FOR_REVIEW', label: '已提交版权中心' },
// { value: 'DONE', label: '已下证' },
// ]
tagArray
}
2024-07-31 16:00:30 +08:00
2024-07-31 18:41:25 +08:00
placeholder={'选择标签'}
2024-07-31 16:00:30 +08:00
2024-07-15 16:58:47 +08:00
/>
2024-07-31 16:00:30 +08:00
<Button onClick={() => {
init()
2024-08-12 14:43:58 +08:00
}} style={{ marginLeft: 10, display: showSearchBox ? 'block' : 'none', height: 31 }}
// type="primary"
icon={<ClearOutlined />}>
2024-07-31 16:00:30 +08:00
</Button>
2024-06-14 15:50:34 +08:00
<div style={{
width: '253px',
height: '31px',
2024-08-12 14:43:58 +08:00
display: showSearchBox ? 'none' : 'block'
2024-06-14 15:50:34 +08:00
}}></div>
2024-05-07 17:00:32 +08:00
<div className='nowPosition'>
<img src={backImg} alt="" />
2024-07-31 17:07:19 +08:00
<div style={{ display: now == '首页' ? 'block' : 'none' }}>
{/* <Breadcrumb
2024-05-07 17:00:32 +08:00
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
2024-07-31 17:07:19 +08:00
/> */}
<span></span>
</div>
<div style={{ display: now == '创建项目' ? 'block' : 'none' }}>
{/* <Breadcrumb
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
/> */}
<span style={{ cursor: 'pointer' }}
onClick={() => {
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 17:07:19 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 17:07:19 +08:00
authorId: authorId
}
})
}}
></span>
<span style={{ marginLeft: 10, marginRight: 10 }}>|</span>
<span></span>
</div>
<div style={{ display: now == '编辑项目' ? 'block' : 'none' }}>
{/* <Breadcrumb
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
/> */}
<span style={{ cursor: 'pointer' }}
onClick={() => {
nav('/home', {
state: {
keyword: keywords,
2024-08-01 13:25:33 +08:00
type: type,
2024-07-31 17:07:19 +08:00
chargeAdditionals: chargeAdditionals,
2024-07-31 18:41:25 +08:00
tagDataId: tagDataId,
2024-07-31 17:07:19 +08:00
authorId: authorId
}
})
}}
></span>
<span style={{ marginLeft: 10, marginRight: 10 }}>|</span>
<span></span>
2024-05-07 17:00:32 +08:00
</div>
</div>
</div>
</div>
{/* {
2024-03-27 18:56:48 +08:00
listData.type === IndexListDataType.PROJ ? <ListProj/> : (
listData.type == IndexListDataType.AGENT ? <ListProjAgent/> : <></>
)
2024-05-07 17:00:32 +08:00
} */}
2024-05-12 07:45:51 +08:00
<div>
<Outlet></Outlet>
</div>
2024-03-27 18:56:48 +08:00
</div>
</div>
</IndexListDispatchContext.Provider>
</IndexListContext.Provider>
</>
)
}