Commit d669b678 by wangshuo

合并master

parents e18d5e04 1670e3e8
......@@ -14,7 +14,11 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");
importScripts(
<<<<<<< HEAD
"/precache-manifest.24de3a7f1901319e314914a540e9db15.js"
=======
"/precache-manifest.abe621760f8f2b29b2d7a83410923ff7.js"
>>>>>>> master
);
workbox.clientsClaim();
......
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 { initialState } from "@/store/userReducer"
import { withRouter, Link } 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 {initialState} from "@/store/userReducer"
import {withRouter, Link} 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 stringify from 'json-stringify-safe'
......@@ -24,6 +24,13 @@ import './assets/css/index.scss'
import './assets/font/iconfont.css'
class App extends Component {
constructor(props) {
super(props)
this.state = {
isShowActivityEntry: 0,
isShowChannel: 0
}
}
static displayName = 'App'
......@@ -36,20 +43,15 @@ class App extends Component {
firstLoad = true
componentWillMount() {
if (!getParam('version')) {
if (!cookie.get('qimoClientIdedu')) {
this.getqimoClientId()
} else {
window.qimoClientId = cookie.get('qimoClientIdedu')
}
}
let url = window.location.href;
if(url.indexOf('ccode')) {
if(url.indexOf('ccode') > -1) {
cookie.set('ccode', getParam('ccode'), { expires: 1, domain: '.julyedu.com', path: '/' })
}
}
componentDidMount() {
this.getStage()
this.umengStatistic()
//平台信息
!getParam('version') && cookie.set('plat', '5', {domain: '.julyedu.com'})
......@@ -96,10 +98,25 @@ class App extends Component {
this.removeShareCodeCookie()
}
})
}
// 获取宝箱阶段
getStage = () => {
let ccode = cookie.get('ccode')
http.get(`${API.home}/activity/stage?ccode=${ccode}`).then(res => {
const {code, data, msg} = res.data
if (code === 200) {
// treasure_stage,宝箱阶段,0-不在活动时间,1-活动时间内
this.setState({
isShowActivityEntry: data.treasure_stage,
isShowChannel: data.is_show_site_window_by_channel
})
if (!getParam('version')) {
this.QimoClient()
window.sessionStorage.setItem('isShowSiteWindowByChannel', data.is_show_site_window_by_channel)
} else {
Toast.info(msg, 2)
}
})
}
umengStatistic = () => {
......@@ -209,6 +226,7 @@ class App extends Component {
if (!this.props.user.hasError && getParam('redirect')) {
window.location.href = getParam('redirect')
}
}
setPreviousLocation = () => {
......@@ -282,51 +300,15 @@ class App extends Component {
}
}
// 七陌客服代码 start
getqimoClientId = () => {
http.post(`${API['home']}/qiMoUserId`)
.then(res => {
if (res.data.code == 200) {
window.qimoClientId = res.data.data.userId
cookie.set('qimoClientIdedu', res.data.data.userId, {domain: '.julyedu.com'})
}
})
.catch(function () {
})
}
QimoClient = () => {
let zhihu_cb = getParam('cb')
var src = ''
// 知乎投放
if (zhihu_cb) {
src = 'https://webchat.7moor.com/javascripts/7moorInit.js?accessId=e2ca4f90-2d04-11ea-84c3-43908ae47640&autoShow=false&language=ZHCN'
} else {
// m端
src = 'https://webchat.7moor.com/javascripts/7moorInit.js?accessId=fbcf9aa0-2d03-11ea-84c3-43908ae47640&autoShow=false&language=ZHCN'
}
var script = document.createElement('script')
script.type = 'text/javascript'
script.src = src
script.async = 'async'
document.body.appendChild(script)
}
// 七陌客服代码 end
render() {
return <>
<Routes/>
{
/*this.state.isShowActivityEntry &&
!!this.state.isShowActivityEntry && !!this.state.isShowChannel &&
<Link className={'year19-index'} to="/box/boxActive">
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/treasure-active/m/global-entry.png" alt=""/>
</Link>*/
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/treasure-active/m/global-entry.png"
alt=""/>
</Link>
}
</>
}
......
......@@ -633,3 +633,8 @@
height: 8px;
background-color: #F3F4F8;
}
.index-box ~ .year19-index {
display: none;
}
\ No newline at end of file
......@@ -221,7 +221,7 @@ class YearCourse extends Component {
toQQque = () => {
if (!getParam('version')) {
qimoChatClick()
location.href = 'http://q.url.cn/s/Vbkup6m?_type=wpa'
} else {
SendMessageToApp("toQQ", 'https://q.url.cn/AB8aue?_type=wpa&qidian=true')
}
......
......@@ -43,7 +43,7 @@ class Landing extends Component {
this.fetchPageData()
this.getIndexData()
window.showFollowAlert = this.remind.bind(this, 'create')
document.title = 'AI充电季,开宝箱免费学AI爆款好课,300本程序员必备纸质书免费送,AI进阶宝典来就送!-七月在线'
document.title = 'AI就业季,开宝箱免费拿VIP年会员,200本程序员必备纸质书免费包邮送!- 七月在线'
const landing = document.querySelector('#landing')
const boxContainer = document.querySelector('.box-container')
if (boxContainer.offsetHeight < window.innerHeight) {
......@@ -89,7 +89,7 @@ class Landing extends Component {
http.get(`${API.home}/activity/stage`).then(res => {
const {code, data, msg} = res.data
if (code === 200) {
if (Number(data.activity_stage) === 0) {
if (Number(data.treasure_stage) === 0) {
this.props.history.push('/');
return;
}
......
......@@ -43,7 +43,7 @@ class MyTreasure extends Component {
componentDidMount() {
this.fetchMyTreasure()
this.fetchActivityStatus()
document.title = 'AI充电季,开宝箱免费学AI爆款好课,300本程序员必备纸质书免费送,AI进阶宝典来就送!-七月在线';
document.title = 'AI就业季,开宝箱免费拿VIP年会员,200本程序员必备纸质书免费包邮送!- 七月在线';
}
componentWillReceiveProps(nextProp) {
......@@ -309,7 +309,7 @@ class MyTreasure extends Component {
http.get(`${API.home}/activity/stage`).then(res => {
const {code, data} = res.data
if (code === 200) {
if(Number(data.activity_stage) === 0) {
if(Number(data.treasure_stage) === 0) {
this.props.history.push('/');
return;
}
......
......@@ -221,7 +221,7 @@ class YearCourse extends Component {
toQQque = () => {
if (!getParam('version')) {
qimoChatClick()
location.href = 'http://q.url.cn/s/Vbkup6m?_type=wpa'
} else {
SendMessageToApp("toQQ", 'https://q.url.cn/AB8aue?_type=wpa&qidian=true')
}
......
......@@ -39,7 +39,7 @@ export default class index extends Component {
_this.loginInfo(result)
}
_this.getStage()
document.title = 'AI充电季,开宝箱免费学AI爆款好课,300本程序员必备纸质书免费送,AI进阶宝典来就送!-七月在线';
document.title = 'AI就业季,开宝箱免费拿VIP年会员,200本程序员必备纸质书免费包邮送!- 七月在线';
}
// 获取app登录数据
......@@ -110,7 +110,7 @@ export default class index extends Component {
http.get(`${API.home}/activity/stage`).then(res => {
const {code, data, msg} = res.data
if (code === 200) {
if(Number(data.activity_stage) === 0) {
if(Number(data.treasure_stage) === 0) {
this.props.history.push('/');
return;
}
......
......@@ -23,9 +23,9 @@ class YarnWish extends Component {
componentWillUpdate() {
const {activityStage} = this.state
if (activityStage == 1) {
document.title = `七月在线年终大回馈,人气好课免费学,精品课程1分抢!`
document.title = `AI就业季,开宝箱免费拿VIP年会员,200本程序员必备纸质书免费包邮送!- 七月在线`
} else {
document.title = `七月在线年终大回馈,人气好课免费学,精品课程1分抢!`
document.title = `AI就业季,开宝箱免费拿VIP年会员,200本程序员必备纸质书免费包邮送!- 七月在线`
}
}
......
......@@ -313,10 +313,6 @@ class BtnStatus extends Component {
});
}
qimoChatClick = () => {
qimoChatClick()
}
render() {
// data 课程信息;barInfo 砍价信息
const {user = {}, toCart, country} = this.props;
......@@ -355,7 +351,7 @@ class BtnStatus extends Component {
{
info.is_baoming === 0 && info.group_status !== 3 &&
<div className='btns-box'>
<a className='consult consult-s' onClick={() => this.qimoChatClick()}>
<a className='consult consult-s' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -376,7 +372,7 @@ class BtnStatus extends Component {
{
info.is_baoming === 0 && info.is_deposit != 0 &&
<div className='btns-box'>
<a className='consult consult-m' onClick={() => this.qimoChatClick()}>
<a className='consult consult-m' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'/>
<span>课程咨询</span>
</a>
......@@ -390,7 +386,7 @@ class BtnStatus extends Component {
{
info.is_baoming === 1 &&
<div className='btns-box'>
<a className='consult consult-m' onClick={() => this.qimoChatClick()}>
<a className='consult consult-m' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'/>
<span>课程咨询</span>
</a>
......@@ -403,7 +399,7 @@ class BtnStatus extends Component {
{
info.is_baoming === 0 && info.group_status === 3 &&
<div className='btns-box'>
<a className='consult consult-s' onClick={() => this.qimoChatClick()}>
<a className='consult consult-s' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -424,7 +420,7 @@ class BtnStatus extends Component {
{
info.is_baoming === 0 && info.group_status === 4 &&
<div className='btns-box'>
<a className='consult consult-s' onClick={() => this.qimoChatClick()}>
<a className='consult consult-s' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -438,7 +434,7 @@ class BtnStatus extends Component {
{
info.is_baoming === 0 && this.props.data && this.props.data.is_bargain &&
<div className='btns-box'>
<a className='consult consult-s' onClick={() => this.qimoChatClick()}>
<a className='consult consult-s' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -466,7 +462,7 @@ class BtnStatus extends Component {
{
this.state.isbuy === 20 &&
<div className='btns-box'>
<a className='consult-l' onClick={() => this.qimoChatClick()}>
<a className='consult-l' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -477,7 +473,7 @@ class BtnStatus extends Component {
{
(info.is_aist && (this.props.user.hasError || info.is_baoming === 0)) &&
<div className='btns-box'>
<a className='consult consult-m' onClick={() => this.qimoChatClick()}>
<a className='consult consult-m' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -491,7 +487,7 @@ class BtnStatus extends Component {
{
info.is_aist && !this.props.user.hasError && info.is_baoming === 1 &&
<div className='btns-box'>
<a className='consult consult-m' onClick={() => this.qimoChatClick()}>
<a className='consult consult-m' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......@@ -531,7 +527,7 @@ class BtnStatus extends Component {
* limit_free_status: 0 未领取 1已领取未过期 2已过期
* */
info.is_baoming === 0 && info.is_limit_free && info.limit_free_status == 0 && <div className='btns-box'>
<a className='consult consult-m' onClick={() => this.qimoChatClick()}>
<a className='consult consult-m' href='http://q.url.cn/s/Vbkup6m?_type=wpa'>
<i className='iconfont iconerji'></i>
<span>课程咨询</span>
</a>
......
......@@ -50,6 +50,7 @@ class Detail extends Component {
isRedPacket: true,
countDownTime: '20s',
isShowChannel: window.sessionStorage.getItem('isShowSiteWindowByChannel')
}
}
......@@ -78,7 +79,6 @@ class Detail extends Component {
if (getParam('ac') && Number(getParam('ac')) === 11) {
this.getBorwerCourse();
}
}
getBorwerCourse = () => {
......@@ -575,7 +575,11 @@ class Detail extends Component {
<ExpandActiveToast/>
{
this.state.isShowChannel == 1 &&
<CallApp className='toapp' path={`/detail/id=${getParam('id')}`}/>
}
{/*弹幕*/}
<Barrage isShow={course_info.is_show}/>
......
......@@ -28,7 +28,8 @@ class PythonDes extends Component {
toApp: false,
payMoney: 0,
isOnline: true, //课程是否上架
courseInfo: {}
courseInfo: {},
isShowChannel: window.sessionStorage.getItem('isShowSiteWindowByChannel')
}
}
......@@ -219,9 +220,10 @@ class PythonDes extends Component {
)
}
{
this.state.isShowChannel == 1 &&
<CallApp className='toapp'/>
}
{/* 课程介绍 */}
<Description/>
......
......@@ -14,7 +14,9 @@ class PythonStudy extends Component {
toApp: false,
courseInfo: '',
syllabus: '',
learning: ''
learning: '',
isShowChannel: window.sessionStorage.getItem('isShowSiteWindowByChannel')
};
}
......@@ -112,7 +114,10 @@ class PythonStudy extends Component {
</div>
}
{
this.state.isShowChannel == 1 &&
<CallApp className='toapp'/>
}
</div>
{
......
......@@ -71,6 +71,21 @@ class Login extends Component {
history.push('/passport/student-login')
}
componentDidMount() {
const {location} = this.props
const {action} = this.props.history
let pathname = location.state && location.state.from && location.state.from.pathname
let search = location.state && location.state.from && location.state.from.search
console.log(action,pathname,search);
if(action !== 'POP'){
let historyUrl = `${pathname}${search}`
window.localStorage.setItem('HistoryUrl',historyUrl)
}
}
render() {
const {
loginWays,
......
......@@ -15,6 +15,35 @@ import { connect } from "react-redux"
import { setCurrentUser } from '@/store/userAction'
class SetPassword extends Component {
toFrom = () => {
let historyUrl = window.localStorage.getItem('HistoryUrl')
const {history} = this.props
history.push(historyUrl)
// window.localStorage.removeItem('HistoryUrl')
return
}
//
// componentDidMount() {
// const {location} = this.props
// const {action} = this.props.history
// let pathname = location.state && location.state.from && location.state.from.pathname
// let search = location.state && location.state.from && location.state.from.search
//
// console.log(location);
// console.log(location.state);
// console.log(action,pathname,search);
//
// // if(action !== 'PUSH'){
// // let historyUrl = `${pathname}${search}`
// // window.localStorage.setItem('HistoryUrl',historyUrl)
// // }
//
// }
render() {
let {values, errors, location} = this.props
let {from} = location.state || {from: {pathname: '/'}}
......@@ -52,7 +81,7 @@ class SetPassword extends Component {
</Form>
<div className="skip"
style={{display: from && from.pathname.includes('forgot-password') ? 'none' : 'block'}}>
<Link replace to='/passport/account-login'>跳过</Link>
<span onClick={this.toFrom}>跳过</span>
</div>
</div>
</>
......@@ -68,7 +97,6 @@ const formikConfig = {
}
},
handleSubmit: (values, {props}) => {
const {location} = props
let from = location.state && location.state.records && location.state.records[location.state.records.length - 2] || {pathname: '/'}
......@@ -117,7 +145,6 @@ function forgotPasswordReset(values, props) {
}
function bindMobileSetPassword(values, props) {
http.post(`${API['passport-api']}/bind_mobile/set_pwd_new`, {
uid: props.user.data.uid,
password: encrypt(values.password)
......@@ -128,10 +155,21 @@ function bindMobileSetPassword(values, props) {
Toast.info('密码设置成功')
let from = location.state && location.state.from || {pathname: '/'}
let local_redirect_url = JSON.parse(window.localStorage.getItem('binding_redirect'))
setTimeout(function () {
if (local_redirect_url) {
const {pathname, search, hash} = local_redirect_url
history.replace(pathname + search + hash)
// setTimeout(function () {
// if (local_redirect_url) {
// const {pathname, search, hash} = local_redirect_url
// history.replace(pathname + search + hash)
// } else {
// history.replace(from.pathname)
// }
// }, 1000)
let HistoryUrl = window.localStorage.getItem('HistoryUrl')
setTimeout(()=> {
if (HistoryUrl) {
let historyUrl = window.localStorage.getItem('HistoryUrl')
props.history.push(historyUrl)
} else {
history.replace(from.pathname)
}
......
......@@ -15,7 +15,8 @@ class PythonStudy extends Component {
toApp: false,
courseInfo: '',
syllabus: '',
learning: ''
learning: '',
isShowChannel: window.sessionStorage.getItem('isShowSiteWindowByChannel')
};
}
......@@ -115,7 +116,10 @@ class PythonStudy extends Component {
</div>
}
<CallApp className={'toapp'}/>
{
this.state.isShowChannel == 1 &&
<CallApp className='toapp'/>
}
<Accordion
defaultActiveKey="0"
......
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