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
51ae25de
Commit
51ae25de
authored
Dec 15, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:调整直播课列表的接口
parent
f4809454
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
143 additions
and
183 deletions
+143
-183
src/data-source/course/request-api.ts
+6
-1
src/domains/course-domain/CourseService.ts
+6
-2
src/modules/course-manage/AddLive.jsx
+9
-63
src/modules/course-manage/LiveCoursePage.jsx
+56
-59
src/modules/course-manage/components/AddLiveClass.jsx
+60
-54
src/modules/course-manage/components/AddLiveClass.less
+0
-1
src/modules/course-manage/components/AddLiveIntro.jsx
+3
-2
src/modules/course-manage/components/AddLiveIntro.less
+3
-1
No files found.
src/data-source/course/request-api.ts
View file @
51ae25de
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-12-12 11:57:10
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-1
4 20:32:46
* @LastEditTime: 2020-12-1
5 12:55:55
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -20,3 +20,7 @@ export function fetchUserData(params: object) {
export
function
createLiveCloudCourse
(
params
:
object
)
{
return
Service
.
Hades
(
"public/courseCloud/createLiveCloudCourse"
,
params
);
}
export
function
getLiveCloudCoursePage
(
params
:
object
)
{
return
Service
.
Hades
(
"public/courseCloud/getLiveCloudCoursePage"
,
params
);
}
\ No newline at end of file
src/domains/course-domain/CourseService.ts
View file @
51ae25de
...
...
@@ -2,11 +2,11 @@
* @Author: wufan
* @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-1
4 21:01:52
* @LastEditTime: 2020-12-1
5 12:56:16
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
{
fetchLecturerData
,
fetchUserData
,
createLiveCloudCourse
}
from
'@/data-source/course/request-api'
;
import
{
fetchLecturerData
,
fetchUserData
,
createLiveCloudCourse
,
getLiveCloudCoursePage
}
from
'@/data-source/course/request-api'
;
export
default
class
courseService
{
// 获取讲师上课数据
...
...
@@ -21,4 +21,7 @@ export default class courseService {
static
createLiveCloudCourse
(
params
:
any
)
{
return
createLiveCloudCourse
(
params
);
}
static
getLiveCloudCoursePage
(
params
:
any
)
{
return
getLiveCloudCoursePage
(
params
);
}
}
\ No newline at end of file
src/modules/course-manage/AddLive.jsx
View file @
51ae25de
...
...
@@ -37,15 +37,11 @@ const defaultBasicInfo = {
const
defaultClassInfo
=
{
teacherId
:
null
,
adminId
:
null
,
teacherName
:
null
,
liveDate
:
null
,
timeHorizonStart
:
null
,
timeHorizonEnd
:
null
,
studentList
:
[],
// 学员列表
assistant
:
[],
// 已经选择的助教老师
liveType
:
"LARGE_CLASS_LIVE"
,
consumeClassTime
:
30
,
// 累计在线时长, 默认30分钟
consumeHourNum
:
1
,
// 课时, 默认1课时
calendarTime
:
[],
startTime
:
new
Date
().
getTime
()
+
300000
,
endTime
:
new
Date
().
getTime
()
+
300000
,
...
...
@@ -114,6 +110,7 @@ class AddLive extends React.Component {
addLiveClassInfo
:
{
teacherId
:
null
,
teacherName
:
null
,
adminId
:
null
,
liveDate
:
null
,
timeHorizonStart
:
null
,
timeHorizonEnd
:
null
,
...
...
@@ -122,9 +119,6 @@ class AddLive extends React.Component {
excludeStudentIds
:
[],
// 已经入库的不扣课时学员
excludeConsumeStudentIds
:
[],
// 已经入口的扣课时学员
assistant
:
[],
// 已经选择的助教老师
liveType
:
"LARGE_CLASS_LIVE"
,
consumeClassTime
:
30
,
// 累计在线时长, 默认30分钟
consumeHourNum
:
1
,
// 课时, 默认1课时
applyMode
:
''
,
calendarTime
:
[],
// 批量排课
startTime
:
new
Date
().
getTime
()
+
300000
,
// 批量开始时分
...
...
@@ -332,6 +326,7 @@ class AddLive extends React.Component {
liveType
,
liveDate
,
teacherId
,
adminId
,
assistant
,
studentList
,
consumeHourNum
,
...
...
@@ -352,13 +347,12 @@ class AddLive extends React.Component {
const
_liveDate
=
moment
(
liveDate
).
format
(
"YYYY-MM-DD"
);
const
_timeHorizonStart
=
moment
(
timeHorizonStart
).
format
(
'HH:mm'
);
const
_timeHorizonEnd
=
moment
(
timeHorizonEnd
).
format
(
'HH:mm'
);
startTime
=
moment
(
_liveDate
+
' '
+
_timeHorizonStart
).
format
(
'x'
);
endTime
=
moment
(
_liveDate
+
' '
+
_timeHorizonEnd
).
format
(
'x'
);
}
const
commonParams
=
{
adminIds
:[
'1338412893361590273'
],
adminIds
:[
adminId
],
calendarTime
,
categoryId
:
parentCatalogId
,
endTime
,
...
...
@@ -368,25 +362,17 @@ class AddLive extends React.Component {
storeId
:
User
.
getUserId
(),
courseName
:
courseName
.
trim
(),
storeId
:
User
.
getStoreId
(),
teacherId
:
'1338461876914020353'
,
teacherId
:
teacherId
,
}
if
(
type
===
'add'
)
{
const
params
=
{
...
commonParams
,
}
// if(params.liveCourseWarmMedia && !params.liveCourseWarmMedia.mediaUrl) {
// delete params.liveCourseWarmMedia
// }
CourseService
.
createLiveCloudCourse
(
params
).
then
((
res
)
=>
{
// if (!res) return;
// message.success("新建成功");
// localStorage.setItem('largeLiveCourseItem', JSON.stringify({
// ...params,
// liveCourseId: res.result
// }));
// window.RCHistory.goBack();
if
(
res
.
success
){
message
.
success
(
"新建成功"
);
}
});
}
else
{
...
...
@@ -405,45 +391,6 @@ class AddLive extends React.Component {
}
})
}
handleValidateLackConsumeModal
=
(
consumeHourNum
,
calendarTime
,
consumeStudentList
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
lackConsumeStudentList
=
[];
consumeStudentList
.
forEach
(
item
=>
{
if
(
item
.
consumeHourNum
<
consumeHourNum
*
calendarTime
.
length
)
{
lackConsumeStudentList
.
push
(
item
);
}
})
if
(
lackConsumeStudentList
.
length
>
0
)
{
const
lackConsumeStudentModal
=
(
<
LackConsumeStudentModal
consumeHourNum=
{
consumeHourNum
}
calendarTime=
{
calendarTime
}
lackConsumeStudentList=
{
lackConsumeStudentList
}
onOk=
{
()
=>
{
resolve
(
true
);
this
.
setState
({
lackConsumeStudentModal
:
null
})
}
}
onClose=
{
()
=>
{
resolve
(
false
);
this
.
setState
({
lackConsumeStudentModal
:
null
})
}
}
/>
)
this
.
setState
({
lackConsumeStudentModal
})
}
else
{
resolve
(
true
);
}
})
}
handleValidate
=
(
addLiveBasicInfo
,
addLiveClassInfo
,
addLiveIntroInfo
,
isEdit
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
{
type
}
=
this
.
state
;
...
...
@@ -567,7 +514,6 @@ class AddLive extends React.Component {
})
}
else
{
// 直接返回
window
.
RCHistory
.
goBack
();
}
}
...
...
src/modules/course-manage/LiveCoursePage.jsx
View file @
51ae25de
...
...
@@ -2,6 +2,8 @@ import React from 'react';
import
LiveCourseFilter
from
'./components/LiveCourseFilter'
;
import
LiveCourseOpt
from
'./components/LiveCourseOpt'
;
import
LiveCourseList
from
'./components/LiveCourseList'
;
import
CourseService
from
"@/domains/course-domain/CourseService"
;
import
User
from
'@/common/js/user'
;
class
LiveCoursePage
extends
React
.
Component
{
...
...
@@ -13,8 +15,7 @@ class LiveCoursePage extends React.Component {
query
:
{
current
:
1
,
size
:
10
,
instId
:
0
,
teacherId
:
0
storeId
:
User
.
getStoreId
()
},
total
:
0
,
loading
:
true
,
...
...
@@ -23,65 +24,61 @@ class LiveCoursePage extends React.Component {
componentWillMount
()
{
this
.
handleFetchLiveList
(
this
.
state
.
query
);
}
// // 获取直播课列表
// handleFetchLiveList = (_query) => {
// const { query } = this.state;
// const { teacherId } = window.currentUserInstInfo;
// const params = {
// teacherId: teacherId ? teacherId : null,
// ...query,
// ..._query,
// };
// this.setState({ query: params });
// window.axios
// .Apollo("public/businessLive/getLargeClassLiveList", params)
// .then((res) => {
// const { result: { records = [], total } } = res;
// this.setState({
// total,
// courseList: records
// });
// }) .finally(() => {
// this.setState({ loading: false });
// });
// }
handleFetchLiveList
=
(
_query
)
=>
{
const
_courseList
=
[
{
applyMode
:
"ANYONE"
,
autoSendReport
:
"AUTO"
,
channel
:
"XIAOMAI"
,
consumeClassTime
:
30
,
consumeHourNum
:
1
,
courseDocumentCount
:
0
,
courseMediaVOS
:
[],
courseName
:
"0988"
,
courseState
:
"EXPIRED"
,
createdReport
:
"INVALID"
,
endTime
:
1607515751000
,
haveRecord
:
"NO"
,
instId
:
"1213001850820476929"
,
intro
:
""
,
liveCourseId
:
"1336612757182279681"
,
liveType
:
"LARGE_CLASS_LIVE"
,
needRecord
:
"YES"
,
nickname
:
"张莹"
,
podium
:
0
,
quota
:
1
,
roomId
:
9984
,
startTime
:
1607508551000
,
teacherId
:
"1226497609046880257"
,
thirdPartType
:
"TENCENT"
,
whetherRecord
:
"YES"
,
}
];
this
.
setState
({
courseList
:
_courseList
,
total
:
1
// 获取直播课列表
handleFetchLiveList
=
(
_query
)
=>
{
const
{
query
}
=
this
.
state
;
const
params
=
{
...
query
,
...
_query
,
};
this
.
setState
({
query
:
params
});
CourseService
.
getLiveCloudCoursePage
(
params
).
then
((
res
)
=>
{
const
{
result
:
{
records
=
[],
total
}
}
=
res
;
this
.
setState
({
total
,
courseList
:
records
});
})
.
finally
(()
=>
{
this
.
setState
({
loading
:
false
});
});
}
// handleFetchLiveList= (_query) => {
// const _courseList=[
// {
// applyMode: "ANYONE",
// autoSendReport: "AUTO",
// channel: "XIAOMAI",
// consumeClassTime: 30,
// consumeHourNum: 1,
// courseDocumentCount: 0,
// courseMediaVOS: [],
// courseName: "0988",
// courseState: "EXPIRED",
// createdReport: "INVALID",
// endTime: 1607515751000,
// haveRecord: "NO",
// instId: "1213001850820476929",
// intro: "",
// liveCourseId: "1336612757182279681",
// liveType: "LARGE_CLASS_LIVE",
// needRecord: "YES",
// nickname: "张莹",
// podium: 0,
// quota: 1,
// roomId: 9984,
// startTime: 1607508551000,
// teacherId: "1226497609046880257",
// thirdPartType: "TENCENT",
// whetherRecord: "YES",
// }
// ];
// this.setState({
// courseList: _courseList,
// total:1
// });
// }
render
()
{
const
{
query
,
total
,
courseList
}
=
this
.
state
;
...
...
src/modules/course-manage/components/AddLiveClass.jsx
View file @
51ae25de
...
...
@@ -24,14 +24,21 @@ const defaultTeacherQuery = {
current
:
1
,
nickName
:
null
}
const
defaultAssistantQuery
=
{
size
:
10
,
current
:
1
,
nickName
:
null
}
class
AddLiveClass
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
loading
:
false
,
hasNext
:
false
,
assistantHasNext
:
false
,
teacherQuery
:
defaultTeacherQuery
,
teacherList
:[],
assistantQuery
:
defaultAssistantQuery
,
assistantList
:
[],
// 助教老师列表
addLiveType
:
props
.
addLiveType
}
...
...
@@ -60,55 +67,42 @@ class AddLiveClass extends React.Component {
}
// 获取助教老师列表
getAssistantList
=
(
current
=
1
,
selectList
)
=>
{
// const { query, assistantList } = this.state;
// const { selectedAssistant } = this.props;
// const { teacherId, assistant } = this.props.data;
// const idList = selectList ? selectList : assistant;
// const _query = {
// ...query,
// current,
// idList,
// size: idList.length <= 10 ? 10 : idList.length + 10
// };
// this.setState({ query: _query });
// axios.Apollo("public/businessLive/queryAdminByName", _query).then((res) => {
// const { result = {} } = res;
// const { records = [], total = 0, hasNext } = result;
// const list = current > 1 ? assistantList.concat(records) : records;
// const _assistantList = _.uniq(
// selectedAssistant.concat(
// _.reject(list, (item) => item.id === teacherId)
// ),
// false,
// (item) => item.id
// );
// this.setState({
// hasNext,
// assistantList: list,
// _assistantList: _assistantList
// })
// });
}
// 修改直播模式
handleChangeLiveType
=
(
e
)
=>
{
this
.
setState
({
addLiveType
:
e
.
target
.
value
,
const
{
assistantQuery
,
assistantList
}
=
this
.
state
;
const
_query
=
{
...
assistantQuery
,
current
,
size
:
10
};
StoreService
.
getEmployeeList
(
_query
).
then
((
res
)
=>
{
const
{
result
=
{}
}
=
res
;
const
{
records
=
[],
total
=
0
,
hasNext
}
=
result
;
const
list
=
current
>
1
?
assistantList
.
concat
(
records
)
:
records
;
this
.
setState
({
assistantHasNext
:
hasNext
,
assistantList
:
list
,
})
});
this
.
props
.
onChange
(
'liveType'
,
e
.
target
.
value
);
};
}
// 滑动加载更多
handleScroll
=
(
e
)
=>
{
console
.
log
(
'srcoll'
)
// 滑动加载更多讲师列表
handleScrollTeacherList
=
(
e
)
=>
{
const
{
hasNext
}
=
this
.
state
;
const
container
=
e
.
target
;
const
scrollToBottom
=
container
&&
container
.
scrollHeight
<=
container
.
clientHeight
+
container
.
scrollTop
;
if
(
scrollToBottom
&&
hasNext
)
{
const
{
query
}
=
this
.
state
;
this
.
getAssistantList
(
query
.
current
+
1
);
const
{
teacherQuery
}
=
this
.
state
;
this
.
getTeacherList
(
teacherQuery
.
current
+
1
);
}
}
// 滑动加载更多助教列表
handleScrollAssistantList
=
(
e
)
=>
{
const
{
assistantHasNext
}
=
this
.
state
;
const
container
=
e
.
target
;
const
scrollToBottom
=
container
&&
container
.
scrollHeight
<=
container
.
clientHeight
+
container
.
scrollTop
;
if
(
scrollToBottom
&&
assistantHasNext
)
{
const
{
assistantQuery
}
=
this
.
state
;
this
.
getAssistantList
(
assistantQuery
.
current
+
1
);
}
}
...
...
@@ -125,14 +119,11 @@ class AddLiveClass extends React.Component {
const
{
loading
,
teacherList
,
teacherQuery
assistantList
,
teacherQuery
,
assistantQuery
}
=
this
.
state
;
// pageType: 页面类型:add->新建、edit->编辑
// liveScene: 直播场景: interactive -> 互动班课 large -> 大班直播
// data:表单数据
// selectedAssistant: 已经选择的助教
const
{
pageType
,
liveScene
,
data
,
selectedAssistant
,
isXiaomai
,
isEdit
,
after
}
=
this
.
props
;
const
{
endTime
,
...
...
@@ -208,7 +199,7 @@ class AddLiveClass extends React.Component {
placeholder=
"请选择讲师"
style=
{
{
width
:
240
,
marginTop
:
6
}
}
filterOption=
{
(
input
,
option
)
=>
option
}
// onPopupScroll={this.handleScroll
}
onPopupScroll=
{
this
.
handleScrollTeacherList
}
onChange=
{
(
value
)
=>
{
this
.
props
.
onChange
(
'teacherId'
,
value
)
}
}
...
...
@@ -217,13 +208,13 @@ class AddLiveClass extends React.Component {
this
.
setState
({
teacherQuery
},
()
=>
{
this
.
getAssistant
List
()
this
.
handleScrollTeacher
List
()
})
}
}
>
{
_
.
map
(
teacherList
,
(
item
,
index
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
id
}
key=
{
item
.
i
d
}
>
{
item
.
nickName
}
</
Select
.
Option
>
<
Select
.
Option
value=
{
item
.
userId
}
key=
{
item
.
userI
d
}
>
{
item
.
nickName
}
</
Select
.
Option
>
);
})
}
</
Select
>
...
...
@@ -232,12 +223,27 @@ class AddLiveClass extends React.Component {
<
span
className=
"label"
>
助教:
</
span
>
<
Select
id=
"assistant"
mode=
"multiple"
placeholder=
"请选择助教老师"
style=
{
{
width
:
240
,
marginTop
:
6
}
}
filterOption=
{
(
input
,
option
)
=>
option
}
onPopupScroll=
{
this
.
handleScrollAssistantList
}
onChange=
{
(
value
)
=>
{
this
.
props
.
onChange
(
'adminId'
,
value
)
}
}
onSearch=
{
(
value
)
=>
{
assistantQuery
.
nickName
=
value
this
.
setState
({
assistantQuery
},
()
=>
{
this
.
getAssistantList
()
})
}
}
>
{
_
.
map
(
assistantList
,
(
item
,
index
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
userId
}
key=
{
item
.
userId
}
>
{
item
.
nickName
}
</
Select
.
Option
>
);
})
}
</
Select
>
</
div
>
</
div
>
...
...
src/modules/course-manage/components/AddLiveClass.less
View file @
51ae25de
...
...
@@ -4,7 +4,6 @@
.label {
width: 100px;
text-align: right;
.require {
color: #EC4B35;
}
...
...
src/modules/course-manage/components/AddLiveIntro.jsx
View file @
51ae25de
...
...
@@ -212,9 +212,10 @@ class AddLiveIntro extends React.Component {
return
(
<
div
className=
"add-live__intro-info"
>
<
div
className=
"playback"
>
<
span
className=
"label"
>
直播回放:
</
span
>
<
span
className=
"label"
><
span
className=
"require"
>
*
</
span
>
直播回放:
</
span
>
<
div
className=
"content"
>
<
Radio
.
Group
>
<
Radio
.
Group
value=
{
needRecord
}
onChange=
{
(
e
)
=>
{
this
.
props
.
onChange
(
'needRecord'
,
e
.
target
.
value
)
}
}
>
<
Row
style=
{
{
marginBottom
:
'5px'
}
}
>
<
Col
span=
{
8
}
>
<
Radio
value=
"YES"
>
...
...
src/modules/course-manage/components/AddLiveIntro.less
View file @
51ae25de
...
...
@@ -2,7 +2,9 @@
.playback {
margin-bottom: 10px;
.require {
color: #EC4B35;
}
&__text {
color: #999;
}
...
...
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