Commit 571a92e6 by xuzhenghua

BUG

parents 6e055ead 412d2753
...@@ -177,7 +177,8 @@ class CollectBlessing extends Component { ...@@ -177,7 +177,8 @@ class CollectBlessing extends Component {
render() { render() {
const { const {
isSign, isSign,
userInfo: { isLogin = false, blessingVal = 0, buyBlessing = 0, inviteBlessing = 0 }, userInfo: {blessingVal = 0, buyBlessing = 0, inviteBlessing = 0 },
isLogin,
handleToShowNotice, handleToShowNotice,
handleToShowList, handleToShowList,
handleToShowInvite, handleToShowInvite,
......
...@@ -3,11 +3,11 @@ import './index.scss'; ...@@ -3,11 +3,11 @@ import './index.scss';
class CourseItem extends Component { class CourseItem extends Component {
render() { render() {
const { image } = this.props; const { image,toCourse,id} = this.props;
return ( return (
<div className="course-container"> <div className="course-container">
<div className="course__cover"> <div className="course__cover">
<img src={image} alt="cover"/> <img src={image} alt="cover" onClick={() => toCourse(id)}/>
</div> </div>
{this.props.children} {this.props.children}
</div> </div>
......
...@@ -15,5 +15,6 @@ ...@@ -15,5 +15,6 @@
img { img {
display: block; display: block;
width: 100%; width: 100%;
height: 100%;
} }
} }
\ No newline at end of file
...@@ -298,7 +298,7 @@ class CourseList extends Component { ...@@ -298,7 +298,7 @@ class CourseList extends Component {
<div data-layout="row"> <div data-layout="row">
{ {
group.course.map(item => ( group.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
<div className="coupon-course__footer"> <div className="coupon-course__footer">
<a onClick={() => this.toQQque()} className="course-button">立抢超低团购价</a> <a onClick={() => this.toQQque()} className="course-button">立抢超低团购价</a>
</div> </div>
...@@ -323,7 +323,7 @@ class CourseList extends Component { ...@@ -323,7 +323,7 @@ class CourseList extends Component {
<div data-layout="row"> <div data-layout="row">
{ {
training.course.map(item => ( training.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
...@@ -391,7 +391,7 @@ class CourseList extends Component { ...@@ -391,7 +391,7 @@ class CourseList extends Component {
<div data-layout="row"> <div data-layout="row">
{ {
basic.course.map(item => ( basic.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
{ {
item.type === 0 && item.type === 0 &&
<div className="coupon-course__footer"> <div className="coupon-course__footer">
...@@ -472,7 +472,7 @@ class CourseList extends Component { ...@@ -472,7 +472,7 @@ class CourseList extends Component {
<div data-layout="row"> <div data-layout="row">
{ {
advanced.course.map(item => ( advanced.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
{ {
item.type === 0 && item.type === 0 &&
<div className="coupon-course__footer"> <div className="coupon-course__footer">
...@@ -552,7 +552,7 @@ class CourseList extends Component { ...@@ -552,7 +552,7 @@ class CourseList extends Component {
<div data-layout="row"> <div data-layout="row">
{ {
higher.course.map(item => ( higher.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
{ {
item.type === 0 && item.type === 0 &&
<div className="coupon-course__footer"> <div className="coupon-course__footer">
...@@ -632,7 +632,7 @@ class CourseList extends Component { ...@@ -632,7 +632,7 @@ class CourseList extends Component {
<div data-layout="row"> <div data-layout="row">
{ {
expand.course.map(item => ( expand.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
{ {
item.type === 0 && item.type === 0 &&
<div className="coupon-course__footer"> <div className="coupon-course__footer">
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
padding: 10px 0; padding: 10px 0;
.course-button { .course-button {
margin: 5px auto 0; //margin: 5px auto 0;
} }
} }
...@@ -42,7 +42,8 @@ ...@@ -42,7 +42,8 @@
text-align: center; text-align: center;
line-height: 1; line-height: 1;
background-image: url('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/coupon-bg-0.png'); background-image: url('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/coupon-bg-0.png');
background-repeat: no-repeat;
background-size: cover;
} }
.coupon-course__button--receive { .coupon-course__button--receive {
......
import React, { Component } from 'react' import React, {Component} from 'react'
import QRCode from 'qrcode' import QRCode from 'qrcode'
import { http, SendMessageToApp,wxShare,is_weixin,getParam} from '@/utils'; import {http, SendMessageToApp, wxShare, is_weixin, getParam} from '@/utils';
import { Link } from 'react-router-dom' import {Link} from 'react-router-dom'
import { throttle, findIndex, debounce } from 'lodash' import {throttle, findIndex, debounce} from 'lodash'
import RulePopup from './rulePopup/index' import RulePopup from './rulePopup/index'
import CoursePopup from './coursePopup/index' import CoursePopup from './coursePopup/index'
import RecordPopup from './recordPopup/index' import RecordPopup from './recordPopup/index'
...@@ -15,9 +15,9 @@ import ListHeader from './listHeader/index' ...@@ -15,9 +15,9 @@ import ListHeader from './listHeader/index'
import LevelTest from './levelTest/index' import LevelTest from './levelTest/index'
import RankList from './rankList/index' import RankList from './rankList/index'
import './index.scss' import './index.scss'
import { Popup } from '@/common' import {Popup} from '@/common'
import { CopyToClipboard } from 'react-copy-to-clipboard' import {CopyToClipboard} from 'react-copy-to-clipboard'
import { Toast } from "antd-mobile" import {Toast} from "antd-mobile"
import Live from './live' import Live from './live'
import Banner from './banner' import Banner from './banner'
import cookie from "js-cookie"; import cookie from "js-cookie";
...@@ -27,7 +27,6 @@ import {compose} from "redux"; ...@@ -27,7 +27,6 @@ import {compose} from "redux";
import {connect} from "react-redux"; import {connect} from "react-redux";
class BlessingPreheat extends Component { class BlessingPreheat extends Component {
constructor(props) { constructor(props) {
...@@ -35,6 +34,7 @@ class BlessingPreheat extends Component { ...@@ -35,6 +34,7 @@ class BlessingPreheat extends Component {
this.navTop = 183 this.navTop = 183
this.prevY = 0 this.prevY = 0
this.state = { this.state = {
isLogin: false,
userInfoList: [], userInfoList: [],
isRule: false, isRule: false,
isCourse: false, isCourse: false,
...@@ -76,6 +76,7 @@ class BlessingPreheat extends Component { ...@@ -76,6 +76,7 @@ class BlessingPreheat extends Component {
}, },
], ],
index: 0, index: 0,
userHasError: props.user.hasError
} }
} }
...@@ -83,7 +84,7 @@ class BlessingPreheat extends Component { ...@@ -83,7 +84,7 @@ class BlessingPreheat extends Component {
this.fetchUserBlessing(); this.fetchUserBlessing();
this.setInitialNavActiveStatus() this.setInitialNavActiveStatus()
window.addEventListener('scroll', throttle(this.calcNavActive, 100)); window.addEventListener('scroll', throttle(this.calcNavActive, 100));
if(is_weixin()) { if (is_weixin()) {
wxShare({ wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!', title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线', desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
...@@ -98,6 +99,17 @@ class BlessingPreheat extends Component { ...@@ -98,6 +99,17 @@ class BlessingPreheat extends Component {
} }
} }
componentDidUpdate(prevProps, prevState){
let {user} = this.props
if (this.props.user.hasError !== this.state.userHasError) {
const uid = user && user.data && user.data.uid;
this.setState({
isLogin: !uid ? false : true,
userHasError: user.hasError
})
}
}
// 获取app登录数据 // 获取app登录数据
loginInfo = (result) => { loginInfo = (result) => {
this.setState({ this.setState({
...@@ -188,15 +200,8 @@ class BlessingPreheat extends Component { ...@@ -188,15 +200,8 @@ class BlessingPreheat extends Component {
} }
fetchUserBlessing() { fetchUserBlessing() {
// 判断登录未登录 根据this.state.userInfo.isLogin // 判断登录未登录 根据this.state.isLogin
if(getParam('version')) { const {userInfo} = this.state;
// app 平台
}else{
// H5
}
const { userInfo } = this.state;
const {user, history} = this.props;
const uid = user && user.data && user.data.uid;
http.get(`${API.home}/sys/user/blessing`).then(res => { http.get(`${API.home}/sys/user/blessing`).then(res => {
const {code, data} = res.data const {code, data} = res.data
if (code === 200) { if (code === 200) {
...@@ -204,10 +209,9 @@ class BlessingPreheat extends Component { ...@@ -204,10 +209,9 @@ class BlessingPreheat extends Component {
isSign: !!data.today_signed, isSign: !!data.today_signed,
isFormal: data.is_activity, isFormal: data.is_activity,
userInfo: Object.assign({}, userInfo, { userInfo: Object.assign({}, userInfo, {
isLogin: !!uid,
blessingVal: data.user_blessing_value, blessingVal: data.user_blessing_value,
buyBlessing: (data.types_total_blessing_value &&data.types_total_blessing_value.buy_course)? data.types_total_blessing_value.buy_course : 0, buyBlessing: (data.types_total_blessing_value && data.types_total_blessing_value.buy_course) ? data.types_total_blessing_value.buy_course : 0,
inviteBlessing: (data.types_total_blessing_value &&data.types_total_blessing_value.invite)? data.types_total_blessing_value.invite : 0, inviteBlessing: (data.types_total_blessing_value && data.types_total_blessing_value.invite) ? data.types_total_blessing_value.invite : 0,
}) })
}) })
if (data.is_login === 1) { if (data.is_login === 1) {
...@@ -241,9 +245,8 @@ class BlessingPreheat extends Component { ...@@ -241,9 +245,8 @@ class BlessingPreheat extends Component {
} }
handleToShow = (key, isLogin = false) => { handleToShow = (key, isLogin = false) => {
const {userInfo} = this.state
// 需要用户登录 并且用户未登录 // 需要用户登录 并且用户未登录
if (isLogin && !userInfo.isLogin) { if (isLogin && !this.state.isLogin) {
this.toLogin() this.toLogin()
} else { } else {
let obj = {} let obj = {}
...@@ -256,9 +259,9 @@ class BlessingPreheat extends Component { ...@@ -256,9 +259,9 @@ class BlessingPreheat extends Component {
// 邀请好友注册 // 邀请好友注册
handleToShowInvite = () => { handleToShowInvite = () => {
const { userInfo } = this.state; const {isLogin} = this.state;
if(userInfo.isLogin) { if (isLogin) {
if(!getParam('version')) { if (!getParam('version')) {
QRCode.toDataURL(`${API.m}/invite`, { QRCode.toDataURL(`${API.m}/invite`, {
width: 120, width: 120,
height: 120, height: 120,
...@@ -349,7 +352,7 @@ class BlessingPreheat extends Component { ...@@ -349,7 +352,7 @@ class BlessingPreheat extends Component {
} }
let el = document.querySelector(`#${navs[_index].id}`) let el = document.querySelector(`#${navs[_index].id}`)
let nav = document.querySelector('#main-nav') let nav = document.querySelector('#main-nav')
if(el) { if (el) {
let top = el.offsetTop let top = el.offsetTop
...@@ -380,6 +383,7 @@ class BlessingPreheat extends Component { ...@@ -380,6 +383,7 @@ class BlessingPreheat extends Component {
const { const {
navs, navs,
userInfo, userInfo,
isLogin,
isRule, isRule,
isCourse, isCourse,
inviteUrl, inviteUrl,
...@@ -408,6 +412,7 @@ class BlessingPreheat extends Component { ...@@ -408,6 +412,7 @@ class BlessingPreheat extends Component {
<CollectBlessing <CollectBlessing
isSign={isSign} isSign={isSign}
userInfo={userInfo} userInfo={userInfo}
isLogin={isLogin}
history={this.props.history} history={this.props.history}
toSection={(e) => this.toSection(this.fetchMoudleId('best-courses'), e)} toSection={(e) => this.toSection(this.fetchMoudleId('best-courses'), e)}
handleToShowList={() => this.handleToShow('isCourse')} handleToShowList={() => this.handleToShow('isCourse')}
...@@ -438,7 +443,7 @@ class BlessingPreheat extends Component { ...@@ -438,7 +443,7 @@ class BlessingPreheat extends Component {
<ListHeader id={'best-courses'} text="精品课程特惠专区" styles={{margin: '30px 0 15px'}}/> <ListHeader id={'best-courses'} text="精品课程特惠专区" styles={{margin: '30px 0 15px'}}/>
<CourseList <CourseList
isFormal={isFormal} isFormal={isFormal}
isLogin={userInfo.isLogin} isLogin={isLogin}
history={this.props.history} history={this.props.history}
toLogin={this.toLogin} toLogin={this.toLogin}
/> />
...@@ -449,7 +454,8 @@ class BlessingPreheat extends Component { ...@@ -449,7 +454,8 @@ class BlessingPreheat extends Component {
} }
{ {
isCourse && isCourse &&
<CoursePopup toLogin={this.toLogin} history={history} isLogin={userInfo.isLogin} handleToHide={() => this.handleToHide('isCourse')}/> <CoursePopup toLogin={this.toLogin} history={history} isLogin={isLogin}
handleToHide={() => this.handleToHide('isCourse')}/>
} }
{ {
showRecordList && showRecordList &&
...@@ -503,12 +509,12 @@ class BlessingPreheat extends Component { ...@@ -503,12 +509,12 @@ class BlessingPreheat extends Component {
</Popup> </Popup>
<ListHeader id={'ai-test'} text="全国AI工程师水平测试" styles={{margin: '30px 0 15px'}} /> <ListHeader id={'ai-test'} text="全国AI工程师水平测试" styles={{margin: '30px 0 15px'}}/>
<div className="test__record" onClick={() => this.handleToShow('showRecordList', true)}> <div className="test__record" onClick={() => this.handleToShow('showRecordList', true)}>
测试记录> 测试记录>
</div> </div>
<LevelTest history={history} isLogin={userInfo.isLogin} toLogin={this.toLogin}></LevelTest> <LevelTest history={history} isLogin={isLogin} toLogin={this.toLogin}></LevelTest>
<RankList></RankList> <RankList></RankList>
......
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