Commit 434cb9ad by zhanghaozhe

eslint prettier

parent 34103119
...@@ -246,7 +246,7 @@ class App extends Component { ...@@ -246,7 +246,7 @@ class App extends Component {
) )
.then((res) => { .then((res) => {
let data = res.data let data = res.data
if (data.errno == 200) { if (data.errno === 200) {
if (data.data.is_check) { if (data.data.is_check) {
this.props.updateCaptchaState({ this.props.updateCaptchaState({
isNeedValidation: true, isNeedValidation: true,
...@@ -412,7 +412,7 @@ class App extends Component { ...@@ -412,7 +412,7 @@ 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 //移除红包统计cookie
this.removeShareCodeCookie() this.removeShareCodeCookie()
let { uid, token, avatar_file: avatar, uname: username } = data.data let { uid, token, avatar_file: avatar, uname: username } = data.data
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from "react" import React from "react"
import "./course.scss" import "./course.scss"
import { Link } from "react-router-dom"
const Course = (props) => { const Course = (props) => {
return ( return (
<li className={`course-item ${props.className}`}> <li className={`course-item ${props.className}`}>
{props.top} {props.top}
<a onClick={() => props.toDetail(props.id)}> <a onClick={() => props.toDetail(props.id)}>
{/* <Link to={`/detail?id=${props.id}`}> */}
<img src={props.img} alt="" /> <img src={props.img} alt="" />
{props.status} {props.status}
<p className={`course-title ${props.className}`}>{props.title}</p> <p className={`course-title ${props.className}`}>{props.title}</p>
{/* </Link> */}
</a> </a>
{props.bottom} {props.bottom}
</li> </li>
......
import React from "react" import React from "react"
import "./orderlist.scss" import "./orderlist.scss"
import { Link } from "react-router-dom"
/** /**
* @OrderList 组件内容 * @OrderList 组件内容
......
...@@ -25,7 +25,7 @@ class AddressPopup extends Component { ...@@ -25,7 +25,7 @@ class AddressPopup extends Component {
fetchUserAddress = () => { fetchUserAddress = () => {
const { addressInfo } = this.state const { addressInfo } = this.state
http.get(`${API.home}/sys/user_address_info`).then((res) => { http.get(`${API.home}/sys/user_address_info`).then((res) => {
const { code, data, msg } = res.data const { code, data } = res.data
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
addressInfo: Object.assign({}, addressInfo, { addressInfo: Object.assign({}, addressInfo, {
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import { Formik, Form, Field } from "formik" import { Formik, Form, Field } from "formik"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
......
...@@ -15,7 +15,7 @@ class ExpandActiveToast extends Component { ...@@ -15,7 +15,7 @@ class ExpandActiveToast extends Component {
componentDidMount() { componentDidMount() {
http.get(`${API["base-api"]}/sys/deposit/notice`).then((res) => { http.get(`${API["base-api"]}/sys/deposit/notice`).then((res) => {
if (res.data.errno == 200) { if (res.data.errno === 200) {
const { data } = res.data const { data } = res.data
this.setState({ this.setState({
expandLength: data.num, expandLength: data.num,
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import { CallApp } from "../../common"
import "./index.scss" import "./index.scss"
import { WithTab } from "src/HOCs" import { WithTab } from "src/HOCs"
// import Swiper from 'react-mobile-swiper' // import Swiper from 'react-mobile-swiper'
......
import React, { Component } from "react" import React, { Component } from "react"
import { connect } from "react-redux" import { connect } from "react-redux"
import { http, getParam } from "src/utils" import { getParam } from "src/utils"
import cookie from "js-cookie"
import "./index.scss" import "./index.scss"
import { Toast } from "antd-mobile"
import jsCookie from "js-cookie" import jsCookie from "js-cookie"
class Activity extends Component { class Activity extends Component {
...@@ -23,7 +21,7 @@ class Activity extends Component { ...@@ -23,7 +21,7 @@ class Activity extends Component {
domain: ".julyedu.com", domain: ".julyedu.com",
expires: 30, expires: 30,
}) })
if (cookie.get("uid")) { if (jsCookie.get("uid")) {
this.setState(() => ({ this.setState(() => ({
butText: "已领取,去使用", butText: "已领取,去使用",
})) }))
......
...@@ -14,7 +14,7 @@ class PrizeWinnerList extends Component { ...@@ -14,7 +14,7 @@ class PrizeWinnerList extends Component {
.get(`${API.home}/sys/activity/lottery_names/${getParam("tid")}`) .get(`${API.home}/sys/activity/lottery_names/${getParam("tid")}`)
.then((res) => { .then((res) => {
const { data } = res const { data } = res
if (data.code == 200) { if (data.code === 200) {
const { data: response } = data const { data: response } = data
this.setState({ this.setState({
title: response.title, title: response.title,
......
/* eslint-disable jsx-a11y/anchor-is-valid, no-script-url, jsx-a11y/heading-has-content, eqeqeq, default-case */
import React, { Component } from "react" import React, { Component } from "react"
import { debounce, groupBy, isEmpty } from "lodash" import { debounce, groupBy, isEmpty } from "lodash"
import { http } from "src/utils" import { http } from "src/utils"
...@@ -347,7 +348,7 @@ class Anniversary2020 extends Component { ...@@ -347,7 +348,7 @@ class Anniversary2020 extends Component {
getUserAddress = () => { getUserAddress = () => {
http.get(`${API.home}/sys/user_address_info`).then((res) => { http.get(`${API.home}/sys/user_address_info`).then((res) => {
const { code, msg, data } = res.data const { code, data } = res.data
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
userAddress: data, userAddress: data,
...@@ -401,8 +402,8 @@ class Anniversary2020 extends Component { ...@@ -401,8 +402,8 @@ class Anniversary2020 extends Component {
`${API["base-api"]}/wx/user_temporary_qrcode/${this.props.user.data.uid}` `${API["base-api"]}/wx/user_temporary_qrcode/${this.props.user.data.uid}`
) )
.then((res) => { .then((res) => {
const { errno, msg, data } = res.data const { errno, data } = res.data
if (errno == 0) { if (errno === 0) {
this.setState({ this.setState({
qrcode: data.qr_image, qrcode: data.qr_image,
}) })
......
/* global _czc */ /* global _czc */
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import { browser, getParam, http } from "src/utils" import { browser, getParam, http } from "src/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
...@@ -130,7 +131,7 @@ class GiveCourseAssistance extends Component { ...@@ -130,7 +131,7 @@ class GiveCourseAssistance extends Component {
code: this.state.code, code: this.state.code,
}) })
.then((res) => { .then((res) => {
const { errno, msg } = res.data const { errno } = res.data
let success = errno == 200 let success = errno == 200
this.setState({ this.setState({
successOneStatus: success, successOneStatus: success,
......
/* globals _czc */ /* eslint-disable jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import "./give-courses.scss" import "./give-courses.scss"
import { getParam, http } from "src/utils" import { getParam, http } from "src/utils"
...@@ -116,7 +116,7 @@ class GiveCourses extends Component { ...@@ -116,7 +116,7 @@ class GiveCourses extends Component {
animate, animate,
marqueeList, marqueeList,
} = this.state } = this.state
var _czc = _czc || [] var _czc = window._czc || []
return ( return (
<div id={"give-courses"}> <div id={"give-courses"}>
<div className="banner"> <div className="banner">
......
/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import { http } from "src/utils" import { http } from "src/utils"
import "./prizes.scss" import "./prizes.scss"
......
/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import BoxContainer from "../box-container/container" import BoxContainer from "../box-container/container"
import { Toast, WhiteSpace } from "antd-mobile" import { Toast, WhiteSpace } from "antd-mobile"
...@@ -216,7 +217,6 @@ class Landing extends Component { ...@@ -216,7 +217,6 @@ class Landing extends Component {
} }
handleToMyTreasure = (id) => { handleToMyTreasure = (id) => {
const { history } = this.props
this.joinSuccessPopup && this.joinSuccessPopup.remove() this.joinSuccessPopup && this.joinSuccessPopup.remove()
if (getParam("version")) { if (getParam("version")) {
window.location.assign( window.location.assign(
...@@ -291,7 +291,7 @@ class Landing extends Component { ...@@ -291,7 +291,7 @@ class Landing extends Component {
} }
inviteMembers = (treasure_code) => { inviteMembers = (treasure_code) => {
const { history, match, user, location } = this.props const { history, match, location } = this.props
if (getParam("version")) { if (getParam("version")) {
let data = { let data = {
title: this.shareTitle, title: this.shareTitle,
...@@ -524,7 +524,6 @@ class Landing extends Component { ...@@ -524,7 +524,6 @@ class Landing extends Component {
} }
toSquare = () => { toSquare = () => {
const { history } = this.props
if (!getParam("version")) { if (!getParam("version")) {
window.location.assign("https://m.julyedu.com/year/yearindex") window.location.assign("https://m.julyedu.com/year/yearindex")
} else { } else {
......
...@@ -361,7 +361,6 @@ class MyTreasure extends Component { ...@@ -361,7 +361,6 @@ class MyTreasure extends Component {
// 邀请好友 // 邀请好友
handleToInvite = (treasure_code) => { handleToInvite = (treasure_code) => {
const { history } = this.props
if (getParam("version")) { if (getParam("version")) {
window.location.assign( window.location.assign(
`https://h5.julyedu.com/activity/newyear-2019/landing?treasure_code=${treasure_code}&origin=1&version=${getParam( `https://h5.julyedu.com/activity/newyear-2019/landing?treasure_code=${treasure_code}&origin=1&version=${getParam(
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from "react" import React from "react"
import "./prize.scss" import "./prize.scss"
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import classnames from "classnames" import classnames from "classnames"
import { Link } from "react-router-dom"
import "./team.scss" import "./team.scss"
import { getParam } from "src/utils" import { getParam } from "src/utils"
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { Link, withRouter } from "react-router-dom" import { withRouter } from "react-router-dom"
import { getParam, http, SendMessageToApp, browser } from "src/utils" import { getParam, http, SendMessageToApp, browser } from "src/utils"
import CommonContainer from "./../../common/commonContainer/index" import CommonContainer from "./../../common/commonContainer/index"
import CommonPopup from "./../../common/commonPopup/index" import CommonPopup from "./../../common/commonPopup/index"
import { connect } from "react-redux" import { connect } from "react-redux"
import { Popup } from "src/common/index"
import QRCode from "qrcode" import QRCode from "qrcode"
@connect((state) => ({ @connect((state) => ({
user: state.user, user: state.user,
...@@ -47,7 +47,7 @@ class LiveRoom extends Component { ...@@ -47,7 +47,7 @@ class LiveRoom extends Component {
// 预约直播 // 预约直播
subscribe = (id) => { subscribe = (id) => {
// 检查是否已登录 // 检查是否已登录
const { hasError, data = {} } = this.props.user const { hasError } = this.props.user
if (hasError) { if (hasError) {
this.toLogin() this.toLogin()
} else { } else {
...@@ -73,7 +73,7 @@ class LiveRoom extends Component { ...@@ -73,7 +73,7 @@ class LiveRoom extends Component {
} }
// 去直播间 // 去直播间
toLivingRoom = (id) => { toLivingRoom = (id) => {
const { hasError, data = {} } = this.props.user const { hasError } = this.props.user
if (hasError) { if (hasError) {
this.toLogin() this.toLogin()
} else { } else {
...@@ -82,7 +82,7 @@ class LiveRoom extends Component { ...@@ -82,7 +82,7 @@ class LiveRoom extends Component {
} }
// 查看回放 // 查看回放
checkVideo = (url) => { checkVideo = (url) => {
const { hasError, data = {} } = this.props.user const { hasError } = this.props.user
if (hasError) { if (hasError) {
this.toLogin() this.toLogin()
} else { } else {
......
import React, { Component } from "react" import React, { Component } from "react"
import classnames from "classnames" import classnames from "classnames"
import { http } from "src/utils"
import "./nav.scss" import "./nav.scss"
class TreasureNav extends Component { class TreasureNav extends Component {
...@@ -27,10 +26,6 @@ class TreasureNav extends Component { ...@@ -27,10 +26,6 @@ class TreasureNav extends Component {
id: "year-course", id: "year-course",
name: "重磅好课", name: "重磅好课",
}, },
// {
// id: 'year-free',
// name: '免费学'
// },
{ {
id: "year-group", id: "year-group",
name: "1分拼团", name: "1分拼团",
......
/* eslint-disable jsx-a11y/anchor-is-valid, eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { http, SendMessageToApp, getParam } from "src/utils" import { http, SendMessageToApp, getParam } from "src/utils"
......
/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import { http } from "src/utils" import { http } from "src/utils"
import "./prizes.scss" import "./prizes.scss"
......
/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import BoxContainer from "../box-container/container" import BoxContainer from "../box-container/container"
import { Toast, WhiteSpace } from "antd-mobile" import { Toast, WhiteSpace } from "antd-mobile"
...@@ -236,7 +237,6 @@ class Landing extends Component { ...@@ -236,7 +237,6 @@ class Landing extends Component {
} }
handleToMyTreasure = (id) => { handleToMyTreasure = (id) => {
const { history } = this.props
this.joinSuccessPopup && this.joinSuccessPopup.remove() this.joinSuccessPopup && this.joinSuccessPopup.remove()
if (getParam("version")) { if (getParam("version")) {
window.location.assign( window.location.assign(
...@@ -311,7 +311,7 @@ class Landing extends Component { ...@@ -311,7 +311,7 @@ class Landing extends Component {
} }
inviteMembers = (treasure_code) => { inviteMembers = (treasure_code) => {
const { history, match, user, location } = this.props const { history, match, location } = this.props
if (getParam("version")) { if (getParam("version")) {
let data = { let data = {
title: this.shareTitle, title: this.shareTitle,
...@@ -546,7 +546,6 @@ class Landing extends Component { ...@@ -546,7 +546,6 @@ class Landing extends Component {
} }
toSquare = () => { toSquare = () => {
const { history } = this.props
if (!getParam("version")) { if (!getParam("version")) {
window.location.assign("https://m.julyedu.com/") window.location.assign("https://m.julyedu.com/")
} else { } else {
......
...@@ -361,7 +361,6 @@ class MyTreasure extends Component { ...@@ -361,7 +361,6 @@ class MyTreasure extends Component {
// 邀请好友 // 邀请好友
handleToInvite = (treasure_code) => { handleToInvite = (treasure_code) => {
const { history } = this.props
if (getParam("version")) { if (getParam("version")) {
window.location.assign( window.location.assign(
`https://h5.julyedu.com/box/landing?treasure_code=${treasure_code}&origin=1&version=${getParam( `https://h5.julyedu.com/box/landing?treasure_code=${treasure_code}&origin=1&version=${getParam(
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from "react" import React from "react"
import "./prize.scss" import "./prize.scss"
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import classnames from "classnames" import classnames from "classnames"
import { Link } from "react-router-dom"
import "./team.scss" import "./team.scss"
import { getParam } from "src/utils" import { getParam } from "src/utils"
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { Link, withRouter } from "react-router-dom" import { withRouter } from "react-router-dom"
import { getParam, http, SendMessageToApp, browser } from "src/utils" import { getParam, http, SendMessageToApp, browser } from "src/utils"
import CommonContainer from "./../../common/commonContainer/index" import CommonContainer from "./../../common/commonContainer/index"
import CommonPopup from "./../../common/commonPopup/index" import CommonPopup from "./../../common/commonPopup/index"
import { connect } from "react-redux" import { connect } from "react-redux"
import { Popup } from "src/common/index"
import QRCode from "qrcode" import QRCode from "qrcode"
@connect((state) => ({ @connect((state) => ({
user: state.user, user: state.user,
...@@ -47,7 +47,7 @@ class LiveRoom extends Component { ...@@ -47,7 +47,7 @@ class LiveRoom extends Component {
// 预约直播 // 预约直播
subscribe = (id) => { subscribe = (id) => {
// 检查是否已登录 // 检查是否已登录
const { hasError, data = {} } = this.props.user const { hasError } = this.props.user
if (hasError) { if (hasError) {
this.toLogin() this.toLogin()
} else { } else {
...@@ -73,7 +73,7 @@ class LiveRoom extends Component { ...@@ -73,7 +73,7 @@ class LiveRoom extends Component {
} }
// 去直播间 // 去直播间
toLivingRoom = (id) => { toLivingRoom = (id) => {
const { hasError, data = {} } = this.props.user const { hasError } = this.props.user
if (hasError) { if (hasError) {
this.toLogin() this.toLogin()
} else { } else {
...@@ -82,7 +82,7 @@ class LiveRoom extends Component { ...@@ -82,7 +82,7 @@ class LiveRoom extends Component {
} }
// 查看回放 // 查看回放
checkVideo = (url) => { checkVideo = (url) => {
const { hasError, data = {} } = this.props.user const { hasError } = this.props.user
if (hasError) { if (hasError) {
this.toLogin() this.toLogin()
} else { } else {
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { http, SendMessageToApp, getParam, browser } from "src/utils" import { http, SendMessageToApp, getParam } from "src/utils"
import CommonContainer from "./../../common/commonContainer/index"
import CourseItem from "../../../../blessingPreheat/courseItem/index"
import { withRouter } from "react-router-dom" import { withRouter } from "react-router-dom"
import CommonPopup from "./../../common/commonPopup/index"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import QRCode from "qrcode" import QRCode from "qrcode"
import { connect } from "react-redux" import { connect } from "react-redux"
import dateFns from "date-fns"
@connect((state) => ({ @connect((state) => ({
user: state.user, user: state.user,
...@@ -638,18 +635,7 @@ class YearCourse extends Component { ...@@ -638,18 +635,7 @@ class YearCourse extends Component {
} }
render() { render() {
const { const { removable } = this.state
bigcourse,
freecourse,
groupcourse,
basic,
advanced,
higher,
expand,
removable,
sum,
} = this.state
const { stage, treasureStage } = this.props
return ( return (
<div className={"year-index-course"}> <div className={"year-index-course"}>
{removable > 0 && ( {removable > 0 && (
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import LiveRoom from "./LiveRoom/index"
import YearCourse from "./YearCourse/index" import YearCourse from "./YearCourse/index"
import TreasureBox from "./../treasure-box/index" import TreasureBox from "./../treasure-box/index"
import TreasureNav from "./nav"
import CommonPopup from "./../common/commonPopup/index" import CommonPopup from "./../common/commonPopup/index"
import cookie from "js-cookie" import cookie from "js-cookie"
import { setCurrentUser, startFetchUser } from "src/store/userAction" import { setCurrentUser, startFetchUser } from "src/store/userAction"
import { SendMessageToApp, getParam, http } from "src/utils" import { http } from "src/utils"
import { addDays } from "date-fns" import { addDays } from "date-fns"
import { connect } from "react-redux" import { connect } from "react-redux"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { compose } from "redux"
@connect( @connect(
(state) => ({ (state) => ({
...@@ -61,7 +59,7 @@ class index extends Component { ...@@ -61,7 +59,7 @@ class index extends Component {
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
let expires = addDays(new Date(), 90) let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => { this.state.userInfoList.forEach((item, index) => {
cookie.set("token", item.token, { cookie.set("token", item.token, {
expires, expires,
path: "/", path: "/",
...@@ -100,7 +98,7 @@ class index extends Component { ...@@ -100,7 +98,7 @@ class index extends Component {
transformUser = (res) => { transformUser = (res) => {
let payload let payload
res.map((item, index) => { res.forEach((item, index) => {
payload = { payload = {
hasError: false, hasError: false,
data: { data: {
......
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { html } from "src/utils"
import classnames from "classnames" import classnames from "classnames"
class Question extends Component { class Question extends Component {
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import { HeaderBar } from "src/common" import { HeaderBar } from "src/common"
import { getParam, http } from "src/utils" import { getParam, http } from "src/utils"
......
/* eslint-disable jsx-a11y/anchor-is-valid */ /* eslint-disable jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { Tabs, Toast } from "antd-mobile" import { Tabs, Toast } from "antd-mobile"
...@@ -20,13 +20,6 @@ class Scores extends Component { ...@@ -20,13 +20,6 @@ class Scores extends Component {
], ],
rankList: [], rankList: [],
rankListTabs: [{ title: "日榜" }, { title: "总榜" }], rankListTabs: [{ title: "日榜" }, { title: "总榜" }],
/*
rankListTabs: [
{title: '日榜'},
{title: '周榜'},
{title: '总榜'},
],
*/
isExpandRankList: false, isExpandRankList: false,
icons: [ icons: [
require("./rank-1.png"), require("./rank-1.png"),
......
...@@ -38,7 +38,7 @@ class aiTestHelp extends Component { ...@@ -38,7 +38,7 @@ class aiTestHelp extends Component {
handleFetchInfo = () => { handleFetchInfo = () => {
http.get(`${API.home}/sys/aitest/invitation`).then((res) => { http.get(`${API.home}/sys/aitest/invitation`).then((res) => {
const { code, data, msg } = res.data const { code, data } = res.data
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
total_num: data.total_num, total_num: data.total_num,
...@@ -49,7 +49,7 @@ class aiTestHelp extends Component { ...@@ -49,7 +49,7 @@ class aiTestHelp extends Component {
getAssist = () => { getAssist = () => {
http.get(`${API.home}/sys/aitest/assist`).then((res) => { http.get(`${API.home}/sys/aitest/assist`).then((res) => {
const { code, data, msg } = res.data const { code, data } = res.data
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
dec: data.ques, dec: data.ques,
......
...@@ -23,7 +23,7 @@ class FollowBarcode extends Component { ...@@ -23,7 +23,7 @@ class FollowBarcode extends Component {
.then((res) => { .then((res) => {
const { errno, data } = res.data const { errno, data } = res.data
console.log(res) console.log(res)
if (errno == 0) { if (errno === 0) {
this.setState({ this.setState({
url: data.url, url: data.url,
}) })
......
import React, { Component } from "react" import React, { Component } from "react"
import { isEmpty } from "lodash"
import { http } from "src/utils" import { http } from "src/utils"
import { Formik, Form, Field } from "formik" import { Formik, Form, Field } from "formik"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
...@@ -26,7 +25,7 @@ class AddressPopup extends Component { ...@@ -26,7 +25,7 @@ class AddressPopup extends Component {
fetchUserAddress = () => { fetchUserAddress = () => {
const { addressInfo } = this.state const { addressInfo } = this.state
http.get(`${API.home}/sys/user_address_info`).then((res) => { http.get(`${API.home}/sys/user_address_info`).then((res) => {
const { code, data, msg } = res.data const { code, data } = res.data
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
addressInfo: Object.assign({}, addressInfo, { addressInfo: Object.assign({}, addressInfo, {
......
import React, { Component } from "react" import React, { Component } from "react"
import { connect } from "react-redux" import { connect } from "react-redux"
import { Link } from "react-router-dom"
import { http, getParam, SendMessageToApp } from "src/utils" import { http, getParam, SendMessageToApp } from "src/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import ListFrame from "./../listFrame/index" import ListFrame from "./../listFrame/index"
...@@ -237,7 +236,7 @@ class CollectBlessing extends Component { ...@@ -237,7 +236,7 @@ class CollectBlessing extends Component {
toLogin, toLogin,
toSection, toSection,
} = this.props } = this.props
const { rules, welfareRuleList, seconds } = this.state const { rules, welfareRuleList } = this.state
return ( return (
<div className="collect-blessing"> <div className="collect-blessing">
{isLogin ? ( {isLogin ? (
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
......
...@@ -314,7 +314,7 @@ class CourseList extends Component { ...@@ -314,7 +314,7 @@ class CourseList extends Component {
// 开始使用 // 开始使用
toCourse2 = (courseId) => { toCourse2 = (courseId) => {
const { history } = this.props const { history } = this.props
var _czc = _czc || [] var _czc = window._czc || []
var name = "课程id=" + courseId var name = "课程id=" + courseId
_czc.push(["_trackEvent", name, "m端双十一开始使用优惠券"]) _czc.push(["_trackEvent", name, "m端双十一开始使用优惠券"])
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import classnames from "classnames" import classnames from "classnames"
import { http, SendMessageToApp } from "src/utils" import { http, SendMessageToApp } from "src/utils"
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import { http } from "src/utils" import { http } from "src/utils"
import { Toast, Tabs } from "antd-mobile" import { Toast, Tabs } from "antd-mobile"
...@@ -190,7 +191,7 @@ class FormalDraw extends Component { ...@@ -190,7 +191,7 @@ class FormalDraw extends Component {
} }
subscribe = (id) => { subscribe = (id) => {
var _czc = _czc || [] var _czc = window._czc || []
_czc.push(["_trackEvent", "预约抽奖", "m端双十一正式页-立即预约"]) _czc.push(["_trackEvent", "预约抽奖", "m端双十一正式页-立即预约"])
if (this.subscribePopupInstance) { if (this.subscribePopupInstance) {
return return
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import listFrame from "./../listFrame/index" import listFrame from "./../listFrame/index"
import { http, SendMessageToApp, getParam } from "src/utils" import { http, getParam } from "src/utils"
class LevelTest extends Component { class LevelTest extends Component {
constructor(props) { constructor(props) {
...@@ -75,8 +76,8 @@ class LevelTest extends Component { ...@@ -75,8 +76,8 @@ class LevelTest extends Component {
} }
render() { render() {
let { testNumber, number, prizeListUrl } = this.state let { testNumber, prizeListUrl } = this.state
const { isLogin, testSum } = this.props const { testSum } = this.props
return ( return (
<> <>
<div className="level__test_module"> <div className="level__test_module">
......
/* global _czc */ /* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { Tabs, Toast } from "antd-mobile" import { Tabs, Toast } from "antd-mobile"
...@@ -52,7 +52,7 @@ class Live extends Component { ...@@ -52,7 +52,7 @@ class Live extends Component {
toLiveRoom = (id) => { toLiveRoom = (id) => {
const { history, isLogin } = this.props const { history, isLogin } = this.props
var _czc = _czc || [] var _czc = window._czc || []
var name = "直播间id=" + id var name = "直播间id=" + id
_czc.push(["_trackEvent", name, "m端双十一大咖直播-正在直播"]) _czc.push(["_trackEvent", name, "m端双十一大咖直播-正在直播"])
if (this.state.isApp) { if (this.state.isApp) {
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { http, getParam } from "src/utils" import { http, getParam } from "src/utils"
...@@ -26,7 +27,6 @@ export default class RecordPopup extends Component { ...@@ -26,7 +27,6 @@ export default class RecordPopup extends Component {
handleToTestRecord = (e, id) => { handleToTestRecord = (e, id) => {
e.preventDefault() e.preventDefault()
const { history } = this.props
if (!getParam("version")) { if (!getParam("version")) {
window.location.href = `${API.m}/levelTest/report?id=${id}` window.location.href = `${API.m}/levelTest/report?id=${id}`
} else { } else {
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import { browser } from "src/utils" import { browser } from "src/utils"
import "./index.scss" import "./index.scss"
......
...@@ -37,7 +37,7 @@ class ToAppDemo extends Component { ...@@ -37,7 +37,7 @@ class ToAppDemo extends Component {
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
let expires = addDays(new Date(), 90) let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => { this.state.userInfoList.forEach((item, index) => {
Toast.info(item.version, 3) Toast.info(item.version, 3)
cookie.set("token", item.token, { cookie.set("token", item.token, {
expires, expires,
...@@ -71,7 +71,7 @@ class ToAppDemo extends Component { ...@@ -71,7 +71,7 @@ class ToAppDemo extends Component {
transformUser = (res) => { transformUser = (res) => {
let payload let payload
res.map((item, index) => { res.forEach((item, index) => {
payload = { payload = {
hasError: false, hasError: false,
data: { data: {
......
/* eslint-disable default-case */
import React, { Component } from "react" import React, { Component } from "react"
import { VList } from "../../common" import { VList } from "../../common"
import { Tabs, WhiteSpace, Toast } from "antd-mobile" import { Tabs, WhiteSpace, Toast } from "antd-mobile"
...@@ -130,10 +131,8 @@ class Classify extends Component { ...@@ -130,10 +131,8 @@ class Classify extends Component {
} }
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props const { history } = this.props
// dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
// }));
} }
toClassify = () => { toClassify = () => {
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import { WithTab } from "src/HOCs" import { WithTab } from "src/HOCs"
import "./index.scss" import "./index.scss"
...@@ -50,7 +51,7 @@ class Classify extends Component { ...@@ -50,7 +51,7 @@ class Classify extends Component {
} }
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props const { history } = this.props
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
return false return false
} }
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import { connect } from "react-redux" import { connect } from "react-redux"
import { bindActionCreators } from "redux" import { bindActionCreators } from "redux"
......
/* eslint-disable no-sequences, eqeqeq, jsx-a11y/anchor-is-valid */
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 "src/utils" import { http, getParam } from "src/utils"
......
import React, { PureComponent } from "react" import React, { PureComponent } from "react"
import "./index.scss" import "./index.scss"
import { http, getParam } from "src/utils" import { http } from "src/utils"
import { WithFullSize } from "src/HOCs" import { WithFullSize } from "src/HOCs"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { HeaderBar } from "src/common"
class UsePatch extends PureComponent { class UsePatch extends PureComponent {
constructor(props) { constructor(props) {
......
import { api, getParam, http } from "src/utils" import { getParam, http } from "src/utils"
export const RECEIVE_COURSES_DETAIL = "RECEIVE_COURSES_DETAIL" export const RECEIVE_COURSES_DETAIL = "RECEIVE_COURSES_DETAIL"
export const ADD_COURSES_TO_CART = "ADD_COURSES_TO_CART" export const ADD_COURSES_TO_CART = "ADD_COURSES_TO_CART"
......
/* eslint-disable */
import React, { Component } from "react" import React, { Component } from "react"
import { getParam, http } from "src/utils" import { getParam, http } from "src/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
...@@ -262,8 +263,6 @@ class BtnStatus extends Component { ...@@ -262,8 +263,6 @@ class BtnStatus extends Component {
//获取砍价信息 //获取砍价信息
getBargainInfo = () => { getBargainInfo = () => {
const { user } = this.props
const uid = user && user.data && user.data.uid
let data = { let data = {
courseId: getParam("id"), courseId: getParam("id"),
} }
...@@ -281,7 +280,7 @@ class BtnStatus extends Component { ...@@ -281,7 +280,7 @@ class BtnStatus extends Component {
// 付定金 付尾款 // 付定金 付尾款
expandPay = (info, type) => { expandPay = (info, type) => {
// type 等于1是定金 等于2是尾款 // type 等于1是定金 等于2是尾款
const { user, history } = 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")
......
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { http, getParam } from "src/utils" import { http } from "src/utils"
import QRCode from "qrcode" import QRCode from "qrcode"
import { connect } from "react-redux" import { connect } from "react-redux"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
...@@ -20,7 +20,7 @@ class FollowQRcode extends Component { ...@@ -20,7 +20,7 @@ class FollowQRcode extends Component {
http http
.get(`${API["base-api"]}/wx/user_temporary_qrcode/${uid}`) .get(`${API["base-api"]}/wx/user_temporary_qrcode/${uid}`)
.then((res) => { .then((res) => {
if (res.data.errno == 0) { if (res.data.errno === 0) {
_this.setState({ _this.setState({
src: res.data.data.url, src: res.data.data.url,
}) })
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { getParam, http } from "src/utils" import { getParam } from "src/utils"
import { connect } from "react-redux"
import { Flex } from "antd-mobile" import { Flex } from "antd-mobile"
import { browser } from "src/utils"
import { Toast } from "antd-mobile"
class Group extends Component { class Group extends Component {
constructor(props) { constructor(props) {
...@@ -18,7 +16,6 @@ class Group extends Component { ...@@ -18,7 +16,6 @@ class Group extends Component {
countdown: props.countdown, countdown: props.countdown,
now_groupon_list: [], now_groupon_list: [],
} }
// console.log(props);
} }
// 查看更多 // 查看更多
...@@ -137,7 +134,7 @@ class Group extends Component { ...@@ -137,7 +134,7 @@ class Group extends Component {
render() { render() {
const { courseInfo } = this.props const { courseInfo } = this.props
const { alreadyIn, countdown, now_groupon_list } = this.state const { alreadyIn, countdown } = this.state
let groupInfo = "", let groupInfo = "",
groupon_member = "", groupon_member = "",
group_status = -1, group_status = -1,
......
/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */
import React, { Component } from "react" import React, { Component } from "react"
import "./togroup.scss" import "./togroup.scss"
import { HeaderBar, VList } from "../../../common" import { HeaderBar, VList } from "../../../common"
...@@ -298,10 +299,9 @@ function GorupContent(props) { ...@@ -298,10 +299,9 @@ function GorupContent(props) {
if (groupon_member && groupon_member.length > 0) { if (groupon_member && groupon_member.length > 0) {
let flag = false let flag = false
!userInfo.hasError && !userInfo.hasError &&
groupon_member.map((item) => { groupon_member.forEach((item) => {
if (item.uid == userInfo.data.uid) { if (item.uid == userInfo.data.uid) {
flag = true flag = true
return
} }
}) })
if (flag) { if (flag) {
......
/* eslint-disable eqeqeq, jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import Bargain from "./bargain" import Bargain from "./bargain"
...@@ -676,7 +677,6 @@ class Detail extends Component { ...@@ -676,7 +677,6 @@ class Detail extends Component {
render() { render() {
const { const {
course: { course_info = {} }, course: { course_info = {} },
barInfo,
singleBox, singleBox,
singleType, singleType,
isRedPacket, isRedPacket,
...@@ -685,18 +685,12 @@ class Detail extends Component { ...@@ -685,18 +685,12 @@ class Detail extends Component {
const { d, h, m } = this.formatTime(course_info.limit_free_time) const { d, h, m } = this.formatTime(course_info.limit_free_time)
let courseInfo = "", let number = 0
service = "",
number = 0,
endTime = 0
// if (this.props.courseInfo.course_info) {
// courseInfo = this.props.courseInfo.course_info;
// service = courseInfo.service;
if (course_info.group_status === 3 || course_info.group_status === 4) { if (course_info.group_status === 3 || course_info.group_status === 4) {
number = course_info.pdd_group_info.groupon_member.number number = course_info.pdd_group_info.groupon_member.number
} }
// } // }
const { share, countdown, list, outList } = this.state const { share, countdown } = this.state
let href = "" let href = ""
const { const {
location: { state = {} }, location: { state = {} },
......
...@@ -20,7 +20,7 @@ class ExpandCallback extends Component { ...@@ -20,7 +20,7 @@ class ExpandCallback extends Component {
order_id: getParam("order_id"), order_id: getParam("order_id"),
}) })
.then((res) => { .then((res) => {
if (res.data.errno == 200) { if (res.data.errno === 200) {
const { data } = res.data const { data } = res.data
this.setState({ this.setState({
data: data, data: data,
...@@ -33,7 +33,7 @@ class ExpandCallback extends Component { ...@@ -33,7 +33,7 @@ class ExpandCallback extends Component {
// 邀请好友助力 // 邀请好友助力
invitation = (url) => { invitation = (url) => {
const { user, history } = 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")
......
/* eslint-disable default-case */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { Link } from "react-router-dom" import { Link } from "react-router-dom"
...@@ -166,6 +167,7 @@ class IntelligentRecommend extends Component { ...@@ -166,6 +167,7 @@ class IntelligentRecommend extends Component {
</div> </div>
<div className="dialog-box"> <div className="dialog-box">
{!!processing.length && {!!processing.length &&
// eslint-disable-next-line array-callback-return
processing.map((item, index) => { processing.map((item, index) => {
switch (item.type) { switch (item.type) {
case messageType.SYSTEM_MESSAGE: case messageType.SYSTEM_MESSAGE:
......
/* eslint-disable eqeqeq, default-case */
import React, { Component } from "react" import React, { Component } from "react"
import { http } from "src/utils" import { http } from "src/utils"
import "./index.scss" import "./index.scss"
...@@ -39,7 +40,7 @@ class LimitFree extends Component { ...@@ -39,7 +40,7 @@ class LimitFree extends Component {
code: coursesCode, code: coursesCode,
msg: coursesMsg, msg: coursesMsg,
} = courses.data } = courses.data
if (tabCode == 200) { if (tabCode === 200) {
this.setState({ this.setState({
tab: tabData, tab: tabData,
}) })
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
......
...@@ -10,7 +10,7 @@ export default class Study extends Component { ...@@ -10,7 +10,7 @@ export default class Study extends Component {
let cs = Math.floor(Number(str) / 10) let cs = Math.floor(Number(str) / 10)
let cv = "" let cv = ""
if (str.length > 1) { if (str.length > 1) {
if (cs == 1) { if (cs === 1) {
cv = ci >= 1 ? cn[9] + cn[ci - 1] : cn[9] cv = ci >= 1 ? cn[9] + cn[ci - 1] : cn[9]
} else { } else {
cv = ci > 1 ? cn[cs - 1] + cn[9] + cn[ci - 1] : cn[cs - 1] + cn[9] cv = ci > 1 ? cn[cs - 1] + cn[9] + cn[ci - 1] : cn[cs - 1] + cn[9]
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import Description from "./Description/index.js" import Description from "./Description/index.js"
......
/* eslint-disable */
import React, { Component } from "react" import React, { Component } from "react"
import { Accordion, Toast } from "antd-mobile" import { Accordion, Toast } from "antd-mobile"
import { HeaderBar, CallApp } from "src/common" import { HeaderBar, CallApp } from "src/common"
......
/* eslint-disable jsx-a11y/anchor-is-valid, jsx-a11y/anchor-has-content, no-script-url */
import React, { PureComponent } from "react" import React, { PureComponent } from "react"
import { Flex, WhiteSpace, List } from "antd-mobile" import { Flex, WhiteSpace, List } from "antd-mobile"
import "./index.scss" import "./index.scss"
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { HeaderBar } from "../../common" import { HeaderBar } from "../../common"
......
...@@ -15,7 +15,6 @@ function OrderList(props) { ...@@ -15,7 +15,6 @@ function OrderList(props) {
<div> <div>
{listData.map((item, index) => { {listData.map((item, index) => {
const { const {
is_coupon,
course_id, course_id,
image_name, image_name,
sale_price, sale_price,
...@@ -148,7 +147,7 @@ class Order extends Component { ...@@ -148,7 +147,7 @@ class Order extends Component {
}) })
.then((res) => { .then((res) => {
const { data } = res const { data } = res
if (data.errno == 200) { if (data.errno === 200) {
if (data.data["pay_jump"]) { if (data.data["pay_jump"]) {
this.props.history.replace( this.props.history.replace(
`/expand/callback?order_id=${data.data["order_id"]}` `/expand/callback?order_id=${data.data["order_id"]}`
...@@ -178,7 +177,7 @@ class Order extends Component { ...@@ -178,7 +177,7 @@ class Order extends Component {
}) })
.then((res) => { .then((res) => {
const { data } = res const { data } = res
if (data.errno == 200) { if (data.errno === 200) {
this.setState({ this.setState({
orderList: [data.data.course], orderList: [data.data.course],
depositPrice: data.data.course["sale_price"], depositPrice: data.data.course["sale_price"],
......
...@@ -159,7 +159,7 @@ const formikConfig = { ...@@ -159,7 +159,7 @@ const formikConfig = {
} }
http.post(`${API["passport-api"]}/bind_mobile`, params).then((res) => { http.post(`${API["passport-api"]}/bind_mobile`, params).then((res) => {
const data = res.data const data = res.data
if (data.errno == 200) { if (data.errno === 200) {
const { history } = props const { history } = props
if (data.data["is_set_pwd"]) { if (data.data["is_set_pwd"]) {
history.replace(`/passport/set-password`, { history.replace(`/passport/set-password`, {
......
...@@ -130,7 +130,7 @@ const formikConfig = { ...@@ -130,7 +130,7 @@ const formikConfig = {
area_code: "00" + props.country.num, area_code: "00" + props.country.num,
}) })
.then((res) => { .then((res) => {
if (res.data.errno == 0) { if (res.data.errno === 0) {
props.history.push("/passport/set-password", { props.history.push("/passport/set-password", {
from: props.location, from: props.location,
}) })
......
...@@ -129,7 +129,7 @@ const formikConfig = { ...@@ -129,7 +129,7 @@ const formikConfig = {
code: values.veriCode, code: values.veriCode,
}) })
.then((res) => { .then((res) => {
if (res.data.errno == 0) { if (res.data.errno === 0) {
props.history.push("/passport/set-password", { props.history.push("/passport/set-password", {
from: props.location, from: props.location,
}) })
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import "./wechatLogin.scss" import "./wechatLogin.scss"
import Input from "../common/inputWithCountryCodes" import Input from "../common/inputWithCountryCodes"
......
...@@ -127,7 +127,7 @@ function forgotPasswordReset(values, props) { ...@@ -127,7 +127,7 @@ function forgotPasswordReset(values, props) {
password: encrypt(values.password), password: encrypt(values.password),
}) })
.then((res) => { .then((res) => {
if (res.data.errno == 200) { if (res.data.errno === 200) {
Toast.info("密码设置成功") Toast.info("密码设置成功")
setTimeout(function () { setTimeout(function () {
props.history.replace("/passport/account-login") props.history.replace("/passport/account-login")
...@@ -146,22 +146,10 @@ function bindMobileSetPassword(values, props) { ...@@ -146,22 +146,10 @@ function bindMobileSetPassword(values, props) {
password: encrypt(values.password), password: encrypt(values.password),
}) })
.then((res) => { .then((res) => {
if (res.data.errno == 200) { if (res.data.errno === 200) {
const { location, history } = props const { location, history } = props
Toast.info("密码设置成功") Toast.info("密码设置成功")
let from = (location.state && location.state.from) || { pathname: "/" } 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)
// } else {
// history.replace(from.pathname)
// }
// }, 1000)
let HistoryUrl = window.localStorage.getItem("HistoryUrl") let HistoryUrl = window.localStorage.getItem("HistoryUrl")
setTimeout(() => { setTimeout(() => {
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import { VList } from "../../common" import { VList } from "../../common"
import { Tabs, WhiteSpace, Toast } from "antd-mobile" import { Tabs, WhiteSpace, Toast } from "antd-mobile"
...@@ -42,7 +43,7 @@ class Preferential extends Component { ...@@ -42,7 +43,7 @@ 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: JSON.stringify(res.data.data) == "{}" ? [] : res.data.data, dataList: JSON.stringify(res.data.data) === "{}" ? [] : res.data.data,
isLoading: false, isLoading: false,
}) })
} else { } else {
...@@ -82,10 +83,8 @@ class Preferential extends Component { ...@@ -82,10 +83,8 @@ class Preferential extends Component {
} }
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props const { history } = this.props
// dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
// }));
} }
render() { render() {
......
/* eslint-disable eqeqeq */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { HeaderBar, VList } from "../../common" import { HeaderBar, VList } from "../../common"
...@@ -35,10 +36,8 @@ class Purchased extends Component { ...@@ -35,10 +36,8 @@ class Purchased extends Component {
} }
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props const { history } = this.props
// dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
// }));
} }
render() { render() {
const { user } = this.props const { user } = this.props
......
...@@ -53,7 +53,7 @@ class Python extends Component { ...@@ -53,7 +53,7 @@ class Python extends Component {
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
let expires = addDays(new Date(), 90) let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => { this.state.userInfoList.forEach((item, index) => {
cookie.set("token", item.token, { cookie.set("token", item.token, {
expires, expires,
path: "/", path: "/",
...@@ -94,7 +94,7 @@ class Python extends Component { ...@@ -94,7 +94,7 @@ class Python extends Component {
transformUser = (res) => { transformUser = (res) => {
let payload let payload
res.map((item, index) => { res.forEach((item, index) => {
payload = { payload = {
hasError: false, hasError: false,
data: { data: {
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
......
/* eslint-disable eqeqeq, jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import Description from "./Description/index.js" import Description from "./Description/index.js"
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import { Flex, WingBlank } from "antd-mobile" import { Flex, WingBlank } from "antd-mobile"
import { Link } from "react-router-dom"
import "./CategoryItem.scss" import "./CategoryItem.scss"
export default class CategoryItem extends Component { export default class CategoryItem extends Component {
constructor(props) {
super(props)
}
render() { render() {
const { const {
course_title, course_title,
......
/* eslint-disable jsx-a11y/alt-text */
import React, { Component } from "react" import React, { Component } from "react"
import { Flex } from "antd-mobile" import { Flex } from "antd-mobile"
import "./SortItem.scss" import "./SortItem.scss"
...@@ -11,9 +12,6 @@ const THIRD = ...@@ -11,9 +12,6 @@ const THIRD =
"https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/order/PC/tong_icon.png" "https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/order/PC/tong_icon.png"
export default class SortItem extends Component { export default class SortItem extends Component {
constructor(props) {
super(props)
}
render() { render() {
const { sortNum, avatar_file, user_name, total_account } = this.props const { sortNum, avatar_file, user_name, total_account } = this.props
let sortImgSrc = "" let sortImgSrc = ""
......
import React, { Component } from "react" import React, { Component } from "react"
import { Checkbox } from "antd-mobile" import { Checkbox } from "antd-mobile"
import OrderList from "src/common/OrderList" import OrderList from "src/common/OrderList"
import { Link } from "react-router-dom"
class CartItem extends Component { class CartItem extends Component {
// 构造函数 // 构造函数
......
...@@ -27,11 +27,11 @@ export const getMyCourses = (payload) => (dispatch) => { ...@@ -27,11 +27,11 @@ export const getMyCourses = (payload) => (dispatch) => {
.get(`${API.home}/m/my_course/${payload.page}/${payload.num}`) .get(`${API.home}/m/my_course/${payload.page}/${payload.num}`)
.then((res) => { .then((res) => {
const { data, code, msg } = res.data const { data, code, msg } = res.data
if (code == 200 && data.length === 0) { if (code === 200 && data.length === 0) {
dispatch(nomoreCourse()) dispatch(nomoreCourse())
return return
} }
if (code == 200 && data.length % 10 !== 0) { if (code === 200 && data.length % 10 !== 0) {
dispatch(nomoreCourse()) dispatch(nomoreCourse())
} }
dispatch( dispatch(
......
...@@ -18,4 +18,5 @@ const TSTest: React.FC = () => { ...@@ -18,4 +18,5 @@ const TSTest: React.FC = () => {
</div> </div>
) )
} }
export default withRouter(TSTest) export default withRouter(TSTest)
import React, { Component } from "react" import React, { Component } from "react"
import { getParam, http, browser } from "src/utils" import { getParam, http } from "src/utils"
import "./camp.scss" import "./camp.scss"
import { import {
CampTitle, CampTitle,
...@@ -82,7 +82,7 @@ class CampResolve extends Component { ...@@ -82,7 +82,7 @@ class CampResolve extends Component {
this.course_id = data.course_id this.course_id = data.course_id
_this.answerList = [] _this.answerList = []
this.rightNumber = 0 this.rightNumber = 0
data.list.map((item) => { data.list.forEach((item) => {
if (item.compare === 1) { if (item.compare === 1) {
this.rightNumber++ this.rightNumber++
} }
......
import React, { Component } from "react" import React, { Component } from "react"
import { getParam, http, browser } from "src/utils" import { getParam, http } from "src/utils"
import "./camp.scss" import "./camp.scss"
import { connect } from "react-redux" import { connect } from "react-redux"
import { Header, CampTitle, TestItem, ChangeQuestion } from "./common/common" import { Header, CampTitle, TestItem, ChangeQuestion } from "./common/common"
...@@ -47,7 +47,7 @@ class CampTest extends Component { ...@@ -47,7 +47,7 @@ class CampTest extends Component {
currentExam: data.list[0], currentExam: data.list[0],
}) })
_this.answerList = [] _this.answerList = []
data.list.map((item) => { data.list.forEach((item) => {
let obj = {} let obj = {}
obj.questionId = item.id obj.questionId = item.id
obj.answerId = 0 obj.answerId = 0
......
...@@ -124,7 +124,7 @@ function Resolve(props) { ...@@ -124,7 +124,7 @@ function Resolve(props) {
let { currentExam } = props let { currentExam } = props
let Test = currentExam.compare === 0 ? "错误" : "正确" let Test = currentExam.compare === 0 ? "错误" : "正确"
let UserIndex, rightIndex let UserIndex, rightIndex
currentExam.options.map((item, index) => { currentExam.options.forEach((item, index) => {
if (currentExam.answer_id === item.opt_id) { if (currentExam.answer_id === item.opt_id) {
rightIndex = index rightIndex = index
} }
......
import React, { Component } from 'react' import React, { Component } from "react"
import HeaderBar from 'src/common/HeaderBar' import HeaderBar from "src/common/HeaderBar"
import './video.scss' import "./video.scss"
import { NavLink, Route, Redirect, Switch } from 'react-router-dom' import { NavLink, Route, Redirect, Switch } from "react-router-dom"
import { http, getParam, browser } from 'src/utils' import { http, getParam, browser } from "src/utils"
import Recommendation from './recommendation' import Recommendation from "./recommendation"
import VideoCatalog from './video-catalog' import VideoCatalog from "./video-catalog"
import DatumCatalog from './datum-catalog' import DatumCatalog from "./datum-catalog"
import { Toast } from 'antd-mobile' import { Toast } from "antd-mobile"
import videojs from 'video.js' import videojs from "video.js"
import 'video.js/dist/video-js.min.css' import "video.js/dist/video-js.min.css"
import { Modal } from "antd-mobile" import { Modal } from "antd-mobile"
import { Loading } from 'src/common' import { Loading } from "src/common"
import { connect } from "react-redux" import { connect } from "react-redux"
import jsCookie from 'js-cookie' import jsCookie from "js-cookie"
import Single from "src/components/detail/single"; import Single from "src/components/detail/single"
import SingleSuccess from "../detail/single/singleSuccess"; import SingleSuccess from "../detail/single/singleSuccess"
import './CustomPlayButton' import "./CustomPlayButton"
let alert = Modal.alert let alert = Modal.alert
function ProgressShareModal(props) { function ProgressShareModal(props) {
return ( return (
props.isShow && props.isShow && (
<div className='progress-share-modal-wrapper'> <div className="progress-share-modal-wrapper">
<div className="progress-share-modal"> <div className="progress-share-modal">
<div className="title">每日打卡</div> <div className="title">每日打卡</div>
<ul className="progress-container"> <ul className="progress-container">
<li> <li>
<div className="title">累计学习</div> <div className="title">累计学习</div>
<div className="number"><span className='num'>{props.data.learn_day_count}</span>天</div> <div className="number">
<span className="num">{props.data.learn_day_count}</span>
</div>
</li> </li>
<li> <li>
<div className="title">行动力超过</div> <div className="title">行动力超过</div>
<div className="number"><span className='num'>{parseFloat(props.data.action_power)}</span>% <div className="number">
<span className="num">
{parseFloat(props.data.action_power)}
</span>
%
</div> </div>
</li> </li>
</ul> </ul>
<div className="share-container"> <div className="share-container">
<div className="title">分享到</div> <div className="title">分享到</div>
<ul> <ul>
<li className='share-icon'> <li className="share-icon">
<a style={{display: 'block'}} href={props.data.url}> <a style={{ display: "block" }} href={props.data.url}>
<div className="icon"><i className='iconfont iconweixinzhifu'/></div> <div className="icon">
<div className='text'>微信好友</div> <i className="iconfont iconweixinzhifu" />
</div>
<div className="text">微信好友</div>
</a> </a>
</li> </li>
<li className='share-icon'> <li className="share-icon">
<a style={{display: 'block'}} href={props.data.url}> <a style={{ display: "block" }} href={props.data.url}>
<div className="icon"><i className='iconfont iconpengyouquaniconx'/></div> <div className="icon">
<div className='text'>朋友圈</div> <i className="iconfont iconpengyouquaniconx" />
</div>
<div className="text">朋友圈</div>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
<i className="iconfont iconiconfront-2 close" onClick={props.closeShareModal}/> <i
className="iconfont iconiconfront-2 close"
onClick={props.closeShareModal}
/>
</div> </div>
</div> </div>
) )
)
} }
class Video extends Component { class Video extends Component {
video //video element video //video element
player //video player instance player //video player instance
currentVideoTimer currentVideoTimer
...@@ -84,7 +97,7 @@ class Video extends Component { ...@@ -84,7 +97,7 @@ class Video extends Component {
RECENTLEARN = "recent_learn" RECENTLEARN = "recent_learn"
state = { state = {
title: '', title: "",
courseId: null, courseId: null,
videoList: [], videoList: [],
datum: [], datum: [],
...@@ -97,44 +110,47 @@ class Video extends Component { ...@@ -97,44 +110,47 @@ class Video extends Component {
isShowShareModal: false, isShowShareModal: false,
shareData: {}, shareData: {},
singleBox: false, singleBox: false,
singMess: '', singMess: "",
singleType: 1,// 单集购买需要 singleType: 1, // 单集购买需要
nowPrice: 0,// 单集购买需要 nowPrice: 0, // 单集购买需要
laterPrice: 0,// 单集购买需要 laterPrice: 0, // 单集购买需要
limitFreeNoPromptChecked: false,//是否勾选"不再显示此弹框"选项 limitFreeNoPromptChecked: false, //是否勾选"不再显示此弹框"选项
showLimitFreePopup: false, showLimitFreePopup: false,
limitFreePopup: {}, limitFreePopup: {},
isShowNeverShowPopupOption: false, //限时免费课程 播放结束后是否显示"不再显示此弹框"选项 isShowNeverShowPopupOption: false, //限时免费课程 播放结束后是否显示"不再显示此弹框"选项
limitFreePopupVideos: JSON.parse(localStorage.getItem('limit-free-popup-videos')), limitFreePopupVideos: JSON.parse(
currentVideoExpireTime: '', localStorage.getItem("limit-free-popup-videos")
),
currentVideoExpireTime: "",
} }
componentDidMount() { componentDidMount() {
if (window.location.protocol === 'https:') { if (window.location.protocol === "https:") {
window.location.replace('http' + window.location.href.slice(5)) window.location.replace("http" + window.location.href.slice(5))
return return
} }
this.courseID = getParam('id') this.courseID = getParam("id")
if (!this.courseID) { if (!this.courseID) {
this.props.history.replace('/') this.props.history.replace("/")
return return
} }
this.setState({ this.setState({
courseId: this.courseID, courseId: this.courseID,
}) })
const {location: {state = {}}} = this.props; const {
location: { state = {} },
} = this.props
if (state.oid) { if (state.oid) {
this.check(state.oid); this.check(state.oid)
} }
if (getParam('is_class') === 1 || getParam('weixinpay')) { if (getParam("is_class") === 1 || getParam("weixinpay")) {
this.payCallback() this.payCallback()
} }
if (browser.isWeixin) { if (browser.isWeixin) {
this.isweixinPay() this.isweixinPay()
} }
this.token = jsCookie.get('token') this.token = jsCookie.get("token")
this.getVideoList() this.getVideoList()
this.getDatumCatalog() this.getDatumCatalog()
} }
...@@ -142,12 +158,16 @@ class Video extends Component { ...@@ -142,12 +158,16 @@ class Video extends Component {
// 直接购买 // 直接购买
tobuy = () => { tobuy = () => {
// 详情页单集购买到该页面,url中的id不是课程id // 详情页单集购买到该页面,url中的id不是课程id
const {course = {}} = this.state; const { course = {} } = this.state
http.get(`${API['base-api']}/m/cart/addtopreorder/[${course.course_id}]`).then((res) => { http
.get(`${API["base-api"]}/m/cart/addtopreorder/[${course.course_id}]`)
.then((res) => {
if (res.data.errno === 0) { if (res.data.errno === 0) {
this.props.history.push(`/order?id=${course.course_id}`, {simple: 1}) this.props.history.push(`/order?id=${course.course_id}`, {
simple: 1,
})
} else { } else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2)
} }
}) })
} }
...@@ -158,30 +178,34 @@ class Video extends Component { ...@@ -158,30 +178,34 @@ class Video extends Component {
singleType: 1, singleType: 1,
singMess: item, singMess: item,
}) })
window.localStorage.setItem('singMess', JSON.stringify(item)) window.localStorage.setItem("singMess", JSON.stringify(item))
} }
// 自组件传给父组件的boxHide // 自组件传给父组件的boxHide
boxHide = (val) => { boxHide = (val) => {
this.setState({singleBox: val, singleType: 1}) this.setState({ singleBox: val, singleType: 1 })
} }
// 单集购买 H5支付成功后回调 // 单集购买 H5支付成功后回调
payCallback = () => { payCallback = () => {
const _this = this; const _this = this
if (!getParam('oid')) { if (!getParam("oid")) {
return; return
} else { } else {
this.setState({ this.setState({
singMess: JSON.parse(window.localStorage.getItem('singMess')), singMess: JSON.parse(window.localStorage.getItem("singMess")),
}) })
_this.intervalPayStatus = setInterval(function () { _this.intervalPayStatus = setInterval(function () {
http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => { http
.get(`${API["base-api"]}/m/orderState/oid/${getParam("oid")}`)
.then((res) => {
if (res.data.errno === 401) { if (res.data.errno === 401) {
clearInterval(_this.intervalPayStatus); clearInterval(_this.intervalPayStatus)
_this.intervalPayStatus = null; _this.intervalPayStatus = null
// 获取课程类型 // 获取课程类型
http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => { http
.get(`${API["base-api"]}/class_order_status/${getParam("oid")}`)
.then((res) => {
if (Number(res.data.data.errno) === 200) { if (Number(res.data.data.errno) === 200) {
// 正常购买单集成功 // 正常购买单集成功
_this.setState({ _this.setState({
...@@ -212,63 +236,90 @@ class Video extends Component { ...@@ -212,63 +236,90 @@ class Video extends Component {
}) })
}, 1000) }, 1000)
} }
}; }
// 单集购买 微信内支付成功后回调 // 单集购买 微信内支付成功后回调
isweixinPay = () => { isweixinPay = () => {
let _this = this; let _this = this
let weixin_code = getParam('code'); let weixin_code = getParam("code")
if (weixin_code) { if (weixin_code) {
if (!getParam('oid')) { if (!getParam("oid")) {
return return
} else { } else {
this.setState({ this.setState({
singMess: JSON.parse(window.localStorage.getItem('singMess')), singMess: JSON.parse(window.localStorage.getItem("singMess")),
}) })
// this.props.weixinPay(weixin_code) // this.props.weixinPay(weixin_code)
http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => { http
.get(
`${API["base-api"]}/pay/wxpay/pub_charge/oid/${getParam(
"oid"
)}/code/${weixin_code}`
)
.then((res) => {
if (res.data.errno === 0) { if (res.data.errno === 0) {
const data = res.data.data; const data = res.data.data
function onBridgeReady() { function onBridgeReady() {
WeixinJSBridge.invoke( WeixinJSBridge.invoke(
'getBrandWCPayRequest', { "getBrandWCPayRequest",
"appId": data.appId, //公众号名称,由商户传入 {
"timeStamp": data.timeStamp, //时间戳,自1970年以来的秒数 appId: data.appId, //公众号名称,由商户传入
"nonceStr": data.nonceStr, //随机串 timeStamp: data.timeStamp, //时间戳,自1970年以来的秒数
"package": data.package, nonceStr: data.nonceStr, //随机串
"signType": data.signType, //微信签名方式: package: data.package,
"paySign": data.paySign, //微信签名 signType: data.signType, //微信签名方式:
paySign: data.paySign, //微信签名
}, },
function (res) { function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") { if (res.err_msg === "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2); Toast.info("支付成功", 2)
_this.intervalPayStatus = setInterval(function () { _this.intervalPayStatus = setInterval(function () {
http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => { http
.get(
`${API["base-api"]}/m/orderState/oid/${getParam(
"oid"
)}`
)
.then((res) => {
if (res.data.errno === 401) { if (res.data.errno === 401) {
clearInterval(_this.intervalPayStatus); clearInterval(_this.intervalPayStatus)
_this.intervalPayStatus = null; _this.intervalPayStatus = null
// 获取课程类型 // 获取课程类型
http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => { http
.get(
`${
API["base-api"]
}/class_order_status/${getParam("oid")}`
)
.then((res) => {
if (Number(res.data.data.errno) === 200) { if (Number(res.data.data.errno) === 200) {
// 正常购买单集成功 // 正常购买单集成功
_this.setState({ _this.setState({
singleType: 6, singleType: 6,
}) })
} else if (Number(res.data.data.errno) === 201) { } else if (
Number(res.data.data.errno) === 201
) {
// 0元参团 // 0元参团
_this.setState({ _this.setState({
singleType: 4, singleType: 4,
}) })
} else if (Number(res.data.data.errno) === 202) { } else if (
Number(res.data.data.errno) === 202
) {
// 0元购 // 0元购
_this.setState({ _this.setState({
singleType: 3, singleType: 3,
}) })
} else if (Number(res.data.data.errno) === 203) { } else if (
Number(res.data.data.errno) === 203
) {
// 三天内特价 // 三天内特价
_this.setState({ _this.setState({
nowPrice: res.data.data.data.now_price, nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price, laterPrice:
res.data.data.data
.three_day_later_price,
singleType: 2, singleType: 2,
}) })
} else { } else {
...@@ -279,18 +330,22 @@ class Video extends Component { ...@@ -279,18 +330,22 @@ class Video extends Component {
}) })
}, 1000) }, 1000)
} else { } else {
alert('支付失败') alert("支付失败")
}
} }
},
) )
} }
if (typeof WeixinJSBridge == "undefined") { if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) { if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false) document.addEventListener(
"WeixinJSBridgeReady",
onBridgeReady,
false
)
} else if (document.attachEvent) { } else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady) document.attachEvent("WeixinJSBridgeReady", onBridgeReady)
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady) document.attachEvent("onWeixinJSBridgeReady", onBridgeReady)
} }
} else { } else {
onBridgeReady() onBridgeReady()
...@@ -301,30 +356,27 @@ class Video extends Component { ...@@ -301,30 +356,27 @@ class Video extends Component {
}) })
} }
} }
}; }
// 判断支付是否成功 // 判断支付是否成功
check = (oid) => { check = (oid) => {
this.setState({ this.setState({
singMess: JSON.parse(window.localStorage.getItem('singMess')), singMess: JSON.parse(window.localStorage.getItem("singMess")),
}) })
http.get(`${API['base-api']}/class_order_status/${oid}`).then((res) => { http.get(`${API["base-api"]}/class_order_status/${oid}`).then((res) => {
if (Number(res.data.data.errno) === 200) { if (Number(res.data.data.errno) === 200) {
// 正常购买单集成功 // 正常购买单集成功
this.setState({ this.setState({
singleType: 6, singleType: 6,
}) })
} else if (Number(res.data.data.errno) === 201) { } else if (Number(res.data.data.errno) === 201) {
// 0元参团 // 0元参团
this.setState({ this.setState({
singleType: 4, singleType: 4,
}) })
} else if (Number(res.data.data.errno) === 202) { } else if (Number(res.data.data.errno) === 202) {
// 0元购 // 0元购
this.setState({ this.setState({
singleType: 3, singleType: 3,
}) })
} else if (Number(res.data.data.errno) === 203) { } else if (Number(res.data.data.errno) === 203) {
// 三天内特价 // 三天内特价
...@@ -332,7 +384,6 @@ class Video extends Component { ...@@ -332,7 +384,6 @@ class Video extends Component {
nowPrice: res.data.data.data.now_price, nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price, laterPrice: res.data.data.data.three_day_later_price,
singleType: 2, singleType: 2,
}) })
} else { } else {
Toast.info(res.data.data.msg, 2) Toast.info(res.data.data.msg, 2)
...@@ -342,102 +393,107 @@ class Video extends Component { ...@@ -342,102 +393,107 @@ class Video extends Component {
// 9502 初始化 监听事件 // 9502 初始化 监听事件
setupWS = () => { setupWS = () => {
this.ws = new WebSocket(API["process-api"]); this.ws = new WebSocket(API["process-api"])
this.ws.addEventListener('error', () => { this.ws.addEventListener("error", () => {
this.ws = null this.ws = null
}) })
this.ws.addEventListener('close', () => { this.ws.addEventListener("close", () => {
if (this.reconnect) { if (this.reconnect) {
this.ws = null this.ws = null
setTimeout(() => { setTimeout(() => {
this.setupWS(); this.setupWS()
}, 1000) }, 1000)
} }
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null; this.timer = null
}) })
this.ws.addEventListener('message', e => { this.ws.addEventListener("message", (e) => {
const data = JSON.parse(e.data); const data = JSON.parse(e.data)
data.code === 4040 && (this.reconnect = false); data.code === 4040 && (this.reconnect = false)
if (data.code === 0 && data.data && data.data.position) { if (data.code === 0 && data.data && data.data.position) {
this.player.currentTime(data.data.position); this.player.currentTime(data.data.position)
} }
}) })
} }
sendMessage = message => { sendMessage = (message) => {
let readyState = this.ws.readyState, _this = this; let readyState = this.ws.readyState,
_this = this
if (readyState === 1) { if (readyState === 1) {
this.ws && this.ws.send(JSON.stringify(message)) this.ws && this.ws.send(JSON.stringify(message))
} else if (readyState === 3) { } else if (readyState === 3) {
this.ws.close(); this.ws.close()
this.ws = null; this.ws = null
let reconnect = setTimeout(function () { let reconnect = setTimeout(function () {
clearTimeout(reconnect); clearTimeout(reconnect)
reconnect = null; reconnect = null
_this.ws = new WebSocket(API["process-api"]); _this.ws = new WebSocket(API["process-api"])
}, 500); }, 500)
} }
} }
//视频结束请求接口 //视频结束请求接口
getShareProgressInfo = () => { getShareProgressInfo = () => {
http.get(`${API['base-api']}/m/aist/share_data/${this.courseID}/${this.state.videoList[this.state.activeIndex]['id']}`) http
.then(res => { .get(
const {data} = res `${API["base-api"]}/m/aist/share_data/${this.courseID}/${
if (data.errno == 200) { this.state.videoList[this.state.activeIndex]["id"]
this.setState({shareData: data.data, isShowShareModal: true}) }`
)
.then((res) => {
const { data } = res
if (data.errno === 200) {
this.setState({ shareData: data.data, isShowShareModal: true })
} }
}) })
} }
//告诉服务端计算进度 //告诉服务端计算进度
countSchedule = () => { countSchedule = () => {
const {videoList, activeIndex, vCourseId, course = {}} = this.state const { videoList, activeIndex, vCourseId, course = {} } = this.state
if (Number(course.course_id) === 0 || course.course_id === '') { if (Number(course.course_id) === 0 || course.course_id === "") {
return; return
} }
let ctype = 0; let ctype = 0
if (course.is_aist) { if (course.is_aist) {
ctype = 2; ctype = 2
} }
// 计算进度 根据ctype判断 课程类型 0-视频 1-直播 2-AI特训营 // 计算进度 根据ctype判断 课程类型 0-视频 1-直播 2-AI特训营
this.sendMessage({ this.sendMessage({
mtype: 'count_schedule', mtype: "count_schedule",
uid: this.props.user.data.uid, uid: this.props.user.data.uid,
token: this.token, token: this.token,
platform: 5, platform: 5,
video_id: videoList[activeIndex]['id'], video_id: videoList[activeIndex]["id"],
course_id: this.state.courseId, course_id: this.state.courseId,
v_course_id: vCourseId, v_course_id: vCourseId,
ctype: ctype, ctype: ctype,
}) })
} }
// 发送时间消息 // 发送时间消息
sendWatchTime = (sec, rate) => { sendWatchTime = (sec, rate) => {
const {videoList, activeIndex, vCourseId, course = {}} = this.state const { videoList, activeIndex, vCourseId, course = {} } = this.state
// 免费课程不发送 // 免费课程不发送
// if (Number(course.course_id) === 0 || course.course_id === '') { // if (Number(course.course_id) === 0 || course.course_id === '') {
// return; // return;
// } // }
// 时间为0 不发送消息 // 时间为0 不发送消息
if (Number(sec) === 0) { if (Number(sec) === 0) {
return; return
} }
let ctype = 0; let ctype = 0
if (course.is_aist) { if (course.is_aist) {
ctype = 2; ctype = 2
} }
// 时间足够不发送 // 时间足够不发送
// if(this.timeEnough) { // if(this.timeEnough) {
// return; // return;
// } // }
this.sendMessage({ this.sendMessage({
mtype: 'watch_time', mtype: "watch_time",
rate, rate,
time: sec, time: sec,
video_id: videoList[activeIndex]['id'], video_id: videoList[activeIndex]["id"],
course_id: this.state.courseId, course_id: this.state.courseId,
v_course_id: vCourseId, v_course_id: vCourseId,
uid: this.props.user.data.uid, uid: this.props.user.data.uid,
...@@ -452,7 +508,7 @@ class Video extends Component { ...@@ -452,7 +508,7 @@ class Video extends Component {
this.count = 0 this.count = 0
this.watchSec = 0 this.watchSec = 0
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null; this.timer = null
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (this.player && this.player.player()) { if (this.player && this.player.player()) {
if (this.count === 5) { if (this.count === 5) {
...@@ -464,90 +520,91 @@ class Video extends Component { ...@@ -464,90 +520,91 @@ class Video extends Component {
} }
} }
}, 1000) }, 1000)
} }
// 初始化视频播放器 // 初始化视频播放器
initializePlayer = () => { initializePlayer = () => {
window.HELP_IMPROVE_VIDEOJS = false; window.HELP_IMPROVE_VIDEOJS = false
this.player = videojs(this.video, { this.player = videojs(this.video, {
controls: true, controls: true,
preload: 'auto', preload: "auto",
bigPlayButton: false, bigPlayButton: false,
textTrackDisplay: false, textTrackDisplay: false,
posterImage: false, posterImage: false,
errorDisplay: false, errorDisplay: false,
playbackRates: ['0.75', '1', '1.5', '2'], playbackRates: ["0.75", "1", "1.5", "2"],
controlBar: { controlBar: {
pictureInPictureToggle: false, pictureInPictureToggle: false,
}, },
}) })
this.player.addChild('CustomPlayButtonCover') this.player.addChild("CustomPlayButtonCover")
this.player.on('play', () => { this.player.on("play", () => {
const {videoList, activeIndex, vCourseId, course = {}} = this.state const { videoList, activeIndex, vCourseId } = this.state
// 当视频播放时 看是否是第一次播放(初次进入页面 刷新页面 切换视频 都是第一次播放 需要获取上次的播放时间) // 当视频播放时 看是否是第一次播放(初次进入页面 刷新页面 切换视频 都是第一次播放 需要获取上次的播放时间)
if (this.isCurrentVideoFirstPlay) { if (this.isCurrentVideoFirstPlay) {
// 当某些原因导致视频暂停时(用户暂停 网络不好等) 再播放时不需要发送 // 当某些原因导致视频暂停时(用户暂停 网络不好等) 再播放时不需要发送
this.isCurrentVideoFirstPlay = false; this.isCurrentVideoFirstPlay = false
// 发送消息 recent_learn // 发送消息 recent_learn
this.ws.send(JSON.stringify({ this.ws.send(
JSON.stringify({
mtype: this.RECENTLEARN, mtype: this.RECENTLEARN,
uid: this.props.user.data.uid, uid: this.props.user.data.uid,
token: this.token, token: this.token,
platform: 5, platform: 5,
video_id: videoList[activeIndex]['id'], video_id: videoList[activeIndex]["id"],
course_id: this.state.courseId, course_id: this.state.courseId,
v_course_id: vCourseId, v_course_id: vCourseId,
is_live: 0, is_live: 0,
})) })
)
} }
if (!this.timer) { if (!this.timer) {
this.setupTimer(); this.setupTimer()
} }
}) })
this.player.on('durationchange', () => { this.player.on("durationchange", () => {
let videoTime = window.sessionStorage.getItem('videoTimeBeforeReload') let videoTime = window.sessionStorage.getItem("videoTimeBeforeReload")
let rate = window.sessionStorage.getItem('videoRateBeforeReload') let rate = window.sessionStorage.getItem("videoRateBeforeReload")
if (videoTime) { if (videoTime) {
this.player.currentTime(Number(videoTime)) this.player.currentTime(Number(videoTime))
rate && this.player.playbackRate(rate) rate && this.player.playbackRate(rate)
window.sessionStorage.removeItem('videoTimeBeforeReload') window.sessionStorage.removeItem("videoTimeBeforeReload")
window.sessionStorage.removeItem('videoRateBeforeReload') window.sessionStorage.removeItem("videoRateBeforeReload")
} }
}) })
this.player.on('ratechange', () => { this.player.on("ratechange", () => {
this.currentPlaybackRate = this.player.playbackRate() this.currentPlaybackRate = this.player.playbackRate()
this.sendWatchTime(this.watchSec, this.previousPlaybackRate) this.sendWatchTime(this.watchSec, this.previousPlaybackRate)
this.count = this.watchSec = 0 this.count = this.watchSec = 0
this.previousPlaybackRate = this.currentPlaybackRate this.previousPlaybackRate = this.currentPlaybackRate
}) })
this.player.on('ended', () => { this.player.on("ended", () => {
this.sendWatchTime(this.watchSec, this.currentPlaybackRate); this.sendWatchTime(this.watchSec, this.currentPlaybackRate)
this.count = this.watchSec = 0; this.count = this.watchSec = 0
this.countSchedule(); // 计算进度 -- 播放完毕 this.countSchedule() // 计算进度 -- 播放完毕
// 返现课程才出现打卡记录 // 返现课程才出现打卡记录
if (this.state.course.is_aist) { if (this.state.course.is_aist) {
this.getShareProgressInfo() this.getShareProgressInfo()
} }
clearInterval(this.timer); clearInterval(this.timer)
this.timer = null; this.timer = null
if (this.state.limitFreePopup.is_free) { if (this.state.limitFreePopup.is_free) {
this.setState({ this.setState({
showLimitFreePopup: true, showLimitFreePopup: true,
}) })
} }
}) })
this.player.on('error', () => { this.player.on("error", () => {
this.handleVideoAuthError(0) this.handleVideoAuthError(0)
}) })
this.player.on('waiting', () => { this.player.on("waiting", () => {
this.handleVideoAuthError(3000) this.handleVideoAuthError(3000)
}) })
} }
sendLastRecord = () => { sendLastRecord = () => {
http.post(`${API.home}/m/course/record_last_video`, { http.post(`${API.home}/m/course/record_last_video`, {
v_course_id: this.state.course['v_course_id'], v_course_id: this.state.course["v_course_id"],
video_id: this.state.videoList[this.state.activeIndex].id, video_id: this.state.videoList[this.state.activeIndex].id,
}) })
} }
...@@ -556,7 +613,7 @@ class Video extends Component { ...@@ -556,7 +613,7 @@ class Video extends Component {
this.player && this.player.dispose() this.player && this.player.dispose()
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null; this.timer = null
this.ws && this.ws.close() this.ws && this.ws.close()
this.ws = null this.ws = null
...@@ -570,8 +627,14 @@ class Video extends Component { ...@@ -570,8 +627,14 @@ class Video extends Component {
clearTimeout(this.currentVideoTimer) clearTimeout(this.currentVideoTimer)
this.currentVideoTimer = setTimeout(() => { this.currentVideoTimer = setTimeout(() => {
if (this.currentVideoExpireTime < new Date().getTime()) { if (this.currentVideoExpireTime < new Date().getTime()) {
window.sessionStorage.setItem('videoTimeBeforeReload', this.player.currentTime()) window.sessionStorage.setItem(
window.sessionStorage.setItem('videoRateBeforeReload', this.player.playbackRate()) "videoTimeBeforeReload",
this.player.currentTime()
)
window.sessionStorage.setItem(
"videoRateBeforeReload",
this.player.playbackRate()
)
this.getVideoSrc() this.getVideoSrc()
} }
}, interval) }, interval)
...@@ -579,14 +642,16 @@ class Video extends Component { ...@@ -579,14 +642,16 @@ class Video extends Component {
//请求签名视频地址 //请求签名视频地址
getVideoSrc = () => { getVideoSrc = () => {
const {videoList, activeIndex} = this.state const { videoList, activeIndex } = this.state
let lesson = videoList[activeIndex] let lesson = videoList[activeIndex]
http.get(`${API.home}/web/check_video/${lesson.id}/${lesson.v_course_id}`) http
.then(res => { .get(`${API.home}/web/check_video/${lesson.id}/${lesson.v_course_id}`)
const {data, code, msg} = res.data .then((res) => {
const { data, code, msg } = res.data
let url = new URL(data.url).searchParams let url = new URL(data.url).searchParams
if (code === 200) { if (code === 200) {
this.currentVideoExpireTime = url.has('Expires') && (Number(url.get('Expires')) * 1000) this.currentVideoExpireTime =
url.has("Expires") && Number(url.get("Expires")) * 1000
this.setPlayerSrc(data.url) this.setPlayerSrc(data.url)
} else { } else {
Toast.info(msg) Toast.info(msg)
...@@ -595,81 +660,83 @@ class Video extends Component { ...@@ -595,81 +660,83 @@ class Video extends Component {
} }
// 选择新的视频 // 选择新的视频
selectVideo = index => { selectVideo = (index) => {
if (index === this.state.activeIndex) { if (index === this.state.activeIndex) {
return return
} }
this.isCurrentVideoFirstPlay = true; // 切换视频则重置这个变量 因为新视频肯定是首次播放 this.isCurrentVideoFirstPlay = true // 切换视频则重置这个变量 因为新视频肯定是首次播放
this.sendWatchTime(this.watchSec, this.currentPlaybackRate) this.sendWatchTime(this.watchSec, this.currentPlaybackRate)
this.countSchedule(); // 计算进度 -- 选择新视频(可能是M端特有的) this.countSchedule() // 计算进度 -- 选择新视频(可能是M端特有的)
this.setupTimer(); this.setupTimer()
this.setState( this.setState(
{ {
activeIndex: index, activeIndex: index,
}, },
() => { () => {
if (this.hasAuth(this.state.activeIndex)) { if (this.hasAuth(this.state.activeIndex)) {
this.getVideoSrc() this.getVideoSrc()
this.sendLastRecord() this.sendLastRecord()
this.playVideo() this.playVideo()
} else { } else {
this.getCoursePrice(); this.getCoursePrice()
} }
}, }
); )
} }
getLastVideoIndex = lastIndex => { getLastVideoIndex = (lastIndex) => {
return this.state.videoList.findIndex(item => item.id == lastIndex) return this.state.videoList.findIndex(
(item) => Number(item.id) === Number(lastIndex)
)
} }
getVideoList = () => { getVideoList = () => {
let url = ''; let url = ""
if (getParam('video_id')) { if (getParam("video_id")) {
url = `${API.home}/m/course/play/${this.courseID + '?video_id=' + getParam('video_id')}` url = `${API.home}/m/course/play/${
http.post(`${API['base-api']}/sys/get_class_audition`, { this.courseID + "?video_id=" + getParam("video_id")
video_id: getParam('video_id'), }`
http.post(`${API["base-api"]}/sys/get_class_audition`, {
video_id: getParam("video_id"),
}) })
} else { } else {
url = `${API.home}/m/course/play/${this.courseID}` url = `${API.home}/m/course/play/${this.courseID}`
} }
http.get(url).then(res => { http.get(url).then((res) => {
const {data = {}, code} = res.data; const { data = {}, code } = res.data
if (code === 200) { if (code === 200) {
this.setState( this.setState(
state => ({ (state) => ({
videoList: data['lessons'], videoList: data["lessons"],
course: data.course, course: data.course,
courseId: data.course['course_id'], courseId: data.course["course_id"],
vCourseId: data.course['v_course_id'], vCourseId: data.course["v_course_id"],
title: data.course['course_title'], title: data.course["course_title"],
isLoading: false, isLoading: false,
}), }),
this.playSetup, this.playSetup
) )
data.course.course_id && this.getLimitFreePopup(data.course.course_id) data.course.course_id && this.getLimitFreePopup(data.course.course_id)
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
} }
}, })
)
} }
playSetup = () => { playSetup = () => {
// is_aist,是否AI特训营 // is_aist,是否AI特训营
const {course = {}} = this.state; const { course = {} } = this.state
let _this = this; let _this = this
this.setupWS(); this.setupWS()
this.setupTimer(); this.setupTimer()
let scheduleTime = setTimeout(function () { let scheduleTime = setTimeout(function () {
clearTimeout(scheduleTime); clearTimeout(scheduleTime)
scheduleTime = null; scheduleTime = null
_this.countSchedule(); // 刚进入页面的时候 就计算进度 先获取视频列表getVideoList 获取列表后 播放选择的视频 然后计算进度 _this.countSchedule() // 刚进入页面的时候 就计算进度 先获取视频列表getVideoList 获取列表后 播放选择的视频 然后计算进度
}, 1000); }, 1000)
let index = this.getLastVideoIndex(course.last_video_id); let index = this.getLastVideoIndex(course.last_video_id)
index = index >= 0 ? index : 0; index = index >= 0 ? index : 0
this.setState( this.setState(
{ {
activeIndex: index, activeIndex: index,
...@@ -682,28 +749,29 @@ class Video extends Component { ...@@ -682,28 +749,29 @@ class Video extends Component {
this.playWithAuth() this.playWithAuth()
}) })
} else { } else {
this.getCoursePrice(); this.getCoursePrice()
} }
} else { } else {
alert('暂无视频', '', [{ alert("暂无视频", "", [
text: 'OK', {
text: "OK",
onPress: () => { onPress: () => {
this.props.history.push('/') this.props.history.push("/")
}, },
}])
}
}, },
); ])
}
}
)
} }
setPlayerSrc = src => { setPlayerSrc = (src) => {
if (!this.player) { if (!this.player) {
this.initializePlayer() this.initializePlayer()
} }
this.player.src({ this.player.src({
src, src,
type: 'application/x-mpegURL', type: "application/x-mpegURL",
}) })
this.player.play() this.player.play()
} }
...@@ -715,51 +783,47 @@ class Video extends Component { ...@@ -715,51 +783,47 @@ class Video extends Component {
} }
getDatumCatalog() { getDatumCatalog() {
http.get(`${API.home}/m/course/data/${this.courseID}`) http.get(`${API.home}/m/course/data/${this.courseID}`).then((res) => {
.then(res => {
const data = res.data const data = res.data
if (data.code === 200) { if (data.code === 200) {
this.setState({ this.setState({
datum: data.data, datum: data.data,
}) })
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
} }
}) })
} }
lessonAvailable = index => { lessonAvailable = (index) => {
return this.state.videoList[index]['video_size'] !== 0 return this.state.videoList[index]["video_size"] !== 0
} }
getCoursePrice = () => { getCoursePrice = () => {
const {course = {}} = this.state; const { course = {} } = this.state
http.get(`${API.home}/sys/course/price/${course.course_id}`) http.get(`${API.home}/sys/course/price/${course.course_id}`).then((res) => {
.then(res => { const { data } = res
const {data} = res
if (data.code === 200) { if (data.code === 200) {
this.setState({ this.setState({
salePrice: data.data['sale_price'], salePrice: data.data["sale_price"],
}) })
} }
}) })
} }
playWithAuth = () => { playWithAuth = () => {
const {activeIndex} = this.state const { activeIndex } = this.state
if (this.hasAuth(activeIndex)) { if (this.hasAuth(activeIndex)) {
this.getVideoSrc() this.getVideoSrc()
} }
} }
hasAuth = index => { hasAuth = (index) => {
const {videoList} = this.state const { videoList } = this.state
let lesson = videoList[index] let lesson = videoList[index]
if (lesson['video_auth']) { if (lesson["video_auth"]) {
this.setState({ this.setState({
isAuth: true, isAuth: true,
}) })
...@@ -769,24 +833,24 @@ class Video extends Component { ...@@ -769,24 +833,24 @@ class Video extends Component {
isAuth: false, isAuth: false,
}) })
return false return false
} }
} }
getLimitFreePopup = id => { getLimitFreePopup = (id) => {
http.post(`${API.home}/sys/popup`, { http
.post(`${API.home}/sys/popup`, {
course_id: id, course_id: id,
}) })
.then(res => { .then((res) => {
const {code, msg, data} = res.data const { code, msg, data } = res.data
if (code === 200) { if (code === 200) {
const { courseId, limitFreePopupVideos } = this.state
const {courseId, limitFreePopupVideos} = this.state
this.setState({ this.setState({
limitFreePopup: data, limitFreePopup: data,
isShowNeverShowPopupOption: limitFreePopupVideos ? limitFreePopupVideos.includes(courseId) : false, isShowNeverShowPopupOption: limitFreePopupVideos
? limitFreePopupVideos.includes(courseId)
: false,
}) })
} else { } else {
Toast.info(msg, 2, null, false) Toast.info(msg, 2, null, false)
} }
...@@ -796,25 +860,24 @@ class Video extends Component { ...@@ -796,25 +860,24 @@ class Video extends Component {
if (!this.state.limitFreeNoPromptChecked) { if (!this.state.limitFreeNoPromptChecked) {
return return
} }
http.post(`${API.home}/sys/checklist`, { http
.post(`${API.home}/sys/checklist`, {
course_id: this.state.course.course_id, course_id: this.state.course.course_id,
}) })
.then(res => { .then((res) => {
const {code, msg} = res.data const { code, msg } = res.data
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
limitFreePopup: {...this.state.limitFreePopup, is_free: 0}, limitFreePopup: { ...this.state.limitFreePopup, is_free: 0 },
}) })
} else { } else {
Toast.info(msg, 2, null, false) Toast.info(msg, 2, null, false)
} }
}) })
} }
render() { render() {
let {match, location, history} = this.props let { match, location, history } = this.props
const { const {
videoList, videoList,
activeIndex, activeIndex,
...@@ -826,81 +889,100 @@ class Video extends Component { ...@@ -826,81 +889,100 @@ class Video extends Component {
showLimitFreePopup, showLimitFreePopup,
limitFreePopup, limitFreePopup,
isShowNeverShowPopupOption, isShowNeverShowPopupOption,
} = this.state; } = this.state
let toHref = ''; let toHref = ""
if (location.state && location.state.to && location.state.to === 'detail') { if (location.state && location.state.to && location.state.to === "detail") {
toHref = `/detail?id=${course.course_id}` toHref = `/detail?id=${course.course_id}`
} }
return ( return (
<div className='play'> <div className="play">
<HeaderBar title={this.state.title} arrow={true} toHref={() => { <HeaderBar
toHref ? history.push( title={this.state.title}
toHref, arrow={true}
{ toHref={() => {
to: 'classify', toHref
}, ? history.push(toHref, {
) : history.go(-1) to: "classify",
}}/> })
: history.go(-1)
}}
/>
<Loading isLoading={this.state.isLoading}> <Loading isLoading={this.state.isLoading}>
<div className="video"> <div className="video">
<video className={'video-js'} ref={el => this.video = el} <video
className={"video-js"}
ref={(el) => (this.video = el)}
webkit-playsinline="true" webkit-playsinline="true"
playsInline={true} playsInline={true}
x-webkit-airplay="allow" x-webkit-airplay="allow"
x5-video-player-type="h5"> x5-video-player-type="h5"
<source src={'/'} type='application/x-mpegURL'/> >
<source src={"/"} type="application/x-mpegURL" />
</video> </video>
{ {!isAuth && !!videoList[activeIndex]["is_class"] && (
!isAuth && !!videoList[activeIndex]['is_class'] && (
<div className="purchase-box"> <div className="purchase-box">
<div className='hint'>您尚未购买该课时,请购买后学习。</div> <div className="hint">您尚未购买该课时,请购买后学习。</div>
<div className='btns'> <div className="btns">
<button <button
type='button' type="button"
onClick={this.tobuy} onClick={this.tobuy}
className='purchase-class' className="purchase-class"
> >
¥{salePrice} 购买课程 ¥{salePrice} 购买课程
</button> </button>
<button <button
type='button' type="button"
onClick={this.toSingleset.bind(this, videoList[activeIndex])} onClick={this.toSingleset.bind(
className='purchase-episode' this,
videoList[activeIndex]
)}
className="purchase-episode"
> >
¥{videoList.length && videoList[activeIndex]['class_price']} 购买单集 ¥{videoList.length && videoList[activeIndex]["class_price"]}{" "}
购买单集
</button> </button>
</div> </div>
</div> </div>
) )}
} {!isAuth && !!course.is_aist && (
{
!isAuth && !!course.is_aist && (
<div className="is-aist-box"> <div className="is-aist-box">
<i className={'iconfont iconiconfront-21'}></i> <i className={"iconfont iconiconfront-21"}></i>
<p className={'time'}>{videoList[activeIndex]['aist_start_time']}</p> <p className={"time"}>
<p className={'time'}>请耐心等待...</p> {videoList[activeIndex]["aist_start_time"]}
</p>
<p className={"time"}>请耐心等待...</p>
</div> </div>
) )}
}
</div> </div>
<div className='tab'> <div className="tab">
<div> <div>
<NavLink to={{pathname: `${match.url}/video`, search: `?id=${this.courseID}`}} <NavLink
to={{
pathname: `${match.url}/video`,
search: `?id=${this.courseID}`,
}}
replace replace
activeClassName='active' activeClassName="active"
>视频</NavLink> >
视频
</NavLink>
</div> </div>
<div> <div>
<NavLink to={{pathname: `${match.url}/datum`, search: `?id=${this.courseID}`}} <NavLink
to={{
pathname: `${match.url}/datum`,
search: `?id=${this.courseID}`,
}}
replace replace
activeClassName='active' activeClassName="active"
>资料</NavLink> >
资料
</NavLink>
</div> </div>
</div> </div>
{/*单集购买*/} {/*单集购买*/}
{ {singleBox && (
singleBox &&
<Single <Single
courseId={course.course_id} courseId={course.course_id}
singleBox={this.state.singleBox} singleBox={this.state.singleBox}
...@@ -910,11 +992,11 @@ class Video extends Component { ...@@ -910,11 +992,11 @@ class Video extends Component {
vcourseId={course.v_course_id} vcourseId={course.v_course_id}
videoId={this.state.singMess.video_id} videoId={this.state.singMess.video_id}
check={this.check} check={this.check}
title={this.state.singMess.course_tile}/> title={this.state.singMess.course_tile}
} />
)}
{/* 单集购买成功 */} {/* 单集购买成功 */}
{ {singleType !== 1 && (
singleType !== 1 &&
<SingleSuccess <SingleSuccess
courseId={course.course_id} courseId={course.course_id}
boxHide={this.boxHide} boxHide={this.boxHide}
...@@ -925,17 +1007,20 @@ class Video extends Component { ...@@ -925,17 +1007,20 @@ class Video extends Component {
nowPrice={this.state.nowPrice} nowPrice={this.state.nowPrice}
laterPrice={this.state.laterPrice} laterPrice={this.state.laterPrice}
/> />
} )}
</Loading> </Loading>
<Switch> <Switch>
<Redirect exact from={'/play'} to={{ <Redirect
pathname: '/play/video', exact
from={"/play"}
to={{
pathname: "/play/video",
search: location.search, search: location.search,
}}/> }}
/>
<Route <Route
path={`${match.path}/video`} path={`${match.path}/video`}
render={props => { render={(props) => {
return ( return (
<VideoCatalog <VideoCatalog
activeIndex={this.state.activeIndex} activeIndex={this.state.activeIndex}
...@@ -944,72 +1029,95 @@ class Video extends Component { ...@@ -944,72 +1029,95 @@ class Video extends Component {
isAist={course.is_aist} isAist={course.is_aist}
{...props} {...props}
/> />
); )
}}
/>
<Route
path={`${match.path}/datum`}
render={(props) => {
return <DatumCatalog {...props} datum={this.state.datum} />
}} }}
/> />
<Route path={`${match.path}/datum`} render={props => {
return <DatumCatalog {...props} datum={this.state.datum}/>
}}/>
</Switch> </Switch>
<Route render={props => { <Route
return this.state.vCourseId ? <Recommendation {...props} vCourseId={this.state.vCourseId}/> render={(props) => {
: null return this.state.vCourseId ? (
}}/> <Recommendation {...props} vCourseId={this.state.vCourseId} />
<ProgressShareModal isShow={this.state.isShowShareModal} ) : null
closeShareModal={() => this.setState({isShowShareModal: false})} }}
/>
<ProgressShareModal
isShow={this.state.isShowShareModal}
closeShareModal={() => this.setState({ isShowShareModal: false })}
data={this.state.shareData} data={this.state.shareData}
/> />
{ {showLimitFreePopup && (
showLimitFreePopup && <div className={"limit-free-cover"}>
<div className={'limit-free-cover'}>
<div className="free-popup"> <div className="free-popup">
<div className="title"> <div className="title">
<span>{limitFreePopup.pop_descbition}</span> <span>{limitFreePopup.pop_descbition}</span>
</div> </div>
<div className={'des'}> <div className={"des"}>
<img className="qrcode" <img
src={limitFreePopup.wechat_img} alt=''/> className="qrcode"
src={limitFreePopup.wechat_img}
alt=""
/>
<span>长按/扫码识别</span> <span>长按/扫码识别</span>
<span>添加时请备注<span>{course.course_id}</span>哦</span> <span>
添加时请备注<span>{course.course_id}</span>
</span>
<div className="no-prompt"> <div className="no-prompt">
{ {isShowNeverShowPopupOption && (
isShowNeverShowPopupOption &&
<label htmlFor="no-prompt"> <label htmlFor="no-prompt">
<span <span
className={`checkbox-label ${this.state.limitFreeNoPromptChecked ? 'checked' : 'unchecked'}`}> className={`checkbox-label ${
<i className={'iconfont iconiconfront-73'}/> this.state.limitFreeNoPromptChecked
? "checked"
: "unchecked"
}`}
>
<i className={"iconfont iconiconfront-73"} />
</span> </span>
<input type="checkbox" id={'no-prompt'} onChange={(e) => { <input
type="checkbox"
id={"no-prompt"}
onChange={(e) => {
this.setState({ this.setState({
limitFreeNoPromptChecked: e.target.checked, limitFreeNoPromptChecked: e.target.checked,
}) })
}}/> }}
/>
<span>本课程不再提示</span> <span>本课程不再提示</span>
</label> </label>
} )}
</div> </div>
</div> </div>
<i className={'close-btn iconfont iconiconfront-2'} onClick={() => { <i
className={"close-btn iconfont iconiconfront-2"}
onClick={() => {
this.setState({ this.setState({
showLimitFreePopup: false, showLimitFreePopup: false,
isShowNeverShowPopupOption: true, isShowNeverShowPopupOption: true,
}) })
const {courseId, limitFreePopupVideos} = this.state const { courseId, limitFreePopupVideos } = this.state
localStorage.setItem('limit-free-popup-videos', JSON.stringify( localStorage.setItem(
limitFreePopupVideos ? [...limitFreePopupVideos, courseId] : [courseId], "limit-free-popup-videos",
)) JSON.stringify(
limitFreePopupVideos
? [...limitFreePopupVideos, courseId]
: [courseId]
)
)
this.checkNeverShowLimitFreePopup() this.checkNeverShowLimitFreePopup()
}}/> }}
/>
</div> </div>
</div> </div>
} )}
</div> </div>
); )
} }
} }
export default connect((state) => ({ user: state.user }), null)(Video)
export default connect(
state => ({user: state.user}),
null,
)(Video);
import React, { PureComponent } from "react" import React, { PureComponent } from "react"
import { connect } from "react-redux" import { connect } from "react-redux"
import { getCourses } from "./../../detail/actions"
import "./recommendation.scss" import "./recommendation.scss"
import { http } from "src/utils" import { http } from "src/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
...@@ -45,10 +44,8 @@ class Recommendation extends PureComponent { ...@@ -45,10 +44,8 @@ class Recommendation extends PureComponent {
} }
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props const { history } = this.props
// dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
// }));
} }
render() { render() {
......
/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid */
import React, { Component } from "react" import React, { Component } from "react"
import "./index.scss" import "./index.scss"
import { http, SendMessageToApp, getParam } from "src/utils" import { http, SendMessageToApp, getParam } from "src/utils"
...@@ -178,7 +179,7 @@ class NewVip extends Component { ...@@ -178,7 +179,7 @@ class NewVip extends Component {
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
let expires = addDays(new Date(), 90) let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => { this.state.userInfoList.forEach((item, index) => {
cookie.set("token", item.token, { cookie.set("token", item.token, {
expires, expires,
path: "/", path: "/",
...@@ -215,7 +216,7 @@ class NewVip extends Component { ...@@ -215,7 +216,7 @@ class NewVip extends Component {
} }
transformUser = (res) => { transformUser = (res) => {
let payload let payload
res.map((item, index) => { res.forEach((item, index) => {
payload = { payload = {
hasError: false, hasError: false,
data: { data: {
......
...@@ -23,7 +23,7 @@ function RouteMiddlePage(props) { ...@@ -23,7 +23,7 @@ function RouteMiddlePage(props) {
} }
} }
} }
}, [props.user.isFetching]) }, [props, props.user.isFetching])
return ( return (
<div className={"loading-route"}> <div className={"loading-route"}>
......
...@@ -27,7 +27,7 @@ export default function SendMessageToApp() { ...@@ -27,7 +27,7 @@ export default function SendMessageToApp() {
window[fun_name] = callback window[fun_name] = callback
} }
if (window.webkit != undefined) { if (window.webkit !== undefined) {
sendToIOS(messageName, params) sendToIOS(messageName, params)
} else { } else {
//貌似安卓传的参数,不能是数组和对象,所以这里json一下 //貌似安卓传的参数,不能是数组和对象,所以这里json一下
......
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