Commit 9f89dd3a by zhanghaozhe

小课加分销

parent 1d52297b
......@@ -64,7 +64,6 @@ class ShareRank extends Component {
} else {
const courseId = getParam('id')
const dist_first = info.dist_first_level_ti
const uid = info.uid
const dist_code = this.state.code
this.props.history.push(`/shareposter?courseId=${courseId}&dist_first=${dist_first}&uid=${uid}&dist_code=${dist_code}`)
}
......
......@@ -13,7 +13,7 @@ import {setCurrentUser, startFetchUser} from "@/store/userAction"
}),
{setCurrentUser, startFetchUser}
)
class Python extends Component {
class ML extends Component {
constructor(props) {
super(props)
this.state = {
......@@ -149,4 +149,4 @@ class Python extends Component {
}
}
export default Python
export default ML
import React, {Component} from 'react'
import React, { Component } from 'react'
import './index.scss'
import Description from './Description/index.js'
import Study from './Study/index.js'
......@@ -8,255 +8,262 @@ import Progream from './Progream/index.js'
import Selection from './Selection'
import Mask from './../poup/index.js'
import InAction from "./InAction"
import {http, getParam, SendMessageToApp,} from '@/utils'
import {connect} from 'react-redux'
import {Toast} from "antd-mobile"
import ShareRank from "@components/detail/shareRank"
import { http, getParam, SendMessageToApp, } from '@/utils'
import { connect } from 'react-redux'
import { Toast } from "antd-mobile"
@connect(state => ({
user: state.user
user: state.user
}))
class PythonDes extends Component {
constructor(props) {
super(props)
this.state = {
syllabus: [], // 阶梯学习
allSyllabus: [], // 阶梯学习
allSyllabusShow: false,
allPractice: [], // 课后实操
toApp: false,
payMoney: 0,
isOnline: true, //课程是否上架
}
constructor(props) {
super(props)
this.state = {
syllabus: [], // 阶梯学习
allSyllabus: [], // 阶梯学习
allSyllabusShow: false,
allPractice: [], // 课后实操
toApp: false,
payMoney: 0,
isOnline: true, //课程是否上架
courseInfo: {}
}
}
// 立即报名
signUp = () => {
// 已登录
if (!this.props.user.hasError) {
this.toDetail()
} else {// 未登录
this.toLogin()
}
}
// 立即体验、免费试学
tryLearn = () => {
// 已登录
if (!this.props.user.hasError) {
this.toLearn()
} else {// 未登录
this.toLogin()
}
// 立即报名
signUp = () => {
// 已登录
if (!this.props.user.hasError) {
this.toDetail()
} else {// 未登录
this.toLogin()
}
}
toLearn = () => {
const {backwardVersion} = this.props;
http.post(`${API['home']}/m/it/user/trialCourse`, {course_id: getParam('id')}).then((res) => {
const {code, msg} = res.data
if (code == 200) {
if (!getParam('version')) { // H5
this.setState({
toApp: true
})
} else { // APP
if(backwardVersion) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端体验', 2)
} else {
SendMessageToApp("toLearn", getParam('id'))
}
}
} else {
Toast.info(msg, 2)
}
})
}
closePop = () => {
this.setState({
toApp: false
})
// 立即体验、免费试学
tryLearn = () => {
// 已登录
if (!this.props.user.hasError) {
this.toLearn()
} else {// 未登录
this.toLogin()
}
}
toDetail = () => {
const {backwardVersion} = this.props;
const id = getParam('id')
toLearn = () => {
const {backwardVersion} = this.props;
http.post(`${API['home']}/m/it/user/trialCourse`, {course_id: getParam('id')}).then((res) => {
const {code, msg} = res.data
if (code == 200) {
if (!getParam('version')) { // H5
http.get(`${API['base-api']}/m/cart/addtopreorder/[${id}]`).then((res) => {
if (res.data.errno === 0) {
this.props.history.push(`/order?id=${id}`, {simple: 1})
} else {
Toast.info(res.data.msg, 2)
}
})
this.setState({
toApp: true
})
} else { // APP
if(backwardVersion) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端购买', 2);
let onlyoneUse = setTimeout(() => {
clearTimeout(onlyoneUse);
onlyoneUse = null;
SendMessageToApp('toPay', id)
}, 2000);
} else {
SendMessageToApp('toPay', id)
}
if (backwardVersion) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端体验', 2)
} else {
SendMessageToApp("toLearn", getParam('id'))
}
}
}
} else {
Toast.info(msg, 2)
}
})
}
toLogin = () => {
if (!getParam('version')) { // H5
this.props.history.push('/passport')
} else { // APP
SendMessageToApp("toLogin")
closePop = () => {
this.setState({
toApp: false
})
}
toDetail = () => {
const {backwardVersion} = this.props;
const id = getParam('id')
if (!getParam('version')) { // H5
http.get(`${API['base-api']}/m/cart/addtopreorder/[${id}]`).then((res) => {
if (res.data.errno === 0) {
this.props.history.push(`/order?id=${id}`, {simple: 1})
} else {
Toast.info(res.data.msg, 2)
}
})
} else { // APP
if (backwardVersion) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端购买', 2);
let onlyoneUse = setTimeout(() => {
clearTimeout(onlyoneUse);
onlyoneUse = null;
SendMessageToApp('toPay', id)
}, 2000);
} else {
SendMessageToApp('toPay', id)
}
}
}
showAll = (key) => {
if (key === 1) {
this.setState({
syllabus: this.state.allSyllabus,
allSyllabusShow: true,
})
}
if (key === 2) {
this.setState({
practice: this.state.allPractice,
allPracticeShow: true,
})
}
toLogin = () => {
if (!getParam('version')) { // H5
this.props.history.push('/passport')
} else { // APP
SendMessageToApp("toLogin")
}
hideSome = (key) => {
if (key === 1) {
this.setState({
syllabus: this.state.allSyllabus.slice(0, 2),
allSyllabusShow: false,
})
}
if (key === 2) {
this.setState({
practice: this.state.allPractice.slice(0, 2),
allPracticeShow: false,
})
}
}
showAll = (key) => {
if (key === 1) {
this.setState({
syllabus: this.state.allSyllabus,
allSyllabusShow: true,
})
}
if (key === 2) {
this.setState({
practice: this.state.allPractice,
allPracticeShow: true,
})
}
}
hideSome = (key) => {
if (key === 1) {
this.setState({
syllabus: this.state.allSyllabus.slice(0, 2),
allSyllabusShow: false,
})
}
if (key === 2) {
this.setState({
practice: this.state.allPractice.slice(0, 2),
allPracticeShow: false,
})
}
}
getStatus = () => {
http.get(`${API['home']}/web/it_detail?course_id=${getParam('id')}`).then(res => {
const {code, data, msg} = res.data
if (code == 200) {
this.setState({
syllabus: data.syllabus.slice(0, 2),
allSyllabus: data.syllabus,
allPractice: data.practice,
payMoney: data.course_info.price1,
})
} else {
Toast.info(msg)
}
getStatus = () => {
http.get(`${API['home']}/web/it_detail?course_id=${getParam('id')}`).then(res => {
const {code, data, msg} = res.data
if (code == 200) {
this.setState({
syllabus: data.syllabus.slice(0, 2),
allSyllabus: data.syllabus,
allPractice: data.practice,
payMoney: data.course_info.price1,
courseInfo: data.course_info
})
} else {
Toast.info(msg)
}
})
}
componentDidMount() {
this.getStatus()
const {backwardVersion, isPay} = this.props;
if (backwardVersion && isPay === 1) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端学习', 2);
}
}
componentDidMount() {
this.getStatus()
const {backwardVersion, isPay} = this.props;
if(backwardVersion && isPay === 1) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端学习', 2);
}
shouldComponentUpdate(nextProps, nextState, nextContext) {
if (this.props.isAppUpdate !== nextProps.isAppUpdate) {
this.getStatus()
return false
}
return true
}
render() {
const {
syllabus,
allSyllabusShow,
toApp,
payMoney,
isOnline,
courseInfo
} = this.state
return (
<div className={'python__des'}>
<div className={'des__start'}></div>
{
!!courseInfo.is_dist && <ShareRank courseInfo={courseInfo}/>
}
<div className={'course__introduce'}></div>
{
isOnline
? (
<div className={'bottom__btn_group'}>
<div className={'course__price'}>
<div className={'money'}>{payMoney}<span style={{fontSize: '18px'}}></span></div>
<div className={'discount'}>
限时特惠
<div className={'triangle'}></div>
</div>
</div>
shouldComponentUpdate(nextProps, nextState, nextContext) {
if (this.props.isAppUpdate !== nextProps.isAppUpdate) {
this.getStatus()
return false
<div className={'btn__group'}>
<div className={'try__study'} onClick={this.tryLearn}>免费试学</div>
<div className={'sign__now'} onClick={this.signUp}>立即报名</div>
</div>
</div>
)
: (
<div className="bottom__btn_group">
<p className="online__label">Python人工智能</p>
<button className="online__button">即将上架 敬请期待</button>
</div>
)
}
return true
}
render() {
const {
syllabus,
allSyllabusShow,
toApp,
payMoney,
isOnline
} = this.state
return (
<div className={'python__des'}>
<div className={'des__start'}></div>
<div className={'course__introduce'}></div>
{
isOnline
? (
<div className={'bottom__btn_group'}>
<div className={'course__price'}>
<div className={'money'}>{payMoney}<span style={{fontSize: '18px'}}></span></div>
<div className={'discount'}>
限时特惠
<div className={'triangle'}></div>
</div>
</div>
{/* 课程介绍 */}
<Description/>
<div className={'btn__group'}>
<div className={'try__study'} onClick={this.tryLearn}>免费试学</div>
<div className={'sign__now'} onClick={this.signUp}>立即报名</div>
</div>
</div>
)
: (
<div className="bottom__btn_group">
<p className="online__label">Python人工智能</p>
<button className="online__button">即将上架 敬请期待</button>
</div>
)
}
{/* 课程介绍 */}
<Description/>
<Study syllabus={syllabus} allSyllabusShow={allSyllabusShow} show={this.showAll}
hide={this.hideSome}></Study>
<Study syllabus={syllabus} allSyllabusShow={allSyllabusShow} show={this.showAll}
hide={this.hideSome}></Study>
{/*精选习题*/}
<Selection/>
{/*精选习题*/}
<Selection/>
{/*项目实战*/}
<InAction/>
{/*项目实战*/}
<InAction/>
<Team/>
<Team/>
{/* 试学体验 */}
<Experience tryLearn={this.tryLearn} isOnline={isOnline} />
<img
style={{
display: 'block',
width: '100%',
height: '8px'
}}
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/mlCourse/m/di.png"
alt=""
/>
{/* 常见问题 */}
<Progream />
{
toApp && (<Mask type={1} closePop={this.closePop}/>)
}
</div>
)
}
{/* 试学体验 */}
<Experience tryLearn={this.tryLearn} isOnline={isOnline}/>
<img
style={{
display: 'block',
width: '100%',
height: '8px'
}}
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/mlCourse/m/di.png"
alt=""
/>
{/* 常见问题 */}
<Progream/>
{
toApp && (<Mask type={1} closePop={this.closePop}/>)
}
</div>
)
}
}
function DefineItem(props) {
const {item, item: {desInfo}} = props
return (
<div className={'number_one'}>
<img className={'trophy'} src={item.titleUrl}></img>
<p className={'item__title'}>{item.title}</p>
<p className={'item__subtitle'} style={{width: item.subWidth}}>{item.subTitle}</p>
<img style={{width: desInfo.width, height: desInfo.height}} src={item.bottomUrl}></img>
</div>
)
const {item, item: {desInfo}} = props
return (
<div className={'number_one'}>
<img className={'trophy'} src={item.titleUrl}></img>
<p className={'item__title'}>{item.title}</p>
<p className={'item__subtitle'} style={{width: item.subWidth}}>{item.subTitle}</p>
<img style={{width: desInfo.width, height: desInfo.height}} src={item.bottomUrl}></img>
</div>
)
}
export default PythonDes
......@@ -3,6 +3,7 @@
height: 100vh;
padding-bottom: 60px;
overflow: auto;
background: #fff;
.des__start {
position: relative;
......@@ -11,7 +12,6 @@
background: url("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/mlCourse/m/banner.png")
center center no-repeat;
background-size: contain;
z-index: 100;
}
.python__define {
......
......@@ -5,6 +5,7 @@ import { http, getParam } from '@/utils';
import './index.scss';
import { connect } from "react-redux";
import Mask from './../poup/index.js'
import ShareRank from "@components/detail/shareRank"
class PythonStudy extends Component {
constructor(props) {
......@@ -88,7 +89,7 @@ class PythonStudy extends Component {
<HeaderBar title='Python基础语法' arrow={true}/>
<div className="python-study__header">
<div className="python-study__course">
<h2 className="python-study__course-name">Python人工智能</h2>
<h2 className="python-study__course-name">机器学习小课 第一期</h2>
<p className="python-study__course-contact">
<span>{courseInfo.contact_type == 1 ? '上课请加QQ学习群' : '添加助教微信入群'}{courseInfo.course_qq}</span>
<span>并备注您的学号:{uid}</span>
......@@ -97,7 +98,12 @@ class PythonStudy extends Component {
{
learning.schedule > 0 &&
<div className="python-study__progress">
<h2 className="python-study__progress-title">学习进度</h2>
<h2 className="python-study__progress-title">
学习进度
{
!!learning.day && <span>(已连续学习<span>{learning.day}</span>天)</span>
}
</h2>
<div className="python-study__progress-bar">
<i style={{width: learning.schedule + '%'}}/>
<span className="python-study__progress-tip"
......@@ -107,6 +113,11 @@ class PythonStudy extends Component {
}
</div>
{
!!courseInfo.is_dist && <div className={'dist-wrapper'}>
<ShareRank courseInfo={courseInfo}/>
</div>
}
<Accordion
defaultActiveKey="0"
className="python-study__stage"
......@@ -160,7 +171,7 @@ class PythonStudy extends Component {
}}
>
<img className="python-study__subject-icon"
src={lessonsItem.project.icon} alt=""/>
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/mlCourse/m/project-icon.png" alt=""/>
{
lessonsItem.project.is_unlock == 1 && lessonsItem.project.complete == 1 &&
<i className="python-study__subject-status"
......
......@@ -46,6 +46,11 @@ html:not([data-scale]) .am-accordion.python-study__stage .am-accordion-item .am-
height: 100%;
background-color: #F4F5F6;
padding-bottom: 15px;
.dist-wrapper{
background: #fff;
margin: 20px 10px 30px;
}
}
.python-study__header {
......@@ -62,7 +67,7 @@ html:not([data-scale]) .am-accordion.python-study__stage .am-accordion-item .am-
position: relative;
height: 55px;
padding: 0 12px;
background-color: #1A9BFC;
background-color: #4B41FF;
&::after {
content: '';
......@@ -115,14 +120,21 @@ html:not([data-scale]) .am-accordion.python-study__stage .am-accordion-item .am-
.python-study__progress-title {
font-size: 14px;
font-weight: 600;
color: rgba(51, 51, 51, .6);
color: #333333;
line-height: 39px;
&>span{
color: #999;
span{
color: #09f;
}
}
}
.python-study__progress-bar {
position: relative;
height: 3px;
margin: 18px 0 15px;
width: 98%;
border-radius: 2px;
background-color: rgba(207, 219, 229, .6);
......
......@@ -11,6 +11,7 @@ import Mask from './../poup/index.js'
import {http, getParam, SendMessageToApp,} from '@/utils'
import {connect} from 'react-redux'
import {Toast} from "antd-mobile"
import ShareRank from "@components/detail/shareRank"
@connect(state => ({
user: state.user
......@@ -97,6 +98,7 @@ class PythonDes extends Component {
],
payMoney: 0,
isOnline: true, //课程是否上架
courseInfo: {},
}
}
......@@ -220,6 +222,7 @@ class PythonDes extends Component {
practice: data.practice.slice(0, 2),
allPractice: data.practice,
payMoney: data.course_info.price1,
courseInfo: data.course_info
})
} else {
Toast.info(msg)
......@@ -256,11 +259,16 @@ class PythonDes extends Component {
allPracticeShow,
toApp,
payMoney,
isOnline
isOnline,
courseInfo
} = this.state
console.log(courseInfo)
return (
<div className={'python__des'}>
<div className={'des__start'}></div>
{
!!courseInfo.is_dist && <ShareRank courseInfo={courseInfo}/>
}
<div className={'python__define'}>
<img className={'left__decorate'}
src={'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/left__decorate.png'}></img>
......
......@@ -6,6 +6,7 @@ import './index.scss';
import {Link} from "react-router-dom"
import {connect} from "react-redux";
import Mask from './../poup/index.js'
import ShareRank from "@components/detail/shareRank"
class PythonStudy extends Component {
constructor(props) {
......@@ -96,7 +97,7 @@ class PythonStudy extends Component {
</p>
</div>
{
learning.schedule == 0 &&
learning.schedule > 0 &&
<div className="python-study__progress">
<h2 className="python-study__progress-title">学习进度</h2>
<div className="python-study__progress-bar">
......@@ -108,6 +109,11 @@ class PythonStudy extends Component {
}
</div>
{
!!courseInfo.is_dist && <div className={'dist-wrapper'}>
<ShareRank courseInfo={courseInfo}/>
</div>
}
<Accordion
defaultActiveKey="0"
className="python-study__stage"
......
......@@ -46,6 +46,10 @@ html:not([data-scale]) .am-accordion.python-study__stage .am-accordion-item .am-
height: 100%;
background-color: #F4F5F6;
padding-bottom: 15px;
.dist-wrapper{
background: #fff;
margin: 20px 10px 30px;
}
}
.python-study__header {
......
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