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
Hide 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
React
,
{
Component
}
from
'react'
;
import
'./index.scss'
import
'./index.scss'
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
http
}
from
"@/utils"
import
{
browser
,
getParam
,
http
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
connect
}
from
"react-redux"
;
import
{
connect
}
from
"react-redux"
;
import
{
WithFullSize
}
from
"@/HOCs"
import
{
WithFullSize
}
from
"@/HOCs"
...
@@ -31,7 +31,11 @@ class IntelligentRecommend extends Component {
...
@@ -31,7 +31,11 @@ class IntelligentRecommend extends Component {
}
}
componentDidMount
()
{
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
()
this
.
getMessage
()
}
}
}
}
...
@@ -63,7 +67,7 @@ class IntelligentRecommend extends Component {
...
@@ -63,7 +67,7 @@ class IntelligentRecommend extends Component {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
showAnalyzing
:
false
})
this
.
setState
({
showAnalyzing
:
false
})
this
.
props
.
addResult
({...
data
})
this
.
props
.
addResult
({...
data
})
},
Math
.
random
()
*
1000
+
2
000
)
},
Math
.
random
()
*
500
+
1
000
)
})
})
}
else
{
}
else
{
const
message
=
{
const
message
=
{
...
@@ -95,6 +99,21 @@ class IntelligentRecommend extends Component {
...
@@ -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
()
{
render
()
{
const
{
showAnalyzing
,
systemAvatar
,
options
}
=
this
.
state
const
{
showAnalyzing
,
systemAvatar
,
options
}
=
this
.
state
const
{
user
,
intelligentRecommend
:
{
result
,
processing
},
reselect
}
=
this
.
props
const
{
user
,
intelligentRecommend
:
{
result
,
processing
},
reselect
}
=
this
.
props
...
@@ -169,7 +188,13 @@ class IntelligentRecommend extends Component {
...
@@ -169,7 +188,13 @@ class IntelligentRecommend extends Component {
{
{
!!
recommends
.
courses
.
length
&&
recommends
.
courses
.
map
(
item
=>
{
!!
recommends
.
courses
.
length
&&
recommends
.
courses
.
map
(
item
=>
{
return
<
li
className
=
{
'course'
}
key
=
{
item
.
course_id
}
onClick
=
{(
e
)
=>
{
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"
>
<
div
className
=
"cover"
>
<
img
src
=
{
item
.
img_url
}
<
img
src
=
{
item
.
img_url
}
...
@@ -211,6 +236,7 @@ class IntelligentRecommend extends Component {
...
@@ -211,6 +236,7 @@ class IntelligentRecommend extends Component {
<
/div
>
<
/div
>
);
);
}
}
}
}
function
Message
({
text
,
avatar
,
identity
})
{
function
Message
({
text
,
avatar
,
identity
})
{
...
...
src/components/intelligent-recommend/index.scss
View file @
4c2dba18
...
@@ -79,7 +79,6 @@
...
@@ -79,7 +79,6 @@
img
{
img
{
width
:
30px
;
width
:
30px
;
height
:
30px
;
height
:
30px
;
border
:
1px
solid
rgba
(
0
,
153
,
255
,
1
);
border-radius
:
50%
;
border-radius
:
50%
;
}
}
}
}
...
@@ -268,6 +267,10 @@
...
@@ -268,6 +267,10 @@
}
}
.title
{
.title
{
width
:
97%
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
margin-bottom
:
8px
;
margin-bottom
:
8px
;
font-size
:
16px
;
font-size
:
16px
;
line-height
:
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