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
6ba731e7
Commit
6ba731e7
authored
Dec 22, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:处理封面图相关的展示
parent
89929c93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
21 deletions
+59
-21
src/modules/course-manage/AddLive.jsx
+30
-15
src/modules/course-manage/components/AddLiveBasic.jsx
+16
-5
src/modules/course-manage/components/LiveCourseList.jsx
+13
-1
No files found.
src/modules/course-manage/AddLive.jsx
View file @
6ba731e7
...
...
@@ -27,6 +27,7 @@ const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png';
const
defaultBasicInfo
=
{
courseName
:
null
,
// 课程名称
coverUrl
:
defaultCover
,
coverId
:
null
,
categoryId
:
null
,
categoryName
:
null
,
};
...
...
@@ -69,6 +70,7 @@ class AddLive extends React.Component {
addLiveBasicInfo
:
{
courseName
:
null
,
// 课程名称
coverUrl
:
defaultCover
,
coverId
:
null
,
categoryId
:
null
,
categoryName
:
null
,
},
...
...
@@ -127,13 +129,15 @@ class AddLive extends React.Component {
categoryName
,
admins
}
=
res
.
result
;
let
coverId
;
let
coverUrl
;
let
liveCourseMediaRequests
=
[];
let
liveCourseWarmMedia
;
courseMediaVOS
.
map
((
item
)
=>
{
switch
(
item
.
contentType
){
case
"COVER"
:
coverUrl
=
item
.
mediaContent
;
coverId
=
item
.
mediaContent
;
coverUrl
=
item
.
mediaUrl
;
break
;
case
"WARMUP"
:
liveCourseWarmMedia
=
item
;
...
...
@@ -147,10 +151,11 @@ class AddLive extends React.Component {
return
item
;
})
const
addLiveBasicInfo
=
{
courseName
,
coverUrl
:
coverUrl
||
defaultCover
,
coverId
,
categoryId
,
categoryName
};
...
...
@@ -196,14 +201,16 @@ class AddLive extends React.Component {
}
// 修改基本信息
handleChangeBasicInfo
=
(
field
,
value
)
=>
{
this
.
setState
({
addLiveBasicInfo
:
{
...
this
.
state
.
addLiveBasicInfo
,
[
field
]:
value
,
}
},()
=>
{
console
.
log
(
this
.
state
.
addLiveBasicInfo
)})
}
// 修改基本信息
handleChangeBasicInfo
=
(
field
,
value
)
=>
{
const
{
coverUrl
}
=
this
.
state
.
addLiveBasicInfo
;
this
.
setState
({
addLiveBasicInfo
:
{
...
this
.
state
.
addLiveBasicInfo
,
[
field
]:
value
,
}
})
}
// 修改上课信息
handleChangeClassInfo
=
(
field
,
value
)
=>
{
...
...
@@ -262,7 +269,7 @@ class AddLive extends React.Component {
this
.
handleValidate
(
addLiveBasicInfo
,
addLiveClassInfo
,
addLiveIntroInfo
,
isEdit
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
const
{
type
}
=
this
.
state
;
const
{
courseName
,
coverUrl
,
categoryId
}
=
addLiveBasicInfo
;
const
{
courseName
,
coverUrl
,
coverId
,
categoryId
}
=
addLiveBasicInfo
;
const
{
liveDate
,
teacherId
,
...
...
@@ -285,10 +292,18 @@ class AddLive extends React.Component {
startTime
=
moment
(
_liveDate
+
' '
+
_timeHorizonStart
).
format
(
'x'
);
endTime
=
moment
(
_liveDate
+
' '
+
_timeHorizonEnd
).
format
(
'x'
);
}
const
coverObj
=
{
let
coverObj
=
{
contentType
:
'COVER'
,
mediaContent
:
coverUrl
,
mediaType
:
'PICTURE'
mediaContent
:
coverId
,
mediaType
:
'PICTURE'
,
mediaUrl
:
coverUrl
,
}
let
scheduleMediaRequests
;
if
(
coverId
){
scheduleMediaRequests
=
[
coverObj
,
liveCourseWarmMedia
,...
liveCourseMediaRequests
]
}
else
{
scheduleMediaRequests
=
[
liveCourseWarmMedia
,...
liveCourseMediaRequests
]
}
const
commonParams
=
{
adminIds
:
assistant
,
...
...
@@ -301,7 +316,7 @@ class AddLive extends React.Component {
storeId
:
User
.
getStoreId
(),
teacherId
:
teacherId
,
whetherVisitorsJoin
,
scheduleMediaRequests
:[
coverObj
,
liveCourseWarmMedia
,...
liveCourseMediaRequests
]
scheduleMediaRequests
}
if
(
type
===
'add'
)
{
...
...
src/modules/course-manage/components/AddLiveBasic.jsx
View file @
6ba731e7
...
...
@@ -61,6 +61,9 @@ class AddLiveBasic extends React.Component {
if
(
isDefaultCover
)
return
;
message
.
success
(
'已替换为默认图'
);
this
.
props
.
onChange
(
'coverUrl'
,
defaultCover
);
setTimeout
(()
=>
{
this
.
props
.
onChange
(
'coverId'
,
null
);
},
1000
)
}
catalogChange
=
(
value
)
=>
{
...
...
@@ -108,7 +111,7 @@ class AddLiveBasic extends React.Component {
const
viewImgDom
=
document
.
querySelector
(
'#preview-url-box'
);
const
options
=
{
size
:
[
500
,
73
],
size
:
[
297
,
169
],
rotateFree
:
false
,
ok
:
okBtnDom
,
view
:
viewImgDom
,
...
...
@@ -126,6 +129,7 @@ class AddLiveBasic extends React.Component {
fail
:
(
failInfo
)
=>
{
},
loadComplete
:(
img
)
=>
{
this
.
refs
.
headPicModal
.
click
();
this
.
setState
({
previewUrl
:
img
.
src
})
...
...
@@ -147,12 +151,14 @@ class AddLiveBasic extends React.Component {
);
};
//获取resourceId
getSignature
=
(
blob
,
fileName
)
=>
{
getSignature
=
(
blob
,
fileName
)
=>
{
const
{
choosedBannerId
}
=
this
.
state
;
Upload
.
uploadBlobToOSS
(
blob
,
'
avatar'
+
(
new
Date
()).
valueOf
()).
then
((
coverClicpPath
)
=>
{
Upload
.
uploadBlobToOSS
(
blob
,
'
cover'
+
(
new
Date
()).
valueOf
(),
null
,
'signInfo'
).
then
((
signInfo
)
=>
{
this
.
setState
({
coverClicpPath
coverClicpPath
:
signInfo
.
fileUrl
,
coverId
:
signInfo
.
resourceId
})
});
};
// base64转换成blob
...
...
@@ -166,7 +172,7 @@ class AddLiveBasic extends React.Component {
return
new
Blob
([
ab
],
{
type
:
"image/png"
});
};
updateCover
=
()
=>
{
const
{
coverClicpPath
}
=
this
.
state
const
{
coverClicpPath
,
coverId
}
=
this
.
state
this
.
setState
({
showSelectFileModal
:
false
})
...
...
@@ -177,6 +183,10 @@ class AddLiveBasic extends React.Component {
// }
// console.log("coverObj",coverObj);
this
.
props
.
onChange
(
'coverUrl'
,
coverClicpPath
);
setTimeout
(()
=>
{
this
.
props
.
onChange
(
'coverId'
,
coverId
);
},
1000
)
}
render
()
{
const
{
showCutModal
,
imageFile
,
courseCatalogList
,
showSelectFileModal
,
visible
}
=
this
.
state
;
...
...
@@ -307,6 +317,7 @@ class AddLiveBasic extends React.Component {
<
div
className=
"clip-box"
>
<
div
id=
"headPicModal"
ref=
"headPicModal"
style=
{
{
width
:
"500px"
,
height
:
"430px"
,
...
...
src/modules/course-manage/components/LiveCourseList.jsx
View file @
6ba731e7
...
...
@@ -146,6 +146,7 @@ class LiveCourseList extends React.Component {
</
div
>
</
div
>
);
const
columns
=
[
{
title
:
"直播课"
,
...
...
@@ -153,9 +154,20 @@ class LiveCourseList extends React.Component {
key
:
"course"
,
dataIndex
:
"courseName"
,
render
:
(
val
,
record
)
=>
{
let
hasCover
=
false
;
return
(
<
div
className=
"record__item"
>
<
img
className=
"course-cover"
src=
{
'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'
}
/>
{
record
.
courseMediaVOS
.
map
((
item
,
index
)
=>
{
if
(
item
.
contentType
===
"COVER"
){
hasCover
=
true
;
return
<
img
className=
"course-cover"
src=
{
item
.
mediaUrl
}
/>
}
})
}
{
!
hasCover
&&
<
img
className=
"course-cover"
src=
{
'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'
}
/>
}
<
div
>
<
div
className=
"course-name"
>
{
record
.
courseName
}
</
div
>
<
div
>
...
...
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