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
3f0a9d28
Commit
3f0a9d28
authored
Jul 01, 2021
by
guomingpang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:首页新增学员周活跃模块
parent
f803fff4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
331 additions
and
299 deletions
+331
-299
src/modules/home/Home.jsx
+297
-266
src/modules/home/Home.less
+34
-33
No files found.
src/modules/home/Home.jsx
View file @
3f0a9d28
import
React
from
'react'
;
import
{
Select
,
Tooltip
}
from
'antd'
;
import
DataSet
from
"@antv/data-set"
;
import
{
Chart
as
G2Chart
}
from
'@antv/g2'
;
import
{
G2
,
Chart
,
Geom
,
Axis
,
Tooltip
as
G2Tooltip
,
Coord
,
Label
,
Legend
,
View
,
Guide
,
Shape
,
Facet
,
Util
}
from
"bizcharts"
;
import
moment
from
'moment'
import
Service
from
"@/common/js/service"
;
import
Service
from
'@/common/js/service'
;
import
User
from
'@/common/js/user'
;
import
DataSet
from
'@antv/data-set'
;
import
{
Chart
as
G2Chart
}
from
'@antv/g2'
;
import
{
Select
,
Tooltip
}
from
'antd'
;
import
{
Axis
,
Chart
,
Coord
,
Geom
,
Guide
,
Tooltip
as
G2Tooltip
}
from
'bizcharts'
;
import
moment
from
'moment'
;
import
React
from
'react'
;
import
'./Home.less'
;
const
Option
=
Select
.
Option
;
...
...
@@ -42,7 +28,9 @@ class Home extends React.Component {
studyTimeRange
:
'7'
,
completeNum
:
0
,
unfinishedNum
:
0
,
}
weekVisitCustomerNum
:
0
,
incWeekVisitCustomerNum
:
0
,
};
this
.
_chart
=
null
;
}
...
...
@@ -56,7 +44,7 @@ class Home extends React.Component {
getTrainingInfo
()
{
Service
.
Hades
(
'public/hades/planOverview'
,
{
storeId
:
User
.
getStoreId
()
}).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
setState
(
res
.
result
)
this
.
setState
(
res
.
result
)
;
}
});
}
...
...
@@ -68,25 +56,25 @@ class Home extends React.Component {
scheduleType
,
storeId
:
User
.
getStoreId
(),
timeRange
,
}
}
;
Service
.
Hades
(
'public/courseCloud/hotCourse'
,
data
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
setState
({
list
:
res
.
result
})
list
:
res
.
result
,
})
;
}
})
})
;
}
getStudyInfo
()
{
const
{
studyTimeRange
}
=
this
.
state
;
Service
.
Hades
(
'public/hades/studyInfo'
,
{
storeId
:
User
.
getStoreId
(),
timeRange
:
studyTimeRange
}).
then
((
res
)
=>
{
if
(
res
.
success
)
{
const
dataList
=
res
.
result
.
map
(
item
=>
({
const
dataList
=
res
.
result
.
map
(
(
item
)
=>
({
time
:
moment
(
item
.
dateline
).
format
(
'MM-DD'
),
studyNum
:
item
.
studyNum
,
studyTime
:
Math
.
round
(
item
.
studyTime
/
6
)
/
10
,
}))
}))
;
this
.
createChart
(
dataList
);
}
});
...
...
@@ -110,9 +98,11 @@ class Home extends React.Component {
pictureCourseNum
:
res
.
result
.
pictureCourseNum
,
offlineCourseNum
:
res
.
result
.
offlineCourseNum
,
trainingPlanNum
:
res
.
result
.
trainingPlanNum
,
})
weekVisitCustomerNum
:
res
.
result
.
weekVisitCustomerNum
,
incWeekVisitCustomerNum
:
res
.
result
.
incWeekVisitCustomerNum
,
});
}
})
})
;
}
showNumber
(
index
)
{
...
...
@@ -135,82 +125,92 @@ class Home extends React.Component {
container
:
'chart-id'
,
forceFit
:
true
,
height
:
290
,
padding
:
[
48
,
64
]
})
padding
:
[
48
,
64
]
,
})
;
}
this
.
_chart
.
clear
();
this
.
_chart
.
source
(
data
,
{
studyTime
:
{
formatter
:
(
val
)
=>
{
return
val
return
val
;
},
tickCount
:
5
,
},
time
:
{
formatter
:
(
val
)
=>
{
return
`
${
val
}
`
return
`
${
val
}
`
;
},
},
studyNum
:
{
formatter
:
(
val
)
=>
{
return
val
return
val
;
},
tickCount
:
5
,
}
},
});
this
.
_chart
.
axis
(
'time'
,
{
label
:
{
offset
:
20
,
textStyle
:
{
fill
:
'#666666'
,
fontSize
:
14
}
fontSize
:
14
,
},
},
line
:
{
stroke
:
'#E8E8E8'
stroke
:
'#E8E8E8'
,
},
tickLine
:
{
stroke
:
'#E8E8E8'
}
})
stroke
:
'#E8E8E8'
,
},
});
this
.
_chart
.
axis
(
'submitCount'
,
{
label
:
{
textStyle
:
{
fill
:
'#666666'
,
fontSize
:
14
}
}
})
fontSize
:
14
,
},
},
});
this
.
_chart
.
axis
(
'studyTime'
,
{
label
:
{
textStyle
:
{
fill
:
'#666666'
,
fontSize
:
14
}
}
})
this
.
_chart
.
line
().
position
(
'time*studyNum'
).
color
(
'#2966FF'
).
tooltip
(
'time*studyNum'
,
function
(
time
,
studyNum
){
fontSize
:
14
,
},
},
});
this
.
_chart
.
line
()
.
position
(
'time*studyNum'
)
.
color
(
'#2966FF'
)
.
tooltip
(
'time*studyNum'
,
function
(
time
,
studyNum
)
{
return
{
name
:
'学习人数'
,
value
:
studyNum
+
'人'
}
value
:
studyNum
+
'人'
,
};
});
this
.
_chart
.
line
().
position
(
'time*studyTime'
).
color
(
'#FFBB54'
).
tooltip
(
'time*studyTime'
,
function
(
time
,
studyTime
){
this
.
_chart
.
line
()
.
position
(
'time*studyTime'
)
.
color
(
'#FFBB54'
)
.
tooltip
(
'time*studyTime'
,
function
(
time
,
studyTime
)
{
return
{
name
:
'人均学习时长'
,
value
:
studyTime
+
'分钟'
}
value
:
studyTime
+
'分钟'
,
};
});
this
.
_chart
.
legend
(
false
);
this
.
_chart
.
tooltip
({
containerTpl
:
'<div class="g2-tooltip" style="background: #fff !important;">'
+
'<div class="g2-tooltip-title" style="margin:10px 0;"></div>'
+
'<ul class="g2-tooltip-list"></ul></div>'
,
// tooltip 容器模板
itemTpl
:
'<li data-index={index}><span style="background-color:{color};width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:8px;"></span>{name}<span style="display: inline-block; float: right; margin-left: 30px;">{value}</span></li>'
,
// tooltip 每项记录的默认模板
})
containerTpl
:
'<div class="g2-tooltip" style="background: #fff !important;">'
+
'<div class="g2-tooltip-title" style="margin:10px 0;"></div>'
+
'<ul class="g2-tooltip-list"></ul></div>'
,
// tooltip 容器模板
itemTpl
:
'<li data-index={index}><span style="background-color:{color};width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:8px;"></span>{name}<span style="display: inline-block; float: right; margin-left: 30px;">{value}</span></li>'
,
// tooltip 每项记录的默认模板
});
this
.
_chart
.
render
();
}
};
render
()
{
const
{
...
...
@@ -235,313 +235,344 @@ class Home extends React.Component {
planCustomerNum
,
incOfflineCourseNum
,
offlineCourseNum
,
weekVisitCustomerNum
,
incWeekVisitCustomerNum
,
}
=
this
.
state
;
const
data
=
[
{
item
:
'已完成培训'
,
count
:
completeNum
,
},
{
},
{
item
:
'未完成培训'
,
count
:
unfinishedNum
,
}
}
,
];
const
{
DataView
}
=
DataSet
;
const
{
Html
}
=
Guide
;
const
sum
=
data
[
0
].
count
+
data
[
1
].
count
;
const
dv
=
new
DataView
();
sum
&&
dv
.
source
(
data
).
transform
({
type
:
"percent"
,
field
:
"count"
,
dimension
:
"item"
,
as
:
"percent"
sum
&&
dv
.
source
(
data
).
transform
({
type
:
'percent'
,
field
:
'count'
,
dimension
:
'item'
,
as
:
'percent'
,
});
const
cols
=
{
percent
:
{
formatter
:
val
=>
{
val
=
val
*
100
+
"%"
;
formatter
:
(
val
)
=>
{
val
=
val
*
100
+
'%'
;
return
val
;
}
}
}
,
}
,
};
return
(
<
div
className=
"home-page"
>
<
div
className=
"data-wrap"
>
<
div
className=
"home-title"
>
数据概况
</
div
>
<
div
className=
"data-box"
>
<
div
className=
"data-item"
>
<
div
className=
"header"
>
<
img
className=
"header-icon"
src=
"https://image.xiaomaiketang.com/xm/wAaFtjeRsM.png"
/>
<
span
className=
"header-word"
>
学员总数 (人)
</
span
>
</
div
>
<
div
className=
"data-number"
>
{
totalCustomerNum
}
</
div
>
<
div
className=
"data-footer"
>
<
span
className=
"footer-word"
>
本月新增
</
span
>
{
incCustomerNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"footer-number"
>
{
incCustomerNum
}
</
span
>
</
div
>
</
div
>
<
div
className=
"data-item course-data"
>
<
div
className=
"header"
>
<
img
className=
"header-icon"
src=
"https://image.xiaomaiketang.com/xm/jPrRhw8EMF.png"
/>
<
span
className=
"header-word"
>
课程总数 (个)
</
span
>
</
div
>
<
div
className=
"data-number"
>
{
videoCourseNum
+
liveCourseNum
+
pictureCourseNum
}
</
div
>
<
div
className=
"course-box"
>
<
div
className=
"course-item"
>
<
div
className=
"course-title"
>
直播课
</
div
>
<
div
className=
"data"
>
<
span
className=
"course-number"
>
{
liveCourseNum
}
</
span
>
<
span
className=
"course-word"
>
本月新增
</
span
>
{
incLiveCourseNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"add-number"
>
{
incLiveCourseNum
}
</
span
>
<
div
className=
'home-page'
>
<
div
className=
'data-wrap'
>
<
div
className=
'home-title'
>
数据概况
</
div
>
<
div
className=
'data-box'
>
<
div
className=
'data-item'
>
<
div
className=
'header'
>
<
img
className=
'header-icon'
src=
'https://image.xiaomaiketang.com/xm/wAaFtjeRsM.png'
alt=
''
/>
<
span
className=
'header-word'
>
学员总数 (人)
</
span
>
</
div
>
<
div
className=
'data-number'
>
{
totalCustomerNum
}
</
div
>
<
div
className=
'data-footer'
>
<
span
className=
'footer-word'
>
本月新增
</
span
>
{
incCustomerNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'footer-number'
>
{
incCustomerNum
}
</
span
>
</
div
>
</
div
>
<
div
className=
'data-item'
>
<
div
className=
'header'
>
<
img
className=
'header-icon'
src=
'https://image.xiaomaiketang.com/xm/nXYAHExPrX.png'
alt=
''
/>
<
span
className=
'header-word'
>
学员周活跃 (人)
</
span
>
</
div
>
<
div
className=
'data-number'
>
{
weekVisitCustomerNum
||
0
}
</
div
>
<
div
className=
'data-footer'
>
<
span
className=
'footer-word'
>
本月新增
</
span
>
{
incWeekVisitCustomerNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'footer-number'
>
{
incWeekVisitCustomerNum
||
0
}
</
span
>
</
div
>
</
div
>
<
div
className=
"course-item"
>
<
div
className=
"course-title"
>
视频课
</
div
>
<
div
className=
"data"
>
<
span
className=
"course-number"
>
{
videoCourseNum
}
</
span
>
<
span
className=
"course-word"
>
本月新增
</
span
>
{
incVideoCourseNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"add-number"
>
{
incVideoCourseNum
}
</
span
>
<
div
className=
'data-item course-data'
>
<
div
className=
'header'
>
<
img
className=
'header-icon'
src=
'https://image.xiaomaiketang.com/xm/jPrRhw8EMF.png'
alt=
''
/>
<
span
className=
'header-word'
>
课程总数 (个)
</
span
>
</
div
>
<
div
className=
'data-number'
>
{
videoCourseNum
+
liveCourseNum
+
pictureCourseNum
}
</
div
>
<
div
className=
'data-footer'
>
<
span
className=
'footer-word'
>
本月新增
</
span
>
{
incCustomerNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'footer-number'
>
{
incCustomerNum
}
</
span
>
</
div
>
<
div
className=
"course-item"
>
<
div
className=
"course-title"
>
图文课
</
div
>
<
div
className=
"data"
>
<
span
className=
"course-number"
>
{
pictureCourseNum
}
</
span
>
<
span
className=
"course-word"
>
本月新增
</
span
>
{
incPictureCourseNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"add-number"
>
{
incPictureCourseNum
}
</
span
>
<
div
className=
'course-box'
>
<
div
className=
'course-item'
>
<
div
className=
'course-title'
>
直播课
</
div
>
<
div
className=
'data'
>
<
span
className=
'course-number'
>
{
liveCourseNum
}
</
span
>
{
incLiveCourseNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'add-number'
>
{
incLiveCourseNum
}
</
span
>
</
div
>
</
div
>
<
div
className=
"course-item"
>
<
div
className=
"course-title"
>
线下课
</
div
>
<
div
className=
"data"
>
<
span
className=
"course-number"
>
{
offlineCourseNum
}
</
span
>
<
span
className=
"course-word"
>
本月新增
</
span
>
{
incOfflineCourseNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"add-number"
>
{
incOfflineCourseNum
}
</
span
>
<
div
className=
'course-item'
>
<
div
className=
'course-title'
>
视频课
</
div
>
<
div
className=
'data'
>
<
span
className=
'course-number'
>
{
videoCourseNum
}
</
span
>
{
incVideoCourseNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'add-number'
>
{
incVideoCourseNum
}
</
span
>
</
div
>
</
div
>
<
div
className=
'course-item'
>
<
div
className=
'course-title'
>
图文课
</
div
>
<
div
className=
'data'
>
<
span
className=
'course-number'
>
{
pictureCourseNum
}
</
span
>
{
incPictureCourseNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'add-number'
>
{
incPictureCourseNum
}
</
span
>
</
div
>
</
div
>
<
div
className=
"data-item"
>
<
div
className=
"header"
>
<
img
className=
"header-icon"
src=
"https://image.xiaomaiketang.com/xm/jZf3GNY5tY.png"
/>
<
span
className=
"header-word"
>
培训计划总数 (个)
</
span
>
<
div
className=
'course-item'
>
<
div
className=
'course-title'
>
线下课
</
div
>
<
div
className=
'data'
>
<
span
className=
'course-number'
>
{
offlineCourseNum
}
</
span
>
{
incOfflineCourseNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'add-number'
>
{
incOfflineCourseNum
}
</
span
>
</
div
>
<
div
className=
"data-number"
>
{
trainingPlanNum
}
</
div
>
<
div
className=
"data-footer"
>
<
span
className=
"footer-word"
>
本月新增
</
span
>
{
incTrainingPlanNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"footer-number"
>
{
incTrainingPlanNum
}
</
span
>
</
div
>
</
div
>
</
div
>
<
div
className=
'data-item'
>
<
div
className=
'header'
>
<
img
className=
'header-icon'
src=
'https://image.xiaomaiketang.com/xm/jZf3GNY5tY.png'
alt=
''
/>
<
span
className=
'header-word'
>
培训计划总数 (个)
</
span
>
</
div
>
<
div
className=
'data-number'
>
{
trainingPlanNum
}
</
div
>
<
div
className=
'data-footer'
>
<
span
className=
'footer-word'
>
本月新增
</
span
>
{
incTrainingPlanNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'footer-number'
>
{
incTrainingPlanNum
}
</
span
>
</
div
>
</
div
>
<
div
className=
"data-item"
>
<
div
className=
"header"
>
<
img
className=
"header-icon"
src=
"https://image.xiaomaiketang.com/xm/3CfrPs23Re.png"
/>
<
span
className=
"header-word"
>
考试总数 (个)
</
span
>
</
div
>
<
div
className=
"data-number"
>
{
examNum
}
</
div
>
<
div
className=
"data-footer"
>
<
span
className=
"footer-word"
>
本月新增
</
span
>
{
incExamNum
>
0
&&
<
span
className=
"icon iconfont"
>

</
span
>
}
<
span
className=
"footer-number"
>
{
incExamNum
}
</
span
>
<
div
className=
'data-item'
>
<
div
className=
'header'
>
<
img
className=
'header-icon'
src=
'https://image.xiaomaiketang.com/xm/3CfrPs23Re.png'
alt=
''
/>
<
span
className=
'header-word'
>
考试总数 (个)
</
span
>
</
div
>
<
div
className=
'data-number'
>
{
examNum
}
</
div
>
<
div
className=
'data-footer'
>
<
span
className=
'footer-word'
>
本月新增
</
span
>
{
incExamNum
>
0
&&
<
span
className=
'icon iconfont'
>

</
span
>
}
<
span
className=
'footer-number'
>
{
incExamNum
}
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"study-wrap"
>
<
div
className=
"home-title"
>
学习概况
</
div
>
<
div
className=
"study-box"
>
<
div
className=
"study-item"
>
<
div
className=
"study-title"
>
课程学习排行榜
</
div
>
<
div
className=
"study-header"
>
<
div
className=
"study-tab"
>
<
div
className=
'study-wrap'
>
<
div
className=
'home-title'
>
学习概况
</
div
>
<
div
className=
'study-box'
>
<
div
className=
'study-item'
>
<
div
className=
'study-title'
>
课程学习排行榜
</
div
>
<
div
className=
'study-header'
>
<
div
className=
'study-tab'
>
<
span
className=
{
`tab${scheduleType === 'LIVE' ? ' selected' : ''}`
}
onClick=
{
()
=>
this
.
setState
({
scheduleType
:
'LIVE'
},
()
=>
this
.
getHotCourse
())
}
>
直播课
</
span
>
onClick=
{
()
=>
this
.
setState
({
scheduleType
:
'LIVE'
},
()
=>
this
.
getHotCourse
())
}
>
直播课
</
span
>
<
span
className=
{
`tab${scheduleType === 'VOICE' ? ' selected' : ''}`
}
onClick=
{
()
=>
this
.
setState
({
scheduleType
:
'VOICE'
},
()
=>
this
.
getHotCourse
())
}
>
视频课
</
span
>
onClick=
{
()
=>
this
.
setState
({
scheduleType
:
'VOICE'
},
()
=>
this
.
getHotCourse
())
}
>
视频课
</
span
>
<
span
className=
{
`tab${scheduleType === 'PICTURE' ? ' selected' : ''}`
}
onClick=
{
()
=>
this
.
setState
({
scheduleType
:
'PICTURE'
},
()
=>
this
.
getHotCourse
())
}
>
图文课
</
span
>
</
div
>
<
div
className=
"study-select"
>
<
span
className=
"select-word"
>
(
{
moment
().
subtract
(
timeRange
-
1
,
'day'
).
format
(
'MM.DD'
)
}
~
{
moment
().
format
(
'MM.DD'
)
}
)
</
span
>
onClick=
{
()
=>
this
.
setState
({
scheduleType
:
'PICTURE'
},
()
=>
this
.
getHotCourse
())
}
>
图文课
</
span
>
</
div
>
<
div
className=
'study-select'
>
<
span
className=
'select-word'
>
(
{
moment
()
.
subtract
(
timeRange
-
1
,
'day'
)
.
format
(
'MM.DD'
)
}{
' '
}
~
{
moment
().
format
(
'MM.DD'
)
}
)
</
span
>
<
Select
style=
{
{
width
:
88
}
}
value=
{
timeRange
}
onChange=
{
(
value
)
=>
{
this
.
setState
({
timeRange
:
value
},
()
=>
this
.
getHotCourse
());
}
}
>
<
Option
value=
"7"
>
近7天
</
Option
>
<
Option
value=
"15"
>
近15天
</
Option
>
<
Option
value=
"30"
>
近30天
</
Option
>
}
}
>
<
Option
value=
'7'
>
近7天
</
Option
>
<
Option
value=
'15'
>
近15天
</
Option
>
<
Option
value=
'30'
>
近30天
</
Option
>
</
Select
>
</
div
>
</
div
>
{
_
.
isEmpty
(
list
)
?
<
div
className=
"study-empty"
>
<
img
src=
"https://image.xiaomaiketang.com/xm/52dmait5Bx.png"
/>
<
Choose
>
<
When
condition=
{
_
.
isEmpty
(
list
)
}
>
<
div
className=
'study-empty'
>
<
img
src=
'https://image.xiaomaiketang.com/xm/52dmait5Bx.png'
/>
<
div
>
暂无课程上榜
</
div
>
</
div
>
:
list
.
map
((
item
,
index
)
=>
(
</
When
>
<
Otherwise
>
{
list
.
map
((
item
,
index
)
=>
(
<
div
className=
{
`table-item${index % 2 ? '' : ' odd'}`
}
key=
{
item
.
id
}
>
{
index
<
3
?
<
span
className=
"table-number"
><
img
src=
{
this
.
showNumber
(
index
)
}
className=
"table-image"
/></
span
>
:
<
span
className=
"table-number"
>
{
index
+
1
}
</
span
>
}
<
div
className=
"table-data"
>
<
div
className=
"table-name"
>
<
Tooltip
title=
{
item
.
courseName
}
>
{
item
.
courseName
}
</
Tooltip
>
<
Choose
>
<
When
condition=
{
index
<
3
}
>
<
span
className=
'table-number'
>
<
img
src=
{
this
.
showNumber
(
index
)
}
className=
'table-image'
alt=
''
/>
</
span
>
</
When
>
<
Otherwise
>
<
span
className=
'table-number'
>
{
index
+
1
}
</
span
>
</
Otherwise
>
</
Choose
>
<
div
className=
'table-data'
>
<
div
className=
'table-name'
>
<
Tooltip
title=
{
item
.
courseName
}
>
{
item
.
courseName
}
</
Tooltip
>
</
div
>
<
div
className=
"table-tag"
>
{
item
.
categoryName
}
</
div
>
<
div
className=
'table-tag'
>
{
item
.
categoryName
}
</
div
>
</
div
>
<
span
className=
"table-study"
>
{
item
.
studyNum
||
0
}
人已学习
</
span
>
<
span
className=
'table-study'
>
{
item
.
studyNum
||
0
}
人已学习
</
span
>
</
div
>
))
}
))
}
</
Otherwise
>
</
Choose
>
</
div
>
<
div
className=
"study-item"
>
<
div
className=
"study-title"
>
培训计划完成情况
<
Tooltip
overlayClassName=
"data-plan-tooltip"
title=
"若某人加入多个培训计划,则需完成所有已加入的培训计划后,才视为已完成培训"
>
<
span
className=
"iconfont icon"
>

</
span
>
<
div
className=
'study-item'
>
<
div
className=
'study-title'
>
培训计划完成情况
<
Tooltip
overlayClassName=
'data-plan-tooltip'
title=
'若某人加入多个培训计划,则需完成所有已加入的培训计划后,才视为已完成培训'
>
<
span
className=
'iconfont icon'
>

</
span
>
</
Tooltip
>
<
span
className=
"tip"
>
(本月)
</
span
>
<
span
className=
'tip'
>
(本月)
</
span
>
</
div
>
{
(
unfinishedNum
||
completeNum
)
?
<
Choose
>
<
When
condition=
{
unfinishedNum
||
completeNum
}
>
<
div
className=
"left-graph-container"
id=
"mountNode"
className=
'left-graph-container'
id=
'mountNode'
style=
{
{
width
:
'100%'
,
marginLeft
:
'-20%'
,
marginTop
:
-
30
}
}
ref=
{
e
=>
e
&&
(
this
.
width
=
e
.
clientWidth
)
}
>
{
this
.
width
&&
<
div
>
<
Chart
height=
{
400
}
width=
{
this
.
width
}
data=
{
dv
}
scale=
{
cols
}
padding=
{
20
}
>
<
Coord
type=
{
"theta"
}
radius=
{
0.75
}
innerRadius=
{
0.6
}
/>
<
Axis
name=
"percent"
/>
ref=
{
(
e
)
=>
e
&&
(
this
.
width
=
e
.
clientWidth
)
}
>
{
this
.
width
&&
(
<
div
>
<
Chart
height=
{
400
}
width=
{
this
.
width
}
data=
{
dv
}
scale=
{
cols
}
padding=
{
20
}
>
<
Coord
type=
{
'theta'
}
radius=
{
0.75
}
innerRadius=
{
0.6
}
/>
<
Axis
name=
'percent'
/>
<
G2Tooltip
showTitle=
{
false
}
itemTpl=
"<li><span style="background-color:
{
color
}
;&
quot
;
class=
"g2-tooltip-marker"></span>
{
name
}
:
{
value
}</
li
>
"
itemTpl=
'<li><span style="background-color:
{
color
}
;"
class=
"g2-tooltip-marker"
></
span
>
{
name
}
:
{
value
}
</
li
>
'
/
>
<
Guide
>
<
Html
position=
{
[
'50%'
,
"50%"
]
}
position=
{
[
'50%'
,
'50%'
]
}
html=
{
`<div style="color:#8c8c8c;font-size:14px;text-align: center;width: ${this.width}px;"><span style="color:#333;font-size:20px">${planCustomerNum}人</span><br>新增培训人数</div>`
}
alignX=
"middle"
alignY=
"middle"
alignX=
'middle'
alignY=
'middle'
/>
</
Guide
>
<
Geom
type=
"intervalStack"
position=
"percent"
type=
'intervalStack'
position=
'percent'
color=
{
[
'item'
,
[
'#FFBB54'
,
'#2966FF'
]]
}
tooltip=
{
[
"item*percent"
,
'item*percent'
,
(
item
,
percent
)
=>
{
percent
=
Math
.
round
(
percent
*
100
)
+
"%"
;
percent
=
Math
.
round
(
percent
*
100
)
+
'%'
;
return
{
name
:
item
,
value
:
percent
,
};
}
},
]
}
style=
{
{
lineWidth
:
1
,
stroke
:
"#fff"
}
}
>
</
Geom
>
stroke
:
'#fff'
,
}
}
></
Geom
>
</
Chart
>
<
/
div
>
}
)
}
</
div
>
:
<
div
className=
"circle-box"
>
<
div
className=
"big-circle"
>
<
div
className=
"small-circle"
>
<
div
className=
"tip-box"
>
</
When
>
<
Otherwise
>
<
div
className=
'circle-box'
>
<
div
className=
'big-circle'
>
<
div
className=
'small-circle'
>
<
div
className=
'tip-box'
>
<
div
style=
{
{
color
:
'#333'
,
fontSize
:
'20px'
,
marginBottom
:
4
}
}
>
{
planCustomerNum
}
人
</
div
>
<
div
style=
{
{
color
:
'#999'
}
}
>
新增培训人数
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
}
<
div
className=
"circle-tip unfinished"
>
<
div
className=
"spot"
></
div
>
<
div
className=
"number"
>
{
unfinishedNum
}
人
</
div
>
<
div
className=
"word"
>
未完成培训
</
div
>
</
div
>
<
div
className=
"circle-tip finished"
>
<
div
className=
"spot"
></
div
>
<
div
className=
"number"
>
{
completeNum
}
人
</
div
>
<
div
className=
"word"
>
完成培训
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"study-chart"
>
<
div
className=
"study-title"
>
学习人数与时长
<
div
className=
"study-select"
>
<
span
className=
"select-word"
>
(
{
moment
().
subtract
(
studyTimeRange
-
1
,
'day'
).
format
(
'MM.DD'
)
}
~
{
moment
().
format
(
'MM.DD'
)
}
)
</
span
>
</
Otherwise
>
</
Choose
>
<
div
className=
'circle-tip unfinished'
>
<
div
className=
'spot'
></
div
>
<
div
className=
'number'
>
{
unfinishedNum
}
人
</
div
>
<
div
className=
'word'
>
未完成培训
</
div
>
</
div
>
<
div
className=
'circle-tip finished'
>
<
div
className=
'spot'
></
div
>
<
div
className=
'number'
>
{
completeNum
}
人
</
div
>
<
div
className=
'word'
>
完成培训
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'study-chart'
>
<
div
className=
'study-title'
>
学习人数与时长
<
div
className=
'study-select'
>
<
span
className=
'select-word'
>
(
{
moment
()
.
subtract
(
studyTimeRange
-
1
,
'day'
)
.
format
(
'MM.DD'
)
}{
' '
}
~
{
moment
().
format
(
'MM.DD'
)
}
)
</
span
>
<
Select
style=
{
{
width
:
88
}
}
value=
{
studyTimeRange
}
onChange=
{
(
value
)
=>
{
this
.
setState
({
studyTimeRange
:
value
},
()
=>
this
.
getStudyInfo
());
}
}
>
<
Option
value=
"7"
>
近7天
</
Option
>
<
Option
value=
"15"
>
近15天
</
Option
>
<
Option
value=
"30"
>
近30天
</
Option
>
}
}
>
<
Option
value=
'7'
>
近7天
</
Option
>
<
Option
value=
'15'
>
近15天
</
Option
>
<
Option
value=
'30'
>
近30天
</
Option
>
</
Select
>
</
div
>
</
div
>
<
div
className=
"chart-tip"
>
<
div
>
学习人数(人)
<
Tooltip
title=
"参与任意课程进行学习的人数"
>
<
span
className=
"iconfont icon"
>

</
span
>
<
div
className=
'chart-tip'
>
<
div
>
学习人数(人)
<
Tooltip
title=
'参与任意课程进行学习的人数'
>
<
span
className=
'iconfont icon'
>

</
span
>
</
Tooltip
>
</
div
>
<
div
>
人均学习时长(分钟)
</
div
>
</
div
>
<
div
id=
"chart-id"
></
div
>
<
div
className=
"chart-bottom-tip"
>
<
div
className=
"tip-item"
style=
{
{
marginRight
:
100
}
}
><
span
className=
"student-dot"
></
span
>
学习人数
</
div
>
<
div
className=
"tip-item"
><
span
className=
"time-dot"
></
span
>
人均学习时长
</
div
>
<
div
id=
'chart-id'
></
div
>
<
div
className=
'chart-bottom-tip'
>
<
div
className=
'tip-item'
style=
{
{
marginRight
:
100
}
}
>
<
span
className=
'student-dot'
></
span
>
学习人数
</
div
>
<
div
className=
'tip-item'
>
<
span
className=
'time-dot'
></
span
>
人均学习时长
</
div
>
</
div
>
</
div
>
</
div
>
)
)
;
}
}
...
...
src/modules/home/Home.less
View file @
3f0a9d28
...
...
@@ -2,34 +2,34 @@
// padding: 0 16px 16px;
min-width: 1100px;
position: relative;
z-index:3;
z-index:
3;
.g2-tooltip-marker {
border-radius: 50% !important;
}
.home-title {
color: #333;
padding-left:28px;
font-size:16px;
font-weight:bold;
padding-left:
28px;
font-size:
16px;
font-weight:
bold;
position: relative;
padding-top:16px;
&::before{
width:4px;
height:12px;
content:'';
background-image: linear-gradient(#2966
FF 83.5%, #0ACCA
4 16.5%);
display:inline-block;
padding-top:
16px;
&::before
{
width:
4px;
height:
12px;
content:
'';
background-image: linear-gradient(#2966
ff 83.5%, #0acca
4 16.5%);
display:
inline-block;
position: absolute;
left:16px;
top:22px;
left:
16px;
top:
22px;
}
}
@font-face {
font-family: 'number';
src: url('https://image.xiaomaiketang.com/xm/n2sADd2jY6.TTF');
}
.data-wrap{
background: #
FFF
;
.data-wrap
{
background: #
fff
;
.data-box {
display: flex;
justify-content: space-between;
...
...
@@ -41,7 +41,7 @@
width: ~'calc(16.67% - 8px)';
padding: 16px;
&.course-data {
width: ~'calc(
50
% - 24px)';
width: ~'calc(
33
% - 24px)';
}
.header {
display: flex;
...
...
@@ -55,7 +55,7 @@
font-size: 14px;
line-height: 18px;
color: #333;
font-weight:500;
font-weight:
500;
}
}
.data-number {
...
...
@@ -74,7 +74,7 @@
.iconfont {
font-size: 12px;
margin-right: 4px;
color: #
EC4B
35;
color: #
ec4b
35;
}
.footer-number {
font-size: 12px;
...
...
@@ -83,7 +83,7 @@
}
.course-box {
border-radius: 4px;
background: #
FAFAFA
;
background: #
fafafa
;
height: 124px;
width: 66%;
position: absolute;
...
...
@@ -114,7 +114,7 @@
.iconfont {
font-size: 12px;
margin-right: 4px;
color: #
EC4B
35;
color: #
ec4b
35;
}
.add-number {
font-size: 12px;
...
...
@@ -126,9 +126,9 @@
}
}
}
.study-wrap{
background: #
FFF
;
margin-top:16px;
.study-wrap
{
background: #
fff
;
margin-top:
16px;
.study-box {
display: flex;
justify-content: space-between;
...
...
@@ -148,7 +148,7 @@
margin-bottom: 12px;
.iconfont {
font-size: 14px;
color: #
BFBFBF
;
color: #
bfbfbf
;
margin-left: 4px;
}
.tip {
...
...
@@ -169,13 +169,13 @@
color: #666;
cursor: pointer;
&.selected {
color: #2966
FF
;
color: #2966
ff
;
&::after {
position: absolute;
width: 24px;
height: 2px;
content: '';
background: #2966
FF
;
background: #2966
ff
;
border-radius: 1px;
left: 9px;
bottom: -4px;
...
...
@@ -196,7 +196,7 @@
display: flex;
align-items: center;
&.odd {
background: #
FAFAFA
;
background: #
fafafa
;
}
.table-image {
width: 24px;
...
...
@@ -257,7 +257,7 @@
width: 204px;
height: 204px;
border-radius: 102px;
background: #
F1F3F
6;
background: #
f1f3f
6;
margin-top: -20px;
.small-circle {
display: flex;
...
...
@@ -280,13 +280,13 @@
&.unfinished {
top: 152px;
.spot {
background: #2966
FF
;
background: #2966
ff
;
}
}
&.finished {
top: 232px;
.spot {
background: #
FFBB
54;
background: #
ffbb
54;
}
}
.spot {
...
...
@@ -352,14 +352,14 @@
align-items: center;
color: #666;
.student-dot {
background: #2966
FF
;
background: #2966
ff
;
height: 8px;
width: 8px;
border-radius: 50%;
margin-right: 8px;
}
.time-dot {
background: #
FEB
613;
background: #
feb
613;
height: 8px;
width: 8px;
border-radius: 50%;
...
...
@@ -382,7 +382,8 @@
font-size: 14px;
}
.g2-tooltip-list {
li,span {
li,
span {
display: flex;
align-items: center;
font-size: 14px;
...
...
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