Commit 3425c7ed by xuzhenghua

detail

parent dc388e28
.search-nav {
height: 44px;
line-height: 44px;
padding: 0 15px;
background-color: $bg_f7f9fc;
display: flex;
justify-content: space-between;
.am-search {
width: 81%;
background-color: $bg_f7f9fc;
}
.am-search-input, .am-search-synthetic-ph, .am-search-value {
text-align: left;
padding-left: 15px;
height: 26px;
line-height: 26px;
}
.am-search-input {
background-color: $bg_EBEFF5;
border-radius: 13px;
}
.shopping-cart, .return {
font-size: 18px !important;
}
}
\ No newline at end of file
...@@ -2,7 +2,6 @@ import React from 'react'; ...@@ -2,7 +2,6 @@ import React from 'react';
import './index.scss' import './index.scss'
const VList = (props) => { const VList = (props) => {
console.log(props)
return ( return (
<li className='v-list-item' onClick={e=>props.handleClick(props.id)}> <li className='v-list-item' onClick={e=>props.handleClick(props.id)}>
<div className="content"> <div className="content">
......
.class-child { .class-child {
.search-nav {
height: 44px;
line-height: 44px;
padding: 0 15px;
background-color: $bg_f7f9fc;
display: flex;
justify-content: space-between;
.am-search {
width: 81%;
background-color: $bg_f7f9fc;
}
.am-search-input,.am-search-synthetic-ph,.am-search-value{
text-align: left;
padding-left: 15px;
height: 26px;
line-height: 26px;
}
.am-search-input {
background-color: $bg_EBEFF5;
border-radius: 13px;
}
.shopping-cart,.return {
font-size: 18px !important;
}
}
.class-content { .class-content {
padding: 0 12px; padding: 0 12px;
...@@ -111,6 +82,9 @@ ...@@ -111,6 +82,9 @@
display: flex; display: flex;
margin-top: 10px; margin-top: 10px;
margin-bottom: 50px; margin-bottom: 50px;
ul {
width: 100%;
}
} }
.pull-down { .pull-down {
......
...@@ -17,18 +17,20 @@ class Classify extends Component { ...@@ -17,18 +17,20 @@ class Classify extends Component {
componentDidMount() { componentDidMount() {
let data = 1 let data = 1
api.get(`/m/course/classify/${data}`,).then((res) => { api.get(`/m/course/classify/${data}`,).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
if(res.data.data.special.length > 0){ if (res.data.data.common.length > 0) {
this.setState({ this.setState({
basics: res.data.data.common[0], basics: res.data.data.common[0],
advanced: res.data.data.common[1], advanced: res.data.data.common[1],
}) })
} }
if(res.data.data.common.length > 0){ if (res.data.data.special.length > 0) {
this.setState({ this.setState({
basics: res.data.data.common[0], camp: res.data.data.special[0],
advanced: res.data.data.common[1], employment: res.data.data.special[1],
special: res.data.data.special[2],
}) })
} }
...@@ -36,18 +38,23 @@ class Classify extends Component { ...@@ -36,18 +38,23 @@ class Classify extends Component {
}) })
} }
toClassList =(id)=>{
console.log(id)
// this.props.history.push({pathname: `/courselist?id=${id}`})
}
render() { render() {
return ( return (
<div className='class-box'> <div className='class-box'>
<div className="class-title">分类</div> <div className="class-title">分类</div>
<ClassCourseBox data={this.state.camp.list} title={this.state.camp.name} type={1}/> <ClassCourseBox data={this.state.camp.list} title={this.state.camp.name} type={1} />
<ClassCourseBox data={this.state.employment.list} title={this.state.employment.name} type={1}/> <ClassCourseBox data={this.state.employment.list} title={this.state.employment.name} type={1}/>
<ClassCourseBox data={this.state.basics.list} title={this.state.basics.name} type={2}/> <ClassCourseBox data={this.state.basics.list} title={this.state.basics.name} type={2} toClassList={this.toClassList}/>
<ClassCourseBox data={this.state.advanced.list} title={this.state.advanced.name} type={2}/> <ClassCourseBox data={this.state.advanced.list} title={this.state.advanced.name} type={2} toClassList={this.toClassList}/>
<div className="vip"> <div className="vip">
{this.state.special.list && this.state.special.list.length > 0 && this.state.special.list.map((item,index)=>{ {this.state.special.list && this.state.special.list.length > 0 && this.state.special.list.map((item, index) => {
return( return (
<a key={index} href={item.course_img}> <a key={index} href='/detail'>
<img src={item.course_img} alt=""/> <img src={item.course_img} alt=""/>
</a> </a>
) )
...@@ -66,7 +73,7 @@ function ClassCourseA({data}) { ...@@ -66,7 +73,7 @@ function ClassCourseA({data}) {
{ {
data && data.length > 0 && data.map((item, index) => { data && data.length > 0 && data.map((item, index) => {
return ( return (
<a href={item.course_id} key={index} className='item-banner'><img src={item.course_img} alt=""/></a> <a href={`/detail?id=${item.course_id}`} key={index} className='item-banner'><img src={item.course_img} alt=""/></a>
) )
}) })
} }
...@@ -74,13 +81,13 @@ function ClassCourseA({data}) { ...@@ -74,13 +81,13 @@ function ClassCourseA({data}) {
) )
} }
function ClassCourseB({data}) { function ClassCourseB(props) {
return ( return (
<div className='items-box'> <div className='items-box'>
{ {
data && data.length > 0 && data.map((item, index) => { props.data && props.data.length > 0 && props.data.map((item, index) => {
return ( return (
<a href={item.c_id} key={index} className='item-label'>{item.c_name}</a> <span onClick={e => props.toClassList(item.c_id)} key={index} className='item-label'>{item.c_name}</span>
) )
}) })
} }
...@@ -88,18 +95,18 @@ function ClassCourseB({data}) { ...@@ -88,18 +95,18 @@ function ClassCourseB({data}) {
) )
} }
function ClassCourseBox({data, title, type}) { function ClassCourseBox(props) {
return ( return (
<div className="class-course"> <div className="class-course">
<p className='course-items-title'> <p className='course-items-title'>
<img src={require('./image/tips.png')} alt=""/> <img src={require('./image/tips.png')} alt=""/>
{title} {props.title}
</p> </p>
{type === 1 && {props.type === 1 &&
<ClassCourseA data={data}/> <ClassCourseA data={props.data} toClassList={props.toClassList}/>
} }
{type === 2 && {props.type === 2 &&
<ClassCourseB data={data}/> <ClassCourseB data={props.data} toClassList={props.toClassList}/>
} }
</div> </div>
) )
......
...@@ -2,7 +2,7 @@ import React, {Component} from 'react' ...@@ -2,7 +2,7 @@ import React, {Component} from 'react'
import {VList} from '../../common' import {VList} from '../../common'
import {Tabs, WhiteSpace} from 'antd-mobile' import {Tabs, WhiteSpace} from 'antd-mobile'
import './index.scss' import './index.scss'
import HeaderBar from './headerBar' import HeaderSearch from '../../common/HeaderSearch/index'
import {api} from "@/utils" import {api} from "@/utils"
class Preferential extends Component { class Preferential extends Component {
...@@ -19,7 +19,7 @@ class Preferential extends Component { ...@@ -19,7 +19,7 @@ class Preferential extends Component {
} }
// 限时特惠 // 限时特惠
specialSale=()=>{ specialSale = () => {
api.get('/m/home/weekDiscounts').then((res) => { api.get('/m/home/weekDiscounts').then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
...@@ -29,7 +29,7 @@ class Preferential extends Component { ...@@ -29,7 +29,7 @@ class Preferential extends Component {
}) })
} }
// 砍价专区 // 砍价专区
bargain=()=>{ bargain = () => {
api.get('/m/home/bargainZone').then((res) => { api.get('/m/home/bargainZone').then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
...@@ -39,7 +39,7 @@ class Preferential extends Component { ...@@ -39,7 +39,7 @@ class Preferential extends Component {
}) })
} }
// 一键拼团 // 一键拼团
group=()=>{ group = () => {
api.get('/m/home/grouponList').then((res) => { api.get('/m/home/grouponList').then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
...@@ -49,10 +49,10 @@ class Preferential extends Component { ...@@ -49,10 +49,10 @@ class Preferential extends Component {
}) })
} }
// tab 切换 // tab 切换
ontabclick=(tab, index)=> { ontabclick = (tab, index) => {
console.log(tab, index) console.log(tab, index)
this.state.courseStatus = index this.state.courseStatus = index
switch(index) { switch (index) {
case 0: case 0:
this.specialSale() this.specialSale()
break break
...@@ -64,7 +64,7 @@ class Preferential extends Component { ...@@ -64,7 +64,7 @@ class Preferential extends Component {
} }
} }
handleClick=(courseId)=>{ handleClick = (courseId) => {
console.log(courseId) console.log(courseId)
} }
...@@ -76,7 +76,7 @@ class Preferential extends Component { ...@@ -76,7 +76,7 @@ class Preferential extends Component {
] ]
return ( return (
<div className='preferential'> <div className='preferential'>
<HeaderBar></HeaderBar> <HeaderSearch></HeaderSearch>
<div className='class-content'> <div className='class-content'>
<WhiteSpace/> <WhiteSpace/>
...@@ -91,12 +91,12 @@ class Preferential extends Component { ...@@ -91,12 +91,12 @@ class Preferential extends Component {
const Info = ( const Info = (
<div className="info"> <div className="info">
<p className='title'>{item.course_title}</p> <p className='title'>{item.course_title}</p>
<p className='contact text-overflow-2'>{item. course_desc}</p> <p className='contact text-overflow-2'>{item.course_desc}</p>
<div className='des'> <div className='des'>
{item.is_buy && {item.is_buy &&
<p className="course-price"> <p className="course-price">
{this.state.courseStatus === 0 && {this.state.courseStatus === 0 &&
<span className='price'>特惠价:</span> <span className='price'>特惠价:</span>
} }
<span className="new">¥{item.price2}</span> <span className="new">¥{item.price2}</span>
<span className="old">¥{item.price1}</span> <span className="old">¥{item.price1}</span>
...@@ -119,7 +119,8 @@ class Preferential extends Component { ...@@ -119,7 +119,8 @@ class Preferential extends Component {
</div> </div>
) )
return ( return (
<VList handleClick={this.handleClick} key={index} img={item.image_name} id={item.course_id} status={status} <VList handleClick={this.handleClick} key={index} img={item.image_name}
id={item.course_id} status={status}
info={Info}></VList> info={Info}></VList>
) )
})} })}
......
.preferential { .preferential {
.search-nav {
height: 44px;
line-height: 44px;
padding: 0 15px;
background-color: $bg_f7f9fc;
display: flex;
justify-content: space-between;
.am-search {
width: 81%;
background-color: $bg_f7f9fc;
}
.am-search-input, .am-search-synthetic-ph, .am-search-value {
text-align: left;
padding-left: 15px;
height: 26px;
line-height: 26px;
}
.am-search-input {
background-color: $bg_EBEFF5;
border-radius: 13px;
}
.shopping-cart, .return {
font-size: 18px !important;
}
}
.class-content { .class-content {
padding: 0 12px; padding: 0 12px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment