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
c4ebb26d
Commit
c4ebb26d
authored
Jun 04, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detail
parent
df76033c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
47 deletions
+75
-47
src/common/HeaderSearch/index.js
+1
-1
src/components/Index/index.js
+2
-2
src/components/Index/liveRoom.js
+23
-17
src/components/classify/courselist.js
+27
-17
src/components/classify/courselist.scss
+12
-0
src/components/classify/index.js
+3
-3
src/components/preferential/index.js
+7
-7
No files found.
src/common/HeaderSearch/index.js
View file @
c4ebb26d
...
...
@@ -7,7 +7,7 @@ class HeaderBar extends Component {
window
.
location
.
href
=
'/search'
}
return
()
{
window
.
location
.
href
=
'/
index
'
window
.
location
.
href
=
'/'
}
render
()
{
...
...
src/components/Index/index.js
View file @
c4ebb26d
...
...
@@ -5,7 +5,7 @@ import {WithTab} from '@/HOCs'
import
Swiper
from
'react-mobile-swiper'
import
createStyle
from
'./createStyle'
import
LazyLoad
from
'react-lazy-load'
import
{
api
}
from
'@/utils'
import
{
http
,
api
}
from
'@/utils'
import
LiveRoom
from
'./liveRoom'
...
...
@@ -53,7 +53,7 @@ class Index extends Component {
componentDidMount
()
{
// 首页课程
api
.
get
(
'/m/home'
).
then
((
res
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/home`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
banner
:
res
.
data
.
data
.
banner
,
...
...
src/components/Index/liveRoom.js
View file @
c4ebb26d
import
React
,
{
Component
}
from
'react'
;
import
'./index.scss'
;
import
{
api
}
from
'@/utils'
import
{
http
,
api
}
from
'@/utils'
class
LiveRoom
extends
Component
{
constructor
(
props
)
{
...
...
@@ -16,18 +16,18 @@ class LiveRoom extends Component {
componentDidMount
()
{
// this.livePrepare(this.props.roomId,'',2,'')
// this.livePrepare(this.props.roomId,'',2,'')
}
// 直播间预约接口公共方法
livePrepare
=
(
room_id
,
type
,
source
,
mobile
)
=>
{
livePrepare
=
(
room_id
,
type
,
source
,
mobile
)
=>
{
let
data
=
{
room_id
:
room_id
,
// 直播间id
type
:
type
,
// 1-为微信服务通知预约 2-为手机号预约
source
:
source
,
// 1-为微信内置浏览器 2-为wap(微信外
mobile
:
mobile
// 手机号 当type为2时,该参数为必填
};
api
.
post
(
'/m/live/prepare'
,
data
).
then
((
res
)
=>
{
http
.
post
(
`
${
api
.
home
}
/m/live/prepare`
,
data
).
then
((
res
)
=>
{
/* status 0表示预约成功
1表示预约失败
2表示未关注服务号
...
...
@@ -35,12 +35,12 @@ class LiveRoom extends Component {
4表示手机号不能为空
*/
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
data
.
status
===
0
){
alert
(
res
.
data
.
data
.
msg
)
this
.
setState
(
status
=>
({
success
:
true
,
toSubscribe
:
false
}));
if
(
res
.
data
.
data
.
status
===
0
)
{
alert
(
res
.
data
.
data
.
msg
)
this
.
setState
(
status
=>
({
success
:
true
,
toSubscribe
:
false
}));
// if (type === 1){
// this.setState(status => ({
...
...
@@ -52,11 +52,11 @@ class LiveRoom extends Component {
// success: true,
// toSubscribe: false
// }));
// }
// }
}
else
if
(
res
.
data
.
data
.
status
===
1
){
}
else
if
(
res
.
data
.
data
.
status
===
1
)
{
alert
(
res
.
data
.
data
.
msg
)
}
else
if
(
res
.
data
.
data
.
status
===
2
){
}
else
if
(
res
.
data
.
data
.
status
===
2
)
{
alert
(
res
.
data
.
data
.
msg
)
this
.
setState
(
status
=>
({
toSubscribe
:
true
,
...
...
@@ -64,13 +64,13 @@ class LiveRoom extends Component {
isfollow
:
true
}));
}
else
if
(
res
.
data
.
data
.
status
===
3
){
}
else
if
(
res
.
data
.
data
.
status
===
3
)
{
alert
(
res
.
data
.
data
.
msg
)
this
.
setState
(
status
=>
({
issubscribe
:
1
,
}));
}
else
if
(
res
.
data
.
data
.
status
===
4
){
}
else
if
(
res
.
data
.
data
.
status
===
4
)
{
alert
(
res
.
data
.
data
.
msg
)
}
else
{
alert
(
res
.
data
.
data
.
msg
)
...
...
@@ -84,25 +84,30 @@ class LiveRoom extends Component {
}
})
}
// 关闭弹窗
liveColse
()
{
this
.
props
.
colseBox
(
false
);
}
// 点击预约
toSubscribe
()
{
this
.
props
.
colseBox
(
false
);
this
.
livePrepare
(
this
.
props
.
roomId
,
''
,
2
,
''
)
this
.
livePrepare
(
this
.
props
.
roomId
,
''
,
2
,
''
)
}
// 手机号预约
iphoneStep
()
{
this
.
setState
(
status
=>
({
step
:
1
}));
}
// 服务号预约
serverStep
()
{
this
.
livePrepare
(
this
.
props
.
roomId
,
1
,
2
,
''
)
this
.
livePrepare
(
this
.
props
.
roomId
,
1
,
2
,
''
)
}
// 最后提交
submit
()
{
if
(
this
.
state
.
step
===
1
)
{
...
...
@@ -112,6 +117,7 @@ class LiveRoom extends Component {
this
.
livePrepare
(
this
.
props
.
roomId
,
1
,
1
,
''
)
}
}
// 取消预约 关闭弹窗
subscribeColse
()
{
this
.
setState
(
status
=>
({
...
...
src/components/classify/courselist.js
View file @
c4ebb26d
...
...
@@ -3,7 +3,7 @@ import {VList} from '../../common';
import
{
Tabs
,
WhiteSpace
}
from
'antd-mobile'
;
import
'./courselist.scss'
;
import
HeaderSearch
from
'../../common/HeaderSearch/index'
import
{
api
,
getParam
}
from
"@/utils"
;
import
{
http
,
api
,
getParam
}
from
"@/utils"
;
class
Classify
extends
Component
{
...
...
@@ -15,19 +15,20 @@ class Classify extends Component {
arr
:
[{
basics
:
[]},
{
advanced
:
[]}],
allClass
:
[],
data
:
[],
activeTab
:
decodeURIComponent
(
getParam
(
'name'
))
}
}
componentDidMount
()
{
this
.
getTabs
()
this
.
getList
(
getParam
(
'id'
)
)
this
.
getList
()
}
// 获取tabs接口
getTabs
=
()
=>
{
let
data
=
0
api
.
get
(
`
/m/course/classify/
${
data
}
`
,)
http
.
get
(
`
${
api
.
home
}
/m/course/classify/
${
data
}
`
,)
.
then
((
res
)
=>
{
const
_this
=
this
if
(
res
.
data
.
code
===
200
)
{
...
...
@@ -54,8 +55,8 @@ class Classify extends Component {
}
// 获取课程接口
getList
=
(
id
)
=>
{
api
.
get
(
`/m/course/list/
${
id
}
`
,).
then
((
res
)
=>
{
getList
=
()
=>
{
http
.
get
(
`
${
api
.
home
}
/m/course/list/
${
getParam
(
'id'
)
}
`
,).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
(
status
=>
({
data
:
res
.
data
.
data
,
...
...
@@ -71,7 +72,11 @@ class Classify extends Component {
// 点击横向滚动tab查询
ontabclick
=
(
tab
)
=>
{
this
.
getList
(
tab
.
id
)
this
.
props
.
history
.
push
(
`/courselist?id=
${
tab
.
id
}
&name=
${
tab
.
title
}
`
)
this
.
getList
()
this
.
setState
({
activeTab
:
decodeURIComponent
(
getParam
(
'name'
))
});
}
// 上下展示
...
...
@@ -83,11 +88,13 @@ class Classify extends Component {
}
// 弹窗里面tab点击查询
labelclick
=
(
id
,
index
)
=>
{
this
.
getList
(
id
)
labelclick
=
(
item
)
=>
{
this
.
props
.
history
.
push
(
`/courselist?id=
${
item
.
c_id
}
&name=
${
item
.
c_name
}
`
)
this
.
getList
()
this
.
setState
(
status
=>
({
ispull
:
!
status
.
ispull
,
display
:
status
.
ispull
?
'none'
:
'block'
display
:
status
.
ispull
?
'none'
:
'block'
,
activeTab
:
decodeURIComponent
(
getParam
(
'name'
))
}))
}
...
...
@@ -99,6 +106,8 @@ class Classify extends Component {
<
i
className
=
{
'iconfont iconiconfront-71 pull-down'
}
><
/i
>
)
let
page
=
this
.
state
.
allClass
.
findIndex
((
item
)
=>
item
.
title
===
this
.
state
.
activeTab
)
return
(
<
div
className
=
'class-child'
>
<
HeaderSearch
><
/HeaderSearch
>
...
...
@@ -110,6 +119,7 @@ class Classify extends Component {
<
Tabs
tabs
=
{
this
.
state
.
allClass
}
animated
=
{
false
}
page
=
{
page
}
onChange
=
{(
tab
)
=>
this
.
ontabclick
(
tab
)}
>
<
div
className
=
'tabs'
>
...
...
@@ -134,10 +144,10 @@ class Classify extends Component {
const
status
=
(
<
div
>
{
item
.
bargain_num
===
0
&&
item
.
groupon_num
!==
0
&&
<
p
className
=
'course-status'
>
拼团减
{
item
.
price
}
元
<
/p
>
<
p
className
=
'course-status'
>
拼团减
{
item
.
groupon_num
}
元
<
/p
>
}
{
item
.
bargain_num
!==
0
&&
item
.
groupon_num
===
0
&&
<
p
className
=
'course-status'
>
砍价减
{
item
.
price2
}
元
<
/p
>
<
p
className
=
'course-status'
>
砍价减
{
item
.
bargain_num
}
元
<
/p
>
}
<
/div
>
)
...
...
@@ -156,10 +166,10 @@ class Classify extends Component {
{
this
.
state
.
arr
.
basics
&&
<
div
className
=
"tabcontent"
>
<
ClassCourse
data
=
{
this
.
state
.
arr
.
basics
.
list
}
title
=
{
this
.
state
.
arr
.
basics
.
name
}
labelclick
=
{
this
.
labelclick
}
/
>
<
ClassCourse
data
=
{
this
.
state
.
arr
.
advanced
.
list
}
title
=
{
this
.
state
.
arr
.
advanced
.
name
}
labelclick
=
{
this
.
labelclick
}
/
>
<
ClassCourse
activeTab
=
{
this
.
state
.
activeTab
}
data
=
{
this
.
state
.
arr
.
basics
.
list
}
title
=
{
this
.
state
.
arr
.
basics
.
name
}
labelclick
=
{
this
.
labelclick
}
/
>
<
ClassCourse
activeTab
=
{
this
.
state
.
activeTab
}
data
=
{
this
.
state
.
arr
.
advanced
.
list
}
title
=
{
this
.
state
.
arr
.
advanced
.
name
}
labelclick
=
{
this
.
labelclick
}
/
>
<
/div
>
}
<
/div
>
...
...
@@ -178,8 +188,8 @@ function ClassCourse(props) {
{
props
.
data
&&
props
.
data
.
length
>
0
&&
props
.
data
.
map
((
item
,
index
)
=>
{
return
(
<
span
key
=
{
index
}
onClick
=
{
e
=>
props
.
labelclick
(
item
.
c_id
,
index
)
}
className
=
'item-label'
>
{
item
.
c_name
}
<
/span
>
<
span
className
=
{
props
.
activeTab
===
item
.
c_name
?
'active-label'
:
'item-label'
}
key
=
{
index
}
onClick
=
{
e
=>
props
.
labelclick
(
item
)}
>
{
item
.
c_name
}
<
/span
>
)
})
}
...
...
src/components/classify/courselist.scss
View file @
c4ebb26d
...
...
@@ -175,6 +175,18 @@
margin-top
:
15px
;
margin-bottom
:
-5px
;
}
.active-label
{
display
:
inline-block
;
width
:
30
.5%
;
height
:
30px
;
line-height
:
30px
;
text-align
:
center
;
background-color
:
$bg_active
;
border-radius
:
15px
;
margin-top
:
15px
;
margin-bottom
:
-5px
;
color
:
$white
;
}
}
}
...
...
src/components/classify/index.js
View file @
c4ebb26d
import
React
,
{
Component
}
from
'react'
;
import
{
WithTab
}
from
'@/HOCs'
import
'./index.scss'
;
import
{
api
}
from
"@/utils"
;
import
{
http
,
api
}
from
"@/utils"
;
import
{
Link
}
from
'react-router-dom'
class
Classify
extends
Component
{
...
...
@@ -19,7 +19,7 @@ class Classify extends Component {
componentDidMount
()
{
let
data
=
1
api
.
get
(
`
/m/course/classify/
${
data
}
`
,).
then
((
res
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/course/classify/
${
data
}
`
,).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
data
.
common
.
length
>
0
)
{
this
.
setState
({
...
...
@@ -83,7 +83,7 @@ function ClassCourseB(props) {
{
props
.
data
&&
props
.
data
.
length
>
0
&&
props
.
data
.
map
((
item
,
index
)
=>
{
return
(
<
Link
to
=
{
`/courselist?id=
${
item
.
c_id
}
`
}
key
=
{
index
}
className
=
'item-label'
>
<
Link
to
=
{
`/courselist?id=
${
item
.
c_id
}
&name=
${
item
.
c_name
}
`
}
key
=
{
index
}
className
=
'item-label'
>
{
item
.
c_name
}
<
/Link
>
)
...
...
src/components/preferential/index.js
View file @
c4ebb26d
...
...
@@ -3,7 +3,7 @@ import {VList} from '../../common'
import
{
Tabs
,
WhiteSpace
}
from
'antd-mobile'
import
'./index.scss'
import
HeaderSearch
from
'../../common/HeaderSearch/index'
import
{
api
}
from
"@/utils"
import
{
http
,
api
}
from
"@/utils"
class
Preferential
extends
Component
{
constructor
(
props
)
{
...
...
@@ -20,7 +20,7 @@ class Preferential extends Component {
// 限时特惠
specialSale
=
()
=>
{
api
.
get
(
'/m/home/weekDiscounts'
).
then
((
res
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/home/weekDiscounts`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
dataList
:
res
.
data
.
data
...
...
@@ -30,7 +30,7 @@ class Preferential extends Component {
}
// 砍价专区
bargain
=
()
=>
{
api
.
get
(
'/m/home/bargainZone'
).
then
((
res
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/home/bargainZone`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
dataList
:
res
.
data
.
data
...
...
@@ -40,7 +40,7 @@ class Preferential extends Component {
}
// 一键拼团
group
=
()
=>
{
api
.
get
(
'/m/home/grouponList'
).
then
((
res
)
=>
{
http
.
get
(
`
${
api
.
home
}
/m/home/grouponList`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
dataList
:
res
.
data
.
data
...
...
@@ -98,8 +98,8 @@ class Preferential extends Component {
{
this
.
state
.
courseStatus
===
0
&&
<
span
className
=
'price'
>
特惠价:
<
/span
>
}
<
span
className
=
"new"
>
¥
{
item
.
price
2
}
<
/span
>
<
span
className
=
"old"
>
¥
{
item
.
price
1
}
<
/span
>
<
span
className
=
"new"
>
¥
{
item
.
price
1
}
<
/span
>
<
span
className
=
"old"
>
¥
{
item
.
price
0
}
<
/span
>
<
/p
>
}
{
!
item
.
is_buy
&&
...
...
@@ -111,7 +111,7 @@ class Preferential extends Component {
const
status
=
(
<
div
>
{
this
.
state
.
courseStatus
===
1
&&
<
p
className
=
'course-status'
>
砍价减
{
item
.
price
2
}
元
<
/p
>
<
p
className
=
'course-status'
>
砍价减
{
item
.
price
1
}
元
<
/p
>
}
{
this
.
state
.
courseStatus
===
2
&&
<
p
className
=
'course-status'
>
拼团减
{
item
.
price
}
元
<
/p
>
...
...
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