Commit 412d2753 by xuzhenghua

denglu

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