Commit c33f67a4 by FE

pull and solve

parents 4eff0815 201cb0a9
import React, {Component} from 'react'
import React, { Component } from 'react'
import Routes from './router'
import cookie from 'js-cookie'
import {connect} from "react-redux";
import {setCurrentUser, startFetchUser} from "@/store/userAction";
import {withRouter} from 'react-router-dom'
import {compose} from 'redux'
import {getParam, http, browser} from "@/utils";
import {Toast} from "antd-mobile";
import {addDays} from 'date-fns'
import { connect } from "react-redux";
import { setCurrentUser, startFetchUser } from "@/store/userAction";
import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import { getParam, http, browser } from "@/utils";
import { Toast } from "antd-mobile";
import { addDays } from 'date-fns'
//拦截ajax请求,返回mock数据
......@@ -70,12 +70,18 @@ class App extends Component {
return
}
location.state = {from: this.previousLocation};
} else {
this.removeShareCodeCookie()
}
})
}
removeShareCodeCookie = () => {
cookie.remove('share_code', {path: '/', domain: '.julyedu.com'})
}
setNavigationRecord = (location) => {
let {location: _location} = this.props
let {state: _state = {}} = _location
......@@ -165,6 +171,8 @@ class App extends Component {
transformUser = res => {
let payload
if (res.data.code === 200) {
//移除红包统计cookie
this.removeShareCodeCookie()
const {
msg, data: {
avatar_file: avatar,
......@@ -200,6 +208,8 @@ class App extends Component {
transformWxUser = res => {
let data = res.data
if (data.errno == 200) {
//移除红包统计cookie
this.removeShareCodeCookie()
let {uid, token, avatar_file: avatar, uname: username,} = data.data
return {
......
......@@ -8,6 +8,8 @@
height: 44px;
background-color: $bg_fff;
padding: 10px 15px;
position: fixed;
z-index: 52;
.logo {
width: 78px;
......@@ -37,7 +39,7 @@
}
.index-swiper {
//margin-top: 7px;
margin-top: 44px;
height: 168px;
.swiper-container {
......
......@@ -214,6 +214,16 @@ class BtnStatus extends Component {
}
}
// 开始学习
toStudy=(vCourseId,isHaveVideo)=>{
const { history } = this.props;
if(isHaveVideo == 0){
Toast.info('尚未开课,开课后立即上传课程~', 2)
} else {
history.push(`/play/video?id=${vCourseId}`)
}
}
//获取砍价信息
getBargainInfo = () => {
......@@ -269,7 +279,9 @@ class BtnStatus extends Component {
<i className='iconfont iconerji' />
<span>课程咨询</span>
</a>
<Link to={`/play/video?id=${info.v_course_id}`} className='btn btn-m bg-09f'>开始学习</Link>
<a className='btn btn-m bg-09f' onClick={() => this.toStudy(info.v_course_id,info.is_have_video)}>
开始学习
</a>
</div>
}
{/*拼团 未开团*/}
......@@ -372,10 +384,7 @@ class BtnStatus extends Component {
{
info.aist_start_time === "" ?
(
<Link to={`/play/video?id=${info.v_course_id}`} className='btn btn-m learn-now'>
<span>开始学习</span>
</Link>
<a className='btn btn-m bg-09f' onClick={() => this.toStudy(info.v_course_id,info.is_have_video)}>开始学习</a>
) : (
<button className='btn btn-m wait-open' >
<span>{this.formatDate(info.aist_start_time)}</span>
......
......@@ -486,23 +486,34 @@ class Detail extends Component {
<span className="old">¥{course_info.price0}</span>
</p>
}
{
course_info.is_baoming === 1 &&
<span className="isbuy">已购买</span>
}
{/*{*/}
{/*course_info.is_baoming === 1 &&*/}
{/*<span className="isbuy">已购买</span>*/}
{/*}*/}
</div>
</div>
</div>
{/*正常课程已购买时显示*/}
{/*
没有权限:不显示
vip及赠课:显示黄的
不在vip范围内,单独购买:显示蓝的
单独买了课然后买了vip:显示蓝的
vip_range是vip里买的课,而且买了vip才会返回时间
is_pay 1是单独购买 0是买vip赠的
is_vip 1是属于vip赠的 0是不在vip范围内的
*/}
{
course_info.is_baoming === 1 && course_info.contact_type == 1 &&
course_info.is_baoming === 1 && course_info.is_pay == 1 && course_info.contact_type == 1 && course_info.course_qq &&
<div className='group'>
上课QQ群:{course_info.course_qq},加群请备注您的学号:{course_info.uid}
</div>
}
{
course_info.is_baoming === 1 && course_info.contact_type == 2 &&
course_info.is_baoming === 1 && course_info.is_pay == 1 && course_info.contact_type == 2 && course_info.course_qq &&
<div className='group'>
请添加班主任微信:{course_info.course_qq},添加时备注学号:{course_info.uid}
</div>
......@@ -511,14 +522,14 @@ class Detail extends Component {
{/*vip课程显示*/}
{
course_info.vip_range && course_info.contact_type == 1 &&
course_info.vip_range && course_info.is_vip == 1 && course_info.is_pay == 0 && course_info.contact_type == 1 && course_info.course_qq &&
<div className="vip">
<p>已开通年会员:{course_info.vip_range}</p>
<p>年会员QQ群:{course_info.course_qq},加群请备注您的学号:{course_info.uid}</p>
<p>上课QQ群:{course_info.course_qq},加群请备注您的学号:{course_info.uid}</p>
</div>
}
{
course_info.vip_range && course_info.contact_type == 2 &&
course_info.vip_range && course_info.is_vip == 1 && course_info.is_pay == 0 && course_info.contact_type == 2 && course_info.course_qq &&
<div className="vip">
<p>已开通年会员:{course_info.vip_range}</p>
<p>请添加班主任微信:{course_info.course_qq},添加时备注学号:{course_info.uid}</p>
......
......@@ -9,6 +9,7 @@ import { Toast } from 'antd-mobile';
import Captcha from '@/common/Captcha';
import FollowQRcode from './../followQRcode';
import './index.scss';
import cookie from 'js-cookie'
class RedPacket extends PureComponent {
......@@ -54,9 +55,16 @@ class RedPacket extends PureComponent {
// 分享链接进入
this.judgePopupType();
window.addEventListener('beforeunload', this.removeStatisticsCookie)
// 微信进入
const isWechat = getParam('wechat');
const { userInfo } = this.props;
if(!userInfo || !userInfo.uid) {
this.setRelativeCookie()
}
if(isWechat === '1' && !browser.isWeixin) {
if(userInfo && userInfo.uid) {
const type = window.localStorage.getItem('redpacket-click');
......@@ -95,6 +103,7 @@ class RedPacket extends PureComponent {
window.localStorage.removeItem('redpacket-click');
}
}else {
this.setRelativeCookie()
this.setState({
type: 1
});
......@@ -103,6 +112,15 @@ class RedPacket extends PureComponent {
this.fetchShareInfo();
}
removeStatisticsCookie = () => {
cookie.remove('share_code', {path: '/', domain: '.julyedu.com'})
}
componentWillUnmount() {
window.removeEventListener('beforeunload', this.removeStatisticsCookie)
}
// 获取分享信息
fetchShareInfo = () => {
......@@ -582,6 +600,13 @@ class RedPacket extends PureComponent {
});
}
//设置统计信息
setRelativeCookie = () => {
const config = {path: '/', domain: '.julyedu.com'}
cookie.set('share_code', getParam('share_code') ? getParam('share_code') : 'share_code', config)
}
render() {
// console.log(this.props);
const { history, userInfo } = this.props;
......
......@@ -42,6 +42,7 @@ class My extends PureComponent {
const username = user && user.data && user.data.username
const avatar = user && user.data && user.data.avatar
const isVIP = user && user.data && user.data.isVIP
let list
if (!uid) {
list = <List className="my-list">
......
......@@ -76,16 +76,16 @@ function OrderList(props) {
}}}>
{/* <Link to='coupons' query={{id: course_id}} state={{from: '/order'}}> */}
<Flex justify='between'>
<span
style={{
color: '#333',
fontSize: '15px'
<span
style={{
color: '#333',
fontSize: '15px'
}}
>优惠券</span>
<span
style={{
fontSize: '14px',
color: '#999999'
<span
style={{
fontSize: '14px',
color: '#999999'
}}
>
{!coupon_desc ? (coupon_num === 0 ? '无' : `${coupon_num}张可用`) : (coupon_desc)}
......@@ -415,48 +415,48 @@ class Order extends Component {
<Flex>
<Flex.Item>
<HeaderBar title='课程报名' arrow={true} />
{
!this.state.perfect &&
<Link to={{
pathname: '/orderinfo',
state: {type: this.props.location.state ? this.props.location.state.type : null, id: getParam('id')}
}}
className="order-information">
<i className="iconfont iconiconfront-6 order-addsize" />
<div className="order-infotext">完善报名信息</div>
<i className="iconfont iconiconfront-70 order-next" />
</Link>
}
{
this.state.perfect &&
<div className="order-information2">
<WingBlank>
<Link to={{
pathname: '/orderinfo',
state: {
...this.state.perfect,
...this.props.location.state,
id: getParam('id')
}
}
} >
<Flex align='center' justify='between' style={{ height: '80px' }}>
<i className="iconfont iconiconfront-20 user-icon"></i>
{/*{*/}
{/*!this.state.perfect &&*/}
{/*<Link to={{*/}
{/*pathname: '/orderinfo',*/}
{/*state: {type: this.props.location.state ? this.props.location.state.type : null, id: getParam('id')}*/}
{/*}}*/}
{/*className="order-information">*/}
{/*<i className="iconfont iconiconfront-6 order-addsize" />*/}
{/*<div className="order-infotext">完善报名信息</div>*/}
{/*<i className="iconfont iconiconfront-70 order-next" />*/}
{/*</Link>*/}
{/*}*/}
{/*{*/}
{/*this.state.perfect &&*/}
{/*<div className="order-information2">*/}
{/*<WingBlank>*/}
{/*<Link to={{*/}
{/*pathname: '/orderinfo',*/}
{/*state: {*/}
{/*...this.state.perfect,*/}
{/*...this.props.location.state,*/}
{/*id: getParam('id')*/}
{/*}*/}
{/*}*/}
{/*} >*/}
{/*<Flex align='center' justify='between' style={{ height: '80px' }}>*/}
{/*<i className="iconfont iconiconfront-20 user-icon"></i>*/}
<Flex direction='column' justify='between' align='start' className="order-cell">
<div className="name">{`姓名:${perfect.real_name}`}</div>
<div>{`电话:${perfect.cellphone}`}</div>
</Flex>
{/*<Flex direction='column' justify='between' align='start' className="order-cell">*/}
{/*<div className="name">{`姓名:${perfect.real_name}`}</div>*/}
{/*<div>{`电话:${perfect.cellphone}`}</div>*/}
{/*</Flex>*/}
<Flex align='start' className="order-cell">
<div>{`QQ:${perfect.qq}`}</div>
</Flex>
{/*<Flex align='start' className="order-cell">*/}
{/*<div>{`QQ:${perfect.qq}`}</div>*/}
{/*</Flex>*/}
</Flex>
</Link>
</WingBlank>
</div>
}
{/*</Flex>*/}
{/*</Link>*/}
{/*</WingBlank>*/}
{/*</div>*/}
{/*}*/}
<div className="order-list">
<OrderList
list={orderList}
......
......@@ -74,15 +74,11 @@ const formikConfig = {
const {props, props: {history}} = formikBag
props.accountLogin({
username, password
})/*.then(res => {
if (!res.hasError) {
let {from} = props.location.state || {from: {pathname: '/', search: ''}}
console.log(from, 'account');
history.replace({pathname: from.pathname, search: from.search || ''})
} else {
}).then(res => {
if (res.hasError) {
Toast.info(res.msg, 2, null, false)
}
})*/
})
}
}
......
......@@ -3,7 +3,6 @@
right: 6px;
top: 50%;
transform: translateY(-50%);
width: 84px;
height: 21px;
padding-left: 7px;
border: none;
......
......@@ -70,11 +70,11 @@ class Purchased extends Component {
<div className='des'>助教微信:{item.assist_weixin}</div>
}
{
!item.is_aist && item.contact_type == 1 &&
!item.is_aist && item.contact_type == 1 && item.course_qq &&
<div className='des'>QQ群:{item.course_qq}</div>
}
{
!item.is_aist && item.contact_type == 2 &&
!item.is_aist && item.contact_type == 2 && item.course_qq &&
<div className='des'>班主任微信:{item.course_qq}</div>
}
</div>
......
......@@ -295,6 +295,7 @@ class _Scholarship extends Component {
<div style={{ backgroundColor: '#FFF' }}>
<Tabs tabs={this.tabList}
initialPage={0}
swipeable={false}
// onChange={this.changeTab}
onChange={(tab, index) => {
this.tabIndex = index;
......
......@@ -127,11 +127,11 @@ class MyCourses extends Component {
<div className='contact'>助教微信:{item.assist_weixin}</div>
}
{
!item.is_aist && item.contact_type == 1 &&
!item.is_aist && item.contact_type == 1 && item.course_qq &&
<div className='contact'>QQ群:{item.course_qq}</div>
}
{
!item.is_aist && item.contact_type == 2 &&
!item.is_aist && item.contact_type == 2 && item.course_qq &&
<div className='contact'>班主任微信:{item.course_qq}</div>
}
......
......@@ -24,11 +24,11 @@ const storeUser = (res, dispatch) => {
const data = res.data
let payload
if (data.errno === 0) {
const {user_name: username, avatar_file: avatar, ...rest} = data.data.user_info
const {user_name: username, avatar_file: avatar,is_vip: isVIP, ...rest} = data.data.user_info
payload = {
hasError: false,
msg: data.msg,
data: {username, avatar, ...rest}
data: {username, avatar,isVIP, ...rest}
}
} else {
payload = {
......
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