Commit 52738d02 by FE

Merge branch 'pythonForApp' into pythonClass

parents 6f83cbcc 4828345a
import React, {Component} from 'react' import React, {Component} from 'react'
import {http, getParam, browser} from '@/utils' import {http, getParam, browser, SendMessageToApp} from '@/utils'
import PythonDes from './pythomDes' import PythonDes from './pythomDes'
import PythonStudy from './pythonStudy' import PythonStudy from './pythonStudy'
import {connect} from "react-redux" import {connect} from "react-redux"
...@@ -61,10 +61,12 @@ class Python extends Component { ...@@ -61,10 +61,12 @@ class Python extends Component {
this.setState({ this.setState({
isAppUpdate: true isAppUpdate: true
}) })
this.fetchCourseInfo();
} }
this.props.setCurrentUser(this.transformUser(this.state.userInfoList)) this.props.setCurrentUser(this.transformUser(this.state.userInfoList));
} }
transformUser = res => { transformUser = res => {
let payload let payload
...@@ -98,21 +100,26 @@ class Python extends Component { ...@@ -98,21 +100,26 @@ class Python extends Component {
backwardVersion: true, backwardVersion: true,
isPay: 0, isPay: 0,
}) })
}else{ }else if(browser.isIOSApp && version < 380) { // ISO的低版本
this.setState({
isPay: data.course_info.is_pay
})
}
if(browser.isIOSApp && version < 380) { // ISO的低版本
this.setState({ this.setState({
backwardVersion: true, backwardVersion: true,
isPay: 0, isPay: 0,
}) })
}else{ }else{ // 安卓/IOS 的高版本
if(data.course_info.is_pay === 1) { // 在APP内未登录-去登陆-登录后还显示此页;如果是已购买的用户 就需要跳转到 APP已购买的原生页面
SendMessageToApp('toSyllabusChapter', id); // 跳转到APP的已购买详情页 id 是课程ID
return;
}
this.setState({ this.setState({
backwardVersion: false,
isPay: data.course_info.is_pay isPay: data.course_info.is_pay
}) })
} }
} else {
this.setState({
backwardVersion: false,
isPay: data.course_info.is_pay
})
} }
} }
}) })
...@@ -124,7 +131,14 @@ class Python extends Component { ...@@ -124,7 +131,14 @@ class Python extends Component {
return ( return (
<div> <div>
{ {
isPay === 0 && <PythonDes history={this.props.history} isAppUpdate={isAppUpdate} backwardVersion={backwardVersion} isPay={isPay}></PythonDes> isPay === 0 && (
<PythonDes
backwardVersion={backwardVersion}
history={this.props.history}
isAppUpdate={isAppUpdate}
isPay={isPay}
/>
)
} }
{ {
(isPay === 1 && !getParam('version')) && <PythonStudy isAppUpdate={isAppUpdate}/> (isPay === 1 && !getParam('version')) && <PythonStudy isAppUpdate={isAppUpdate}/>
......
...@@ -35,7 +35,7 @@ export default class Test extends Component { ...@@ -35,7 +35,7 @@ export default class Test extends Component {
<div className={'table_body'}> <div className={'table_body'}>
{ {
this.props.practice.map((item, index)=>{ this.props.practice.map((item, index)=>{
return <div key={index}> return <div className="stage-item" key={index}>
<div className='stage'>{`第${this.Change(item.stage)}阶段 ${item.name}`}</div> <div className='stage'>{`第${this.Change(item.stage)}阶段 ${item.name}`}</div>
{ {
item.questions.map((question, index)=>{ item.questions.map((question, index)=>{
......
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
.table_body { .table_body {
background: #34AFFF; background: #34AFFF;
.stage-item {
border-bottom: 1px solid #0099FF;
}
.stage { .stage {
height: 38px; height: 38px;
font-size: 14px; font-size: 14px;
...@@ -59,6 +63,7 @@ ...@@ -59,6 +63,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.line { .line {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -94,7 +99,6 @@ ...@@ -94,7 +99,6 @@
.table_bottom { .table_bottom {
height: 36px; height: 36px;
background: #3DB1FF; background: #3DB1FF;
border-top: 1px solid #0099FF;
div { div {
display: flex; display: flex;
justify-content: center; justify-content: center;
......
...@@ -121,7 +121,7 @@ class PythonDes extends Component { ...@@ -121,7 +121,7 @@ class PythonDes extends Component {
} }
toLearn = () => { toLearn = () => {
const {backwardVersion, isPay} = this.props; const {backwardVersion} = this.props;
http.post(`${API['home']}/m/it/user/trialCourse`, {course_id: getParam('id')}).then((res) => { http.post(`${API['home']}/m/it/user/trialCourse`, {course_id: getParam('id')}).then((res) => {
const {code, msg} = res.data const {code, msg} = res.data
if (code == 200) { if (code == 200) {
...@@ -133,7 +133,7 @@ class PythonDes extends Component { ...@@ -133,7 +133,7 @@ class PythonDes extends Component {
if(backwardVersion) { if(backwardVersion) {
Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端体验', 2) Toast.info('当前版本不支持该课程模式,请升级到最新版本或前往PC端体验', 2)
} else { } else {
SendMessageToApp("toLearn") SendMessageToApp("toLearn", getParam('id'))
} }
} }
} else { } else {
...@@ -149,7 +149,7 @@ class PythonDes extends Component { ...@@ -149,7 +149,7 @@ class PythonDes extends Component {
} }
toDetail = () => { toDetail = () => {
const {backwardVersion, isPay} = this.props; const {backwardVersion} = this.props;
const id = getParam('id') const id = getParam('id')
if (!getParam('version')) { // H5 if (!getParam('version')) { // H5
http.get(`${API['base-api']}/m/cart/addtopreorder/[${id}]`).then((res) => { http.get(`${API['base-api']}/m/cart/addtopreorder/[${id}]`).then((res) => {
...@@ -304,10 +304,18 @@ class PythonDes extends Component { ...@@ -304,10 +304,18 @@ class PythonDes extends Component {
<Description list={desList} /> <Description list={desList} />
<NoWorry list={worryList}></NoWorry> <NoWorry list={worryList}></NoWorry>
<Study syllabus={syllabus} allSyllabusShow={allSyllabusShow} show={this.showAll} <Study syllabus={syllabus} allSyllabusShow={allSyllabusShow} show={this.showAll}
hide={this.hideSome}></Study> hide={this.hideSome}></Study>
<Test practice={practice} allPracticeShow={allPracticeShow} show={this.showAll}
hide={this.hideSome}></Test> {/* 课后实操 */}
<Test
practice={practice}
allPracticeShow={allPracticeShow}
show={this.showAll}
hide={this.hideSome}
/>
<Team/> <Team/>
{/* 试学体验 */} {/* 试学体验 */}
......
...@@ -59,9 +59,34 @@ html:not([data-scale]) .am-accordion.python-study__stage .am-accordion-item .am- ...@@ -59,9 +59,34 @@ html:not([data-scale]) .am-accordion.python-study__stage .am-accordion-item .am-
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
position: relative;
height: 55px; height: 55px;
padding: 0 12px; padding: 0 12px;
background-color: #1A9BFC; background-color: #1A9BFC;
&::after {
content: '';
position: absolute;
left: -60px;
top: 0;
width: 146px;
height: 100%;
background-repeat: no-repeat;
background-size: 100% auto;
background-image: url('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/pythonCourse/pc/python-title-bg-1.png');
}
&::before {
content: '';
position: absolute;
right: -60px;
bottom: -20px;
width: 106px;
height: 100%;
background-repeat: no-repeat;
background-size: 100% auto;
background-image: url('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/pythonCourse/pc/python-title-bg-0.png');
}
} }
.python-study__course-name { .python-study__course-name {
......
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