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