From a612a6abbe9671bf5701289dd5186832d475741f Mon Sep 17 00:00:00 2001 From: Riollee <530377286@qq.com> Date: Thu, 24 Jun 2021 10:25:57 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=80=BB=E8=A7=88=E5=B1=95=E7=A4=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/task/TaskOverviewPage.js | 211 ++++++++++++++++++++++ src/page/task/TaskOverviewPage.module.css | 31 ++++ 2 files changed, 242 insertions(+) create mode 100644 src/page/task/TaskOverviewPage.js create mode 100644 src/page/task/TaskOverviewPage.module.css diff --git a/src/page/task/TaskOverviewPage.js b/src/page/task/TaskOverviewPage.js new file mode 100644 index 0000000..cf013d1 --- /dev/null +++ b/src/page/task/TaskOverviewPage.js @@ -0,0 +1,211 @@ +import React, { Component } from 'react' +import styles from './TaskOverviewPage.module.css' +import { Button, Divider, Popconfirm, Progress, Space, Table, Tag } from 'antd' +import PropTypes from 'prop-types' +import { connect } from 'react-redux' +import { deleteTaskAsync, getTaskListAsync, getUserInfoAsync } from '../../redux/async-actions' +import BreadcrumbComponent from '../../components/base/BreadcrumbComponent' + +const dataSource = { + 0: 25, + 1: 50, + 2: 75, + 3: 100 +} + +class TaskOverviewPage extends Component { + constructor (props) { + super(props) + this.state = { + page: 0, + pageSize: 100, + taskIndex: 0, + loading: true, + } + } + + UNSAFE_componentWillMount () { + const { page, pageSize } = this.state + const { studentId } = this.props + this.props.getTaskListAsync({ page, pageSize, timeOrder: false }).then( + () => { + this.setState({ loading: false }) + } + ) + this.props.getUserInfoAsync({ id: studentId }) + const { userInfo } = this.props + this.columns = [ + { + title: '名称', + dataIndex: 'taskName', + key: 'taskName', + width: 200, + render: (text, record) => + this.props.taskList.length >= 1 ? ( + + this.handleJumpPage(record.id)}>{text} + + ) : null + }, + { + title: '承担者', + dataIndex: 'acceptorName', + key: 'acceptorName', + }, + { + title: '截止日期', + dataIndex: 'deadline', + key: 'deadline', + }, + { + title: '任务状态', + dataIndex: 'taskStatus', + key: 'taskStatus', + render: (text, _) => { + let color = text === true ? 'green' : 'red' + let word = text === true ? '已完成' : '未完成' + return ( + + {word} + + ) + } + }, + { + title: '活动进度', + dataIndex: 'activityStatus', + key: 'activityStatus', + render: (text, _) => { + return ( + + ) + } + }, + { + title: '操作', + dataIndex: '', + key: 'x', + render: (text, record) => + this.props.taskList.length >= 1 ? ( + + this.handleJumpPage(record.id)}>查看 + { + userInfo.role !== 'Staff' && + this.handleDelete(record.id)}> + 删除 + + } + + ) : null + } + ] + } + + handlePageChange = (page, pageSize) => { + //直接使用setState是异步的,调用api时直接使用page请求。同步方法,即为通过回调函数进行相关操作 + this.setState({ page: page - 1, pageSize }) + } + + handleJumpPage = taskId => { + window.open(`/index/task/${taskId}/content`) + } + + handleDelete = id => { + this.props.deleteTaskAsync({ id: id }) + } + + handleRelease = studentId => { + window.open(`/index/task/${studentId}/release`) + } + + handleClickCategory = (id) => { + let { page, pageSize } = this.state + this.setState({ taskIndex: id, loading: true }) + if (id === 0) { + this.props.getTaskListAsync({ page, pageSize, timeOrder: false }).then( + () => {this.setState({ loading: false })} + ) + } else if (id === 1) { + this.props.getTaskListAsync({ page, pageSize, acceptorId: this.props.studentId, timeOrder: false }).then( + () => {this.setState({ loading: false })} + ) + } else if (id === 2) { + this.props.getTaskListAsync({ page, pageSize, creatorId: this.props.studentId, timeOrder: false }).then( + () => {this.setState({ loading: false })} + ) + } + } + + render () { + const { studentId, userInfo } = this.props + const { taskIndex } = this.state + return ( +
+
+ +
+
+
+
+
+ 类别: +
+ + + + + +
+ { + userInfo.role !== 'Staff' && +
+ +
+ } +
+ 任务列表 + this.handlePageChange(page, pageSize),//返回分页的页码和大小 + pageSize: 10, + }} + /> + + + ) + } +} + +TaskOverviewPage.propTypes = { + taskList: PropTypes.any +} + +TaskOverviewPage = connect( + ({ + $TaskState: { taskList }, + $LoginState: { userId }, + $UserState: { userInfo }, + }) => + ({ + taskList, + studentId: userId, + userInfo + }), + { + getTaskListAsync, + deleteTaskAsync, + getUserInfoAsync + } +)(TaskOverviewPage) + +export default TaskOverviewPage \ No newline at end of file diff --git a/src/page/task/TaskOverviewPage.module.css b/src/page/task/TaskOverviewPage.module.css new file mode 100644 index 0000000..0bfc28f --- /dev/null +++ b/src/page/task/TaskOverviewPage.module.css @@ -0,0 +1,31 @@ +.container { + padding: 30px 0 0 0; +} + +.Breadcrumb { + padding: 0 0 20px 0; +} + +.select { + display: flex; +} + +.category { + display: flex; +} + +.listSub { + line-height: 40px; + font-size: 16px; + font-weight: 900; + color: #555555; +} + +.release { + flex: 1; + text-align: right; +} + +.postList { + +} \ No newline at end of file -- Gitee From 37ee2b293503397a85a4150c1adb31df0bcd70ce Mon Sep 17 00:00:00 2001 From: Riollee <530377286@qq.com> Date: Thu, 24 Jun 2021 11:20:19 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/task/TaskContentPage.js | 147 +++++++++++++++++++++++ src/page/task/TaskContentPage.module.css | 38 ++++++ 2 files changed, 185 insertions(+) create mode 100644 src/page/task/TaskContentPage.js create mode 100644 src/page/task/TaskContentPage.module.css diff --git a/src/page/task/TaskContentPage.js b/src/page/task/TaskContentPage.js new file mode 100644 index 0000000..7dedfe0 --- /dev/null +++ b/src/page/task/TaskContentPage.js @@ -0,0 +1,147 @@ +import React, { Component } from 'react' +import styles from './TaskContentPage.module.css' +import PropTypes from 'prop-types' +import { Descriptions, Button, Popconfirm, Space, Divider, Badge } from 'antd' +import ActivityStateComponent from '../../components/activity-component/ActivityStateComponent' +import { connect } from 'react-redux' +import { + editTaskStatusAsync, + getActivityContentAsync, + getTaskContentAsync, getTaskCountAsync, + getTaskStatusAsync, getUserInfoAsync +} from '../../redux/async-actions' +import BreadcrumbComponent from '../../components/base/BreadcrumbComponent' +import { Link } from 'react-router-dom' + +class TaskContentPage extends Component { + + async UNSAFE_componentWillMount () { + const taskId = this.props.match.params.taskId + this.props.getUserInfoAsync({ id: this.props.studentId }) + this.props.getTaskStatusAsync({ id: taskId }) + await this.props.getTaskContentAsync(taskId) + await this.props.getActivityContentAsync({ Id: this.props.taskContent.activityId }) + await this.props.getTaskCountAsync({ activityId: this.props.taskContent.activityId }) + } + + handleComplete = () => { + this.props.editTaskStatusAsync({ id: this.props.match.params.taskId, status: true }) + } + + render () { + const { + createTime, + creatorName, + taskName, + acceptorName, + content, + activityStatus, + activityId, + deadline, + lastModifyTime + } = this.props.taskContent + const { taskStatus } = this.props.taskStatus + const { studentId, userInfo, taskCount } = this.props + const { name } = this.props.activityContent + return ( +
+
+
+ +
+
+

{name || '待加载'}

+ +
+
+

{taskName || '任务名称'}

+
+
+ 任务信息 +
+ + {creatorName} + {createTime === undefined ? createTime : createTime.substr(0, 10)} + {acceptorName} + {deadline} + {lastModifyTime === undefined ? lastModifyTime : lastModifyTime.substr(0, 10)} + + {taskStatus === false ? '未完成' : '已完成'} + + +
{content}
+
+
+
+
+
+ 任务状态 + +
+ 状态: + + {taskStatus === false ? '未完成' : '已完成'} + +
+ { + taskStatus !== true && userInfo.role !== 'Staff' && +
+ + + +
+ } +
+
+
+
+ +
+
+ ) + } +} + +TaskContentPage = connect( + ({ + $TaskState: { taskContent, taskStatus, taskCount }, + $LoginState: { userId }, + $ActivityState: { activityContent }, + $UserState: { userInfo }, + }) => ({ + taskContent, + taskStatus, + activityContent, + studentId: userId, + userInfo, + taskCount + }), + { + getTaskContentAsync, + getTaskStatusAsync, + editTaskStatusAsync, + getActivityContentAsync, + getUserInfoAsync, + getTaskCountAsync, + } +)(TaskContentPage) + +TaskContentPage.propType = { + taskName: PropTypes.string, + acceptor: PropTypes.string, +} + +export default TaskContentPage \ No newline at end of file diff --git a/src/page/task/TaskContentPage.module.css b/src/page/task/TaskContentPage.module.css new file mode 100644 index 0000000..d1a7831 --- /dev/null +++ b/src/page/task/TaskContentPage.module.css @@ -0,0 +1,38 @@ +.container { + padding: 30px 0 0 0; + display: flex; +} + +.Breadcrumb { + padding: 0 0 20px 0; +} + +.detailed { + width: 90%; + padding: 0 10px 20px 0; +} + +.description { +} + +.content { + width: 75%; +} + +.taskContent { + width: 80%; +} + +.progress { + padding: 150px 0 0 0; + transform: scale(1.2); +} + +.state { + width: 90%; + padding: 0 10px 20px 0; +} + +.progress:hover { + cursor: pointer +} \ No newline at end of file -- Gitee From 817ce00b58c73bcb8d0ffa2314188158bfa39ad2 Mon Sep 17 00:00:00 2001 From: WHvan <2399445324@qq.com> Date: Thu, 24 Jun 2021 13:06:06 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/task/TaskContentPage.js | 147 +++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 src/page/task/TaskContentPage.js diff --git a/src/page/task/TaskContentPage.js b/src/page/task/TaskContentPage.js new file mode 100644 index 0000000..7dedfe0 --- /dev/null +++ b/src/page/task/TaskContentPage.js @@ -0,0 +1,147 @@ +import React, { Component } from 'react' +import styles from './TaskContentPage.module.css' +import PropTypes from 'prop-types' +import { Descriptions, Button, Popconfirm, Space, Divider, Badge } from 'antd' +import ActivityStateComponent from '../../components/activity-component/ActivityStateComponent' +import { connect } from 'react-redux' +import { + editTaskStatusAsync, + getActivityContentAsync, + getTaskContentAsync, getTaskCountAsync, + getTaskStatusAsync, getUserInfoAsync +} from '../../redux/async-actions' +import BreadcrumbComponent from '../../components/base/BreadcrumbComponent' +import { Link } from 'react-router-dom' + +class TaskContentPage extends Component { + + async UNSAFE_componentWillMount () { + const taskId = this.props.match.params.taskId + this.props.getUserInfoAsync({ id: this.props.studentId }) + this.props.getTaskStatusAsync({ id: taskId }) + await this.props.getTaskContentAsync(taskId) + await this.props.getActivityContentAsync({ Id: this.props.taskContent.activityId }) + await this.props.getTaskCountAsync({ activityId: this.props.taskContent.activityId }) + } + + handleComplete = () => { + this.props.editTaskStatusAsync({ id: this.props.match.params.taskId, status: true }) + } + + render () { + const { + createTime, + creatorName, + taskName, + acceptorName, + content, + activityStatus, + activityId, + deadline, + lastModifyTime + } = this.props.taskContent + const { taskStatus } = this.props.taskStatus + const { studentId, userInfo, taskCount } = this.props + const { name } = this.props.activityContent + return ( +
+
+
+ +
+
+

{name || '待加载'}

+ +
+
+

{taskName || '任务名称'}

+
+
+ 任务信息 +
+ + {creatorName} + {createTime === undefined ? createTime : createTime.substr(0, 10)} + {acceptorName} + {deadline} + {lastModifyTime === undefined ? lastModifyTime : lastModifyTime.substr(0, 10)} + + {taskStatus === false ? '未完成' : '已完成'} + + +
{content}
+
+
+
+
+
+ 任务状态 + +
+ 状态: + + {taskStatus === false ? '未完成' : '已完成'} + +
+ { + taskStatus !== true && userInfo.role !== 'Staff' && +
+ + + +
+ } +
+
+
+
+ +
+
+ ) + } +} + +TaskContentPage = connect( + ({ + $TaskState: { taskContent, taskStatus, taskCount }, + $LoginState: { userId }, + $ActivityState: { activityContent }, + $UserState: { userInfo }, + }) => ({ + taskContent, + taskStatus, + activityContent, + studentId: userId, + userInfo, + taskCount + }), + { + getTaskContentAsync, + getTaskStatusAsync, + editTaskStatusAsync, + getActivityContentAsync, + getUserInfoAsync, + getTaskCountAsync, + } +)(TaskContentPage) + +TaskContentPage.propType = { + taskName: PropTypes.string, + acceptor: PropTypes.string, +} + +export default TaskContentPage \ No newline at end of file -- Gitee From 5f887264640673fe6b04c0bd1e438bbe2ad2f6d5 Mon Sep 17 00:00:00 2001 From: WHvan <2399445324@qq.com> Date: Thu, 24 Jun 2021 13:07:16 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E9=A1=B5=E9=9D=A2UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/task/TaskContentPage.module.css | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/page/task/TaskContentPage.module.css diff --git a/src/page/task/TaskContentPage.module.css b/src/page/task/TaskContentPage.module.css new file mode 100644 index 0000000..d1a7831 --- /dev/null +++ b/src/page/task/TaskContentPage.module.css @@ -0,0 +1,38 @@ +.container { + padding: 30px 0 0 0; + display: flex; +} + +.Breadcrumb { + padding: 0 0 20px 0; +} + +.detailed { + width: 90%; + padding: 0 10px 20px 0; +} + +.description { +} + +.content { + width: 75%; +} + +.taskContent { + width: 80%; +} + +.progress { + padding: 150px 0 0 0; + transform: scale(1.2); +} + +.state { + width: 90%; + padding: 0 10px 20px 0; +} + +.progress:hover { + cursor: pointer +} \ No newline at end of file -- Gitee From ebc0ac28f052509048eba9a8f6e28c90b72de96f Mon Sep 17 00:00:00 2001 From: Riollee <530377286@qq.com> Date: Thu, 24 Jun 2021 14:51:11 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=91=E5=B8=83=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/task/TaskReleasePage.js | 72 ++++++++++++++++++++++++ src/page/task/TaskReleasePage.module.css | 12 ++++ 2 files changed, 84 insertions(+) create mode 100644 src/page/task/TaskReleasePage.js create mode 100644 src/page/task/TaskReleasePage.module.css diff --git a/src/page/task/TaskReleasePage.js b/src/page/task/TaskReleasePage.js new file mode 100644 index 0000000..46f3a72 --- /dev/null +++ b/src/page/task/TaskReleasePage.js @@ -0,0 +1,72 @@ +import React, { Component } from 'react' +import { connect } from 'react-redux' +import { + getActivityListAsync, + getDepartmentsAsync, getUserInfoAsync, + getUserListAsync, + releaseTaskAsync +} from '../../redux/async-actions' +import styles from './TaskReleasePage.module.css' +import TaskReleaseComponent from '../../components/task-component/TaskReleaseComponent' +import BreadcrumbComponent from '../../components/base/BreadcrumbComponent' +import { Redirect } from 'react-router' + +class TaskReleasePage extends Component { + UNSAFE_componentWillMount () { + this.props.getUserListAsync({ page: 0, pageSize: 100 }) + this.props.getActivityListAsync({ category: '全部', page: 0, pageSize: 100 }) + this.props.getDepartmentsAsync() + this.props.getUserInfoAsync({ id: this.props.studentId }) + } + + render () { + const { activityList, userList, studentId, departments, userInfo } = this.props + if (userInfo.role === 'Staff') { + return + } + return ( +
+
+ +
+
+ +
+
+ ) + } +} + +TaskReleasePage = connect( + ({ + $LoginState: { userId }, + $UserState: { userList, departments, userInfo }, + $ActivityState: { activityList }, + }) => ({ + studentId: userId, + userList, + activityList, + departments, + userInfo + }), + { + releaseTaskAsync, + getUserListAsync, + getActivityListAsync, + getDepartmentsAsync, + getUserInfoAsync + } +)(TaskReleasePage) + +export default TaskReleasePage \ No newline at end of file diff --git a/src/page/task/TaskReleasePage.module.css b/src/page/task/TaskReleasePage.module.css new file mode 100644 index 0000000..c83db4d --- /dev/null +++ b/src/page/task/TaskReleasePage.module.css @@ -0,0 +1,12 @@ +.container { + padding: 30px 0 0 0; +} + +.release { + width: 600px; + margin: 0 auto; +} + +.Breadcrumb { + padding: 0 0 20px 0; +} -- Gitee From ab9b856a44aea0411d6a016c139faebf4e425b40 Mon Sep 17 00:00:00 2001 From: Zhang Yifu <281105611@qq.com> Date: Thu, 24 Jun 2021 16:03:53 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=A8=A1=E5=9D=97action-types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/redux/action-types.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/redux/action-types.js b/src/redux/action-types.js index 30c9c14..87fe7b9 100644 --- a/src/redux/action-types.js +++ b/src/redux/action-types.js @@ -5,3 +5,11 @@ export const T_LOGIN = 't_set_accesstoken' export const T_LOGOUT = 't_logout' export const T_LOGIN_STATE = 't_login_state' + +/** + * 用户模块 + * @type {string} + */ +export const U_SET_USER_LIST = 'u_set_user_list' +export const U_SET_USER_INFO = 'u_set_user_info' +export const U_DELETE_USER = 'u_delete_user' \ No newline at end of file -- Gitee From dbe26bc29cda210d9f17bcd49ada087ff51136e1 Mon Sep 17 00:00:00 2001 From: Riollee <530377286@qq.com> Date: Thu, 24 Jun 2021 16:50:24 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=80=BB=E8=A7=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/activity/ActivityOverviewPage.js | 258 ++++++++++++++++++ .../activity/ActivityOverviewPage.module.css | 38 +++ 2 files changed, 296 insertions(+) create mode 100644 src/page/activity/ActivityOverviewPage.js create mode 100644 src/page/activity/ActivityOverviewPage.module.css diff --git a/src/page/activity/ActivityOverviewPage.js b/src/page/activity/ActivityOverviewPage.js new file mode 100644 index 0000000..3b5c8de --- /dev/null +++ b/src/page/activity/ActivityOverviewPage.js @@ -0,0 +1,258 @@ +import React, { Component } from 'react' +import styles from './ActivityOverviewPage.module.css' +import { Button, Divider, Popconfirm, Space, Table, Tag } from 'antd' +import { connect } from 'react-redux' +import { + deleteActivityAsync, + getActivityListAsync, + getUserInfoAsync, + getUserListAsync +} from '../../redux/async-actions' +import PropTypes from 'prop-types' +import BreadcrumbComponent from '../../components/base/BreadcrumbComponent' + +class ActivityOverviewPage extends Component { + constructor (props) { + super(props) + this.state = { + category: '全部', + activeIndex: 0, + page: 0, + pageSize: 100, + loading: true, + } + } + + UNSAFE_componentWillMount () { + const { category, page, pageSize } = this.state + this.props.getActivityListAsync({ category, page, pageSize }).then( + () => { + this.setState({ loading: false }) + } + ) + const { studentId } = this.props + this.props.getUserInfoAsync({ id: studentId }) + this.props.getUserListAsync({ page: 0, pageSize: 500 }) + } + + handleClickCategory = (type, id) => { + this.setState({ category: type, activeIndex: id, loading: true }) + const { page, pageSize } = this.state + this.props.getActivityListAsync({ category: type, page, pageSize, }).then( + () => { + this.setState({ loading: false }) + } + ) + } + + handlePageChange = (page, pageSize) => { + //直接使用setState是异步的,调用api时直接使用page请求。同步方法,即为通过回调函数进行相关操作 + // this.setState({ page: page - 1, pageSize }) + // const { category } = this.state + // this.props.getActivityListAsync({ category, page: page - 1, pageSize }) + } + + handleDelete = activityId => { + this.props.deleteActivityAsync({ id: activityId }) + } + + handleJumpPage = activityId => { + window.open(`/index/activity/${activityId}/content`) + } + + handleRelease = studentId => { + window.open(`/index/activity/${studentId}/release`) + } + + render () { + const { activeIndex } = this.state + const { studentId, userInfo, userList } = this.props + this.columns = [ + { + title: '名称', + dataIndex: 'name', + key: 'name', + render: (text, record) => + this.props.activityList.activities.length >= 1 ? ( + + this.handleJumpPage(record.id)}>{text} + + ) : null + }, + { + title: '类别', + dataIndex: 'category', + key: 'category', + }, + { + title: '创建者', + dataIndex: 'creatorName', + key: 'creatorName', + filters: userList.map(item => ( + { + text: item.realName, + value: item.realName, + } + )), + onFilter: (value, record) => record.creatorName.indexOf(value) === 0, + }, + { + title: '最近更新日期', + dataIndex: 'lastModify', + key: 'lastModify', + + }, + { + title: '活动进度', + dataIndex: 'status', + key: 'status', + filters: [ + { + text: '活动发布', + value: 0, + }, + { + text: '活动准备', + value: 1, + }, + { + text: '活动进行', + value: 2, + }, + { + text: '活动总结', + value: 3, + }, + { + text: '活动结束', + value: 4, + }, + ], + onFilter: (value, record) => record.status.toString().indexOf(value) === 0, + render: (text, _) => { + let color = 'green' + let status = '活动结束' + switch (text) { + case 0 : { + color = 'red' + status = '活动发布' + break + } + case 1 : { + color = 'orange' + status = '活动准备' + break + } + case 2 : { + color = 'purple' + status = '活动进行' + break + } + case 3 : { + color = 'geekblue' + status = '活动总结' + break + } + default: + } + return ( + + {status} + + ) + } + }, + { + title: '操作', + dataIndex: '', + key: 'x', + render: (text, record) => + this.props.activityList.activities.length >= 1 ? ( + + this.handleJumpPage(record.id)}>查看 + { + userInfo.role !== 'Staff' && + this.handleDelete(record.id)}> + 删除 + + } + + ) : null + } + ] + return ( +
+
+ +
+
+
+ 类别: +
+ + + + + + + + { + userInfo.role !== 'Staff' && +
+ +
+ } +
+ 活动列表 +
+
this.handlePageChange(page, pageSize),//返回分页的页码和大小 + pageSize: 10, + }} + /> + + + ) + } +} + +ActivityOverviewPage = connect( + ({ + $ActivityState: { activityList }, + $UserState: { userInfo, userList }, + $LoginState: { userId } + }) => + ({ + activityList, + studentId: userId, + userInfo, + userList + }), + { + getActivityListAsync, + deleteActivityAsync, + getUserInfoAsync, + getUserListAsync, + } +)(ActivityOverviewPage) + +ActivityOverviewPage.propTypes = { + activityList: PropTypes.any +} + +export default ActivityOverviewPage \ No newline at end of file diff --git a/src/page/activity/ActivityOverviewPage.module.css b/src/page/activity/ActivityOverviewPage.module.css new file mode 100644 index 0000000..e61eb13 --- /dev/null +++ b/src/page/activity/ActivityOverviewPage.module.css @@ -0,0 +1,38 @@ +.container { + padding: 30px 0 0 0; +} + +.categoryList { + display: flex; + justify-content: flex-start; + align-items: center; + flex-direction: row; + width: 100%; + margin-bottom: 20px; +} + +.Breadcrumb { + padding: 0 0 20px 0; +} + +.listSub { + height: 40px; + line-height: 40px; + margin-right: 30px; + font-size: 16px; + font-weight: 900; + color: #555555; +} + +Button { + transition: box-shadow 0.1s; +} + +.release { + flex: 1; + text-align: right; +} + +.postList { + +} \ No newline at end of file -- Gitee From f306781b527cf0b55c095c88bbcdbc9949824558 Mon Sep 17 00:00:00 2001 From: Zhang Yifu <281105611@qq.com> Date: Thu, 24 Jun 2021 17:10:48 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90s?= =?UTF-8?q?tore=E5=92=8C=E7=94=A8=E6=88=B7=E7=9A=84reducer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/redux/reducers.js | 60 +++++++++++++++++++++++++++++++++++++++++++ src/redux/store.js | 16 ++++++++++++ 2 files changed, 76 insertions(+) diff --git a/src/redux/reducers.js b/src/redux/reducers.js index 55ec14a..6b645d0 100644 --- a/src/redux/reducers.js +++ b/src/redux/reducers.js @@ -78,4 +78,64 @@ export function $LoginState (state = { accessToken: '' }, { data, type }) { default: return state } +} + +/** + * 定义用户的reducer,使用initUserState初始化 + * @param state + * @param data + * @param type + * @returns {{userInfo: {}, userList}|{userInfo: {}, userList: []}|{userInfo, userList: []}} + */ +export function $UserState (state = initUserState, { data, type }) { + switch (type) { + case U_SET_USER_LIST: + return { ...state, userList: data } + case U_SET_USER_INFO: + return { ...state, userInfo: { ...state.userInfo, ...data } } + case C_SET_CLASS_LIST: + return { ...state, classes: data } + case D_SET_DEPARTMENT_LIST: + return { ...state, departments: data } + case U_DELETE_USER: { + let { userList } = state + let list = [...userList] + list = list.filter(item => item.userId !== data.id) + return { ...state, userList: list } + } + case N_SET_NEWS_LIST: { + let { newsList, total } = data + return { ...state, news: newsList, newsTotal: total } + } + case N_SET_SIMPLE_NEWS_LIST: { + let { newsList, total } = data + return { ...state, simpleNews: newsList, simpleNewsTotal: total } + } + case N_READ_NEWS_LIST: { + let { newsTotal, simpleNewsTotal } = state + let news = state.news + for (let i = 0; i < news.length; i++) { + if (news[i].id === data) { + news[i].marked = true + break + } + } + let simpleNews = [...state.simpleNews] + for (let i = 0; i < simpleNews.length; i++) { + if (simpleNews[i].id === data) { + simpleNews.splice(i, 1) + break + } + } + return { + ...state, + news, + simpleNews, + newsTotal: newsTotal - 1, + simpleNewsTotal: simpleNewsTotal - 1, + } + } + default: + return state + } } \ No newline at end of file diff --git a/src/redux/store.js b/src/redux/store.js index 9b5e844..a6ee834 100644 --- a/src/redux/store.js +++ b/src/redux/store.js @@ -2,12 +2,28 @@ import { applyMiddleware, combineReducers, createStore } from 'redux' import { composeWithDevTools } from 'redux-devtools-extension' import thunk from 'redux-thunk' import { + $ActivityState, $GlobalState, + $UserState, + $LoginState, + $TaskState, + $ReimbursementState, + $MsgboardState, + $AssetState, + $SearchState } from './reducers' const store = createStore( combineReducers({ $GlobalState, + $UserState, + $LoginState, + $ActivityState, + $TaskState, + $ReimbursementState, + $MsgboardState, + $AssetState, + $SearchState }), composeWithDevTools(applyMiddleware(thunk)) ) -- Gitee From 5f8764ddacdc70d8eeb58416cc893517e0296d04 Mon Sep 17 00:00:00 2001 From: Riollee <530377286@qq.com> Date: Thu, 24 Jun 2021 21:12:44 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/activity/ActivityContentPage.js | 456 ++++++++++++++++++ .../activity/ActivityContentPage.module.css | 79 +++ 2 files changed, 535 insertions(+) create mode 100644 src/page/activity/ActivityContentPage.js create mode 100644 src/page/activity/ActivityContentPage.module.css diff --git a/src/page/activity/ActivityContentPage.js b/src/page/activity/ActivityContentPage.js new file mode 100644 index 0000000..0d30952 --- /dev/null +++ b/src/page/activity/ActivityContentPage.js @@ -0,0 +1,456 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import styles from './ActivityContentPage.module.css' +import { + Descriptions, + Button, + Cascader, + DatePicker, + Divider, + Form, + Input, message, + Modal, Popconfirm, + Select, + Space, + Table, + Upload +} from 'antd' +import ActivityStateComponent from '../../components/activity-component/ActivityStateComponent' +import { UploadOutlined } from '@ant-design/icons' +import { connect } from 'react-redux' +import { + deleteFileAsync, + editActivityContentAsync, + editActivityStatusAsync, + getActivityContentAsync, + getActivityStatusAsync, + getDepartmentsAsync, getTaskCountAsync, + getUserInfoAsync, + getUserListAsync +} from '../../redux/async-actions' +import locale from 'antd/es/date-picker/locale/zh_CN' +import BreadcrumbComponent from '../../components/base/BreadcrumbComponent' +import moment from 'moment' +import { departmentIdToName } from '../../components/base/Mapping' + +const layout = { + labelCol: { span: 8 }, + wrapperCol: { span: 8 }, +} + +const validateMessages = { + // eslint-disable-next-line + required: '${label} 未填写!', +} + +class ActivityContentPage extends Component { + constructor (props) { + super(props) + this.state = { + showModal: false, + avatarFile: {}, + page: 0, + pageSize: 5, + editStatus: true, + } + } + + UNSAFE_componentWillMount () { + const activityId = this.props.match.params.activityId + this.props.getUserListAsync({ page: 0, pageSize: 100 }) + this.props.getActivityContentAsync({ Id: activityId }) + this.props.getActivityStatusAsync({ id: activityId }) + this.props.getTaskCountAsync({ activityId }) + this.props.getDepartmentsAsync() + this.props.getUserInfoAsync({ id: this.props.studentId }) + let { userInfo } = this.props + this.columns = [ + { + title: '名称', + dataIndex: 'filename', + key: 'filename', + }, + { + title: '上传者', + dataIndex: 'uploaderName', + key: 'uploaderName', + }, + { + title: '上传时间', + dataIndex: 'uploadTime', + key: 'uploadTime', + }, + { + title: '最近修改人', + dataIndex: 'lastModifyUserName', + key: 'lastModifyUserName', + }, + { + title: '最近修改时间', + dataIndex: 'lastModifyTime', + key: 'lastModifyTime', + }, + { + title: '操作', + dataIndex: '', + key: 'download', + render: (text, record) => + this.props.activityContent.files.length >= 1 ? ( + + this.handleDownload(record.id)}>下载 + { + userInfo.role !== 'Staff' && + this.handleDelete(record.id)}> + 删除 + + } + + ) : null + } + ] + } + + handlePageChange = (page, pageSize) => { + //直接使用setState是异步的,调用api时直接使用page请求。同步方法,即为通过回调函数进行相关操作 + this.setState({ page: page - 1, pageSize }) + // this.props.getActivityContentAsync({ category, page: page - 1, pageSize }) + } + + //修改活动状态 + handleEditStatus = value => { + this.props.editActivityStatusAsync({ id: this.props.match.params.activityId, status: value }) + this.forceUpdate() + } + + handleCloseActivity = () => { + this.props.editActivityStatusAsync({ id: this.props.match.params.activityId, status: 4 }) + this.setState({ + editStatus: false + }) + } + + showModal = () => { + this.setState({ showModal: true }) + } + + handleCancel = () => { + this.setState({ showModal: false }) + } + + handleSubmit = form => { + const { name, category, introduction, department, student, time, teacher } = form + this.props.editActivityContentAsync({ + id: this.props.match.params.activityId, + status: this.props.activityStatus.status, + name: name, + category: category, + introduction: introduction, + departmentId: department, + studentId: student[1], + startTime: time[0].format('YYYY-MM-DD HH:mm:ss'), + endTime: time[1].format('YYYY-MM-DD HH:mm:ss'), + chargerIdList: [student[1]], + departmentIdList: [department], + teacherIdList: [teacher], + chargeNameList: this.props.userList.filter(item => item.userId === student[1])[0].realName, + departmentNameList: departmentIdToName({ departmentId: department }), + teacherNameList: this.props.userList.filter(item => item.userId === teacher)[0].realName + }) + setTimeout(() => { + this.setState({ showModal: false }) + }, 1000) + } + + handleDownload = id => { + window.open(`http://47.108.48.139/api/file/${id}/${this.props.accessToken}`) + message.success('浏览器即将开始下载,如错误请联系开发人员') + } + + handleDelete = id => { + this.props.deleteFileAsync(id) + } + + render () { + const { + name, + introduction, + files, + category, + startTime, + endTime, + releaseTime, + charger, + teachers, + } = this.props.activityContent + const { studentId, getActivityContentAsync, departments, userInfo, activityContent, taskCount } = this.props + console.log({ taskCount }) + let activityId = this.props.match.params.activityId + const { status } = this.props.activityStatus + const chargerId = [] + if (charger !== undefined) { + chargerId[0] = charger[0].departmentId + chargerId[1] = charger[0].userId + } + const uploadProps = { + name: 'file', + action: '/api/file', + method: 'POST', + headers: { + 'accessToken': this.props.accessToken + }, + data: { + 'activityId': this.props.match.params.activityId, + }, + onChange (info) { + if (info.file.status !== 'uploading') { + const { msg } = info.file.response + if (info.file.status === 'done') { + message.success('上传成功') + getActivityContentAsync({ Id: activityId }) + } else if (info.file.status === 'error') { + message.error(msg) + } + } + }, + showUploadList: { + showRemoveIcon: false + } + } + + return ( +
+
+
+ +
+
+

{name}

+ { + userInfo.role !== 'Staff' && +
+
+ +
+ { + status === 4 ? null : +
+ + + +
+ } +
+ } + +
+ + + + + + + + + + + + + + + + + + + + ( + { + value: item1.id, + label: item1.name, + children: this.props.userList.filter(item2 => item2.departmentId === item1.id).map(item3 => ( + { + value: item3.userId, + label: item3.realName, + } + )) + } + )) + } + /> + + + + + +
+
+
+ 活动信息 +
+
+ + {charger === undefined ? charger : charger[0].realName} + {activityContent.departments === undefined ? activityContent.departments : activityContent.departments[0].departmentName} + {teachers === undefined ? teachers : teachers[0].realName} + {releaseTime === undefined ? releaseTime : releaseTime.substr(0, 10)} + {startTime === undefined ? startTime : startTime.substr(0, 10)} - {endTime === undefined ? endTime : endTime.substr(0, 10)} + + +
{introduction}
+
+
+
+ { + userInfo.role !== 'Staff' && +
+ { + 修改活动状态 + } + { + status === 4 ? null : +
+
修改活动状态:
+ +
} + { + status !== 4 ? null : +
该活动已经结束,无法修改状态! +
+ } +
+ } +
+ 活动文件 +
+ + 上传文件: + +
+
this.handlePageChange(page, pageSize),//返回分页的页码和大小 + pageSize: 5, + }} + /> + + +
+ +
+ + ) + } +} + +ActivityContentPage.propTypes = { + name: PropTypes.string, + charger: PropTypes.array, + departments: PropTypes.array, + teachers: PropTypes.array, + introduction: PropTypes.string, + fileList: PropTypes.any, +} + +ActivityContentPage = connect( + ({ + $ActivityState: { activityContent, activityStatus }, + $UserState: { userList, departments, userInfo }, + $LoginState: { userId, accessToken }, + $TaskState: { taskCount } + }) => + ({ + activityContent, + activityStatus, + userList, + studentId: userId, + accessToken, + departments, + userInfo, + taskCount + }), + { + getActivityContentAsync, + editActivityContentAsync, + editActivityStatusAsync, + getActivityStatusAsync, + getUserListAsync, + deleteFileAsync, + getDepartmentsAsync, + getUserInfoAsync, + getTaskCountAsync, + } +)(ActivityContentPage) + +export default ActivityContentPage \ No newline at end of file diff --git a/src/page/activity/ActivityContentPage.module.css b/src/page/activity/ActivityContentPage.module.css new file mode 100644 index 0000000..77d5fc7 --- /dev/null +++ b/src/page/activity/ActivityContentPage.module.css @@ -0,0 +1,79 @@ +.container { + padding: 30px 0 0 0; + display: flex; +} + +.content { + width: 75%; +} + +.title { + display: flex; + align-items: center; + align-content: center; +} + +.edit { + text-align: right; +} + +.content { + padding-top: 20px; +} + +.introduction { + white-space: pre-line; +} + +.status { + font-size: 15px; + padding: 20px 0 0 0; + display: flex; + align-content: center; + align-items: center; +} + +.progress { + padding: 250px 0 0 0; + transform: scale(1.35); +} + +.progress:hover { + cursor: pointer +} + +.file { + padding: 20px 0 0 0; + width: 90%; +} + +.upload { + padding: 0 0 20px; +} + +.Breadcrumb { + padding: 0 0 20px 0; +} + +.close { + margin-left: 10px; +} + +.button { + padding: 0 100px 0 0; + margin-left: auto; + display: flex; +} + +.description { + width: 90%; +} + +.info { + width: 90%; + padding: 0 10px 0 0; +} + +.editStatus { + width: 90%; +} \ No newline at end of file -- Gitee From c78c0eade8cfb72d2ee4751194d414cfa5c01156 Mon Sep 17 00:00:00 2001 From: Riollee <530377286@qq.com> Date: Thu, 24 Jun 2021 21:13:43 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E3=80=90fix=E3=80=91=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=86=E6=B4=BB=E5=8A=A8=E6=A8=A1=E5=9D=97=E5=92=8C=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A8=A1=E5=9D=97=E7=9A=84=E9=83=A8=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=8E=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivityCategoryComponent.js | 42 ++++ .../ActivityCategoryComponent.module.css | 14 ++ .../ActivityReleaseComponent.js | 194 ++++++++++++++++++ .../ActivityReleaseComponent.module.css | 6 + .../ActivityStateComponent.js | 140 +++++++++++++ .../task-component/TaskReleaseComponent.js | 128 ++++++++++++ .../TaskReleaseComponent.module.css | 7 + 7 files changed, 531 insertions(+) create mode 100644 src/components/activity-component/ActivityCategoryComponent.js create mode 100644 src/components/activity-component/ActivityCategoryComponent.module.css create mode 100644 src/components/activity-component/ActivityReleaseComponent.js create mode 100644 src/components/activity-component/ActivityReleaseComponent.module.css create mode 100644 src/components/activity-component/ActivityStateComponent.js create mode 100644 src/components/task-component/TaskReleaseComponent.js create mode 100644 src/components/task-component/TaskReleaseComponent.module.css diff --git a/src/components/activity-component/ActivityCategoryComponent.js b/src/components/activity-component/ActivityCategoryComponent.js new file mode 100644 index 0000000..9a20c3f --- /dev/null +++ b/src/components/activity-component/ActivityCategoryComponent.js @@ -0,0 +1,42 @@ +import React, { Component } from 'react' +import { Card } from 'antd' +import { Link } from 'react-router-dom' +import styles from './ActivityCategoryComponent.module.css' +import PropTypes from 'prop-types' + +class ActivityCategoryComponent extends Component { + render () { + return ( +
+ +
+
+ {this.props.title} +
+
+
{this.props.title}
+
简介:{this.props.description}
+
+ 详细 > > +
+
+
+
+
+ ) + } +} + +ActivityCategoryComponent.propTypes = { + title: PropTypes.string.isRequired, + description: PropTypes.string.isRequired, + link: PropTypes.string.isRequired, + image: PropTypes.any, +} + +export default ActivityCategoryComponent \ No newline at end of file diff --git a/src/components/activity-component/ActivityCategoryComponent.module.css b/src/components/activity-component/ActivityCategoryComponent.module.css new file mode 100644 index 0000000..279b9f0 --- /dev/null +++ b/src/components/activity-component/ActivityCategoryComponent.module.css @@ -0,0 +1,14 @@ +.container { + display: flex; +} + +.title { + font-size: 16px; + font-weight: bold; +} + +.content { + padding: 5px 0 5px 10px; + flex-direction: column; + justify-content: space-between; +} \ No newline at end of file diff --git a/src/components/activity-component/ActivityReleaseComponent.js b/src/components/activity-component/ActivityReleaseComponent.js new file mode 100644 index 0000000..a0820d6 --- /dev/null +++ b/src/components/activity-component/ActivityReleaseComponent.js @@ -0,0 +1,194 @@ +import React, { Component } from 'react' +import styles from './ActivityReleaseComponent.module.css' +import { Button, Cascader, DatePicker, Form, Input, Select } from 'antd' +import PropTypes from 'prop-types' +import 'moment/locale/zh-cn' +import locale from 'antd/es/date-picker/locale/zh_CN' +import { connect } from 'react-redux' +import { checkActivityNameAsync, getDepartmentsAsync, releaseActivityAsync } from '../../redux/async-actions' +import { Redirect } from 'react-router-dom' + +const layout = { + labelCol: { span: 8 }, + wrapperCol: { span: 8 }, +} + +const validateMessages = { + // eslint-disable-next-line + required: '${label} 未填写!', +} + +class ActivityReleaseComponent extends Component { + constructor (props) { + super(props) + this.state = { + validateStatus: null, + help: null, + flag: false, + } + } + + componentDidMount () { + this.props.getDepartmentsAsync() + } + + handleFinish = async form => { + const { name, category, introduction, department, student, time, teacher } = form + await this.props.releaseActivityAsync({ + name: name, + category: category, + introduction: introduction, + departmentId: department, + studentId: student[1], + startTime: time[0].format('YYYY-MM-DD HH:mm:ss'), + endTime: time[1].format('YYYY-MM-DD HH:mm:ss'), + chargerIdList: [student[1]], + departmentIdList: [department], + teacherIdList: [teacher], + }) + await this.setState({ flag: true }) + } + + //动态监测活动名称不重复 + handleCheck = async ({ name }) => { + if (name !== undefined) { + await this.props.checkActivityNameAsync({ name: name }) + const { unique } = await this.props.activityCheck + if (!unique) { + this.setState({ + validateStatus: 'error', + help: '该活动名称已存在,请更换' + }) + } else if (name === '') { + this.setState({ + validateStatus: 'error', + help: null + }) + } else { + this.setState({ + validateStatus: 'validating', + help: null + }) + } + } + } + + render () { + if (this.state.flag) { + return + } + + const { departments } = this.props + + return ( +
+
+ + + + + + + + + + + + + + + + + + + {/*TODO 增加方法校验,当一个部门没有人时不允许选择 */} + + ( + { + value: item1.id, + label: item1.name, + children: this.props.userList.filter(item2 => item2.departmentId === item1.id).map(item3 => ( + { + value: item3.userId, + label: item3.realName, + } + )) + } + )) + } + /> + + + + + +
+ ) + } +} + +ActivityReleaseComponent.propTypes = { + releaseActivityAsync: PropTypes.func, + userList: PropTypes.array, +} + +ActivityReleaseComponent = connect( + ({ + $ActivityState: { activityCheck }, + $LoginState: { userId }, + $UserState: { departments } + }) => ({ + activityCheck, + studentId: userId, + departments + }), + { + checkActivityNameAsync, + releaseActivityAsync, + getDepartmentsAsync, + } +)(ActivityReleaseComponent) + +export default ActivityReleaseComponent \ No newline at end of file diff --git a/src/components/activity-component/ActivityReleaseComponent.module.css b/src/components/activity-component/ActivityReleaseComponent.module.css new file mode 100644 index 0000000..d8f9c0d --- /dev/null +++ b/src/components/activity-component/ActivityReleaseComponent.module.css @@ -0,0 +1,6 @@ +.container { +} + +.submit { + margin: 0 auto; +} \ No newline at end of file diff --git a/src/components/activity-component/ActivityStateComponent.js b/src/components/activity-component/ActivityStateComponent.js new file mode 100644 index 0000000..edfc491 --- /dev/null +++ b/src/components/activity-component/ActivityStateComponent.js @@ -0,0 +1,140 @@ +import React, { Component } from 'react' +import { Modal, Space, Steps, Table, Tag } from 'antd' +import PropTypes from 'prop-types' +import { connect } from 'react-redux' +import { getTaskListAsync } from '../../redux/async-actions' + +const { Step } = Steps + +class ActivityStateComponent extends Component { + state = { + page: 0, + pageSize: 100, + showModal: false, + } + + UNSAFE_componentWillMount () { + this.columns = [ + { + title: '名称', + dataIndex: 'taskName', + key: 'taskName', + width: 150, + ellipsis: true, + render: (text, record) => + this.props.taskList.length >= 1 ? ( + + this.handleJumpPage(record.id)}>{text} + + ) : null + }, + { + title: '承担者', + dataIndex: 'acceptorName', + key: 'acceptorName', + }, + { + title: '截止日期', + dataIndex: 'deadline', + key: 'deadline', + }, + { + title: '任务状态', + dataIndex: 'taskStatus', + key: 'taskStatus', + render: (text, _) => { + let color = text === true ? 'green' : 'red' + let word = text === true ? '已完成' : '未完成' + return ( + + {word} + + ) + } + }, + ] + } + + handleCheckTask = async status => { + const { page, pageSize } = this.state + const { activityId } = this.props + await this.props.getTaskListAsync({ page, pageSize, activityId: activityId, status: status, timeOrder: true }) + await this.showModal() + } + + showModal = () => { + this.setState({ showModal: true }) + } + + handleCancel = () => { + this.setState({ showModal: false }) + } + + handleJumpPage = taskId => { + window.open(`/index/task/${taskId}/content`) + } + + render () { + const { status, taskCount } = this.props + const { release, prepare, process, summarize } = taskCount + return ( +
+
+ + this.handleCheckTask(0)} + description={release === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${release}个任务!`}/> + this.handleCheckTask(1)} + description={prepare === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${prepare}个任务!`}/> + this.handleCheckTask(2)} + description={process === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${process}个任务!`}/> + this.handleCheckTask(3)} + description={summarize === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${summarize}个任务!`}/> + + +
+
+ +
this.handlePageChange(page, pageSize),//返回分页的页码和大小 + pageSize: 5, + }} + /> + + + + ) + } +} + +ActivityStateComponent.propTypes = { + status: PropTypes.number, + activityId: PropTypes.number, + taskCount: PropTypes.any, +} + +ActivityStateComponent = connect( + ({ + $TaskState: { taskList } + }) => ({ + taskList, + }), + { + getTaskListAsync, + } +)(ActivityStateComponent) + +export default ActivityStateComponent \ No newline at end of file diff --git a/src/components/task-component/TaskReleaseComponent.js b/src/components/task-component/TaskReleaseComponent.js new file mode 100644 index 0000000..03a0508 --- /dev/null +++ b/src/components/task-component/TaskReleaseComponent.js @@ -0,0 +1,128 @@ +import React, { Component } from 'react' +import moment from 'moment' +import 'moment/locale/zh-cn' +import styles from './TaskReleaseComponent.module.css' +import { Button, Cascader, DatePicker, Form, Input, Select } from 'antd' +import PropTypes from 'prop-types' +import locale from 'antd/es/date-picker/locale/zh_CN' +import { Redirect } from 'react-router-dom' + +const layout = { + labelCol: { span: 8 }, + wrapperCol: { span: 8 }, +} + +const validateMessages = { + // eslint-disable-next-line + required: '${label} 未填写!', +} + +class TaskReleaseComponent extends Component { + state = { + flag: false + } + + handleFinish = async form => { + const { taskName, acceptor, activity, activityStatus, deadline, content } = form + await this.props.releaseTaskAsync({ + taskName: taskName, + acceptorId: acceptor[1], + activityId: activity, + activityStatus: activityStatus, + deadline: deadline.format('YYYY-MM-DD HH:mm:ss'), + content: content + }) + await this.setState({ flag: true }) + } + + render () { + if (this.state.flag) { + return + } + const { userList, departments, activities } = this.props + return ( +
+
+ + + + + ( + { + value: item1.id, + label: item1.name, + children: userList.filter(item2 => item2.departmentId === item1.id).map(item3 => ( + { + value: item3.userId, + label: item3.realName, + } + )) + } + )) + } + /> + + + + + + + + + + + + + + + + + +
+ ) + } +} + +TaskReleaseComponent.propTypes = { + releaseTaskAsync: PropTypes.func, + userList: PropTypes.array, + activities: PropTypes.array, + studentId: PropTypes.number, + departments: PropTypes.array, +} + +export default TaskReleaseComponent \ No newline at end of file diff --git a/src/components/task-component/TaskReleaseComponent.module.css b/src/components/task-component/TaskReleaseComponent.module.css new file mode 100644 index 0000000..2470f17 --- /dev/null +++ b/src/components/task-component/TaskReleaseComponent.module.css @@ -0,0 +1,7 @@ +.container { + +} + +.submit { + margin: 0 auto; +} \ No newline at end of file -- Gitee From ed923ec3e638f94bd4a2b9a25a572218a27bc56d Mon Sep 17 00:00:00 2001 From: Zhang Yifu <281105611@qq.com> Date: Thu, 24 Jun 2021 23:31:12 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90s?= =?UTF-8?q?ync=E7=9A=84=E6=B3=A8=E5=86=8C=E9=83=A8=E5=88=86=EF=BC=8Casync?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/redux/action-types.js | 12 +++++++++- src/redux/async-actions.js | 46 +------------------------------------- src/redux/sync-actions.js | 44 +++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 47 deletions(-) diff --git a/src/redux/action-types.js b/src/redux/action-types.js index 87fe7b9..65253fe 100644 --- a/src/redux/action-types.js +++ b/src/redux/action-types.js @@ -12,4 +12,14 @@ export const T_LOGIN_STATE = 't_login_state' */ export const U_SET_USER_LIST = 'u_set_user_list' export const U_SET_USER_INFO = 'u_set_user_info' -export const U_DELETE_USER = 'u_delete_user' \ No newline at end of file +export const U_DELETE_USER = 'u_delete_user' + +/** + * 活动模块 + * @type {string} + */ +export const A_SET_ACTIVITY_LIST = 'a_set_activity_list' +export const A_SET_ACTIVITY_CONTENT = 'a_set_activity_content' +export const A_SET_ACTIVITY_STATUS = 'a_set_activity_status' +export const A_DELETE_ACTIVITY = 'a_delete_activity' +export const A_SET_ACTIVITY_CHECK = 'a_set_activity_check' \ No newline at end of file diff --git a/src/redux/async-actions.js b/src/redux/async-actions.js index faf1da3..1c0501e 100644 --- a/src/redux/async-actions.js +++ b/src/redux/async-actions.js @@ -1,48 +1,4 @@ -import { - deleteInit, - getInit, - postInit, - putInit, - query, - request, - rest, -} from '../api/http' -import { asyncResponseHandler } from './base' -import { - a_delete_activity, - a_set_activity_content, - a_set_activity_list, - a_set_activity_status, - f_delete_file, - r_set_reimbursement_approve_list, - r_set_reimbursement_create_list, - r_set_reimbursement_info, - r_set_reimbursement_list, - r_delete_reimbursement_list, - t_login, - t_logout, - t_set_task_content, - t_set_task_list, - t_set_task_status, - u_set_user_info, - u_set_user_list, - t_delete_task, - m_set_msgboard_list, - m_delete_msgboard_list, - a_set_activity_check, - r_approve_reimbursement_list, - r_delete_create_reimbursement, - as_set_asset_list, - d_set_department_list, - c_set_class_list, - t_set_task_count, - n_set_news_list, - u_delete_user, - n_set_simple_news_list, - n_read_news_list, - s_set_search_result_list, -} from './sync-actions' -import { message } from 'antd' + /** * 用户登陆,向后端发送POST diff --git a/src/redux/sync-actions.js b/src/redux/sync-actions.js index 213836d..564068a 100644 --- a/src/redux/sync-actions.js +++ b/src/redux/sync-actions.js @@ -1,3 +1,45 @@ - +import { + A_DELETE_ACTIVITY, + A_SET_ACTIVITY_CHECK, + A_SET_ACTIVITY_CONTENT, + A_SET_ACTIVITY_LIST, + A_SET_ACTIVITY_STATUS, + AS_SET_ASSET_LIST, + C_SET_CLASS_LIST, + D_SET_DEPARTMENT_LIST, + F_DELETE_FILE, + M_DELETE_MSGBOARD_LIST, + M_SET_MSGBOARD_LIST, + N_READ_NEWS_LIST, + N_SET_NEWS_LIST, + N_SET_SIMPLE_NEWS_LIST, + R_APPROVE_REIMBURSEMENT_LIST, + R_DELETE_CREATE_REIMBURSEMENT, + R_DELETE_REIMBURSEMENT_LIST, + R_SET_REIMBURSEMENT_APPROVE_LIST, + R_SET_REIMBURSEMENT_CREATE_LIST, + R_SET_REIMBURSEMENT_INFO, + R_SET_REIMBURSEMENT_LIST, + S_SET_SEARCH_RESULT_LIST, + T_DELETE_TASK, + T_LOGIN, + T_LOGIN_STATE, + T_LOGOUT, + T_SET_TASK_CONTENT, + T_SET_TASK_COUNT, + T_SET_TASK_LIST, + T_SET_TASK_STATUS, + U_DELETE_USER, + U_SET_USER_INFO, + U_SET_USER_LIST, +} from './action-types' export const actionFactory = (type, data = undefined) => ({ type, data }) + +/** + * 注册登陆模块 + * @returns {{data: undefined, type}} + */ +export const t_login = data => actionFactory(T_LOGIN, data) +export const t_logout = () => actionFactory(T_LOGOUT) +export const loadUserState = () => actionFactory(T_LOGIN_STATE) \ No newline at end of file -- Gitee