Commit a8c5d649 by FE

del build

parents 1a7f8849 241193c5
...@@ -3692,6 +3692,11 @@ ...@@ -3692,6 +3692,11 @@
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
}, },
"clipboard-copy": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/clipboard-copy/-/clipboard-copy-3.1.0.tgz",
"integrity": "sha512-Xsu1NddBXB89IUauda5BIq3Zq73UWkjkaQlPQbLNvNsd5WBMnTWPNKYR6HGaySOxGYZ+BKxP2E9X4ElnI3yiPA=="
},
"cliui": { "cliui": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
...@@ -3984,14 +3989,6 @@ ...@@ -3984,14 +3989,6 @@
"resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
}, },
"copy-to-clipboard": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.2.0.tgz",
"integrity": "sha512-eOZERzvCmxS8HWzugj4Uxl8OJxa7T2k1Gi0X5qavwydHIfuSHq2dTD09LOg/XyGq4Zpb5IsR/2OJ5lbOegz78w==",
"requires": {
"toggle-selection": "^1.0.6"
}
},
"core-js": { "core-js": {
"version": "2.6.5", "version": "2.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz",
...@@ -12087,15 +12084,6 @@ ...@@ -12087,15 +12084,6 @@
} }
} }
}, },
"react-copy-to-clipboard": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.0.1.tgz",
"integrity": "sha512-ELKq31/E3zjFs5rDWNCfFL4NvNFQvGRoJdAKReD/rUPA+xxiLPQmZBZBvy2vgH7V0GE9isIQpT9WXbwIVErYdA==",
"requires": {
"copy-to-clipboard": "^3",
"prop-types": "^15.5.8"
}
},
"react-dev-utils": { "react-dev-utils": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-8.0.0.tgz", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-8.0.0.tgz",
...@@ -14514,11 +14502,6 @@ ...@@ -14514,11 +14502,6 @@
"repeat-string": "^1.6.1" "repeat-string": "^1.6.1"
} }
}, },
"toggle-selection": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
"integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI="
},
"topo": { "topo": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz", "resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
......
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数据
...@@ -16,39 +16,26 @@ mock()*/ ...@@ -16,39 +16,26 @@ mock()*/
// 默认样式 // 默认样式
import './assets/css/index.scss'; import './assets/css/index.scss'
// iconfont // iconfont
import './assets/font/iconfont.css'; import './assets/font/iconfont.css'
class App extends Component { class App extends Component {
previousLocation = { static displayName = 'App'
...{
state: { previousLocation = {pathname: '/', search: '', hash: ''}
from:
{
pathname: this.props.location.pathname,
search: this.props.location.search,
hash: this.props.location.hash
}
}
},
...this.props.location
}
records = [] records = []
pathnameBlacklist = ['/country', '/passport']
firstLoad = true firstLoad = true
componentDidMount() { componentDidMount() {
// 友盟统计 this.umengStatistic()
const script = document.createElement('script');
script.src = 'https://s22.cnzz.com/z_stat.php?id=1265696973&web_id=1265696973';
script.language = 'JavaScript';
document.body.appendChild(script);
this.setNavigationRecord(this.props.location, this.props.history.action)
//平台信息 //平台信息
...@@ -57,23 +44,37 @@ class App extends Component { ...@@ -57,23 +44,37 @@ class App extends Component {
if (browser.isWeixin && browser.isIOS) { if (browser.isWeixin && browser.isIOS) {
sessionStorage.setItem('enter_url', window.location.href) sessionStorage.setItem('enter_url', window.location.href)
} }
this.getUser() this.getUser()
this.utm() this.utm()
const routeMatchRule = /binding-tel|forgot|set-password/
const {history} = this.props const {history} = this.props
this.setNavigationRecord(this.props.location, this.props.history.action)
this.setPreviousLocation()
history.listen((location, action) => { history.listen((location, action) => {
this.utm()
this.firstLoad = false this.firstLoad = false
this.setNavigationRecord(location, action) this.setNavigationRecord(location, action)
this.utm()
if (cookie.get('uid') && this.props.user.hasError) { if (cookie.get('uid') && this.props.user.hasError) {
this.getUser() this.getUser()
} }
const {pathname} = location const {pathname, state} = location
if (pathname.startsWith('/passport')) { if (pathname.startsWith('/passport')) {
if (routeMatchRule.test(pathname)) { location.state = {
return ...state,
...{
from: {
pathname: this.previousLocation.pathname,
search: this.previousLocation.search,
hash: this.previousLocation.hash
}
}
} }
location.state = {...location.state, ...{from: this.previousLocation}};
} else { } else {
this.removeShareCodeCookie() this.removeShareCodeCookie()
} }
...@@ -82,6 +83,14 @@ class App extends Component { ...@@ -82,6 +83,14 @@ class App extends Component {
} }
umengStatistic = () => {
// 友盟统计
const script = document.createElement('script')
script.src = 'https://s22.cnzz.com/z_stat.php?id=1265696973&web_id=1265696973'
script.language = 'JavaScript'
document.body.appendChild(script)
}
removeShareCodeCookie = () => { removeShareCodeCookie = () => {
cookie.remove('share_code', {path: '/', domain: '.julyedu.com'}) cookie.remove('share_code', {path: '/', domain: '.julyedu.com'})
} }
...@@ -89,6 +98,7 @@ class App extends Component { ...@@ -89,6 +98,7 @@ class App extends Component {
setNavigationRecord = (location, action) => { setNavigationRecord = (location, action) => {
const {pathname, search, hash} = location const {pathname, search, hash} = location
let isLastRecord = location.pathname === (this.records.length && this.records[this.records.length - 1].pathname) let isLastRecord = location.pathname === (this.records.length && this.records[this.records.length - 1].pathname)
switch (action) { switch (action) {
case 'POP': case 'POP':
this.firstLoad ? this.records.push({pathname, search, hash}) : this.records.pop() this.firstLoad ? this.records.push({pathname, search, hash}) : this.records.pop()
...@@ -102,7 +112,7 @@ class App extends Component { ...@@ -102,7 +112,7 @@ class App extends Component {
location.state && location.state.records location.state && location.state.records
? (location.state.records = this.records) ? (location.state.records = this.records)
: location.state? location.state = {...location.state, records: this.records} : location.state ? location.state = {...location.state, records: this.records}
: (location.state = {records: this.records}) : (location.state = {records: this.records})
} }
...@@ -133,7 +143,7 @@ class App extends Component { ...@@ -133,7 +143,7 @@ class App extends Component {
} }
getUser = () => { getUser = () => {
//获取用户信息
this.props.startFetchUser() this.props.startFetchUser()
http.get(`${API.home}/m/user_info`).then(res => { http.get(`${API.home}/m/user_info`).then(res => {
this.props.setCurrentUser(this.transformUser(res)) this.props.setCurrentUser(this.transformUser(res))
...@@ -170,30 +180,17 @@ class App extends Component { ...@@ -170,30 +180,17 @@ class App extends Component {
componentDidUpdate() { componentDidUpdate() {
this.setPreviousLocation()
if (!this.props.user.hasError && getParam('redirect')) { if (!this.props.user.hasError && getParam('redirect')) {
window.location.href = getParam('redirect') window.location.href = getParam('redirect')
} }
} }
setPreviousLocation = () => { setPreviousLocation = () => {
const {location, history: {action}} = this.props const {location} = this.props
if (location.pathname.startsWith('/passport')) { let isInBlacklist = this.pathnameBlacklist.some(item => location.pathname.startsWith(item))
/*let index = this.records.findIndex(item => item.pathname.startsWith('/passport')) !isInBlacklist && (this.previousLocation = location)
this.previousLocation = index > 0
? this.records[index - 1]
: this.records.length
? this.records[this.records.length - 1]
: null*/
} else {
if (action === 'POP' || action === 'REPLACE') {
let index = this.records.findIndex(item => item.pathname.startsWith('/passport'))
this.previousLocation = index > 0 ? this.records[index - 1] : this.records[this.records.length - 1]
} else {
this.previousLocation = location
}
}
} }
transformUser = res => { transformUser = res => {
......
...@@ -31,12 +31,6 @@ class OpenApp extends Component { ...@@ -31,12 +31,6 @@ class OpenApp extends Component {
text: '在APP打开' text: '在APP打开'
} }
componentWillMount() {
// this.callApp = new CallApp({});
}
handleClick = () => { handleClick = () => {
this.callApp.open({ this.callApp.open({
path: '', path: '',
......
...@@ -3,8 +3,8 @@ import './index.scss' ...@@ -3,8 +3,8 @@ import './index.scss'
const VList = (props) => { const VList = (props) => {
return ( return (
<li <li
className='v-list-item' className='v-list-item'
onClick={() => { onClick={() => {
typeof props.toDetail === 'function' && props.toDetail(props.id) typeof props.toDetail === 'function' && props.toDetail(props.id)
}} }}
...@@ -12,6 +12,7 @@ const VList = (props) => { ...@@ -12,6 +12,7 @@ const VList = (props) => {
<div className="content"> <div className="content">
<div className="cover"> <div className="cover">
{props.status} {props.status}
{props.courseExpire}
{props.toDetail {props.toDetail
? (<img src={props.img} alt=""/>) ? (<img src={props.img} alt=""/>)
: (<img src={props.img} alt=""/>) : (<img src={props.img} alt=""/>)
......
...@@ -27,7 +27,6 @@ class FollowBarcode extends Component { ...@@ -27,7 +27,6 @@ class FollowBarcode extends Component {
const _this = this; const _this = this;
return new Promise(resolve => { return new Promise(resolve => {
QRCode.toDataURL(data.url, {}, function (err, url) { QRCode.toDataURL(data.url, {}, function (err, url) {
console.log(url);
_this.setState({ _this.setState({
codeUrl: url codeUrl: url
}); });
......
...@@ -7,11 +7,15 @@ class Coupon extends PureComponent { ...@@ -7,11 +7,15 @@ class Coupon extends PureComponent {
pick = () => { pick = () => {
let {useCoupon, invalid} = this.props let {useCoupon, invalid} = this.props
!invalid && useCoupon && useCoupon(this.props.id) !invalid && useCoupon && useCoupon(this.props.id)
} }
GoToUse = () => { GoToUse = () => {
this.props.useCoupon(this.props.id) this.props.useCoupon(this.props.id)
} }
ExchangeCourse = (e) => {
this.props.toExchangeCourse(e,this.props.code)
}
render() { render() {
let { let {
...@@ -22,6 +26,7 @@ class Coupon extends PureComponent { ...@@ -22,6 +26,7 @@ class Coupon extends PureComponent {
invalid, invalid,
course_title, course_title,
id, id,
code,
selectedCouponId, selectedCouponId,
showUseButton showUseButton
} = this.props } = this.props
...@@ -56,13 +61,21 @@ class Coupon extends PureComponent { ...@@ -56,13 +61,21 @@ class Coupon extends PureComponent {
limit_course === 0 ? '可用于大于代金券金额的课程' : `仅适用于《${course_title}》` limit_course === 0 ? '可用于大于代金券金额的课程' : `仅适用于《${course_title}》`
}</span> }</span>
{ {
showUseButton && showUseButton && ctype == 1 &&
<button <button
className='use' className='use'
onClick={this.GoToUse} onClick={this.GoToUse}
>立即使用 >立即使用
</button> </button>
} }
{
showUseButton && ctype == 2 &&
<button
className='use'
onClick={(e)=>this.ExchangeCourse(e)}
>立即兑换
</button>
}
</div> </div>
</li> </li>
......
import React, { PureComponent } from 'react'; import React, {PureComponent} from 'react';
import './index.scss' import './index.scss'
import RedeemBar from "../RedeemBar"; import RedeemBar from "../RedeemBar";
import Coupon from '../Coupon' import Coupon from '../Coupon'
import { http, getParam } from '@/utils' import {http, getParam} from '@/utils'
import { WithFullSize } from '@/HOCs' import {WithFullSize} from '@/HOCs'
import { Toast } from 'antd-mobile' import {Toast} from 'antd-mobile'
import { isEmpty } from 'lodash' import {isEmpty} from 'lodash'
import { connect } from 'react-redux'; import {connect} from 'react-redux';
@connect() @connect()
class UseCoupon extends PureComponent { class UseCoupon extends PureComponent {
...@@ -19,11 +19,12 @@ class UseCoupon extends PureComponent { ...@@ -19,11 +19,12 @@ class UseCoupon extends PureComponent {
valid_coupons: [], valid_coupons: [],
invalid_coupons: [], invalid_coupons: [],
courseId: getParam('id'), courseId: getParam('id'),
showUseButton: false showUseButton: false,
courseCouponExchange: false, // 课程券兑换弹窗
courseCouponData: '' // 兑换课程信息
} }
componentDidMount() { componentDidMount() {
const {history, location} = this.props const {history, location} = this.props
const {state} = this.props.location const {state} = this.props.location
...@@ -47,6 +48,7 @@ class UseCoupon extends PureComponent { ...@@ -47,6 +48,7 @@ class UseCoupon extends PureComponent {
this.setState({redeemCode: value}) this.setState({redeemCode: value})
} }
// 兑换
exchange = () => { exchange = () => {
const {location: {state = {}}} = this.props; const {location: {state = {}}} = this.props;
if (this.state.redeemCode !== '') { if (this.state.redeemCode !== '') {
...@@ -59,35 +61,33 @@ class UseCoupon extends PureComponent { ...@@ -59,35 +61,33 @@ class UseCoupon extends PureComponent {
const coupon = data.data const coupon = data.data
if (this.state.showUseButton) { if (coupon['ctype'] == 2) {
this.setState({ this.setState({
couponList: [...this.state.couponList, coupon], courseCouponData: coupon,
courseCouponExchange: true,
redeemCode: '' redeemCode: ''
}) })
} else { } else {
if (this.state.showUseButton) {
const coupon = data.data
if (coupon['ctype'] == 2
&& coupon['limit_course'] != this.state.courseId) {
this.setState({ this.setState({
invalid_coupons: [...this.state.invalid_coupons, coupon], couponList: [...this.state.couponList, coupon],
showUseButton: null redeemCode: ''
}); })
} else { } else {
const coupon = data.data
this.setState({ this.setState({
valid_coupons: [...this.state.valid_coupons, coupon], valid_coupons: [...this.state.valid_coupons, coupon],
redeemCode: '' redeemCode: ''
}) })
} }
Toast.info('兑换成功')
} if (state.from === '/my') {
Toast.info('兑换成功') this.getMyCoupons()
if (state.from === '/my') { }
this.getMyCoupons() if (state.from === '/order') {
} this.getAllCoupons()
if (state.from === '/order') { }
this.getAllCoupons()
} }
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
...@@ -135,6 +135,24 @@ class UseCoupon extends PureComponent { ...@@ -135,6 +135,24 @@ class UseCoupon extends PureComponent {
}) })
} }
// 立即兑换课程
toExchangeCourse = (e,code)=>{
e.stopPropagation();
http.post(`${API['base-api']}/pay/miandan/${code}`, {
}).then(res => {
const data = res.data
if (data.errno === 200) {
this.setState({
courseCouponExchange: true,
courseCouponData:res.data.data
})
this.getMyCoupons()
} else {
Toast.info(data.msg)
}
})
}
useCoupon = val => { useCoupon = val => {
const {history, dispatch} = this.props const {history, dispatch} = this.props
const coupon = this.state.couponList.find(item => item.id === val) const coupon = this.state.couponList.find(item => item.id === val)
...@@ -142,13 +160,11 @@ class UseCoupon extends PureComponent { ...@@ -142,13 +160,11 @@ class UseCoupon extends PureComponent {
if (val) { if (val) {
if (this.state.showUseButton) { if (this.state.showUseButton) {
if (coupon['ctype'] === 1) { if (coupon['limit_course'] === 0) {
history.push(`/classify`) history.push(`/classify`)
} else { } else {
// dispatch(getCourses(coupon['limit_course'], () => { history.push(`/detail?id=${coupon['limit_course']}`);
history.push(`/detail?id=${coupon['limit_course']}`); return false;
return false;
// }));
} }
} else { } else {
...@@ -206,6 +222,26 @@ class UseCoupon extends PureComponent { ...@@ -206,6 +222,26 @@ class UseCoupon extends PureComponent {
} }
// 开始学习
toStudy = (vCourseId, isHaveVideo) => {
const {history} = this.props;
if (isHaveVideo == 0) {
Toast.info('尚未开课,开课后立即上传课程~', 2)
} else {
history.push(`/play/video?id=${vCourseId}`)
}
this.setState({
courseCouponExchange: false
})
}
// 关闭弹窗
closeFreeCourse = () => {
this.setState({
courseCouponExchange: false
})
}
render() { render() {
const {state} = this.props.location const {state} = this.props.location
const {showUseButton, selectedCouponId} = this.state const {showUseButton, selectedCouponId} = this.state
...@@ -227,6 +263,7 @@ class UseCoupon extends PureComponent { ...@@ -227,6 +263,7 @@ class UseCoupon extends PureComponent {
selectedCouponId={selectedCouponId} selectedCouponId={selectedCouponId}
select={this.select} select={this.select}
useCoupon={this.useCoupon} useCoupon={this.useCoupon}
toExchangeCourse={this.toExchangeCourse}
/> />
{ {
this.state.invalid_coupons.length > 0 && this.state.invalid_coupons.length > 0 &&
...@@ -244,6 +281,11 @@ class UseCoupon extends PureComponent { ...@@ -244,6 +281,11 @@ class UseCoupon extends PureComponent {
) )
} }
</div> </div>
{
this.state.courseCouponExchange &&
<FreeCouponCourse toStudy={this.toStudy} closeFreeCourse={this.closeFreeCourse}
courseCouponData={this.state.courseCouponData}/>
}
</div> </div>
); );
} }
...@@ -275,4 +317,29 @@ function Content({coupons, ...rest}) { ...@@ -275,4 +317,29 @@ function Content({coupons, ...rest}) {
) )
} }
function FreeCouponCourse(props) {
const {toStudy, closeFreeCourse, courseCouponData} = props
return (
<div className="free-coupon-box">
<div className="free-coupon-content">
<div className="coures-content-success"><i className={'iconfont icondanseshixintubiao-5'}/></div>
<div className="coures-content-title">恭喜你课程兑换成功!赶快去学习吧~</div>
<img className="coures-content-img" src={courseCouponData.image_name} alt=""/>
{
courseCouponData.course_expire != 0 &&
<div className="coures-content-tip"><i
className={'iconfont icondanseshixintubiao-8'}/><span>课程有效期:自今日起{courseCouponData.course_expire}天内,请在有效期内学习该课程哦~</span>
</div>
}
<a className='toStudy'
onClick={() => toStudy(courseCouponData.v_course_id, courseCouponData.is_is_start)}>去学习</a>
</div>
<div className="free-coupon-close">
<i className={'iconfont iconiconfront-2'} onClick={() => closeFreeCourse()}/>
</div>
</div>
)
}
export default WithFullSize(UseCoupon); export default WithFullSize(UseCoupon);
\ No newline at end of file
.use-coupon { .use-coupon {
display: flex; display: flex;
flex-flow: column; flex-flow: column;
height: 100%; height: 100%;
background-color: #f5f5f5; background-color: #f5f5f5;
.coupons-area { .coupons-area {
padding: 72px 12px 0px; padding: 72px 12px 0px;
background: $bg_f5f5f5; background: $bg_f5f5f5;
flex: 1 1 auto; flex: 1 1 auto;
.empty { .empty {
min-height: 211px; min-height: 211px;
line-height: 211px; line-height: 211px;
font-size: $font_12; font-size: $font_12;
color: $color_666; color: $color_666;
text-align: center; text-align: center;
}
.invalid-title {
text-align: center;
font-size: $font_12;
line-height: 52px;
color: $color_999;
}
}
.free-coupon-box {
position: fixed;
width: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
background: rgba(0,0,0,.6);
z-index: 11;
.free-coupon-content {
width: 290px;
border-radius: 10px;
background-color: #fff;
padding: 20px;
margin: 150px auto 0 auto;
.coures-content-success {
height: 30px;
line-height: 30px;
i {
font-size: 34px;
color: #09f;
} }
}
.coures-content-title {
font-size: 15px;
color: #333;
margin-top: 10px;
}
.invalid-title{ .coures-content-img {
text-align: center; width: 150px;
font-size: $font_12; height: 108px;
line-height: 52px; border-radius: 3px;
color: $color_999; margin-top: 20px;
}
.coures-content-tip {
color: #FF3131;
font-size: 12px;
margin-top: 20px;
text-align: left;
line-height: 15px;
height: 30px;
i {
display: inline-block;
color: #FF3131;
font-size: 18px;
position: relative;
top: 6px;
}
span{
display: inline-block;
margin-left: 20px;
position: relative;
top: -15px;
} }
}
.toStudy {
display: inline-block;
width: 138px;
height: 30px;
line-height: 30px;
background-color: #09f;
border-radius: 15px;
margin-top: 20px;
font-size: 15px;
color: #fff;
}
}
.free-coupon-close {
margin-top: 30px;
i{
font-size: 26px;
color: #fff;
}
} }
}
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ import {bindActionCreators} from "redux"; ...@@ -18,6 +18,7 @@ import {bindActionCreators} from "redux";
import {delCountryNum} from './../country/countryRedux'; import {delCountryNum} from './../country/countryRedux';
import RedPacket from './redPacket'; import RedPacket from './redPacket';
import {Link} from "react-router-dom";
class Detail extends Component { class Detail extends Component {
...@@ -318,13 +319,25 @@ class Detail extends Component { ...@@ -318,13 +319,25 @@ class Detail extends Component {
} }
// 点击子组件试听按钮 // 点击子组件试听按钮
toAudition = (v_course_id, video_id) => { toAudition = (vCourseId,videoId) => {
const {user} = this.props const {user} = this.props
const uid = user && user.data && user.data.uid const uid = user && user.data && user.data.uid
if (!uid) { if (!uid) {
this.props.history.push('/passport/login') this.props.history.push('/passport/login')
} else { } else {
this.props.history.push(`/play/video?id=${v_course_id}&video_id=${video_id}`); if(videoId == '' || videoId == 0 || videoId == undefined){
return false;
}
http.post(`${API['base-api']}/sys/get_class_audition?video_id=${videoId}`).then((res) => {
if (res.data.errno == 200) {
this.props.history.push(`/play/video?id=${vCourseId + '&video_id=' + videoId}`)
}else {
Toast.info(res.data.msg, 2);
}
})
// this.setState({
// auditionBox: true,
// })
} }
} }
// 点击子组件单集购买按钮 // 点击子组件单集购买按钮
......
...@@ -40,7 +40,7 @@ class MyEdut extends PureComponent { ...@@ -40,7 +40,7 @@ class MyEdut extends PureComponent {
// 退出登录 // 退出登录
outLogin = () => { outLogin = () => {
this.props.logout() this.props.logout()
Toast.info('已退出', 2) Toast.info('已退出', 2, null, false)
this.props.history.push('/my') this.props.history.push('/my')
} }
......
...@@ -9,9 +9,9 @@ import ForgotPassword from './forgotPassword' ...@@ -9,9 +9,9 @@ import ForgotPassword from './forgotPassword'
import SetPassword from './setPassword' import SetPassword from './setPassword'
import BindingTel from './bindingTel' import BindingTel from './bindingTel'
import ForgotPasswordEmail from './forgotPasswordEmail' import ForgotPasswordEmail from './forgotPasswordEmail'
import { connect } from "react-redux"; import { connect } from "react-redux"
import { compose } from "redux"; import { compose } from "redux"
import {getParam} from "@/utils"; import { getParam } from "@/utils"
import account from './icons/account.png' import account from './icons/account.png'
import qq from './icons/qq.png' import qq from './icons/qq.png'
...@@ -22,12 +22,13 @@ import wechat from './icons/wechat.png' ...@@ -22,12 +22,13 @@ import wechat from './icons/wechat.png'
class Passport extends Component { class Passport extends Component {
redirectURL = '/' redirectURL = '/'
count = 1
constructor(props) { constructor(props) {
super(props); super(props)
const {location} = props const {location} = props
const {pathname, search, hash} = location const {pathname, search, hash} = location
const {from} = location.state || {from: {pathname: pathname, search: search, hash: hash}} const from = location.state && location.state.from || {pathname: pathname, search: search, hash: hash}
this.redirectURL = window.location.origin + from.pathname + from.search + from.hash this.redirectURL = window.location.origin + from.pathname + from.search + from.hash
this.state = { this.state = {
loginWays: [ loginWays: [
...@@ -60,27 +61,33 @@ class Passport extends Component { ...@@ -60,27 +61,33 @@ class Passport extends Component {
componentDidMount() { componentDidMount() {
this.routeWhenUserLoggedIn() const {history} = this.props
if (!window.passportHistoryListener) {
this.unlisten = history.listen((location, action) => {
window.passportHistoryListener = this.unlisten
location.pathname !== '/country' && !location.pathname.startsWith('/passport') && this.unlisten()
if (action === 'PUSH') {
this.count++
} else if (action === 'POP') {
this.count--
}
})
}
} }
componentDidUpdate() { componentDidUpdate() {
this.routeWhenUserLoggedIn() this.routeWhenUserLoggedIn()
} }
routeWhenUserLoggedIn = () => { routeWhenUserLoggedIn = () => {
let {history, location} = this.props let {hasError} = this.props.user
let {data} = this.props.user if (!hasError) {
if (data && Object.values(data).filter(item => !!item).length) { const redirectURI = getParam('redirect')
if (history.action === 'POP' && history.length <= 3) { redirectURI ? (window.location.href = redirectURI) : this.props.history.go(-this.count)
history.push('/')
} else {
if (!(this.props.user && this.props.user.stage)) {
const from = location.state && location.state.from || {pathname: '/', search: ''};
const redirectURI = getParam('redirect')
redirectURI ? (window.location.href = redirectURI) : history.replace(from);
}
}
} }
} }
......
...@@ -43,7 +43,8 @@ class Preferential extends Component { ...@@ -43,7 +43,8 @@ class Preferential extends Component {
http.get(`${API.home}/m/home/bargainZone`).then((res) => { http.get(`${API.home}/m/home/bargainZone`).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
dataList: res.data.data dataList: res.data.data,
isLoading: false,
}) })
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
...@@ -55,7 +56,8 @@ class Preferential extends Component { ...@@ -55,7 +56,8 @@ class Preferential extends Component {
http.get(`${API.home}/m/home/grouponList`).then((res) => { http.get(`${API.home}/m/home/grouponList`).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
dataList: res.data.data dataList: res.data.data,
isLoading: false,
}) })
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
...@@ -64,7 +66,10 @@ class Preferential extends Component { ...@@ -64,7 +66,10 @@ class Preferential extends Component {
} }
// tab 切换 // tab 切换
ontabclick = (tab, index) => { ontabclick = (tab, index) => {
this.state.courseStatus = index this.setState({
courseStatus: index,
isLoading: true,
})
switch (index) { switch (index) {
case 0: case 0:
this.specialSale() this.specialSale()
...@@ -104,66 +109,67 @@ class Preferential extends Component { ...@@ -104,66 +109,67 @@ class Preferential extends Component {
animated={false} animated={false}
onChange={(tab, index) => this.ontabclick(tab, index)} onChange={(tab, index) => this.ontabclick(tab, index)}
swipeable={false} swipeable={false}
page={this.state.courseStatus}
renderTabBar={props => <div className={'custom-tab-bar'}> renderTabBar={props => <div className={'custom-tab-bar'}>
<Tabs.DefaultTabBar {...props}/> <Tabs.DefaultTabBar {...props}/>
</div>} </div>}
> >
<div className='tabs'> </Tabs>
<ul> <div className='tabs'>
{this.state.dataList.map((item, index) => { <ul>
const Info = ( {this.state.dataList.map((item, index) => {
<div className="info"> const Info = (
<p className='title' onClick={() => this.toCourseDetail(item.course_id)}> <div className="info">
{/* <Link to={`/detail?id=${item.course_id}`}> */} <p className='title' onClick={() => this.toCourseDetail(item.course_id)}>
{item.course_title} {/* <Link to={`/detail?id=${item.course_id}`}> */}
{/* </Link> */} {item.course_title}
</p> {/* </Link> */}
<p className='contact text-overflow-2'>{item.course_desc}</p> </p>
<div className='des'> <p className='contact text-overflow-2'>{item.course_desc}</p>
{!item.is_buy && <div className='des'>
<p className="course-price"> {!item.is_buy &&
{this.state.courseStatus === 0 && <p className="course-price">
<span className='price'>特惠价:</span> {this.state.courseStatus === 0 &&
} <span className='price'>特惠价:</span>
<span className="new">¥{item.price1}</span>
<span className="old">¥{item.price0}</span>
</p>
}
{item.is_buy &&
<a className="isbuy">已购买</a>
} }
</div> <span className="new">¥{item.price1}</span>
</div> <span className="old">¥{item.price0}</span>
) </p>
const status = (
!item.is_buy &&
<div>
{this.state.courseStatus === 1 &&
<p className='course-status'>砍价减{item.bargain_price}</p>
}
{this.state.courseStatus === 2 &&
<p className='course-status'>拼团价{item.price}</p>
} }
{ {item.is_buy &&
item.is_aist && <span className='return_cash'></span> <a className="isbuy">已购买</a>
} }
</div> </div>
) </div>
return ( )
<VList const status = (
key={index} !item.is_buy &&
img={item.image_name} <div>
id={item.course_id} {this.state.courseStatus === 1 &&
status={status} <p className='course-status'>砍价减{item.bargain_price}</p>
info={Info} }
toDetail={this.toCourseDetail} {this.state.courseStatus === 2 &&
/> <p className='course-status'>拼团价{item.price}</p>
) }
})} {
</ul> item.is_aist && <span className='return_cash'></span>
}
</div>
)
return (
<VList
key={index}
img={item.image_name}
id={item.course_id}
status={status}
info={Info}
toDetail={this.toCourseDetail}
/>
)
})}
</ul>
</div> </div>
</Tabs>
<WhiteSpace/> <WhiteSpace/>
</div> </div>
</Loading> </Loading>
......
...@@ -82,6 +82,10 @@ class Purchased extends Component { ...@@ -82,6 +82,10 @@ class Purchased extends Component {
const status = ( const status = (
item.is_aist && <span className='status'>返现</span> item.is_aist && <span className='status'>返现</span>
) )
const courseExpire = (
item.course_expire && item.course_expire!='' &&
<span className='course-expire'>{item.course_expire}</span>
)
return ( return (
<VList <VList
key={index} key={index}
...@@ -89,6 +93,7 @@ class Purchased extends Component { ...@@ -89,6 +93,7 @@ class Purchased extends Component {
id={item.course_id} id={item.course_id}
info={Info} info={Info}
status={status} status={status}
courseExpire={courseExpire}
toDetail={this.toCourseDetail} toDetail={this.toCourseDetail}
/> />
) )
......
...@@ -110,5 +110,18 @@ html, body, #root { ...@@ -110,5 +110,18 @@ html, body, #root {
color: #fff; color: #fff;
background: linear-gradient(to bottom, #FF4000, #FD7700); background: linear-gradient(to bottom, #FF4000, #FD7700);
} }
.course-expire{
display: inline-block;
text-align: center;
position: absolute;
bottom: 10px;
left: 0;
width:92px;
height:20px;
line-height: 21px;
background-color: #FF3A3A;
border-radius:0 10px 10px 0;
color: #fff;
font-size: 12px;
}
} }
\ No newline at end of file
...@@ -31,6 +31,7 @@ class _Scholarship extends Component { ...@@ -31,6 +31,7 @@ class _Scholarship extends Component {
isLoading: false, isLoading: false,
showNoData: false, showNoData: false,
hasMore: true, hasMore: true,
tab: 0,
} }
this.downImage = React.createRef(); this.downImage = React.createRef();
this.tabIndex = 0; this.tabIndex = 0;
...@@ -307,6 +308,7 @@ class _Scholarship extends Component { ...@@ -307,6 +308,7 @@ class _Scholarship extends Component {
isLoading: false, isLoading: false,
hasMore: true, hasMore: true,
dataSource: this.state.dataSource.cloneWithRows(this.rData), dataSource: this.state.dataSource.cloneWithRows(this.rData),
tab: index,
}, },
() => { () => {
this.onEndReached(); this.onEndReached();
...@@ -314,43 +316,52 @@ class _Scholarship extends Component { ...@@ -314,43 +316,52 @@ class _Scholarship extends Component {
); );
}} }}
> >
<div style={{ marginTop: '15px', backgroundColor: '#FFF' }}> </Tabs>
{ {
this.state.dataSource._cachedRowCount !== 0 ? ( this.state.tab === 0 ? (
<ListView <div style={{ marginTop: '15px', backgroundColor: '#FFF' }}>
useBodyScroll={this.state.useBodyScroll} {
dataSource={this.state.dataSource} this.state.dataSource._cachedRowCount !== 0 ? (
renderRow={row} <ListView
renderBodyComponent={() => <div />} useBodyScroll={this.state.useBodyScroll}
onEndReached={this.onEndReached} dataSource={this.state.dataSource}
pageSize={4} renderRow={row}
onEndReachedThreshold={100} renderBodyComponent={() => <div />}
/> onEndReached={this.onEndReached}
) : ( pageSize={4}
onEndReachedThreshold={100}
/>
) : (
null null
) )
} }
</div>
) : null
}
</div> {
<div> this.state.tab === 1 ? (
<Flex justify='center' align='center' className={'runtimeList'}>榜单实时更新,仅显示前50</Flex> <div>
{ <Flex justify='center' align='center' className={'runtimeList'}>榜单实时更新,仅显示前50</Flex>
this.state.dataSource._cachedRowCount !== 0 ? ( {
<ListView this.state.dataSource._cachedRowCount !== 0 ? (
useBodyScroll={this.state.useBodyScroll} <ListView
dataSource={this.state.dataSource} useBodyScroll={this.state.useBodyScroll}
renderRow={row1} dataSource={this.state.dataSource}
renderBodyComponent={() => <div />} renderRow={row1}
onEndReached={this.onEndReached} renderBodyComponent={() => <div />}
pageSize={4} onEndReached={this.onEndReached}
onEndReachedThreshold={100} pageSize={4}
/> onEndReachedThreshold={100}
) : ( />
) : (
null null
) )
} }
</div> </div>
</Tabs> ) : null
}
</div> </div>
</div> </div>
......
...@@ -152,6 +152,10 @@ class MyCourses extends Component { ...@@ -152,6 +152,10 @@ class MyCourses extends Component {
const status = ( const status = (
item.is_aist && <span className='status'>返现</span> item.is_aist && <span className='status'>返现</span>
) )
const courseExpire = (
item.course_expire && item.course_expire!='' &&
<span className='course-expire'>{item.course_expire}</span>
)
return ( return (
<VList img={item.image_name} <VList img={item.image_name}
handleClick={this.handleClick} handleClick={this.handleClick}
...@@ -159,6 +163,7 @@ class MyCourses extends Component { ...@@ -159,6 +163,7 @@ class MyCourses extends Component {
key={index} key={index}
info={Info} info={Info}
status={status} status={status}
courseExpire={courseExpire}
id={item['v_course_id']} id={item['v_course_id']}
/> />
) )
......
...@@ -150,4 +150,18 @@ ...@@ -150,4 +150,18 @@
color: #fff; color: #fff;
background: linear-gradient(to bottom, #FF4000, #FD7700); background: linear-gradient(to bottom, #FF4000, #FD7700);
} }
.course-expire{
display: inline-block;
text-align: center;
position: absolute;
bottom: 10px;
left: 0;
width:92px;
height:20px;
line-height: 21px;
background-color: #FF3A3A;
border-radius:0 10px 10px 0;
color: #fff;
font-size: 12px;
}
} }
\ No newline at end of file
...@@ -14,15 +14,15 @@ function RouteMiddlePage(props) { ...@@ -14,15 +14,15 @@ function RouteMiddlePage(props) {
if (!user.isFetching) { if (!user.isFetching) {
if (user.hasError) { if (user.hasError) {
history.replace('/passport', {from: location}) history.push('/passport', {from: location})
setLoadingState(false) setLoadingState(false)
} else { } else {
let {data} = user || {data: {}} let {data} = user || {data: {}}
if (data && Object.values(data).every(item => !!item)) { if (data && Object.values(data).every(item => !!item)) {
history.replace(location.pathname) history.push(location.pathname)
setLoadingState(false) setLoadingState(false)
} else { } else {
history.replace('/passport', {from: location}) history.push('/passport', {from: location})
} }
} }
} }
......
...@@ -29,8 +29,8 @@ const MyEdit = loadable(() => import(/* webpackChunkName: 'MyEdit'*/'@/component ...@@ -29,8 +29,8 @@ const MyEdit = loadable(() => import(/* webpackChunkName: 'MyEdit'*/'@/component
const Classify = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/classify')) const Classify = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/classify'))
const CampTest = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campTest')) const CampTest = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campTest'))
const CampResolve = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campResolve')) const CampResolve = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campResolve'))
const ShareCourse = loadable(() => import('@/components/ShareCourse/index')) const ShareCourse = loadable(() => import(/* webpackChunkName: 'ShareCourse'*/'@/components/ShareCourse/index'))
const Country = loadable(() => import('@/components/country/index')) const Country = loadable(() => import(/* webpackChunkName: 'Country' */'@/components/country/index'))
export default [ export default [
{ {
path: '/', path: '/',
......
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