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
4c2dba18
Commit
4c2dba18
authored
Jun 18, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
智能选课
parent
b8089100
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
5 deletions
+34
-5
src/components/intelligent-recommend/index.js
+30
-4
src/components/intelligent-recommend/index.scss
+4
-1
No files found.
src/components/intelligent-recommend/index.js
View file @
4c2dba18
import
React
,
{
Component
}
from
'react'
;
import
'./index.scss'
import
{
Link
}
from
"react-router-dom"
;
import
{
http
}
from
"@/utils"
import
{
browser
,
getParam
,
http
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
;
import
{
connect
}
from
"react-redux"
;
import
{
WithFullSize
}
from
"@/HOCs"
...
...
@@ -31,7 +31,11 @@ class IntelligentRecommend extends Component {
}
componentDidMount
()
{
if
(
!
this
.
props
.
intelligentRecommend
.
processing
.
length
)
{
const
{
user
,
intelligentRecommend
,
history
}
=
this
.
props
if
(
user
.
hasError
)
{
return
history
.
push
(
'/passport'
)
}
if
(
!
intelligentRecommend
.
processing
.
length
)
{
this
.
getMessage
()
}
}
...
...
@@ -63,7 +67,7 @@ class IntelligentRecommend extends Component {
setTimeout
(()
=>
{
this
.
setState
({
showAnalyzing
:
false
})
this
.
props
.
addResult
({...
data
})
},
Math
.
random
()
*
1000
+
2
000
)
},
Math
.
random
()
*
500
+
1
000
)
})
}
else
{
const
message
=
{
...
...
@@ -95,6 +99,21 @@ class IntelligentRecommend extends Component {
})
}
goBack
=
()
=>
{
const
{
state
}
=
this
.
props
.
location
if
(
browser
.
isWeixin
&&
getParam
(
'code'
)
&&
getParam
(
'state'
))
{
window
.
history
.
go
(
-
2
)
}
if
(
state
.
records
&&
state
.
records
.
length
>
1
)
{
window
.
history
.
go
(
-
1
);
}
else
if
(
state
.
from
&&
state
.
from
.
pathname
)
{
location
.
replace
(
`
${
state
.
from
.
pathname
}${
state
.
from
.
search
}
`
)
}
else
{
window
.
location
.
href
=
window
.
location
.
origin
}
}
render
()
{
const
{
showAnalyzing
,
systemAvatar
,
options
}
=
this
.
state
const
{
user
,
intelligentRecommend
:
{
result
,
processing
},
reselect
}
=
this
.
props
...
...
@@ -169,7 +188,13 @@ class IntelligentRecommend extends Component {
{
!!
recommends
.
courses
.
length
&&
recommends
.
courses
.
map
(
item
=>
{
return
<
li
className
=
{
'course'
}
key
=
{
item
.
course_id
}
onClick
=
{(
e
)
=>
{
e
.
target
.
nodeName
.
toLowerCase
()
!==
'a'
&&
this
.
props
.
history
.
push
(
`/detail?id=
${
item
.
course_id
}
`
)
if
(
e
.
target
.
nodeName
.
toLowerCase
()
!==
'a'
)
{
if
(
item
.
course_id
)
{
this
.
props
.
history
.
push
(
`/detail?id=
${
item
.
course_id
}
`
)
}
else
{
this
.
props
.
history
.
push
(
`/play?id=
${
item
.
v_course_id
}
`
)
}
}
}}
>
<
div
className
=
"cover"
>
<
img
src
=
{
item
.
img_url
}
...
...
@@ -211,6 +236,7 @@ class IntelligentRecommend extends Component {
<
/div
>
);
}
}
function
Message
({
text
,
avatar
,
identity
})
{
...
...
src/components/intelligent-recommend/index.scss
View file @
4c2dba18
...
...
@@ -79,7 +79,6 @@
img
{
width
:
30px
;
height
:
30px
;
border
:
1px
solid
rgba
(
0
,
153
,
255
,
1
);
border-radius
:
50%
;
}
}
...
...
@@ -268,6 +267,10 @@
}
.title
{
width
:
97%
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
margin-bottom
:
8px
;
font-size
:
16px
;
line-height
:
16px
;
...
...
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