Commit 6fb33331 by xuzhenghua

pre

parents fb6c8d86 62c9455f
......@@ -1508,11 +1508,6 @@
"minimist": "^1.2.0"
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"resolve": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
......@@ -1598,6 +1593,11 @@
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
......@@ -3984,6 +3984,14 @@
"resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
"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": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz",
......@@ -5405,9 +5413,12 @@
}
},
"eslint-utils": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz",
"integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q=="
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz",
"integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==",
"requires": {
"eslint-visitor-keys": "^1.0.0"
}
},
"eslint-visitor-keys": {
"version": "1.0.0",
......@@ -9252,9 +9263,9 @@
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4="
},
"lodash.mergewith": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz",
"integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ=="
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz",
"integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ=="
},
"lodash.sortby": {
"version": "4.7.0",
......@@ -9736,9 +9747,9 @@
}
},
"mixin-deep": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
"integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
"integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
"requires": {
"for-in": "^1.0.2",
"is-extendable": "^1.0.1"
......@@ -12068,6 +12079,15 @@
}
}
},
"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": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-8.0.0.tgz",
......@@ -13325,9 +13345,9 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"set-value": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
"integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
"integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
"requires": {
"extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1",
......@@ -14472,6 +14492,11 @@
"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": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
......@@ -14657,35 +14682,14 @@
}
},
"union-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
"integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
"integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
"requires": {
"arr-union": "^3.1.0",
"get-value": "^2.0.6",
"is-extendable": "^0.1.1",
"set-value": "^0.4.3"
},
"dependencies": {
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"requires": {
"is-extendable": "^0.1.0"
}
},
"set-value": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz",
"integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=",
"requires": {
"extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1",
"is-plain-object": "^2.0.1",
"to-object-path": "^0.3.0"
}
}
"set-value": "^2.0.1"
}
},
"uniq": {
......
......@@ -44,6 +44,8 @@ class App extends Component {
script.language = 'JavaScript';
document.body.appendChild(script);
this.setNavigationRecord(this.props.location)
//平台信息
cookie.set('plat', '5', {domain: '.julyedu.com'})
......@@ -56,8 +58,9 @@ class App extends Component {
const routeMatchRule = /binding-tel|forgot|set-password/
const {history} = this.props
history.listen(location => {
if(cookie.get('uid') && this.props.user.hasError){
history.listen((location, action) => {
this.setNavigationRecord(location)
if (cookie.get('uid') && this.props.user.hasError) {
this.getUser()
}
const {pathname} = location
......@@ -70,9 +73,19 @@ class App extends Component {
})
}
setNavigationRecord = (location) => {
let {location: _location} = this.props
let {state: _state = {}} = _location
let {state = {}} = location
location.state = {
...state, ...{
record: _state.record ?
[..._state.record, {pathname: location.pathname}] :
[{pathname: location.pathname}]
}
}
}
getUser = () => {
......
......@@ -9,10 +9,15 @@ class HeaderBar extends Component {
}
goBack = () => {
const {state} = this.props.location
if(browser.isWeixin && getParam('code') && getParam('state')){
window.history.go(-2)
}
if(state.record && state.record.length > 1){
window.history.go(-1);
}else{
window.location.href = window.location.origin
}
}
toLink = () => {
......
body {
height: 100%;
}
#root {
height: 100%;
// background-color: #F5F5F5;
}
.page-body {
height: 100%;
// background-color: #F5F5F5;
}
.country-header {
margin: 0;
padding: 0 13px;
font-size: 15px;
font-family: Hiragino Sans GB;
font-weight: normal;
color: #3E3E3E;
line-height: 28px;
background-color: #F5F5F5;
}
.country-list {
.country-item {
&:nth-child(n+2) {
border-top: 1px solid #ECECEC;
}
}
}
.country-item {
margin: 0 12px;
}
.country-item__link {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
}
.country-name {
font-size: 15px;
font-family: Hiragino Sans GB;
color: #3E3E3E;
}
.country-num {
font-size: 15px;
font-family: Hiragino Sans GB;
color: #555;
}
// NAV
.letter-nav {
position: fixed;
top: 0;
right: 2px;
}
.letter-nav__item {
width: 12px;
// height: 12px;
margin-bottom: 6px;
font-size: 10px;
font-family: Hiragino Sans GB;
color: #0099FF;
text-align: center;
line-height: 12px;
}
.letter-nav__item--active {
border-radius: 50%;
color: #fff;
background-color: #0099FF;
}
\ No newline at end of file
......@@ -595,7 +595,6 @@ class Detail extends Component {
/>
}
{/*砍价*/}
{
course_info.is_baoming === 0 && (!course_info.is_aist) && course_info.is_bargain &&
......
......@@ -496,7 +496,8 @@
.popup-bind__title {
margin: 0;
font-size: 14px;
font-size: 16px;
font-weight: 500;
color: #333;
text-align: center;
line-height: 1;
......@@ -505,7 +506,7 @@
.popup-bind__desc {
margin: 0;
padding: 0 20px;
font-size: 12px;
font-size: 14px;
color: #666;
text-align: left;
}
......@@ -519,15 +520,22 @@
align-items: center;
height: 30px;
margin: 0 52px;
padding: 0 4px;
text-align: left;
&:nth-child(n+2) {
border-top: 1px solid #E5E5E5;
}
.iconfont {
font-size: 22px;
color: #999;
}
}
.popup-bind__account--name {
margin: 0;
padding-left: 7px;
font-size: 12px;
color: #999;
}
......@@ -546,7 +554,17 @@
display: inline-block;
width: 22px;
height: 22px;
background-image: url('./qq.png');
background-image: url('./QQicon.png');
background-size: auto 100%;
background-repeat: no-repeat;
background-position: center;
}
.icon-wachat {
display: inline-block;
width: 22px;
height: 22px;
background-image: url('./wechat.png');
background-size: 100% auto;
background-repeat: no-repeat;
background-position: center;
......
src/components/detail/redPacket/wechat.png

791 Bytes | W: | H:

src/components/detail/redPacket/wechat.png

782 Bytes | W: | H:

src/components/detail/redPacket/wechat.png
src/components/detail/redPacket/wechat.png
src/components/detail/redPacket/wechat.png
src/components/detail/redPacket/wechat.png
  • 2-up
  • Swipe
  • Onion skin
import React, { PureComponent } from 'react';
import {connect} from 'react-redux';
import SearchHeader from './searchHead'
import VList from '@/common/VList'
import { http, getParam } from '@/utils'
import './search-result.scss'
import Recommendation from './recommendation'
import {getCourses} from './../detail/actions';
import throttle from 'lodash/throttle'
const ForwardRefSearchHead = React.forwardRef((props, ref) => {
return <SearchHeader {...props} forwardedRef={ref}/>
})
const Bottom = ({item}) => {
return (
......@@ -16,17 +20,28 @@ const Bottom = ({item}) => {
)
}
@connect()
class SearchResult extends PureComponent {
prevScrollY = 0
searchHead = React.createRef()
swipeUp = 'up'
swipeDown = 'down'
state = {
courseList: [],
value: '',
searchHistory: JSON.parse(localStorage.getItem('searchHistory')) || []
value: decodeURIComponent(getParam('word')) || '',
searchHistory: JSON.parse(localStorage.getItem('searchHistory')) || [],
fixedHeader: false,
searchHeadStyle: {top: 0},
swipeDirection: this.swipeUp
}
componentDidMount() {
this.getCourses(getParam('word'))
document.addEventListener('scroll', this.handleScroll)
}
componentWillUnmount() {
document.removeEventListener('scroll', this.handleScroll)
}
......@@ -56,22 +71,65 @@ class SearchResult extends PureComponent {
}
toCourseDetail = (id) => {
const { dispatch, history } = this.props;
// dispatch(getCourses(id, () => {
const {history} = this.props;
history.push(`/detail?id=${id}`)
// }));
}
handleScroll = throttle(() => {
let y = window.scrollY, headY = this.searchHead.current.offsetTop
if (y < this.prevScrollY) {
if (this.state.swipeDirection === this.swipeDown) {
y <= headY && this.state.searchHeadStyle.position !== 'fixed' && this.setState({
searchHeadStyle: {
top: `0`,
position: 'fixed'
}
})
} else {
this.setState({
swipeDirection: this.swipeDown
}, () => {
if (this.state.swipeDirection === this.swipeDown) {
this.setState({
searchHeadStyle: {
top: `${y > headY ? y - 44 : y}px`
}
})
}
})
}
} else {
this.state.swipeDirection !== this.swipeUp &&
this.setState({
swipeDirection: this.swipeUp,
searchHeadStyle: {
position: 'absolute',
top: `${y}px`
}
})
}
this.prevScrollY = y
}, 0)
render() {
const {courseList} = this.state
return (
<div className='search-result'>
<SearchHeader
<div
className={'search-result'}>
<ForwardRefSearchHead
handleSearch={this.handleSearch}
value={this.state.value}
handleChange={this.handleChange}
searchHistory={this.state.searchHistory}
style={this.state.searchHeadStyle}
ref={this.searchHead}
/>
{
......@@ -115,7 +173,8 @@ class SearchResult extends PureComponent {
抱歉!没有搜到相关内容
</div>
}
<Recommendation />
<Recommendation/>
</div>
);
}
......
.search-result {
padding-top: 44px;
.search-head{
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
ul {
list-style: none;
}
......
......@@ -38,9 +38,8 @@ class SearchHead extends PureComponent {
render() {
const { isFocus } = this.state;
const cls = classnames('submit-btn', {'submit-btn--active': isFocus})
console.log(isFocus);
return (
<div className="search-head">
<div className="search-head" style={this.props.style} ref={this.props.forwardedRef}>
<div className="left" onClick={this.returnPage}>
<i className="iconfont iconiconfront-68"/>
......@@ -57,6 +56,7 @@ class SearchHead extends PureComponent {
placeholder="搜索课程"
onFocus={() => this.changeFontColor(true)}
onBlur={() => this.changeFontColor(false)}
onSubmit={this.search}
/>
</div>
<div className="right right-btn" onClick={this.search}>
......
......@@ -88,7 +88,7 @@ class Video extends Component {
currentVideoSrc: '',
activeIndex: 0,
isAuth: true,
course: {},
course: {}, // course.course_id 为 0 或 '' 时 为免费课程
salePrice: null,
vCourseId: null,
isLoading: true,
......@@ -369,9 +369,6 @@ class Video extends Component {
this.ws = new WebSocket(API["process-api"]);
this.ws.addEventListener('error', () => {
this.ws = null
/*setTimeout(() => {
this.setupWS();
}, 1000)*/
})
this.ws.addEventListener('close', () => {
if (this.reconnect) {
......@@ -403,21 +400,53 @@ class Video extends Component {
})
}
//告诉服务端切换视频
//告诉服务端计算进度 普通课程不发送
countSchedule = () => {
const {videoList, activeIndex, vCourseId, course={}} = this.state
if(Number(course.course_id) === 0 || course.course_id === '') {
console.log('免费课程 拦截');
return;
}
if(course.is_aist) {
// 返现课程
this.sendMessage({
mtype: 'count_schedule',
uid: this.props.user.data.uid,
token: this.token,
platform: 5
})
}else{
// 普通课程
this.sendMessage({
mtype: 'c_count_schedule',
uid: this.props.user.data.uid,
token: this.token,
platform: 5,
video_id: videoList[activeIndex]['id'],
course_id: this.courseID,
v_course_id: vCourseId,
})
}
}
// 发送时间消息
sendWatchTime = (sec, rate) => {
const {videoList, activeIndex, vCourseId} = this.state
const {videoList, activeIndex, vCourseId, course = {}} = this.state
// 免费课程不发送
if(Number(course.course_id) === 0 || course.course_id === '') {
console.log('免费课程 拦截');
return;
}
// 时间为0 不发送消息
if(Number(sec) === 0) {
return;
}
let info_type = 'c_watch_time';
if(course.is_aist) {
info_type = 'watch_time';
}
this.sendMessage({
mtype: 'watch_time',
mtype: info_type,
rate,
time: sec,
video_id: videoList[activeIndex]['id'],
......@@ -473,6 +502,7 @@ class Video extends Component {
})
this.player.on('ended', () => {
this.sendWatchTime(this.watchSec, this.currentPlaybackRate)
this.countSchedule(); // 计算进度
this.getShareProgressInfo()
clearInterval(this.timer)
})
......@@ -505,7 +535,7 @@ class Video extends Component {
return
}
this.countSchedule()
this.countSchedule(); // 计算进度
this.setState(
{
......@@ -559,9 +589,12 @@ class Video extends Component {
playSetup = () => {
// is_aist,是否AI特训营
const { course={} } = this.state;
if (course.is_aist) {
if (Number(course.course_id) === 0 || course.course_id === '') {
console.log('免费课程 拦截');
}else{
this.setupWS();
this.setupTimer();
this.countSchedule();
}
let index = this.getLastVideoIndex(course.last_video_id);
index = index >= 0 ? index : 0;
......
......@@ -30,6 +30,7 @@ const Classify = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/compo
const CampTest = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campTest'))
const CampResolve = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campResolve'))
const ShareCourse = loadable(() => import('@/components/ShareCourse/index'))
const Country = loadable(() => import('@/components/country/index'))
export default [
{
path: '/',
......@@ -154,6 +155,12 @@ export default [
path: '/ShareCourse',
component: ShareCourse
},
// 区号
{
path: '/country',
component: Country
},
{
path: '/togroup',
component: ToGroup
......
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