Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
11fac320
Commit
11fac320
authored
Oct 28, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
course popup basic complete
parent
1c8534b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
6 deletions
+154
-6
src/components/blessingPrehead/coursePopup/index.js
+67
-0
src/components/blessingPrehead/coursePopup/index.scss
+74
-0
src/components/blessingPrehead/index.js
+13
-6
No files found.
src/components/blessingPrehead/coursePopup/index.js
0 → 100644
View file @
11fac320
import
React
,
{
Component
}
from
'react'
;
import
{
http
}
from
"@/utils"
;
import
'./index.scss'
;
class
CoursePopup
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
courseList
:
[]
};
}
componentDidMount
()
{
this
.
fetchCourseData
();
}
fetchCourseData
=
()
=>
{
Promise
.
all
([
http
.
get
(
`
${
API
.
home
}
/sys/browse/blessing/courses`
),
http
.
get
(
`
${
API
.
home
}
/sys/user/blessing`
)
]).
then
(
res
=>
{
const
{
code
,
data
}
=
res
[
0
].
data
;
const
doneCourse
=
res
[
1
].
data
.
data
.
today_browsed_courses
||
[];
if
(
code
===
200
)
{
this
.
setState
({
courseList
:
data
.
map
(
item
=>
{
if
(
doneCourse
.
some
(
id
=>
id
==
item
.
course_id
))
{
return
Object
.
assign
({},
item
,
{
blessing
:
2
});
}
return
item
;
})
});
}
});
}
render
()
{
const
{
courseList
}
=
this
.
state
;
const
{
handleToHide
}
=
this
.
props
;
return
(
<
div
className
=
"course-popup__container"
>
<
div
className
=
"course-popup"
>
<
h2
className
=
"course-popup__title"
>
指定课程
<
/h2
>
<
div
className
=
"course-popup__list"
>
{
courseList
.
map
(
item
=>
(
<
a
href
=
""
className
=
"course-popup__item"
key
=
{
item
.
course_id
}
>
<
span
className
=
"course-popup__name"
>
{
item
.
course_title
}
<
/span
>
{
item
.
blessing
&&
<
span
>+
2
点
<
/span
>
}
<
/a
>
))
}
<
/div
>
<
/div
>
<
i
className
=
"iconfont iconiconfront-2"
onClick
=
{
handleToHide
}
><
/i
>
<
/div
>
);
}
}
export
default
CoursePopup
;
\ No newline at end of file
src/components/blessingPrehead/coursePopup/index.scss
0 → 100644
View file @
11fac320
.course-popup__container
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
background-color
:
rgba
(
0
,
0
,
0
,
.5
);
.iconfont
{
margin
:
16px
0
0
;
font-size
:
24px
;
color
:
#fff
;
cursor
:
pointer
;
}
}
.course-popup
{
width
:
300px
;
height
:
275px
;
padding
:
20px
0
0
;
border-radius
:
10px
;
box-sizing
:
border-box
;
background-color
:
#fff
;
}
.course-popup__title
{
margin
:
0
0
20px
;
font-size
:
16px
;
font-weight
:
500
;
color
:
#525C65
;
text-align
:
center
;
line-height
:
1
;
}
.course-popup__list
{
height
:
190px
;
padding
:
0
15px
;
overflow-y
:
auto
;
}
.course-popup__item
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
width
:
100%
;
height
:
30px
;
padding
:
0
10px
;
border-radius
:
4px
;
box-sizing
:
border-box
;
color
:
rgba
(
82
,
92
,
101
,
.6
);
background-color
:
#E7EDF2
;
&
:nth-child
(
n
+
2
)
{
margin-top
:
10px
;
}
&
:hover
{
color
:
#fff
;
background-color
:
rgba
(
0
,
153
,
255
,
.6
);;
}
}
.course-popup__name
{
width
:
200px
;
font-size
:
12px
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
\ No newline at end of file
src/components/blessingPrehead/index.js
View file @
11fac320
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
RulePopup
from
'./rulePopup/index'
;
import
RulePopup
from
'./rulePopup/index'
;
import
CoursePopup
from
'./coursePopup/index'
;
import
'./index.scss'
;
import
'./index.scss'
;
class
BlessingPrehead
extends
Component
{
class
BlessingPrehead
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
isRule
:
true
isRule
:
false
,
isCourse
:
true
};
};
}
}
handleToHide
=
()
=>
{
handleToHide
=
(
key
)
=>
{
let
obj
=
{};
obj
[
key
]
=
false
;
this
.
setState
({
this
.
setState
({
isRule
:
false
...
obj
});
});
}
}
render
()
{
render
()
{
const
{
isRule
}
=
this
.
state
;
const
{
isRule
,
isCourse
}
=
this
.
state
;
return
(
return
(
<
div
>
<
div
>
22222
22222
{
{
isRule
&&
isRule
&&
<
RulePopup
handleToHide
=
{
this
.
handleToHide
}
/
>
<
RulePopup
handleToHide
=
{()
=>
this
.
handleToHide
(
'isRule'
)}
/
>
}
{
isCourse
&&
<
CoursePopup
handleToHide
=
{()
=>
this
.
handleToHide
(
'isCourse'
)}
/
>
}
}
<
/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