Commit b7a0a8bb by xuzhenghua

bug

parent f1f9bc95
...@@ -19,7 +19,7 @@ const options = { ...@@ -19,7 +19,7 @@ const options = {
}, },
appstore: "https://itunes.apple.com/cn/app/id1102275343?mt=8", appstore: "https://itunes.apple.com/cn/app/id1102275343?mt=8",
yingyongbao: "http://android.myapp.com/myapp/detail.htm?apkName=com.julyapp.julyonline", yingyongbao: "http://android.myapp.com/myapp/detail.htm?apkName=com.julyapp.julyonline",
fallback: "http://www-test.julyedu.com/weekend/redir1" fallback: "http://www.julyedu.com/weekend/redir1"
} }
class OpenApp extends Component { class OpenApp extends Component {
......
import React from 'react'; import React from 'react';
import { NavLink, withRouter } from 'react-router-dom' import { NavLink, withRouter } from 'react-router-dom'
import './index.scss'; import './index.scss'
const navLinkConfig = [ const navLinkConfig = [
{ {
...@@ -38,7 +38,7 @@ const NavBar = React.memo(({location}) => { ...@@ -38,7 +38,7 @@ const NavBar = React.memo(({location}) => {
<div className="nav-bar"> <div className="nav-bar">
{ {
navLinkConfig.map(item => { navLinkConfig.map(item => {
let {icon, text, ...rest} = item let {icon, text, activeIcon, ...rest} = item
return ( return (
<NavLink <NavLink
activeClassName={'active'} activeClassName={'active'}
...@@ -46,7 +46,7 @@ const NavBar = React.memo(({location}) => { ...@@ -46,7 +46,7 @@ const NavBar = React.memo(({location}) => {
key={icon} key={icon}
{...rest} {...rest}
> >
<i className={`iconfont ${location.pathname.startsWith(item.to) ? item.activeIcon : item.icon}`}/> <i className={`iconfont ${item.to.length > 1 ? location.pathname.startsWith(item.to) ? activeIcon : icon : location.pathname === item.to ? activeIcon : icon}`}/>
<span>{text}</span> <span>{text}</span>
</NavLink> </NavLink>
) )
......
...@@ -29,7 +29,10 @@ class Bargain extends Component { ...@@ -29,7 +29,10 @@ class Bargain extends Component {
} }
componentDidMount() { componentDidMount() {
this.getBargainInfo() const { user= {} } = this.props;
if(user.data && user.data.uid) {
this.getBargainInfo();
}
} }
// 获取助理好友 // 获取助理好友
......
...@@ -39,8 +39,8 @@ class BtnStatus extends Component { ...@@ -39,8 +39,8 @@ class BtnStatus extends Component {
// } // }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { data = {}} = nextProps; const { data = {}, user = {}} = nextProps;
if(data.is_bargain) { if(data.is_bargain && user.data && user.data.uid) {
this.getBargainInfo(); this.getBargainInfo();
} }
// if(nextProps.data && nextProps.data.is_bargain) { // if(nextProps.data && nextProps.data.is_bargain) {
...@@ -234,12 +234,10 @@ class BtnStatus extends Component { ...@@ -234,12 +234,10 @@ class BtnStatus extends Component {
} }
render() { render() {
console.log(this.state);
// data 课程信息;barInfo 砍价信息 // data 课程信息;barInfo 砍价信息
const { user = {}, toCart } = this.props; const { user = {}, toCart } = this.props;
const { countdown ,barInfo, courseInfo: info = {}} = this.state; const { countdown ,barInfo, courseInfo: info = {}} = this.state;
const uid = user.data && user.data.uid; const uid = user.data && user.data.uid;
console.log(info.in_cart);
return ( return (
<div> <div>
{/*正常购买*/} {/*正常购买*/}
......
...@@ -79,7 +79,7 @@ class Group extends Component { ...@@ -79,7 +79,7 @@ class Group extends Component {
if (courseInfo.pdd_group_info) { if (courseInfo.pdd_group_info) {
let now_groupon_list = courseInfo.pdd_group_info.now_groupon_list; let now_groupon_list = courseInfo.pdd_group_info.now_groupon_list;
if (now_groupon_list && now_groupon_list.length > 0) { if (now_groupon_list && now_groupon_list.length > 0) {
// setInterval(() => { setInterval(() => {
now_groupon_list.map(item => { now_groupon_list.map(item => {
item.end_time -= 1; item.end_time -= 1;
return item; return item;
...@@ -87,7 +87,7 @@ class Group extends Component { ...@@ -87,7 +87,7 @@ class Group extends Component {
this.setState({ this.setState({
now_groupon_list, now_groupon_list,
}) })
// }, 1000); }, 1000);
} }
} }
} }
......
...@@ -153,7 +153,6 @@ class Detail extends Component { ...@@ -153,7 +153,6 @@ class Detail extends Component {
invitedFriends = () => { invitedFriends = () => {
const {course_title, image_name, course_id, pdd_group_info, pdd_group_info: {groupon_member, groupon_member: {number}, price}} = this.state.course.course_info; const {course_title, image_name, course_id, pdd_group_info, pdd_group_info: {groupon_member, groupon_member: {number}, price}} = this.state.course.course_info;
if (browser.isWeixin) { if (browser.isWeixin) {
console.log(0);
let share = this.state.share; let share = this.state.share;
this.setState({ this.setState({
share: !share, share: !share,
...@@ -221,9 +220,9 @@ class Detail extends Component { ...@@ -221,9 +220,9 @@ class Detail extends Component {
// if (this.props.courseInfo.course_info) { // if (this.props.courseInfo.course_info) {
// courseInfo = this.props.courseInfo.course_info; // courseInfo = this.props.courseInfo.course_info;
// service = courseInfo.service; // service = courseInfo.service;
// if (courseInfo.group_status === 3 || courseInfo.group_status === 4) { if (course_info.group_status === 3 || course_info.group_status === 4) {
// number = courseInfo.pdd_group_info.groupon_member.number; number = course_info.pdd_group_info.groupon_member.number;
// } }
// } // }
const {share, countdown, list, outList} = this.state; const {share, countdown, list, outList} = this.state;
const href = this.props.location && this.props.location.state? this.props.location.state.href : undefined; const href = this.props.location && this.props.location.state? this.props.location.state.href : undefined;
...@@ -360,15 +359,17 @@ class Detail extends Component { ...@@ -360,15 +359,17 @@ class Detail extends Component {
{ {
share ? ( share ? (
<div className='groupSuccessMbc' onClick={() => { <div
this.setState({share: false}) className='groupSuccessMbc'
}}> onClick={() => {
this.setState({share: false})
}}
>
<div className='tipContent'> <div className='tipContent'>
{`还差${number}人,分享到3个群,成团率高达98%`} {`还差${number}人,分享到3个群,成团率高达98%`}
</div> </div>
<div className='tipArrow'> <div className='tipArrow'>
<i className='iconfont iconyindao'></i> <i className='iconfont iconyindao' />
</div> </div>
</div> </div>
) : null ) : null
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
border-radius: 16px 0 0 16px; border-radius: 16px 0 0 16px;
font-size: 12px; font-size: 12px;
color: $white; color: $white;
z-index: 1; z-index: 9;
} }
.course-content { .course-content {
margin: 15px 12px 0 12px; margin: 15px 12px 0 12px;
......
...@@ -15,9 +15,17 @@ class OutLine extends Component { ...@@ -15,9 +15,17 @@ class OutLine extends Component {
} }
htmlDecode = (content) => { htmlDecode = (content) => {
let e = document.createElement('div'); // let e = document.createElement('div');
e.innerHTML = content; // e.innerHTML = content;
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue; // return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
if(content) {
content = content.replace(/&lt;/g , '<');
content = content.replace(/&gt;/g , '>');
content = content.replace(/&amp;gt;/g , '');
content = content.replace(/&quot;/g , '"');
content = content.replace(/&amp;nbsp;/g , '');
}
return content;
} }
tabchange = (tab, index) => { tabchange = (tab, index) => {
......
...@@ -151,6 +151,8 @@ ...@@ -151,6 +151,8 @@
.aist_open { .aist_open {
background: url("../image/aist_open.png") no-repeat; background: url("../image/aist_open.png") no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
width: 22px;
height: 22px;
} }
.aist_close { .aist_close {
background: url("../image/close.png") no-repeat; background: url("../image/close.png") no-repeat;
......
...@@ -72,7 +72,7 @@ class Single extends Component { ...@@ -72,7 +72,7 @@ class Single extends Component {
} }
// 支付宝支付 // 支付宝支付
alipayPay = (orderId) => { alipayPay = (orderId) => {
http.get(`${API['base-api']}/pay/alipay/wap_charge/oid/${orderId}`).then((res) => { http.get(`${API['base-api']}/pay/alipay/wap_charge_new/oid/${orderId}`).then((res) => {
if (res.data.errno === 0) { if (res.data.errno === 0) {
window.location = res.data.data.url; window.location = res.data.data.url;
} else { } else {
...@@ -101,6 +101,7 @@ class Single extends Component { ...@@ -101,6 +101,7 @@ class Single extends Component {
} }
// 微信内部支付 // 微信内部支付
isweixinPay = () => { isweixinPay = () => {
let _this = this;
let weixin_code = getParam('code') let weixin_code = getParam('code')
if (weixin_code) { if (weixin_code) {
if (getParam('oid') === undefined) { if (getParam('oid') === undefined) {
...@@ -108,17 +109,71 @@ class Single extends Component { ...@@ -108,17 +109,71 @@ class Single extends Component {
} else { } else {
http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => { http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => {
if (res.data.errno === 0) { if (res.data.errno === 0) {
const data = res.data.data const data = res.data.data;
this.onBridgeReady(data) function onBridgeReady() {
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": data.appId, //公众号名称,由商户传入
"timeStamp": data.timeStamp, //时间戳,自1970年以来的秒数
"nonceStr": data.nonceStr, //随机串
"package": data.package,
"signType": data.signType, //微信签名方式:
"paySign": data.paySign //微信签名
},
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2);
_this.intervalPayStatus = setInterval(function () {
http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => {
if (res.data.errno === 401) {
clearInterval(_this.intervalPayStatus);
_this.intervalPayStatus = null;
// 获取课程类型
http.get(`${API.home}/sys/orderStatus/${getParam('oid')}`).then((res) => {
if (res.data.data.errno == '200') {
// 正常购买单集成功
this.setState({
status: 6
})
} else if (res.data.data.errno == '201') {
// 0元参团
this.setState({
status: 4
})
} else if (res.data.data.errno == '202') {
// 0元购
this.setState({
status: 3
})
} else if (res.data.data.errno == '203') {
// 三天内特价
this.setState({
nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price,
status: 2
})
} else {
Toast.info(res.data.data.msg, 2)
}
})
}
})
}, 1000)
} else {
alert('支付失败')
}
}
)
}
if (typeof WeixinJSBridge == "undefined") { if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) { if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady, false) document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false)
} else if (document.attachEvent) { } else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady) document.attachEvent('WeixinJSBridgeReady', onBridgeReady)
document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady) document.attachEvent('onWeixinJSBridgeReady', onBridgeReady)
} }
} else { } else {
this.onBridgeReady() onBridgeReady()
} }
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
...@@ -130,33 +185,43 @@ class Single extends Component { ...@@ -130,33 +185,43 @@ class Single extends Component {
// 支付完成之后获取状态 // 支付完成之后获取状态
payCallback = () => { payCallback = () => {
http.get(`${API.home}/sys/orderStatus/${getParam('oid')}`).then((res) => { const _this = this;
if (res.data.data.errno == '200') { _this.intervalPayStatus = setInterval(function () {
// 正常购买单集成功 http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => {
this.setState({ if (res.data.errno === 401) {
status: 6 clearInterval(_this.intervalPayStatus);
}) _this.intervalPayStatus = null;
} else if (res.data.data.errno == '201') { // 获取课程类型
// 0元参团 http.get(`${API.home}/sys/orderStatus/${getParam('oid')}`).then((res) => {
this.setState({ if (res.data.data.errno == '200') {
status: 4 // 正常购买单集成功
}) this.setState({
} else if (res.data.data.errno == '202') { status: 6
// 0元购 })
this.setState({ } else if (res.data.data.errno == '201') {
status: 3 // 0元参团
}) this.setState({
} else if (res.data.data.errno == '203') { status: 4
// 三天内特价 })
this.setState({ } else if (res.data.data.errno == '202') {
nowPrice: res.data.data.data.now_price, // 0元购
laterPrice: res.data.data.data.three_day_later_price, this.setState({
status: 2 status: 3
}) })
} else { } else if (res.data.data.errno == '203') {
Toast.info(res.data.data.msg, 2) // 三天内特价
} this.setState({
}) nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price,
status: 2
})
} else {
Toast.info(res.data.data.msg, 2)
}
})
}
})
}, 1000)
} }
......
...@@ -48,7 +48,7 @@ class Purchased extends Component { ...@@ -48,7 +48,7 @@ class Purchased extends Component {
const uid = user && user.data && user.data.uid const uid = user && user.data && user.data.uid
return ( return (
<div className='purchased-box'> <div className='purchased-box'>
<HeaderBar arrow={true} title='已购课程' cart={false} href='/my' /> <HeaderBar arrow={true} title='已购课程' cart={false} toHref='/my' />
<Loading isLoading={this.state.isLoading}> <Loading isLoading={this.state.isLoading}>
{ {
this.state.data && this.state.data.length > 0 ? this.state.data && this.state.data.length > 0 ?
......
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