Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
d77ed682
Commit
d77ed682
authored
Jul 30, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新建培训计划页面初始化
parent
c4c91386
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
713 additions
and
430 deletions
+713
-430
src/modules/task-center/AddTrainTask.jsx
+104
-0
src/modules/task-center/AddTrainTask.less
+19
-0
src/modules/task-center/TrainTaskPage.jsx
+31
-38
src/modules/task-center/components/BasicInfo.jsx
+158
-0
src/modules/task-center/components/BasicInfo.less
+48
-0
src/modules/task-center/components/TrainFilter.jsx
+113
-138
src/modules/task-center/components/TrainList.jsx
+218
-239
src/modules/task-center/components/TrainList.less
+4
-0
src/modules/task-center/components/TrainOpt.jsx
+11
-14
src/routes/config/mainRoutes.tsx
+7
-1
No files found.
src/modules/task-center/AddTrainTask.jsx
0 → 100644
View file @
d77ed682
/*
* @Author: yuananting
* @Date: 2021-07-29 13:57:03
* @LastEditors: yuananting
* @LastEditTime: 2021-07-29 15:57:33
* @Description: 任务中心-培训任务-新建页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
Tabs
,
message
,
Modal
}
from
'antd'
;
import
ShowTips
from
'@/components/ShowTips'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
BasicInfo
from
'./components/BasicInfo'
;
// import TrainingTask from './components/TrainingTask';
// import ExpiredCourseList from './components/ExpiredCourseList';
import
PlanService
from
'@/domains/plan-domain/planService'
;
import
User
from
'@/common/js/user'
;
import
_
from
'underscore'
;
import
'./AddTrainTask.less'
;
import
Bus
from
'@/core/bus'
;
const
{
TabPane
}
=
Tabs
;
const
defaultCover
=
'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png'
;
const
DEFAULT_BASIC_INFO
=
{
planName
:
''
,
coverUrl
:
defaultCover
,
coverId
:
null
,
durationType
:
'NEVER_EXPIRES'
,
enableState
:
'YES'
,
selectOperatorList
:
[],
instro
:
''
,
operateType
:
'All_Operate'
,
percentCompleteLive
:
80
,
percentCompleteVideo
:
80
,
percentCompletePicture
:
100
,
};
function
AddTrainTask
()
{
const
type
=
getParameterByName
(
'type'
);
const
[
activeStep
,
setActiveStep
]
=
useState
(
'BASIC_INFO'
);
const
[
basicInfo
,
setBasicInfo
]
=
useState
(
DEFAULT_BASIC_INFO
);
function
renderFooter
()
{
return
(
<
Choose
>
<
When
condition=
{
activeStep
===
'BASIC_INFO'
}
>
<
div
className=
'footer shrink-footer'
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
console
.
log
(
'提交'
)
}
>
保存
</
Button
>
<
Button
type=
'primary'
onClick=
{
()
=>
console
.
log
(
'下一步'
)
}
>
下一步
</
Button
>
{
/* disabled={submitDisabled} */
}
</
div
>
</
When
>
<
Otherwise
>
<
div
className=
'footer shrink-footer'
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
console
.
log
(
'上一步'
)
}
>
上一步
</
Button
>
<
Button
onClick=
{
()
=>
console
.
log
(
'提交'
)
}
>
保存
</
Button
>
<
Button
type=
'primary'
onClick=
{
()
=>
console
.
log
(
'提交'
)
}
>
保存并发布
</
Button
>
{
/* disabled={submitDisabled} */
}
</
div
>
</
Otherwise
>
</
Choose
>
);
}
function
handleGoBack
()
{
window
.
RCHistory
.
goBack
();
}
function
handleChangeBasicInfo
(
field
,
value
)
{
setBasicInfo
({
...
basicInfo
,
[
field
]:
value
,
});
}
return
(
<
div
className=
'page add-train-task'
>
<
Breadcrumbs
navList=
{
type
==
'add'
?
'新建培训任务'
:
'编辑培训任务'
}
goBack=
{
handleGoBack
}
/>
<
div
className=
'box'
>
<
div
className=
'show-tips'
>
<
ShowTips
message=
'请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利'
/>
</
div
>
<
Tabs
centered=
{
true
}
onChange=
{
(
key
)
=>
setActiveStep
(
key
)
}
>
<
TabPane
tab=
'1 基本信息'
key=
'BASIC_INFO'
>
<
BasicInfo
data=
{
basicInfo
}
onChange=
{
handleChangeBasicInfo
}
/>
</
TabPane
>
<
TabPane
tab=
'2 培训内容'
key=
'TRAIN_CONTENT'
>
<
div
className=
'train-content__warp'
>
2
</
div
>
</
TabPane
>
</
Tabs
>
</
div
>
{
renderFooter
()
}
</
div
>
);
}
export
default
AddTrainTask
;
src/modules/task-center/AddTrainTask.less
0 → 100644
View file @
d77ed682
.add-train-task {
.footer {
position: fixed;
left: 196px;
bottom: 0;
height: 58px;
width: ~'calc(100% - 218px)';
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 72px;
background: #fff;
border-top: 1px solid #e8e8e8;
z-index: 9999;
.ant-btn {
margin-left: 10px;
}
}
}
src/modules/task-center/TrainTaskPage.jsx
View file @
d77ed682
...
...
@@ -2,63 +2,57 @@
* @Author: yuananting
* @Date: 2021-07-28 11:25:58
* @LastEditors: yuananting
* @LastEditTime: 2021-07-2
8 15:41:00
* @LastEditTime: 2021-07-2
9 13:45:55
* @Description: 任务中心-培训任务
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
useEffect
,
useState
}
from
'react'
import
TrainFilter
from
'./components/TrainFilter'
import
TrainOpt
from
'./components/TrainOpt'
import
TrainList
from
'./components/TrainList'
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
TrainFilter
from
'./components/TrainFilter'
;
import
TrainOpt
from
'./components/TrainOpt'
;
import
TrainList
from
'./components/TrainList'
;
// import PlanList from './components/PlanList'
import
PlanService
from
'@/domains/plan-domain/planService'
import
User
from
'@/common/js/user'
import
PlanService
from
'@/domains/plan-domain/planService'
;
import
User
from
'@/common/js/user'
;
function
TrainTaskPage
()
{
const
[
trainListData
,
setTrainListData
]
=
useState
([])
// 培训任务列表
const
[
trainListData
,
setTrainListData
]
=
useState
([])
;
// 培训任务列表
const
[
query
,
setQuery
]
=
useState
({
status
:
'All'
,
onlyHelp
:
false
,
current
:
1
,
size
:
10
})
const
[
totalCount
,
setTotalCount
]
=
useState
(
0
)
// 总数
size
:
10
,
storeUserId
:
User
.
getStoreUserId
(),
});
const
[
totalCount
,
setTotalCount
]
=
useState
(
0
);
// 总数
useEffect
(()
=>
{
handleFetchTrainList
()
},
[
query
])
handleFetchTrainList
()
;
},
[
query
])
;
function
handleFetchTrainList
(
_query
)
{
const
params
=
{
...
query
,
...
_query
,
storeUserId
:
User
.
getStoreUserId
()
}
//动态获取计划列表
PlanService
.
getTrainingPlanPage
(
params
).
then
((
res
)
=>
{
//动态获取计划列表
function
handleFetchTrainList
()
{
PlanService
.
getTrainingPlanPage
(
query
).
then
((
res
)
=>
{
const
{
result
:
{
records
=
[],
total
}
}
=
res
setTrainListData
(
records
)
setTotalCount
(
total
)
})
result
:
{
records
=
[],
total
}
,
}
=
res
;
setTrainListData
(
records
)
;
setTotalCount
(
total
)
;
})
;
}
// 搜索条件修改
function
queryChange
(
_query
)
{
const
params
=
{
...
query
,
...
_query
}
setQuery
(
params
)
setQuery
({
...
query
,
...
_query
});
}
return
(
<
div
className=
'page'
>
<
div
className=
'content-header'
>
培训任务
</
div
>
<
div
className=
'box'
>
<
TrainFilter
/>
<
TrainFilter
onChange=
{
queryChange
}
/>
<
TrainOpt
/>
<
TrainList
trainListData=
{
trainListData
}
/>
{
/* <PlanList planListData={planListData} query={query} totalCount={totalCount} onChange={queryChange} /> */
}
<
TrainList
trainListData=
{
trainListData
}
query=
{
query
}
totalCount=
{
totalCount
}
onChange=
{
queryChange
}
/>
</
div
>
</
div
>
)
)
;
}
export
default
TrainTaskPage
\ No newline at end of file
export
default
TrainTaskPage
;
src/modules/task-center/components/BasicInfo.jsx
0 → 100644
View file @
d77ed682
/*
* @Author: yuananting
* @Date: 2021-07-29 14:32:24
* @LastEditors: yuananting
* @LastEditTime: 2021-07-29 16:54:42
* @Description: 任务中心-培训任务-新建-基本信息
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
from
'react'
;
import
{
Form
,
Button
,
Input
,
Space
,
DatePicker
,
Radio
,
Row
,
Col
,
message
,
Tooltip
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
withRouter
}
from
'react-router-dom'
;
// import SelectOperatorModal from '../modal/SelectOperatorModal';
// import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal';
import
Upload
from
'@/core/upload'
;
// import GraphicsEditor from '@/modules/course-manage/components/GraphicsEditor';
// import ImgClipModal from '@/components/ImgClipModal';
import
moment
from
'moment'
;
import
'./BasicInfo.less'
;
const
{
TextArea
}
=
Input
;
const
{
RangePicker
}
=
DatePicker
;
const
FormItem
=
Form
.
Item
;
function
BasicInfo
(
props
)
{
const
{
data
}
=
props
;
const
{
planName
,
coverUrl
,
durationType
,
endTime
,
instro
,
enableState
,
operateType
,
selectOperatorList
,
percentCompleteLive
,
percentCompleteVideo
,
percentCompletePicture
,
}
=
data
;
const
isDefaultCover
=
true
;
// 使用默认封面图
function
handleResetCoverUrl
()
{
// const isDefaultCover = coverUrl === defaultCover;
// // 如果已经是默认图的话,不做任何任何处理
// if (isDefaultCover) return;
// message.success('已替换为默认图');
// this.props.onChange('coverUrl', defaultCover);
// setTimeout(() => {
// this.props.onChange('coverId', null);
// }, 1000);
}
return
(
<
div
className=
'basic-info__form'
>
<
Form
labelCol=
{
{
span
:
3
}
}
wrapperCol=
{
{
span
:
21
}
}
>
<
FormItem
label=
'培训任务名称'
>
<
Input
value=
{
planName
}
placeholder=
'请输入培训任务名称(20字以内)'
maxLength=
{
20
}
style=
{
{
width
:
240
}
}
// onChange={(e) => this.props.onChange('planName', e.target.value)}
/>
</
FormItem
>
<
FormItem
label=
'封面图'
>
<
div
className=
'cover__wrap'
>
<
div
className=
'opt-box'
>
<
Button
onClick=
{
()
=>
{
this
.
setState
({
showSelectFileModal
:
true
,
});
}
}
>
上传图片
</
Button
>
<
span
className=
{
`default-btn ${isDefaultCover ? 'disabled' : ''}`
}
onClick=
{
handleResetCoverUrl
}
>
使用默认图
</
span
>
<
div
className=
'tips'
>
建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。
</
div
>
</
div
>
<
div
className=
'img-box'
>
{
isDefaultCover
&&
<
span
className=
'tag'
>
默认图
</
span
>
}
<
img
src=
{
coverUrl
}
width=
'690'
alt=
''
/>
</
div
>
</
div
>
</
FormItem
>
<
FormItem
label=
'培训时间'
>
<
div
className=
'duration__wrap'
>
<
Radio
.
Group
value=
{
durationType
}
onChange=
{
(
e
)
=>
props
.
onChange
(
'durationType'
,
e
.
target
.
value
)
}
>
<
Space
direction=
'vertical'
>
<
Radio
value=
'NEVER_EXPIRES'
>
永久有效
<
span
className=
'tips'
>
设置为“永久有效”,发布后任务开始生效,取消发布后失效
</
span
>
</
Radio
>
<
Radio
value=
'FIXED_DURATION'
>
固定时间段
<
div
className=
'picker-box'
>
<
RangePicker
style=
{
{
width
:
320
}
}
showTime=
{
{
defaultValue
:
[
moment
().
add
(
10
,
'minutes'
),
moment
().
add
(
10
,
'minutes'
)]
}
}
ranges=
{
{
近
7
天
:
[
moment
().
add
(
10
,
'minute'
),
moment
().
add
(
6
,
'day'
).
endOf
(
'day'
)],
近
1
个月
:
[
moment
().
add
(
10
,
'minute'
),
moment
().
add
(
1
,
'month'
).
endOf
(
'day'
)],
近
3
个月
:
[
moment
().
add
(
10
,
'minute'
),
moment
().
add
(
3
,
'month'
).
endOf
(
'day'
)],
}
}
disabled=
{
durationType
===
'NEVER_EXPIRES'
}
// disabledDate={disabledDate}
// value={[examStartTime ? moment(Number(examStartTime)) : null, examEndTime ? moment(Number(examEndTime)) : null]}
// disabledTime={disabledRangeTime}
format=
'YYYY-MM-DD HH:mm'
// onChange={(date) => {
// setStartTime(date && date[0]?.valueOf());
// setExamEndTime(date && date[1]?.valueOf());
// }}
/>
</
div
>
</
Radio
>
</
Space
>
</
Radio
.
Group
>
</
div
>
</
FormItem
>
<
FormItem
label=
'学习模式'
>
<
div
className=
'learning-model__wrap'
>
<
Radio
.
Group
value=
{
durationType
}
onChange=
{
(
e
)
=>
props
.
onChange
(
'durationType'
,
e
.
target
.
value
)
}
>
<
Radio
value=
'FREE_LEARNING'
>
自由学习
</
Radio
>
<
Radio
value=
'BREAKTHROUGH_LEARNING'
>
闯关学习
<
Tooltip
title=
'提示:任务开始后学习模式将不允许更换'
>
<
i
className=
'icon iconfont'
style=
{
{
marginLeft
:
'5px'
,
cursor
:
'pointer'
,
color
:
'#bfbfbf'
,
fontSize
:
'14px'
,
fontWeight
:
'normal'
,
}
}
>

</
i
>
</
Tooltip
>
</
Radio
>
</
Radio
.
Group
>
</
div
>
</
FormItem
>
<
FormItem
label=
'指派学员'
>
<
Button
>
<
PlusOutlined
/>
添加指派对象
</
Button
>
</
FormItem
>
</
Form
>
</
div
>
);
}
export
default
BasicInfo
;
src/modules/task-center/components/BasicInfo.less
0 → 100644
View file @
d77ed682
.basic-info__form {
.cover {
display: flex;
margin-top: 24px;
&__wrap {
position: relative;
.img-box {
position: relative;
margin-top: 8px;
width: 299px;
height: 169px;
.tag {
border-radius: 2px;
background: #d6d6d6;
font-size: 12px;
height: 18px;
width: 52px;
text-align: center;
color: #fff;
position: absolute;
top: 8px;
left: 8px;
}
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
.opt-box {
.default-btn {
margin-left: 14px;
color: #2966ff;
cursor: pointer;
&.disabled {
color: #ccc;
cursor: not-allowed;
}
}
.tips {
margin-top: 8px;
font-size: 14px;
color: #999;
}
}
}
}
}
src/modules/task-center/components/TrainFilter.jsx
View file @
d77ed682
/*
* @Author: 吴文洁
* @Date: 2020-07-14 15:41:30
* @Author: 吴文洁
* @Date: 2020-07-14 15:41:30
* @Last Modified by: 吴文洁
* @Last Modified time: 2020-07-23 13:45:16
* @Description: 大班直播、互动班课列表的筛选组件
...
...
@@ -8,58 +8,58 @@
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
{
Row
,
Input
,
Select
,
Tooltip
}
from
'antd'
;
import
RangePicker
from
"@/modules/common/DateRangePicker"
;
import
{
Row
,
Input
,
Select
,
Tooltip
}
from
'antd'
;
import
RangePicker
from
'@/modules/common/DateRangePicker'
;
import
moment
from
'moment'
;
import
StoreService
from
"@/domains/store-domain/storeService"
;
import
StoreService
from
'@/domains/store-domain/storeService'
;
import
'./TrainFilter.less'
;
const
{
Search
}
=
Input
;
const
{
Option
}
=
Select
;
const
DEFAULT_QUERY
=
{
// 头部筛选默认值
const
DEFAULT_QUERY
=
{
// 头部筛选默认值
planName
:
null
,
createId
:
null
,
// 创建人
startTime
:
null
,
endTime
:
null
,
enableState
:
null
,
createId
:
null
}
const
DEFAULT_CREATOR_QUERY
=
{
// 创建人列表筛选默认值
};
const
DEFAULT_CREATOR_QUERY
=
{
// 创建人列表筛选默认值
size
:
10
,
current
:
1
,
nickName
:
null
}
nickName
:
null
,
// 搜索值
}
;
function
TrainFilter
(
props
)
{
const
[
expandFilter
,
setExpandFilter
]
=
useState
(
false
);
const
[
query
,
setQuery
]
=
useState
(
DEFAULT_QUERY
);
const
[
hasNext
,
setHasNext
]
=
useState
(
false
);
const
[
creatorQuery
,
setCreatorQuery
]
=
useState
(
DEFAULT_CREATOR_QUERY
);
const
[
creatorList
,
setCreatorList
]
=
useState
([]);
const
[
creatorList
,
setCreatorList
]
=
useState
([]);
useEffect
(()
=>
{
getCreatorList
();
},
[]);
// 获取创建人列表
function
getCreatorList
(
current
=
1
,
selectList
)
{
function
getCreatorList
(
current
=
1
)
{
const
_query
=
{
...
creatorQuery
,
current
,
};
StoreService
.
getStoreUserBasicPage
(
_query
).
then
((
res
)
=>
{
const
{
result
=
{}
}
=
res
;
const
{
records
=
[],
hasNext
}
=
result
;
const
list
=
current
>
1
?
creatorList
.
concat
(
records
)
:
records
;
setHasNext
(
hasNext
);
setCreatorList
(
list
);
StoreService
.
getStoreUserBasicPage
(
_query
).
then
((
res
)
=>
{
const
{
result
=
{}
}
=
res
;
const
{
records
=
[],
hasNext
}
=
result
;
const
list
=
current
>
1
?
creatorList
.
concat
(
records
)
:
records
;
setHasNext
(
hasNext
);
setCreatorList
(
list
);
});
}
// 滑动加载更多讲师列表
function
handleScrollCreatorList
(
e
){
// 滑动加载更多讲师列表
function
handleScrollCreatorList
(
e
)
{
const
container
=
e
.
target
;
const
scrollToBottom
=
container
&&
container
.
scrollHeight
<=
container
.
clientHeight
+
container
.
scrollTop
;
const
scrollToBottom
=
container
&&
container
.
scrollHeight
<=
container
.
clientHeight
+
container
.
scrollTop
;
if
(
scrollToBottom
&&
hasNext
)
{
const
_creatorQuery
=
{
...
creatorQuery
};
const
_creatorQuery
=
{
...
creatorQuery
};
_creatorQuery
.
current
=
creatorQuery
.
current
+
1
;
setCreatorQuery
(
_creatorQuery
);
getCreatorList
(
creatorQuery
.
current
+
1
);
...
...
@@ -67,130 +67,106 @@ function TrainFilter(props) {
}
// 改变搜索条件
function
handleChangeQuery
(
field
,
value
){
const
_query
=
{
...
query
,
[
field
]:
value
,
current
:
1
,
}
setQuery
(
_query
);
if
(
field
===
'planName'
)
return
;
// props.onChange( _query);
}
function
handleChangeDates
(
dates
){
function
handleChangeQuery
(
field
,
value
)
{
const
_query
=
_
.
clone
(
query
);
if
(
_
.
isEmpty
(
dates
))
{
delete
_query
.
startTime
;
delete
_query
.
endTime
;
_query
.
current
=
1
;
if
(
field
===
'createdDate'
)
{
_query
.
startTime
=
value
&&
value
[
0
].
valueOf
();
_query
.
endTime
=
value
&&
value
[
1
].
valueOf
();
}
else
{
_query
.
startTime
=
dates
[
0
].
valueOf
();
_query
.
endTime
=
dates
[
1
].
valueOf
();
}
const
param
=
{
...
_query
,
current
:
1
,
_query
[
field
]
=
value
;
}
setQuery
(
param
);
props
.
onChange
(
param
);
setQuery
(
_query
);
if
(
field
===
'planName'
)
return
;
props
.
onChange
(
_query
);
}
// 重置搜索条件
function
handleReset
(){
function
handleReset
()
{
setQuery
(
DEFAULT_QUERY
);
//
props.onChange(DEFAULT_QUERY);
props
.
onChange
(
DEFAULT_QUERY
);
}
return
(
<
div
className=
"train-filter-page"
>
<
Row
>
<
div
className=
"search-condition"
>
<
div
className=
"search-condition__item"
>
<
span
>
培训任务:
</
span
>
<
Search
value=
{
query
.
planName
}
placeholder=
"搜索培训任务名称"
onChange=
{
(
e
)
=>
{
handleChangeQuery
(
'planName'
,
e
.
target
.
value
.
trim
())}
}
// onSearch={ () => { props.onChange(query) } }
style=
{
{
width
:
"calc(100% - 70px)"
}
}
enterButton=
{
<
span
className=
"icon iconfont"
>

</
span
>
}
/>
</
div
>
<
div
className=
"search-condition__item"
>
<
span
>
创建人:
</
span
>
<
Select
placeholder=
"请选择创建人"
style=
{
{
width
:
"calc(100% - 70px)"
}
}
showSearch
allowClear
filterOption=
{
(
input
,
option
)
=>
option
}
suffixIcon=
{
<
span
className=
"icon iconfont"
style=
{
{
fontSize
:
'12px'
,
color
:
'#BFBFBF'
}
}
>

</
span
>
}
onPopupScroll=
{
handleScrollCreatorList
}
value=
{
query
.
createId
}
// onChange={(value) => {
// handleChangeQuery('createId', value)
// }}
// onSearch={(value) => {
// creatorQuery.nickName = value
// setCreatorQuery(creatorQuery)
// getCreatorList()
// }
// }
// onClear ={(value)=>{
// setCreatorQuery({
// size: 10,
// current: 1,
// nickName:null
// })
// getCreatorList()
// }
// }
>
{
_
.
map
(
creatorList
,
(
item
,
index
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
id
}
key=
{
item
.
id
}
>
{
item
.
nickName
}
</
Select
.
Option
>
);
})
}
</
Select
>
</
div
>
<
div
className=
"search-condition__item"
>
<
span
className=
"search-date"
>
创建日期:
</
span
>
<
RangePicker
id=
"course_date_picker"
allowClear=
{
false
}
value=
{
query
.
startTime
?
[
moment
(
query
.
startTime
),
moment
(
query
.
endTime
)]
:
null
}
format=
{
"YYYY-MM-DD"
}
onChange=
{
(
dates
)
=>
{
handleChangeDates
(
dates
)
}
}
style=
{
{
width
:
"calc(100% - 70px)"
}
}
/>
</
div
>
{
expandFilter
&&
<
div
className=
"search-condition__item"
>
<
span
className=
"shelf-status"
>
当前状态:
</
span
>
<
Select
style=
{
{
width
:
"calc(100% - 70px)"
}
}
placeholder=
"请选择当前状态"
allowClear=
{
true
}
value=
{
query
.
enableState
}
onChange=
{
(
value
)
=>
{
handleChangeQuery
(
'enableState'
,
value
)
}
}
suffixIcon=
{
<
span
className=
"icon iconfont"
style=
{
{
fontSize
:
'12px'
,
color
:
'#BFBFBF'
}
}
>

</
span
>
}
>
<
Option
value=
"YES"
>
开启
</
Option
>
<
Option
value=
"NO"
>
关闭
</
Option
>
</
Select
>
</
div
>
<
div
className=
'train-filter-page'
>
<
Row
>
<
div
className=
'search-condition'
>
<
div
className=
'search-condition__item'
>
<
span
>
培训任务:
</
span
>
<
Search
value=
{
query
.
planName
}
placeholder=
'搜索培训任务名称'
onChange=
{
(
e
)
=>
{
handleChangeQuery
(
'planName'
,
e
.
target
.
value
.
trim
());
}
}
onSearch=
{
()
=>
{
props
.
onChange
(
query
);
}
}
style=
{
{
width
:
'calc(100% - 70px)'
}
}
enterButton=
{
<
span
className=
'icon iconfont'
>

</
span
>
}
/>
</
div
>
<
div
className=
'search-condition__item'
>
<
span
>
创建人:
</
span
>
<
Select
placeholder=
'请选择创建人'
style=
{
{
width
:
'calc(100% - 70px)'
}
}
showSearch
allowClear
filterOption=
{
(
input
,
option
)
=>
option
}
suffixIcon=
{
<
span
className=
'icon iconfont'
style=
{
{
fontSize
:
'12px'
,
color
:
'#BFBFBF'
}
}
>

</
span
>
}
</
div
>
onPopupScroll=
{
handleScrollCreatorList
}
value=
{
query
.
createId
}
onChange=
{
(
value
)
=>
{
handleChangeQuery
(
'createId'
,
value
);
}
}
onSearch=
{
(
value
)
=>
{
creatorQuery
.
nickName
=
value
;
setCreatorQuery
(
creatorQuery
);
getCreatorList
();
}
}
onClear=
{
()
=>
{
setCreatorQuery
(
DEFAULT_CREATOR_QUERY
);
getCreatorList
();
}
}
>
{
_
.
map
(
creatorList
,
(
item
,
index
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
id
}
key=
{
item
.
id
}
>
{
item
.
nickName
}
</
Select
.
Option
>
);
})
}
</
Select
>
</
div
>
<
div
className=
'search-condition__item'
>
<
span
className=
'search-date'
>
创建日期:
</
span
>
<
RangePicker
id=
'course_date_picker'
allowClear=
{
false
}
value=
{
query
.
startTime
?
[
moment
(
query
.
startTime
),
moment
(
query
.
endTime
)]
:
null
}
format=
{
'YYYY-MM-DD'
}
onChange=
{
(
value
)
=>
{
handleChangeQuery
(
'createdDate'
,
value
);
}
}
style=
{
{
width
:
'calc(100% - 70px)'
}
}
/>
</
div
>
</
div
>
<
div
className=
"reset-fold-area"
>
<
Tooltip
title=
"清空筛选"
><
span
className=
"resetBtn iconfont icon"
onClick=
{
handleReset
}
>

</
span
></
Tooltip
>
<
span
style=
{
{
cursor
:
'pointer'
}
}
className=
"fold-btn"
onClick=
{
()
=>
{
setExpandFilter
(
!
expandFilter
)
}
}
>
{
expandFilter
?
<
span
><
span
>
收起
</
span
><
span
className=
"iconfont icon fold-icon"
>

</
span
>
</
span
>
:
<
span
>
展开
<
span
className=
"iconfont icon fold-icon"
>

</
span
></
span
>
}
</
span
>
<
div
className=
'reset-fold-area'
>
<
Tooltip
title=
'清空筛选'
>
<
span
className=
'resetBtn iconfont icon'
onClick=
{
handleReset
}
>

{
' '
}
</
span
>
</
Tooltip
>
</
div
>
</
Row
>
</
div
>
)
</
Row
>
</
div
>
);
}
export
default
withRouter
(
TrainFilter
);
\ No newline at end of file
export
default
withRouter
(
TrainFilter
);
src/modules/task-center/components/TrainList.jsx
View file @
d77ed682
...
...
@@ -2,249 +2,233 @@
* @Author: yuananting
* @Date: 2021-07-28 14:56:52
* @LastEditors: yuananting
* @LastEditTime: 2021-07-29
09:42:01
* @LastEditTime: 2021-07-29
13:52:35
* @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
{
Tabs
,
Tooltip
,
Switch
,
Dropdown
}
from
"antd"
;
import
"./TrainList.less"
;
import
{
XMTable
,
PageControl
}
from
"@/components"
;
import
User
from
"@/common/js/user"
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Tabs
,
Tooltip
,
Checkbox
,
Dropdown
}
from
'antd'
;
import
'./TrainList.less'
;
import
{
XMTable
,
PageControl
}
from
'@/components'
;
import
User
from
'@/common/js/user'
;
const
{
TabPane
}
=
Tabs
;
function
renderMoreOperate
(
item
)
{
return
(
<
div
className=
"live-course-more-menu"
>
<
div
className=
"operate__item"
>
编辑
</
div
>
<
div
className=
"operate__item"
>
分享
</
div
>
<
div
className=
"operate__item"
>
审批作业
</
div
>
<
div
className=
"operate__item"
>
删除
</
div
>
</
div
>
);
}
function
TrainList
(
props
)
{
const
{
query
:
{
size
,
current
},
totalCount
,
}
=
props
;
function
parseColumns
()
{
const
columns
=
[
{
title
:
"培训任务"
,
key
:
"planName"
,
dataIndex
:
"planName"
,
width
:
"18%"
,
fixed
:
"left"
,
render
:
(
val
,
record
)
=>
{
return
(
<
div
className=
"plan_name_item"
>
<
img
className=
"plan-cover"
src=
{
record
.
coverUrl
||
"https://image.xiaomaiketang.com/xm/rEAetaTEh3.png"
}
alt=
""
/>
<
Choose
>
<
When
condition=
{
record
.
planName
.
length
>
25
}
>
<
Tooltip
title=
{
record
.
planName
}
>
<
div
className=
"plan-name"
>
{
val
}
</
div
>
</
Tooltip
>
</
When
>
<
Otherwise
>
<
div
className=
"plan-name"
>
{
val
}
</
div
>
</
Otherwise
>
</
Choose
>
</
div
>
);
},
},
{
title
:
"任务状态"
,
width
:
"10%"
,
key
:
"status"
,
dataIndex
:
"status"
,
render
:
(
val
,
record
)
=>
{
return
<
div
className=
"course-number"
>
{
"未开始"
}
</
div
>;
function
renderMoreOperate
(
item
)
{
return
(
<
div
className=
'live-course-more-menu'
>
<
div
className=
'operate__item'
>
编辑
</
div
>
<
div
className=
'operate__item'
>
分享
</
div
>
<
div
className=
'operate__item'
>
审批作业
</
div
>
<
div
className=
'operate__item'
>
删除
</
div
>
</
div
>
);
}
function
parseColumns
()
{
const
columns
=
[
{
title
:
'培训任务'
,
key
:
'planName'
,
dataIndex
:
'planName'
,
width
:
'18%'
,
fixed
:
'left'
,
render
:
(
val
,
record
)
=>
{
return
(
<
div
className=
'plan_name_item'
>
<
img
className=
'plan-cover'
src=
{
record
.
coverUrl
||
'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png'
}
alt=
''
/>
<
Choose
>
<
When
condition=
{
record
.
planName
.
length
>
25
}
>
<
Tooltip
title=
{
record
.
planName
}
>
<
div
className=
'plan-name'
>
{
val
}
</
div
>
</
Tooltip
>
</
When
>
<
Otherwise
>
<
div
className=
'plan-name'
>
{
val
}
</
div
>
</
Otherwise
>
</
Choose
>
</
div
>
);
},
},
},
{
title
:
"任务数"
,
width
:
"10%"
,
key
:
"courseNum"
,
dataIndex
:
"courseNum"
,
render
:
(
val
,
record
)
=>
{
return
<
div
className=
"course-number"
>
{
val
}
</
div
>;
{
title
:
'任务状态'
,
width
:
'10%'
,
key
:
'status'
,
dataIndex
:
'status'
,
render
:
(
val
,
record
)
=>
{
return
<
div
className=
'course-number'
>
{
'未开始'
}
</
div
>;
},
},
},
{
title
:
"学习人数"
,
width
:
"10%"
,
align
:
"right"
,
key
:
"cultureCustomerNum"
,
dataIndex
:
"cultureCustomerNum"
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
<
div
className=
"join-number"
>
{
val
}
</
div
>;
{
title
:
'任务数'
,
width
:
'8%'
,
key
:
'courseNum'
,
dataIndex
:
'courseNum'
,
render
:
(
val
,
record
)
=>
{
return
<
div
className=
'course-number'
>
{
val
}
</
div
>;
},
},
},
{
title
:
(
<
span
>
完成率
<
Tooltip
title=
"完成培训任务的人数/学习总人数"
>
<
i
className=
"icon iconfont"
style=
{
{
marginLeft
:
"5px"
,
cursor
:
"pointer"
,
color
:
"#bfbfbf"
,
fontSize
:
"14px"
,
fontWeight
:
"normal"
,
}
}
>

</
i
>
</
Tooltip
>
</
span
>
),
width
:
"10%"
,
key
:
"rate"
,
dataIndex
:
"rate"
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
<
span
>
100%
</
span
>
{
title
:
'学习人数'
,
width
:
'8%'
,
align
:
'right'
,
key
:
'cultureCustomerNum'
,
dataIndex
:
'cultureCustomerNum'
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
<
div
className=
'join-number'
>
{
val
}
</
div
>;
},
},
},
{
title
:
"培训时间"
,
width
:
"12.5%"
,
key
:
"created"
,
dataIndex
:
"created"
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
(
<
span
style=
{
{
whiteSpace
:
"nowrap"
}
}
>
{
window
.
formatDate
(
"YYYY-MM-DD H:i"
,
val
)
}
{
title
:
(
<
span
>
完成率
<
Tooltip
title=
'完成培训任务的人数/学习总人数'
>
<
i
className=
'icon iconfont'
style=
{
{
marginLeft
:
'5px'
,
cursor
:
'pointer'
,
color
:
'#bfbfbf'
,
fontSize
:
'14px'
,
fontWeight
:
'normal'
,
}
}
>

</
i
>
</
Tooltip
>
</
span
>
);
),
width
:
'10%'
,
key
:
'rate'
,
dataIndex
:
'rate'
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
<
span
>
100%
</
span
>;
},
},
},
{
title
:
"创建人"
,
key
:
"createName"
,
dataIndex
:
"createName"
,
width
:
"11%"
,
render
:
(
val
)
=>
{
return
<
div
className=
"create-name"
>
{
val
}
</
div
>;
{
title
:
'培训时间'
,
width
:
'14%'
,
key
:
'created'
,
dataIndex
:
'created'
,
render
:
(
val
)
=>
{
return
<
span
style=
{
{
whiteSpace
:
'nowrap'
}
}
>
{
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
)
}
</
span
>;
},
},
},
{
title
:
"创建时间"
,
width
:
"12.5%"
,
key
:
"created"
,
dataIndex
:
"created"
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
(
<
span
style=
{
{
whiteSpace
:
"nowrap"
}
}
>
{
window
.
formatDate
(
"YYYY-MM-DD H:i"
,
val
)
}
</
span
>
);
{
title
:
'创建人'
,
key
:
'createName'
,
dataIndex
:
'createName'
,
width
:
'10%'
,
render
:
(
val
)
=>
{
return
<
div
className=
'create-name'
>
{
val
}
</
div
>;
},
},
},
{
title
:
"更新时间"
,
width
:
"10%"
,
key
:
"updated"
,
dataIndex
:
"updated"
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
(
<
span
style=
{
{
whiteSpace
:
"nowrap"
}
}
>
{
window
.
formatDate
(
"YYYY-MM-DD H:i"
,
val
)
}
</
span
>
);
{
title
:
'创建时间'
,
width
:
'14%'
,
key
:
'created'
,
dataIndex
:
'created'
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
<
span
style=
{
{
whiteSpace
:
'nowrap'
}
}
>
{
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
)
}
</
span
>;
},
},
{
title
:
'更新时间'
,
width
:
'10%'
,
key
:
'updated'
,
dataIndex
:
'updated'
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
<
span
style=
{
{
whiteSpace
:
'nowrap'
}
}
>
{
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
)
}
</
span
>;
},
},
},
{
title
:
"操作"
,
key
:
"operate"
,
dataIndex
:
"operate"
,
fixed
:
"right"
,
width
:
"18%"
,
render
:
(
val
,
record
)
=>
{
return
(
<
div
className=
"operate"
>
<
div
className=
"operate__item"
onClick=
{
()
=>
toLearningDataPage
(
record
)
}
>
数据
</
div
>
{
record
.
enableState
===
"YES"
&&
(
<>
<
span
className=
"operate__item split"
>
|
</
span
>
<
div
className=
"operate__item"
onClick=
{
()
=>
{
handleShowShareModal
(
record
);
}
}
>
指派
</
div
>
</>
)
}
{
record
.
enableState
===
"YES"
&&
(
<>
<
span
className=
"operate__item split"
>
|
</
span
>
<
div
className=
"operate__item"
onClick=
{
()
=>
{
handleShowShareModal
(
record
);
}
}
>
发布
</
div
>
</>
)
}
{
(
User
.
getUserRole
()
===
"CloudManager"
||
User
.
getUserRole
()
===
"StoreManager"
)
&&
(
<>
<
span
className=
"operate__item split"
>
|
</
span
>
<
Dropdown
overlay=
{
renderMoreOperate
(
record
)
}
>
<
span
className=
"more-operate"
>
<
span
className=
"operate-text"
>
更多
</
span
>
<
span
className=
"iconfont icon"
style=
{
{
color
:
"#2966FF"
}
}
>

{
title
:
'操作'
,
key
:
'operate'
,
dataIndex
:
'operate'
,
fixed
:
'right'
,
width
:
'16%'
,
render
:
(
val
,
record
)
=>
{
return
(
<
div
className=
'operate'
>
<
div
className=
'operate__item'
onClick=
{
()
=>
toLearningDataPage
(
record
)
}
>
数据
</
div
>
{
record
.
enableState
===
'YES'
&&
(
<>
<
span
className=
'operate__item split'
>
|
</
span
>
<
div
className=
'operate__item'
onClick=
{
()
=>
{
handleShowShareModal
(
record
);
}
}
>
指派
</
div
>
</>
)
}
{
record
.
enableState
===
'YES'
&&
(
<>
<
span
className=
'operate__item split'
>
|
</
span
>
<
div
className=
'operate__item'
onClick=
{
()
=>
{
handleShowShareModal
(
record
);
}
}
>
发布
</
div
>
</>
)
}
{
(
User
.
getUserRole
()
===
'CloudManager'
||
User
.
getUserRole
()
===
'StoreManager'
)
&&
(
<>
<
span
className=
'operate__item split'
>
|
</
span
>
<
Dropdown
overlay=
{
renderMoreOperate
(
record
)
}
>
<
span
className=
'more-operate'
>
<
span
className=
'operate-text'
>
更多
</
span
>
<
span
className=
'iconfont icon'
style=
{
{
color
:
'#2966FF'
}
}
>

</
span
>
</
span
>
</
spa
n
>
</
Dropdown
>
</>
)
}
</
div
>
);
</
Dropdow
n
>
</>
)
}
</
div
>
);
},
},
},
];
return
columns
;
}
];
return
columns
;
}
// 改变搜索条件(状态 协同与否)
function
handleChangeQuery
(
field
,
value
)
{
const
_query
=
{
...
props
.
query
,
[
field
]:
value
,
};
props
.
onChange
(
_query
);
}
function
TrainList
(
props
)
{
console
.
log
(
props
.
trainListData
);
return
(
<
div
className=
"train-list-page"
>
<
div
className=
"search-box"
>
<
Tabs
type=
"card"
>
<
TabPane
tab=
"全部"
key=
"all"
/>
<
TabPane
tab=
"已发布"
key=
"published"
/>
<
TabPane
tab=
"未发布"
key=
"unpublished"
/>
<
div
className=
'train-list-page'
>
<
div
className=
'search-box'
>
<
Tabs
onChange=
{
(
value
)
=>
handleChangeQuery
(
'status'
,
value
)
}
type=
'card'
>
<
TabPane
tab=
{
`全部 (${20})`
}
key=
'all'
/>
<
TabPane
tab=
{
`已发布 (${10})`
}
key=
'published'
/>
<
TabPane
tab=
{
`未发布 (${10})`
}
key=
'unpublished'
/>
</
Tabs
>
<
Checkbox
onChange=
{
(
e
)
=>
handleChangeQuery
(
'onlyHelp'
,
e
.
target
.
checked
)
}
>
只看我协同的 (
{
10
}
)
</
Checkbox
>
</
div
>
<
div
className=
"list-content"
>
<
div
className=
'list-content'
>
<
XMTable
rowKey=
{
(
record
)
=>
record
.
id
}
showSorterTooltip=
{
false
}
...
...
@@ -253,29 +237,24 @@ function TrainList(props) {
pagination=
{
false
}
// onChange={handleChangeTable}
bordered
size=
"middle"
scroll=
{
{
x
:
1
4
00
}
}
size=
'middle'
scroll=
{
{
x
:
1
6
00
}
}
// className='plan-list-table'
renderEmpty=
{
{
description
:
(
<
span
style=
{
{
display
:
"block"
,
paddingBottom
:
24
}
}
>
暂无数据
</
span
>
),
description
:
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
}
}
>
暂无数据
</
span
>,
}
}
/>
{
/* <div className='box-footer'>
<PageControl
current={props.query.current - 1}
pageSize={props.query.size}
total={props.totalCount}
toPage={(page) => {
// const _query = { ...props.query, current: page + 1 };
// props.onChange(_query);
}}
// onShowSizeChange={onShowSizeChange}
/> */
}
{
/* </div> */
}
<
div
className=
'box-footer'
>
<
PageControl
current=
{
current
-
1
}
pageSize=
{
size
}
total=
{
totalCount
}
toPage=
{
(
page
)
=>
{
handleChangeQuery
(
'current'
,
page
+
1
);
}
}
showSizeChanger=
{
false
}
/>
</
div
>
</
div
>
</
div
>
);
...
...
src/modules/task-center/components/TrainList.less
View file @
d77ed682
.train-list-page {
margin-top: 12px;
.search-box {
display: flex;
line-height: 46px;
}
.ant-tabs-nav {
margin: 0 !important;
}
...
...
src/modules/task-center/components/TrainOpt.jsx
View file @
d77ed682
...
...
@@ -2,7 +2,7 @@
* @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51
* @LastEditors: yuananting
* @LastEditTime: 2021-07-2
8 14:46:51
* @LastEditTime: 2021-07-2
9 14:04:05
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -12,21 +12,19 @@ import { withRouter } from 'react-router-dom';
import
User
from
'@/common/js/user'
;
// import './PlanOpt.less';
function
PlanOpt
()
{
function
handleCreatePlan
()
{
function
handleCreatePlan
()
{
window
.
RCHistory
.
push
({
pathname
:
'/create-
plan
?type=add'
,
})
pathname
:
'/create-
train-task
?type=add'
,
})
;
}
return
(
<
div
className=
"plan-opt-page"
>
{
(
User
.
getUserRole
()
===
"CloudManager"
||
User
.
getUserRole
()
===
"StoreManager"
)
&&
<
Button
type=
"primary"
className=
"mr12"
onClick=
{
handleCreatePlan
}
>
新建培训任务
</
Button
>
}
<
div
className=
'plan-opt-page'
>
{
(
User
.
getUserRole
()
===
'CloudManager'
||
User
.
getUserRole
()
===
'StoreManager'
)
&&
(
<
Button
type=
'primary'
className=
'mr12'
onClick=
{
handleCreatePlan
}
>
新建培训任务
</
Button
>
)
}
</
div
>
);
}
export
default
withRouter
(
PlanOpt
)
\ No newline at end of file
export
default
withRouter
(
PlanOpt
);
src/routes/config/mainRoutes.tsx
View file @
d77ed682
...
...
@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-04-29 10:26:32
* @LastEditors: yuananting
* @LastEditTime: 2021-07-2
8 11:33:1
3
* @LastEditTime: 2021-07-2
9 14:03:2
3
* @Description: 内容线路由配置
*/
import
Home
from
'@/modules/home/Home'
;
...
...
@@ -37,6 +37,7 @@ import ExaminationManagerTestDetail from '@/modules/teach-tool/examination-manag
import
KnowledgeBase
from
'@/modules/knowledge-base/index'
;
import
CollegeInfoPage
from
'@/modules/college-manage/CollegeInfoPage'
;
import
TrainTaskPage
from
'@/modules/task-center/TrainTaskPage'
;
import
AddTrainTask
from
'@/modules/task-center/AddTrainTask'
;
const
mainRoutes
=
[
{
...
...
@@ -167,6 +168,11 @@ const mainRoutes = [
name
:
'培训任务'
,
},
{
path
:
'/create-train-task'
,
component
:
AddTrainTask
,
name
:
'创建培训任务'
,
},
{
path
:
'/create-plan'
,
component
:
AddPlanPage
,
name
:
'创建线上课'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment