Commit 506536e6 by zhanghaozhe

prettier

parent de646276
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react"
import "./index.scss"
import { http, SendMessageToApp, getParam, browser } from "src/utils"
......@@ -8,7 +9,6 @@ import CommonPopup from "./../../common/commonPopup/index"
import { Toast } from "antd-mobile"
import QRCode from "qrcode"
import { connect } from "react-redux"
import dateFns from "date-fns"
@connect((state) => ({
user: state.user,
......@@ -110,7 +110,7 @@ class YearCourse extends Component {
let _this = this
http.get(`${API.home}/activity/wish_sum`).then((res) => {
const { code, data } = res.data
if (code == 200) {
if (code === 200) {
_this.setState({
sum: data.sum,
})
......@@ -322,7 +322,7 @@ class YearCourse extends Component {
)
.then((res) => {
const { errno, data, msg } = res.data
if (errno == 0) {
if (errno === 0) {
this.setState({
qrUrl: data.url,
})
......@@ -381,7 +381,7 @@ class YearCourse extends Component {
.post(`${API.home}/activity/join_list`, { course_id: id })
.then((res) => {
const { code, msg } = res.data
if (code == 200) {
if (code === 200) {
Toast.success("已成功加入心愿单", 3)
_this.getLength()
if (key === "1") {
......@@ -640,52 +640,16 @@ class YearCourse extends Component {
render() {
const {
bigcourse,
freecourse,
groupcourse,
basic,
advanced,
higher,
expand,
removable,
sum,
} = this.state
const { stage, treasureStage } = this.props
const { stage } = this.props
return (
<div className={"year-index-course"}>
{/*浮框*/}
{/*{*/}
{/*Number(treasureStage) === 1 &&*/}
{/*<div className='nav-right'>*/}
{/*<span onClick={this.toBoxList} className='nav-right__link'>*/}
{/*未开宝箱*/}
{/*{*/}
{/*removable > 0 &&*/}
{/*<i className="nav-right__number">{removable}</i>*/}
{/*}*/}
{/*</span>*/}
{/*<a onClick={() => this.toYearWish()} className='nav-right__link'>*/}
{/*心愿单*/}
{/*{*/}
{/*sum > 0 &&*/}
{/*<i className="nav-right__number">{sum}</i>*/}
{/*}*/}
{/*</a>*/}
{/*</div>*/}
{/*}*/}
{/*{*/}
{/*Number(treasureStage) === 0 &&*/}
{/*<div className='nav-right-wish nav-right'>*/}
{/*<a onClick={() => this.toYearWish()} className='nav-right__link'>*/}
{/*心愿单*/}
{/*{*/}
{/*sum > 0 &&*/}
{/*<i className="nav-right__number">{sum}</i>*/}
{/*}*/}
{/*</a>*/}
{/*</div>*/}
{/*}*/}
<div className="nav-right-wish nav-right">
<span onClick={this.toBoxList} className="nav-right__link">
未开宝箱
......@@ -738,7 +702,7 @@ class YearCourse extends Component {
toCourse={this.toCourse}
>
<div className="coupon-course__footer">
{item.is_vip == 1 && (
{Number(item.is_vip) === 1 && (
<a
className="btn big-course"
onClick={() => this.toQQque()}
......
......@@ -7,11 +7,10 @@ import TreasureNav from "./nav"
import CommonPopup from "./../common/commonPopup/index"
import cookie from "js-cookie"
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 { connect } from "react-redux"
import { Toast } from "antd-mobile"
import { compose } from "redux"
/*eslint-disable*/
@connect(
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react"
import { http, getParam, SendMessageToApp } from "src/utils"
import "./rank.scss"
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react"
import { http, getParam, SendMessageToApp } from "src/utils"
import "./rank.scss"
......
......@@ -6,7 +6,7 @@ import { Toast } from "antd-mobile"
import AddressPopup from "./../blessingPreheat/addressPopup/index"
import { Popup } from "src/common"
import { connect } from "react-redux"
import jsCookie from "js-cookie"
@connect(({ user }) => ({
uid: user.data.uid || "",
}))
......@@ -81,7 +81,6 @@ class BlessingGetPrize extends Component {
is_winning,
is_virtual,
prize_data,
address,
} = this.state
return (
<div className="blessing_get_prize">
......@@ -121,7 +120,11 @@ class BlessingGetPrize extends Component {
prize_data.map((item, index) => {
return (
<div className="prize__item" key={index}>
<img className="prize__image" src={item.img}></img>
<img
className="prize__image"
src={item.img}
alt={item.name}
></img>
<div className="name__num">
<span>{item.name}</span>
<span>{`*${item.num}`}</span>
......
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { Component } from "react"
import classnames from "classnames"
import { http, getParam, SendMessageToApp } from "src/utils"
......
......@@ -874,9 +874,9 @@ class BlessingPreheat extends Component {
<button
type="button"
className={
address.name != "" &&
address.phone != "" &&
address.address != ""
address.name !== "" &&
String(address.phone) !== "" &&
address.address !== ""
? "active"
: ""
}
......
......@@ -1048,19 +1048,12 @@ class Country extends Component {
}
return ""
})
lens.map((item, index) => {
lens.forEach((item, index) => {
if (item && top >= item) {
this.setState({
currentNav: data[index]["type"],
})
}
/*
if(item && (top + 200) > item) {
this.setState({
currentNav: data[index]['type']
})
}
*/
})
}
......
......@@ -95,7 +95,7 @@ class Detail extends Component {
http.get(`${API["base-api"]}/sys/user/new_user_status`).then((res) => {
const { errno, data } = res.data
if (errno === 0) {
if (data.status == 1) {
if (Number(data.status) === 1) {
// 新用户登录之后判断是否是新用户
this.setState({
isShowUserGift: false,
......@@ -292,7 +292,7 @@ class Detail extends Component {
paySign: data.paySign, //微信签名
},
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
if (res.err_msg === "get_brand_wcpay_request:ok") {
Toast.info("支付成功", 2)
_this.intervalPayStatus = setInterval(function () {
http
......@@ -520,6 +520,7 @@ class Detail extends Component {
if (!uid) {
this.props.history.push("/passport/login")
} else {
/* eslint-disable-next-line */
if (videoId == "" || videoId == 0 || videoId == undefined) {
return false
}
......
......@@ -5,7 +5,6 @@ import "./index.scss"
import { getParam, http } from "src/utils"
import { Toast } from "antd-mobile"
import { StickyContainer } from "react-sticky"
import { RenderTabBar } from "src/common"
class OutLine extends Component {
constructor(props) {
......
......@@ -4,8 +4,7 @@ import classnames from "classnames"
import { HeaderBar, Tag } from "../../common"
import OpenApp from "./OpenApp"
import { http, html, htmlDecode } from "src/utils"
import { config } from "rxjs"
import { http, htmlDecode } from "src/utils"
import { Object } from "core-js"
export default class Examination extends PureComponent {
......
......@@ -72,7 +72,7 @@ class PythonStudy extends Component {
}
toPythonHome = (isUnlock) => {
if (isUnlock == 1) {
if (Number(isUnlock) === 1) {
this.setState({
toApp: true,
})
......
......@@ -82,11 +82,9 @@ class My extends PureComponent {
}
toCourseDetail = (id) => {
const { dispatch, history } = this.props
// dispatch(getCourses(id, () => {
const { history } = this.props
history.push(`/detail?id=${id}`)
return false
// }));
}
render() {
......
......@@ -8,7 +8,6 @@ import { Modal, Toast } from "antd-mobile"
import Loading from "src/common/Loading"
import InfiniteScroll from "react-infinite-scroller"
import { debounce } from "lodash"
import { getCourses } from "./../detail/actions"
import { connect } from "react-redux"
const alert = Modal.alert
......@@ -78,11 +77,9 @@ class MyOrders extends Component {
}
toCourseDetail = (id) => {
const { dispatch, history } = this.props
// dispatch(getCourses(id, () => {
const { history } = this.props
history.push(`/detail?id=${id}`)
return false
// }));
}
render() {
......@@ -137,20 +134,21 @@ class MyOrders extends Component {
toDetail={this.toCourseDetail}
/>
{item.course_expire && item.course_expire != "" && (
<span className="course-expire">
{item.course_expire}
</span>
)}
{item.course_expire &&
item.course_expire !== "" && (
<span className="course-expire">
{item.course_expire}
</span>
)}
</div>
)
})}
<PayInfo item={item} cancel={this.cancel} />
{item.type == 5 &&
item.is_buy == 0 &&
item.is_overdue == 0 && (
{Number(item.type) === 5 &&
Number(item.is_buy) === 0 &&
Number(item.is_overdue) === 0 && (
<div className={"expand-pay-wk"}>
<span className={"expand-pay-time"}>
{item.final_end_time}结束付尾款
......@@ -158,9 +156,9 @@ class MyOrders extends Component {
<span>还需支付尾款</span>
</div>
)}
{item.type == 5 &&
item.is_buy == 0 &&
item.is_overdue == 1 && (
{Number(item.type) === 5 &&
Number(item.is_buy) === 0 &&
Number(item.is_overdue) === 1 && (
<div className={"expand-pay-wk"}>
<span>支付尾款时间已过</span>
</div>
......
......@@ -6,7 +6,6 @@ import { http, getParam } from "src/utils"
import { throttle } from "lodash"
import { HeaderBar } from "../../common"
import { connect } from "react-redux"
import { getCourses } from "./../detail/actions"
import "./order.scss"
......@@ -18,7 +17,6 @@ function OrderList(props) {
<div>
{listData.map((item, index) => {
const {
is_coupon,
course_id,
image_name,
price1,
......@@ -148,9 +146,9 @@ class Order extends Component {
cut_amount: 0, // 减金额
}
}
// 提交订单
submitOrder = () => {
const { total } = this.state
if (this.state.orderList.length === 0) {
Toast.info("没有要提交的订单!")
return
......@@ -323,8 +321,8 @@ class Order extends Component {
}
}
}
componentDidMount() {
let _this = this
// type: 1,返现课程,simple: 1,正常购买
if (this.props.location.state && this.props.location.state.type === 1) {
http.get(`${API["base-api"]}/m/order/preorder?type=1`).then((res) => {
......@@ -379,28 +377,10 @@ class Order extends Component {
Toast.info(courseInfo.data.msg, 2)
return
}
// this.groupPrice = orderInfo.data.data.course_info.pdd_group_info.price;
// if(courseInfo.data.data.course.length === 0) {
// courseInfo.data.data.course.push(orderInfo.data.data.course_info)
// }
this.publicGetData(newData)
this.publicLocalStorage()
})
} else {
// if(getParam('id')) {
// Promise.all([http.get(`${API.home}/m/del_cart_order/${getParam('id')}`), http.get(`${API['base-api']}/m/order/preorder`)]).then(res => {
// console.log(res);
// let preorder = res[1],
// orderList = preorder.data.data.course;
// if(preorder.data.errno !== 200) {
// Toast.info(preorder.data.msg, 2);
// return;
// }
// this.publicGetData(preorder);
// this.publicLocalStorage();
// })
// }else{
http.get(`${API["base-api"]}/m/order/preorder`).then((res) => {
console.log("为了验证什么条件下会走这段代码")
if (res.data.errno !== 200) {
......@@ -411,42 +391,12 @@ class Order extends Component {
this.publicGetData(res.data.data)
this.publicLocalStorage()
})
// }
}
// else {
// if(getParam('id')) {
// Promise.all([http.get(`${API.home}/m/del_cart_order/${getParam('id')}`), http.get(`${API.home}/m/order/preorder`)]).then(res => {
// console.log(res);
// let preorder = res[1],
// orderList = preorder.data.data.course;
// if(preorder.data.errno !== 200) {
// Toast.info(preorder.data.msg, 2);
// return;
// }
//
// this.publicGetData(preorder);
// this.publicLocalStorage();
// })
// }else{
// http.get(`${API.home}/m/order/preorder`).then((res) => {
// console.log('为了验证什么条件下会走这段代码');
// if (res.data.errno !== 200) {
// Toast.info(res.data.msg, 2);
// return;
// }
//
// this.publicGetData(res);
// this.publicLocalStorage();
// })
// }
// }
}
toCourseDetail = (id) => {
const { dispatch, history } = this.props
// dispatch(getCourses(id, () => {
const { history } = this.props
history.push(`/detail?id=${id}`)
// }));
}
render() {
......@@ -469,48 +419,6 @@ class Order extends Component {
<Flex>
<Flex.Item>
<HeaderBar title="课程报名" arrow={true} />
{/*{*/}
{/*!this.state.perfect &&*/}
{/*<Link to={{*/}
{/*pathname: '/orderinfo',*/}
{/*state: {type: this.props.location.state ? this.props.location.state.type : null, id: getParam('id')}*/}
{/*}}*/}
{/*className="order-information">*/}
{/*<i className="iconfont iconiconfront-6 order-addsize" />*/}
{/*<div className="order-infotext">完善报名信息</div>*/}
{/*<i className="iconfont iconiconfront-70 order-next" />*/}
{/*</Link>*/}
{/*}*/}
{/*{*/}
{/*this.state.perfect &&*/}
{/*<div className="order-information2">*/}
{/*<WingBlank>*/}
{/*<Link to={{*/}
{/*pathname: '/orderinfo',*/}
{/*state: {*/}
{/*...this.state.perfect,*/}
{/*...this.props.location.state,*/}
{/*id: getParam('id')*/}
{/*}*/}
{/*}*/}
{/*} >*/}
{/*<Flex align='center' justify='between' style={{ height: '80px' }}>*/}
{/*<i className="iconfont iconiconfront-20 user-icon"></i>*/}
{/*<Flex direction='column' justify='between' align='start' className="order-cell">*/}
{/*<div className="name">{`姓名:${perfect.real_name}`}</div>*/}
{/*<div>{`电话:${perfect.cellphone}`}</div>*/}
{/*</Flex>*/}
{/*<Flex align='start' className="order-cell">*/}
{/*<div>{`QQ:${perfect.qq}`}</div>*/}
{/*</Flex>*/}
{/*</Flex>*/}
{/*</Link>*/}
{/*</WingBlank>*/}
{/*</div>*/}
{/*}*/}
<div className="order-list">
<OrderList
list={orderList}
......
......@@ -5,7 +5,6 @@ import { Course } from "src/common"
import { http } from "src/utils"
import { Toast } from "antd-mobile"
import { withRouter } from "react-router-dom"
import { getCourses } from "./../../detail/actions"
@connect()
class Recommendation extends Component {
......@@ -25,15 +24,9 @@ class Recommendation extends Component {
})
}
// handleClick = (id) => {
// this.props.history.push(`/detail?id=${id}`)
// }
toCourseDetail = (id) => {
const { dispatch, history } = this.props
// dispatch(getCourses(id, () => {
const { history } = this.props
history.push(`/detail?id=${id}`)
// }));
}
render() {
......
......@@ -80,7 +80,6 @@ class SearchResult extends PureComponent {
handleScroll = throttle(() => {
let y = window.scrollY < 0 ? 0 : window.scrollY,
headY = this.searchHead.current.offsetTop,
h = this.searchHead.current.offsetHeight
if (y > this.prevScrollY) {
this.setState({
......
......@@ -7,7 +7,6 @@ import ShopCart from "./cartList.js"
import "./card.scss"
import classnames from "classnames"
import { http } from "src/utils"
import { getCourses } from "./../detail/actions"
const alert = Modal.alert
......@@ -57,9 +56,8 @@ class Cart extends Component {
this.calc(newData)
if (checked) {
let arr = []
newData.map((item, i) => {
arr.push(item.course_id)
let arr = newData.map((item) => {
return item.course_id
})
this.setState({
courseIdarr: arr,
......@@ -131,7 +129,7 @@ class Cart extends Component {
`${API["base-api"]}/m/cart/addtopreorder/[${this.state.courseIdarr}]`
)
.then((res) => {
if (res.data.errno == 0) {
if (res.data.errno === 0) {
this.props.history.push(`/order?id=[${this.state.courseIdarr}]`, {
simple: 1,
})
......@@ -170,11 +168,8 @@ class Cart extends Component {
}
toCourseDetail = (id) => {
// console.log(id);
const { dispatch, history } = this.props
// dispatch(getCourses(id, () => {
const { history } = this.props
history.push(`/detail?id=${id}`)
// }));
}
render() {
......
......@@ -6,7 +6,6 @@ import { Toast } from "antd-mobile"
import classnames from "classnames"
import { isEmpty } from "lodash"
import InfiniteScroll from "react-infinite-scroller"
import { HashLoader } from "react-spinners"
import "./free-courses.scss"
......@@ -30,7 +29,7 @@ class FreeCourse extends PureComponent {
componentDidMount() {
this.getFreeCourses().then((res) => {
let data = res.data
if (data.code == 200) {
if (data.code === 200) {
this.setState({
courses: data.data,
hasMore: true,
......@@ -41,7 +40,7 @@ class FreeCourse extends PureComponent {
})
this.getFreeLive().then((res) => {
let data = res.data
if (data.code == 200) {
if (data.code === 200) {
this.setState({
live: isEmpty(data.data) ? [] : data.data,
})
......@@ -81,7 +80,7 @@ class FreeCourse extends PureComponent {
() => {
this.getFreeCourses().then((res) => {
let data = res.data
if (data.code == 200) {
if (data.code === 200) {
Array.isArray(data.data) &&
this.setState({
courses: this.state.courses.concat(data.data),
......@@ -125,7 +124,7 @@ class FreeCourse extends PureComponent {
)
const LiveStatus =
item["live_status"] == 0 ? (
Number(item["live_status"]) === 0 ? (
<Tag className={"tag-soon top"}>即将开始</Tag>
) : (
<Tag className={"tag-playing top"}>正在直播</Tag>
......
......@@ -90,7 +90,6 @@ const setCurrentUser = (payload) => ({
payload: { ...payload, isFetching: false },
})
const LOGOUT = "LOGOUT"
const logout = () => (dispatch) => {
jsCookie.remove("token", { path: "/", domain: ".julyedu.com" })
jsCookie.remove("uid", { path: "/", domain: ".julyedu.com" })
......
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