Commit ea4bd874 by zhanghaozhe

eslint

parent ed0bb3a3
src/
\ No newline at end of file
......@@ -121,7 +121,12 @@
"build-storybook": "build-storybook"
},
"eslintConfig": {
"extends": "react-app"
"extends": "react-app",
"globals": {
"API": "readonly",
"NoCaptcha": "readonly",
"WeixinJSBridge": "readonly"
}
},
"browserslist": {
"production": [
......
import React, { Component } from 'react';
import {connect} from "react-redux"
import { connect } from "react-redux"
import './index.scss';
import { http, getParam, is_weixin, wxShare, getC, SendMessageToApp } from 'src/utils';
import {Toast} from "antd-mobile";
import { http, getParam, browser, wxShare, SendMessageToApp } from 'src/utils';
import { Toast } from "antd-mobile";
import jsCookie from 'js-cookie';
......@@ -16,16 +16,16 @@ class Invite extends Component {
hot_schedule: '',
userList: [],
inviteCode: '',
isshowAppTip:false
isshowAppTip: false,
}
}
componentWillMount() {
let uid = jsCookie.get('uid');
let shareuid = getParam('shareuid');
if(uid === shareuid) {
if (uid === shareuid) {
} else {
if(getParam('new')) {
if (getParam('new')) {
this.props.history.push(`/activity?shareuid=${shareuid}&inviteCode=${getParam('inviteCode')}`);
}
}
......@@ -36,23 +36,25 @@ class Invite extends Component {
distinguishVersion = () => {
// plat_form 1ios 2android
// version 1->3.704 2->4.5.1.20191105
if(getParam('plat_form') == 1){
// eslint-disable-next-line eqeqeq
if (getParam('plat_form') == 1) {
let version = Number(getParam('version'))
this.setState({
isshowAppTip: version < 3.704 ? true : false
isshowAppTip: version < 3.704,
});
}
if(getParam('plat_form') == 2){
// eslint-disable-next-line eqeqeq
if (getParam('plat_form') == 2) {
let version = getParam('version').replace(/\./g, '').slice(0, 3)
this.setState({
isshowAppTip: Number(version) < 451 ? true:false
isshowAppTip: Number(version) < 451,
});
}
}
componentDidMount() {
if(!this.props.user.hasError) {
if (!this.props.user.hasError) {
this.getUserList();
this.getHotValue();
this.getInviteCode();
......@@ -61,7 +63,7 @@ class Invite extends Component {
componentWillReceiveProps(nextProps) {
console.log('componentWillReceiveProps');
if(!nextProps.user.hasError) {
if (!nextProps.user.hasError) {
this.getUserList();
this.getHotValue();
this.getInviteCode();
......@@ -71,9 +73,9 @@ class Invite extends Component {
getUserList = () => {
http.get(`${API.home}/sys/user/invite/list`).then(res => {
let {code, data, msg} = res.data;
if(code === 200) {
if (code === 200) {
this.setState({
userList: data
userList: data,
});
} else {
Toast.info(msg, 2);
......@@ -84,10 +86,10 @@ class Invite extends Component {
getHotValue = () => {
http.get(`${API.home}/sys/user/hot/value`).then(res => {
let {code, data, msg} = res.data;
if(code === 200) {
if (code === 200) {
this.setState({
hot_schedule: data.hot_schedule,
hotValue: data.hot_value
hotValue: data.hot_value,
});
} else {
Toast.info(msg, 2);
......@@ -98,36 +100,36 @@ class Invite extends Component {
getInviteCode = () => {
http.get(`${API.home}/sys/user/invite/link`).then(res => {
let {code, data, msg} = res.data;
if(code === 200) {
if (code === 200) {
let inviteCode = data.blessing_invite_code;
if(is_weixin()) {
if (browser.isWeixin) {
wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
link: encodeURI(location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`),
link: encodeURI(window.location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`),
imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png',
});
}
this.setState(()=>({
inviteCode: inviteCode
this.setState(() => ({
inviteCode: inviteCode,
}))
}else if(code === 4030 || code === 4040) {
history.push('/passport');
}else{
} else if (code === 4030 || code === 4040) {
this.props.history.push('/passport');
} else {
Toast.info(msg, 2);
}
});
}
inviteFriends = () => {
const { user, history } = this.props;
const {inviteCode,isshowAppTip} = this.state;
const {user, history} = this.props;
const {inviteCode, isshowAppTip} = this.state;
// 未登录先去登录
if (getParam('version')) {
if(user.hasError) {
if (user.hasError) {
SendMessageToApp("toLogin");
}else {
if(isshowAppTip){
} else {
if (isshowAppTip) {
Toast.info('请前往h5/pc端使用该功能', 2);
} else {
let data = {
......@@ -139,23 +141,23 @@ class Invite extends Component {
SendMessageToApp("toShare", data)
}
}
}else {
if(user.hasError) {
} else {
if (user.hasError) {
history.push('/passport');
}else {
if(is_weixin()) {
} else {
if (browser.isWeixin) {
history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`);
wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
link: encodeURI(location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`),
link: encodeURI(window.location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`),
imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png',
});
this.setState({
showTip: true,
isWeiXin: true,
});
}else{
} else {
history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`);
this.setState({
showTip: true,
......@@ -215,7 +217,7 @@ class Invite extends Component {
<p className="show__new">(仅显示新用户)</p>
</>
) : (null)
) : null
}
{
......@@ -226,7 +228,7 @@ class Invite extends Component {
return (
<div className="user__item-info item__con-only" key={index}>
<div className="item__con">
<img className="user_avatar" src={item.head_image} />
<img className="user_avatar" alt={item.user_name} src={item.head_image}/>
<div className="user_name">{item.user_name}</div>
</div>
</div>
......@@ -239,7 +241,7 @@ class Invite extends Component {
return (
<div className="user__item-info" key={index}>
<div className="item__con">
<img className="user_avatar" src={item.head_image} />
<img className="user_avatar" alt={item.user_name} src={item.head_image}/>
<div className="user_name">{item.user_name}</div>
</div>
</div>
......@@ -247,9 +249,7 @@ class Invite extends Component {
})
}
</div>
) : (
null
)
) : null
}
</div>
{
......@@ -261,9 +261,7 @@ class Invite extends Component {
{
isWeiXin ? (
<div className="share__row"></div>
) : (
null
)
) : null
}
</div>
)
......@@ -276,5 +274,5 @@ class Invite extends Component {
export default connect(
state => ({user: state.user}),
null
null,
)(Invite);
import React, { Component } from 'react'
import QRCode from 'qrcode'
import { http, SendMessageToApp, wxShare, is_weixin, getParam } from 'src/utils'
import { http, SendMessageToApp, wxShare, browser, getParam } from 'src/utils'
import { Link } from 'react-router-dom'
import { throttle, findIndex, debounce } from 'lodash'
import RulePopup from './rulePopup/index'
......@@ -142,14 +142,8 @@ class BlessingPreheat extends Component {
}
componentDidMount() {
const _this = this;
this.fetchUserBlessing()
// setTimeout(function(){
// // 这里有获取ID的步骤,由于运营过多的调整,导致顺序不定,所以包含ID的title必须要放到判断中(防止出现多个title),设置定时器是因为如果返回较慢 获取不到ID导致报错
// _this.setInitialNavActiveStatus()
// }, 50);
// window.addEventListener('scroll', throttle(this.calcNavActive, 100))
if (is_weixin()) {
if (browser.isWeixin) {
wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
......@@ -163,7 +157,7 @@ class BlessingPreheat extends Component {
this.loginInfo(result)
}
window['getNewData'] = result => {
window['getNewData'] = () => {
this.fetchUserBlessing()
}
window['QQWXWBshare'] = result => {
......@@ -208,7 +202,7 @@ class BlessingPreheat extends Component {
// 保存cookie
appLogin = () => {
let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => {
this.state.userInfoList.forEach((item) => {
cookie.set("token", item.token, {expires, path: '/', domain: '.julyedu.com'})
cookie.set("plat", item.plat, {expires, path: '/', domain: '.julyedu.com'})
cookie.set("uid", item.uid, {expires, path: '/', domain: '.julyedu.com'})
......@@ -228,7 +222,7 @@ class BlessingPreheat extends Component {
transformUser = res => {
let payload
res.map((item, index) => {
res.forEach((item) => {
payload = {
hasError: false,
data: {
......@@ -347,21 +341,6 @@ class BlessingPreheat extends Component {
}
})
}
handleToAddBlessing = (key) => {
http.post(`${API.home}/sys/add/blessing`, {
share_platform: key, // 1 朋友圈 2 微博 3 qq
type: 3 // 1:签到;3:分享;4:浏览课程;
}).then(res => {
const {code} = res.data
if (code === 200) {
Toast.info('+2点福气值~', 2, null, false)
}
})
}
handleToSign = () => {
const {userInfo} = this.state
http.post(`${API.home}/sys/add/blessing`, {
......@@ -448,11 +427,6 @@ class BlessingPreheat extends Component {
SendMessageToApp("toLogin")
}
}
onCopy = () => {
Toast.info('复制成功', 2, null, false)
}
toSection = (i, e) => {
const {navs} = this.state
e.preventDefault()
......@@ -524,6 +498,7 @@ class BlessingPreheat extends Component {
http.get(`${API.home}/sys/activity/my_lotteries`)
.then(res => {
const {code, data, msg} = res.data
// eslint-disable-next-line eqeqeq
if (code == 200) {
this.recordInstance = Popup({
title: '我的中奖纪录',
......@@ -564,7 +539,8 @@ class BlessingPreheat extends Component {
...this.state.address
})
.then(res => {
const {data, code, msg} = res.data
const {code, msg} = res.data
// eslint-disable-next-line eqeqeq
if (code == 200) {
this.setState({
......@@ -597,6 +573,7 @@ class BlessingPreheat extends Component {
http.get(`${API.home}/sys/user_address_info`)
.then(res => {
const {data, code, msg} = res.data
// eslint-disable-next-line eqeqeq
if (code == 200) {
this.recordInstance && this.recordInstance.close()
this.setState({
......@@ -819,8 +796,8 @@ class BlessingPreheat extends Component {
}}
value={address.address}
/>
<button type='button'
className={(address.name != '' && address.phone != '' && address.address != '') ? 'active' : ''}
{/* eslint-disable-next-line eqeqeq */}
<button type='button' className={(address.name != '' && address.phone != '' && address.address != '') ? 'active' : ''}
onClick={this.submitAddress}
>提交
</button>
......
import React, {Component} from 'react'
import React, { Component } from 'react'
import './share.scss'
import {http, getParam, browser, wxShare,is_weixin} from 'src/utils'
import {Toast} from 'antd-mobile'
import {connect} from "react-redux";
import {Link} from "react-router-dom";
import { http, getParam, browser, wxShare } from 'src/utils'
import { Toast } from 'antd-mobile'
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import showAlert from 'src/common/deposit/end-expansion-alert'
class ExpandShare extends Component {
......@@ -21,7 +21,7 @@ class ExpandShare extends Component {
componentDidMount() {
this.getListorData()
this.getCourseList()
if(is_weixin()) {
if (browser.isWeixin) {
wxShare({
title: 'AI充电节,预热来袭!80元红包送给你,手要快!',
desc: '积福气享1折秒课,超10万元奖品来就送--七月在线',
......@@ -35,9 +35,9 @@ class ExpandShare extends Component {
getListorData = () => {
http.get(`${API['base-api']}/sys/help_list/${getParam('deposit_code')}`).then((res) => {
const {data, errno, msg} = res.data
if (errno == 200) {
if (errno === 200) {
this.setState({
data: data
data: data,
})
} else {
Toast.info(msg, 2)
......@@ -51,22 +51,22 @@ class ExpandShare extends Component {
const _this = this
http.get(`${API['base-api']}/anniversary2019/pre_course`).then((res) => {
const {data, errno, msg} = res.data
if (errno == 200) {
if (JSON.stringify(data) == '{}') {
if (errno === 200) {
if (JSON.stringify(data) === '{}') {
_this.setState({
isshowMore: false,
courseList: []
courseList: [],
})
} else if (data.length <= 6) {
_this.setState({
isshowMore: false,
courseList: data
courseList: data,
})
} else {
_this.setState({
isshowMore: true,
courseList: data.slice(0, 6),
courseListMore: data
courseListMore: data,
})
}
} else {
......@@ -80,12 +80,12 @@ class ExpandShare extends Component {
getMoreCourseList = () => {
this.setState({
courseList: this.state.courseListMore,
isshowMore: false
isshowMore: false,
})
}
// 立即付定金
expandPaydj = (courseId) => {
const {user, history} = this.props;
const {user} = this.props;
const uid = user && user.data && user.data.uid;
if (!uid) {
this.props.history.push('/passport/login')
......@@ -95,14 +95,14 @@ class ExpandShare extends Component {
{
id: courseId,
isexpand: 1,
sourcenum: 1
}
sourcenum: 1,
},
)
}
}
// 立即付尾款
expandPaywk = (courseId, time, day) => {
const {user, history} = this.props;
const {user} = this.props;
const uid = user && user.data && user.data.uid;
if (!uid) {
this.props.history.push('/passport/login')
......@@ -113,9 +113,9 @@ class ExpandShare extends Component {
'/final-deposit-order?source=1',
{
id: courseId,
sourcenum: 1
sourcenum: 1,
}
},
)
} else {
Toast.info("付尾款时间将在" + day + "开启", 2);
......@@ -131,44 +131,44 @@ class ExpandShare extends Component {
showRule = () => {
this.setState({
isShow: true,
step: 1
step: 1,
})
}
// 邀请好友
share = () => {
const {user, history} = this.props;
const {user} = this.props;
const uid = user && user.data && user.data.uid;
if (!uid) {
this.props.history.push('/passport/login')
} else {
this.setState({
isShow: true,
step: 0
step: 0,
})
}
}
// 帮好友助力
helpFriend = (id) => {
const {user, history} = this.props;
const {user} = this.props;
const uid = user && user.data && user.data.uid;
if (!uid) {
this.props.history.push('/passport/login')
} else {
http.post(`${API['base-api']}/sys/help/${id}`).then((res) => {
const {data, errno, msg} = res.data
if (errno == 200) {
if (errno === 200) {
this.setState({
isShow: true,
step: 2,
helpData: data
helpData: data,
})
this.getListorData()
} else if (errno === 17018 || errno === 17020) {
this.setState({
isShow: true,
step: 4
step: 4,
})
} else {
Toast.info(msg, 2)
......@@ -179,7 +179,7 @@ class ExpandShare extends Component {
// 结束助力
isendExpand = (data) => {
const {user, history} = this.props;
const {user} = this.props;
const uid = user && user.data && user.data.uid;
if (!uid) {
this.props.history.push('/passport/login')
......@@ -190,25 +190,25 @@ class ExpandShare extends Component {
limit_amount,
onCancel: () => {
this.setState({
isShow: false
isShow: false,
})
},
onConfirm: () => {
http.post(`${API['base-api']}/sys/end_expansion`, {
id
id,
})
.then(res => {
const {errno, msg} = res.data
if (errno == 200) {
if (errno === 200) {
this.setState({
isShow: false
isShow: false,
})
this.getListorData()
} else {
Toast.info(msg)
}
})
}
},
})
}
}
......@@ -216,7 +216,7 @@ class ExpandShare extends Component {
// 关闭弹窗
close = () => {
this.setState({
isShow: false
isShow: false,
})
}
......@@ -244,7 +244,7 @@ class ExpandShare extends Component {
{/*好友助力列表*/}
{
(data.oneself === 1 || data.help_list && data.help_list.length !== 0) &&
((data.oneself === 1 || data.help_list) && data.help_list.length !== 0) &&
<FriendList data={data}/>
}
{/*预售课程列表*/}
......@@ -569,13 +569,23 @@ function CourseList(props) {
<div className="btn">
{
item.is_buy === 0 &&
/*eslint-disable-next-line*/
<a className="to-expand-buy1"
onClick={() => expandPaydj(item.course_id)}>立即付定金</a>
href={'#'}
onClick={(e) => {
e.preventDefault()
expandPaydj(item.course_id)
}}>立即付定金</a>
}
{
item.is_buy === 1 &&
/*eslint-disable-next-line*/
<a className="to-expand-buy2"
onClick={() => expandPaywk(item.course_id, item.start_timestamp, item.final_start_time)}>立即付尾款</a>
href='#'
onClick={(e) => {
e.preventDefault()
expandPaywk(item.course_id, item.start_timestamp, item.final_start_time)
}}>立即付尾款</a>
}
{
item.is_buy === 2 &&
......@@ -607,6 +617,6 @@ function CourseList(props) {
export default connect(
state => ({
user: state.user
user: state.user,
}),
)(ExpandShare)
import React, { Component } from 'react'
import { Flex, WingBlank, WhiteSpace, List, Radio, Toast, Checkbox } from 'antd-mobile'
import { http, getParam, is_weixin, browser } from 'src/utils'
import { OrderItem, HeaderBar } from 'src/common/index'
import { http, getParam, browser } from 'src/utils'
import { HeaderBar } from 'src/common/index'
import { Link } from 'react-router-dom'
import './index.scss'
import { VList } from 'src/common'
......@@ -10,10 +10,10 @@ import classnames from 'classnames'
const RadioItem = Radio.RadioItem
let mockData = []
let mockData
if (browser.isWeixin) {
mockData = [
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'}
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'},
]
} else {
mockData = [
......@@ -41,7 +41,7 @@ class PayOrder extends Component {
{value: 'huabei', qishu: '9', lilv: '7.50%', everyMoney: 100, feiyong: 7.5},
],
categoryList: [],
agree: false
agree: false,
}
}
......@@ -59,7 +59,7 @@ class PayOrder extends Component {
// 确定购买
pay = () => {
const {payType, orderId} = this.state
if(!this.state.agree){
if (!this.state.agree) {
return
}
if (payType === 0) {
......@@ -71,7 +71,7 @@ class PayOrder extends Component {
// 微信支付
weixinPay = (orderId) => {
// 微信内部-支付
if (is_weixin()) {
if (browser.isWeixin) {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" + encodeURIComponent(window.location.href + "&aa=bb").toLowerCase() + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
} else {
// 微信外部-支付
......@@ -89,9 +89,7 @@ class PayOrder extends Component {
let _this = this
let weixin_code = getParam('code')
if (weixin_code) {
if (getParam('oid') === undefined) {
return
} else {
if (getParam('oid') !== undefined) {
http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => {
if (res.data.errno === 0) {
let data = res.data.data
......@@ -104,9 +102,10 @@ class PayOrder extends Component {
nonceStr: data.nonceStr, //随机串
package: data.package,
signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名
paySign: data.paySign, //微信签名
},
function (res) {
// eslint-disable-next-line eqeqeq
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2)
_this.intervalPayStatus = setInterval(function () {
......@@ -121,7 +120,7 @@ class PayOrder extends Component {
} else {
alert('支付失败')
}
}
},
)
}
......@@ -162,6 +161,7 @@ class PayOrder extends Component {
let _this = this
data = data || _this.BridgeData
/* eslint-disable-next-line no-undef */
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": "wx23dac6775ac82877", //公众号名称,由商户传入
......@@ -169,16 +169,17 @@ class PayOrder extends Component {
"nonceStr": data.nonceStr, //随机串
"package": data.package,
"signType": data.signType, //微信签名方式:
"paySign": data.paySign //微信签名
"paySign": data.paySign, //微信签名
},
function (res) {
// eslint-disable-next-line eqeqeq
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2)
_this.payCallback()
} else {
alert('支付失败')
}
}
},
)
}
// 支付宝支付
......@@ -205,13 +206,14 @@ class PayOrder extends Component {
http.post(`${API["base-api"]}/m/deposit/detail`, {
order_id: this.state.orderId
order_id: this.state.orderId,
}).then(res => {
const {data} = res
// eslint-disable-next-line eqeqeq
if (data.errno == 200) {
this.setState({
categoryList: [data.data.course_info],
salePrice: data.data.course_info.sale_price
salePrice: data.data.course_info.sale_price,
})
} else {
Toast.info(data.msg)
......@@ -233,7 +235,7 @@ class PayOrder extends Component {
singleMoney,
periodNumber,
categoryList,
agree
agree,
} = this.state
return (
<div className='pay-order'>
......@@ -297,7 +299,7 @@ class PayOrder extends Component {
checkPeriod ? (
<span style={{
color: '#333333',
fontSize: '12px'
fontSize: '12px',
}}>{`${singleMoney}元 × ${periodNumber}期`}</span>
) : null
}
......
import React, { Component } from 'react'
import { Checkbox, Flex, List, Radio, Toast, WhiteSpace, WingBlank } from 'antd-mobile'
import { browser, getParam, http, is_weixin } from 'src/utils'
import { browser, getParam, http } from 'src/utils'
import { HeaderBar } from 'src/common/index'
import VlistBase from 'src/common/v-list-base'
import './index.scss'
import { WithFullSize } from 'src/HOCs'
import { Link } from "react-router-dom"
import app from "src/utils/app"
const RadioItem = Radio.RadioItem
......@@ -25,6 +24,7 @@ function OrderList({courses, toggleSelectedCourse}) {
定金折扣:<span className={'price'}>-¥{course.deduction_amount}</span>
</div>
{
// eslint-disable-next-line eqeqeq
course.coupon_amount != 0 &&
<div className={'coupon-amount'}>
使用优惠券:<span className={'price'}>-¥{course.coupon_amount}</span>
......@@ -67,20 +67,20 @@ function OrderList({courses, toggleSelectedCourse}) {
pathname: `/coupons`,
search: `?id=${course_id}`,
state: {
from: '/order'
}
from: '/order',
},
}}>
<Flex justify='between'>
<span
style={{
color: '#333',
fontSize: '15px'
fontSize: '15px',
}}
>优惠券</span>
<span
style={{
fontSize: '14px',
color: '#999999'
color: '#999999',
}}
>
{!coupon_desc ? (coupon_num === 0 ? '无' : `${coupon_num}张可用`) : (coupon_desc)}
......@@ -98,10 +98,10 @@ function OrderList({courses, toggleSelectedCourse}) {
)
}
let mockData = []
let mockData
if (browser.isWeixin) {
mockData = [
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'}
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'},
]
} else {
mockData = [
......@@ -129,7 +129,7 @@ class FinalDepositOrder extends Component {
moneyOffRules: [],
finalEndTime: '',
offset: 0,
appliedMoneyOffRule: {}
appliedMoneyOffRule: {},
}
}
......@@ -157,9 +157,9 @@ class FinalDepositOrder extends Component {
//提交
submit = () => {
this.createOrder().then(res => {
if (res.data.errno == 200) {
if (res.data.errno === 200) {
this.setState({
order_id: res.data.data.order_id
order_id: res.data.data.order_id,
}, () => {
if (res.data.data.pay_jump === 1) {
this.props.history.push('/purchased')
......@@ -176,7 +176,7 @@ class FinalDepositOrder extends Component {
//创建订单
createOrder = () => {
const {selectedCourses, salePrice, useBalance, user_account, appliedMoneyOffRule} = this.state
const {selectedCourses, salePrice, useBalance, appliedMoneyOffRule} = this.state
return http.post(`${API["base-api"]}/m/deposit/final/create`, {
course_ids: selectedCourses.map(item => item.course_id),
cut_amount: appliedMoneyOffRule.cut_amount || 0,
......@@ -184,13 +184,13 @@ class FinalDepositOrder extends Component {
is_deduction: useBalance ? 1 : 0,
deduction_amount: useBalance ? this.getBalanceOffset() : 0,
plat_form: 5,
source: getParam('source')
source: getParam('source'),
})
}
// 微信支付
weixinPay = (orderId) => {
// 微信内部-支付
if (is_weixin()) {
if (browser.isWeixin) {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" + encodeURIComponent(window.location.href + "&aa=bb").toLowerCase() + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
} else {
// 微信外部-支付
......@@ -209,14 +209,13 @@ class FinalDepositOrder extends Component {
let _this = this
let weixin_code = getParam('code')
if (weixin_code) {
if (getParam('oid') === undefined) {
return
} else {
if (getParam('oid') !== undefined) {
http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => {
if (res.data.errno === 0) {
let data = res.data.data
function onBridgeReady() {
/* eslint-disable-next-line no-undef */
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
appId: data.appId, //公众号名称,由商户传入
......@@ -224,10 +223,10 @@ class FinalDepositOrder extends Component {
nonceStr: data.nonceStr, //随机串
package: data.package,
signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名
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.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => {
......@@ -241,7 +240,7 @@ class FinalDepositOrder extends Component {
} else {
alert('支付失败')
}
}
},
)
}
......@@ -304,17 +303,17 @@ class FinalDepositOrder extends Component {
http.get(`${API["base-api"]}/m/deposit/final/preorder`)
.then(res => {
const {data} = res
if (data.errno == 200) {
if (data.errno === 200) {
this.setState({
categoryList: [...data.data.courses],
salePrice: this.getTotalPrice({
courses: [...data.data.courses],
moneyOffRules: data.data['full_rule']
moneyOffRules: data.data['full_rule'],
}),
selectedCourses: [...data.data.courses],
user_account: data.data.user_account,
moneyOffRules: data.data['full_rule'],
finalEndTime: data.data['final_end_time']
finalEndTime: data.data['final_end_time'],
})
} else {
Toast.info(data.msg)
......@@ -326,7 +325,7 @@ class FinalDepositOrder extends Component {
// 展示余额抵扣规则
showInfo = () => {
this.setState((prevState) => ({
info: !prevState.info
info: !prevState.info,
}))
}
......@@ -334,8 +333,8 @@ class FinalDepositOrder extends Component {
toggleSelectedCourse = course => {
this.setState(prevState => {
const {selectedCourses} = prevState
let index = prevState.selectedCourses.findIndex(item => item.course_id == course.course_id)
if (index == -1) {
let index = prevState.selectedCourses.findIndex(item => item.course_id === course.course_id)
if (index === -1) {
selectedCourses.push(course)
} else {
selectedCourses.splice(index, 1)
......@@ -350,8 +349,8 @@ class FinalDepositOrder extends Component {
{
courses = this.state.selectedCourses,
useBalance = this.state.useBalance,
moneyOffRules = this.state.moneyOffRules
} = {}
moneyOffRules = this.state.moneyOffRules,
} = {},
) => {
let totalPrice = this.getOriginTotalPrice({courses})
totalPrice = this.moneyOff(totalPrice, moneyOffRules)
......@@ -369,7 +368,7 @@ class FinalDepositOrder extends Component {
let rule = rules[i]
if (result >= rule.full_amount) {
this.setState({
appliedMoneyOffRule: rule
appliedMoneyOffRule: rule,
})
return result - parseFloat(rule.cut_amount)
}
......@@ -385,7 +384,7 @@ class FinalDepositOrder extends Component {
return {
useBalance,
salePrice: totalPrice,
offset: this.getBalanceOffset(totalPrice)
offset: this.getBalanceOffset(totalPrice),
}
})
......@@ -408,7 +407,6 @@ class FinalDepositOrder extends Component {
render() {
const {
orderId,
salePrice,
payType,
categoryList,
......@@ -417,12 +415,12 @@ class FinalDepositOrder extends Component {
info,
finalEndTime,
offset,
appliedMoneyOffRule
appliedMoneyOffRule,
} = this.state
return (
<div className='deposit-pay-order'>
<HeaderBar title='课程报名' arrow={true}></HeaderBar>
<WhiteSpace size='sm' />
<WhiteSpace size='sm'/>
{/*<div className='order-number'>
<WingBlank>
<Flex justify='between' align='center' style={{height: '44px'}}>
......@@ -431,7 +429,7 @@ class FinalDepositOrder extends Component {
</Flex>
</WingBlank>
</div>*/}
<WhiteSpace size='md' />
<WhiteSpace size='md'/>
<div className={'order-list'}>
<OrderList
......@@ -460,7 +458,7 @@ class FinalDepositOrder extends Component {
<span style={{
color: '#FF2121',
fontSize: '15px',
marginRight: "6px"
marginRight: "6px",
}}>{`-¥${offset}`}</span>
<i
className={`iconfont icondanseshixintubiao-5 balance-used`}
......@@ -524,7 +522,7 @@ class FinalDepositOrder extends Component {
width: '100%',
height: '100%',
backgroundColor: 'rgba(0, 0, 0, 0.8)',
zIndex: '99'
zIndex: '99',
}}>
<div style={{
padding: '20px',
......@@ -535,14 +533,14 @@ class FinalDepositOrder extends Component {
position: 'absolute',
left: '50%',
top: '50%',
transform: 'translate(-50%, -50%)'
transform: 'translate(-50%, -50%)',
}}>
<Flex direction='column' justify='between' align='center' style={{height: '100%'}}>
<p style={{fontSize: '16px', color: '#333333'}}>余额抵扣说明</p>
<p style={{
lineHeight: '20px',
fontSize: '13px',
color: '#666666'
color: '#666666',
}}>分销课程或者参与七月在线的相关活动,可获得资金奖励。账户资金可直接提现,也可抵扣课程费用。</p>
<div onClick={this.showInfo} style={{
width: '260px',
......@@ -552,7 +550,7 @@ class FinalDepositOrder extends Component {
borderRadius: '3px',
border: '1px solid #0099FF',
color: '#0099FF',
fontSize: '15px'
fontSize: '15px',
}}>知道了
</div>
</Flex>
......
import React, { Component } from 'react';
import { Flex, WingBlank, WhiteSpace, List, Radio, Toast } from 'antd-mobile';
import { http, getParam, is_weixin, browser } from 'src/utils';
import { OrderItem, HeaderBar } from 'src/common/index';
import { http, getParam, browser } from 'src/utils';
import { HeaderBar } from 'src/common/index';
import { Link } from 'react-router-dom';
import './PayOrder.scss';
import { VList } from 'src/common';
const Item = List.Item;
const Brief = Item.Brief;
const RadioItem = Radio.RadioItem;
let mockData = []
let mockData
if (browser.isWeixin) {
mockData = [
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'}
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'},
];
} else {
mockData = [
......@@ -58,10 +56,10 @@ export default class PayOrder extends Component {
// type订单类型 0普通订单 1团购 2小团 3砍价 4单集购买 5定金课定金 6定金课尾款
if (parseInt(type, 10) === 2) {
history.push(`/togroup?id=${oid}`);
}else if(parseInt(type, 10) === 4) {
courseId && window.localStorage.setItem('payCourse', courseId);
} else if (parseInt(type, 10) === 4) {
const courseId = window.localStorage.getItem('payCourse')
courseId && history.push(`/detail?id=${courseId}`,{oid});
courseId && window.localStorage.setItem('payCourse', courseId);
courseId && history.push(`/detail?id=${courseId}`, {oid});
} else {
history.push('/purchased');
}
......@@ -110,7 +108,7 @@ export default class PayOrder extends Component {
// 微信支付
weixinPay = (orderId) => {
// 微信内部-支付
if (is_weixin()) {
if (browser.isWeixin) {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" + encodeURIComponent(window.location.href + "&aa=bb").toLowerCase() + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
// if(window.location.href.indexOf('aa=bb') === -1){
// localStorage.setItem('a', '第一次');
......@@ -138,9 +136,7 @@ export default class PayOrder extends Component {
let _this = this;
let weixin_code = getParam('code');
if (weixin_code) {
if (getParam('oid') === undefined) {
return
} else {
if (getParam('oid') !== undefined) {
http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => {
if (res.data.errno === 0) {
let data = res.data.data;
......@@ -153,9 +149,10 @@ export default class PayOrder extends Component {
nonceStr: data.nonceStr, //随机串
package: data.package,
signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名
paySign: data.paySign, //微信签名
},
function (res) {
// eslint-disable-next-line eqeqeq
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2);
_this.intervalPayStatus = setInterval(function () {
......@@ -178,7 +175,7 @@ export default class PayOrder extends Component {
} else {
alert('支付失败')
}
}
},
)
}
......@@ -235,16 +232,17 @@ export default class PayOrder extends Component {
"nonceStr": data.nonceStr, //随机串
"package": data.package,
"signType": data.signType, //微信签名方式:
"paySign": data.paySign //微信签名
"paySign": data.paySign, //微信签名
},
function (res) {
// eslint-disable-next-line eqeqeq
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2);
_this.payCallback();
} else {
alert('支付失败')
}
}
},
)
}
// 支付宝支付
......@@ -260,7 +258,7 @@ export default class PayOrder extends Component {
}
// 花呗分期 暂时不做
huabeiPay = (orderId) => {
const {singleMoney, periodNumber} = this.state;
const {periodNumber} = this.state;
// console.log('花呗分期支付');
http.get(`/pay/alipay/wap_charge/oid/${orderId}/plat/{plat} /hb_num/${periodNumber}`).then(res => {
......@@ -275,25 +273,25 @@ export default class PayOrder extends Component {
componentDidMount() {
this.redirectAfterPay()
let data = {}
if(this.props.location.state && this.props.location.state.group){
let data
if (this.props.location.state && this.props.location.state.group) {
data = {
order_id: this.state.orderId,
type: 2
type: 2,
}
} else {
data = {
order_id: this.state.orderId,
}
}
http.post(`${API['base-api']}/m/order/detail`,data).then((res) => {
http.post(`${API['base-api']}/m/order/detail`, data).then((res) => {
if (res.data.errno !== 200) {
Toast.info(res.data.msg, 2);
return;
}
const {course, pay_amount} = res.data.data;
const fenqiList = [];
[1, 2, 3].map((item) => {
[1, 2, 3].forEach((item) => {
let obj = {};
obj.value = item;
if (item === 1) {
......@@ -329,9 +327,9 @@ export default class PayOrder extends Component {
if (getParam('is_class') === 1 || getParam('weixinpay')) {
this.payCallback()
}
if (is_weixin()) {
if (browser.isWeixin) {
this.setState({
payType: 1
payType: 1,
})
this.isweixinPay()
}
......@@ -402,7 +400,7 @@ export default class PayOrder extends Component {
checkPeriod ? (
<span style={{
color: '#333333',
fontSize: '12px'
fontSize: '12px',
}}>{`${singleMoney}元 × ${periodNumber}期`}</span>
) : null
}
......
import React, { Component } from 'react';
import { Tabs, WhiteSpace, List, Flex, WingBlank, Modal, ListView, Toast } from 'antd-mobile';
import './scholarship.scss';
import { is_weixin, http } from "src/utils";
import { browser, http } from "src/utils";
import CategoryItem from './CategoryItem/CategoryItem.js';
import SortItem from './SortItem/SortItem.js';
import { connect } from 'react-redux';
import OpenApp from 'src/common/CallApp';
import {getCourses} from './../detail/actions';
const Item = List.Item;
@connect(state => ({
user: state.user
user: state.user,
}))
class _Scholarship extends Component {
constructor(props) {
......@@ -38,9 +37,10 @@ class _Scholarship extends Component {
this.searchObject = {};
this.rData = [];
}
tabList = [
{ title: '课程列表', sub: '1' },
{ title: '分销榜单', sub: '2' },
{title: '课程列表', sub: '1'},
{title: '分销榜单', sub: '2'},
];
// 返回上一页
goback = () => {
......@@ -62,40 +62,39 @@ class _Scholarship extends Component {
}
// 提现按钮 根据是否在微信环境中显示提示
drawCash = () => {
if (is_weixin()) {
if (browser.isWeixin) {
this.setState({
drawCashWechat: true
drawCashWechat: true,
});
} else {
this.setState({
drawCashHtml: true
drawCashHtml: true,
});
}
const {hasError, data = {}} = this.props.user;
if(hasError) {
if (hasError) {
Toast.info("请登录提现!", undefined, undefined, false);
return;
}
http.get(`${API['base-api']}/wx/user_temporary_qrcode/${data.uid}`).then(res => {
if(res.data.errno === 0) {
if (is_weixin()) {
if (res.data.errno === 0) {
if (browser.isWeixin) {
this.setState({
codeSrc: res.data.data.qr_image
codeSrc: res.data.data.qr_image,
});
} else {
this.setState({
codeSrc: res.data.data.qr_image
codeSrc: res.data.data.qr_image,
});
}
}else{
} else {
Toast.info(res.data.data.msg, 2);
}
});
};
// 去登陆
toLogin = () => {
......@@ -112,7 +111,7 @@ class _Scholarship extends Component {
// 分销赚钱
shareCategory = (course_id, money) => {
const {hasError, data = {}} = this.props.user;
if(hasError) {
if (hasError) {
Toast.info("请登录后分享!", undefined, undefined, false);
return;
}
......@@ -133,24 +132,27 @@ class _Scholarship extends Component {
let apiUrl = `${API.home}/m/dist/course_list`;
if (this.tabIndex === 1) { apiUrl = `${API.home}/m/dist/commission_ranking_list` };
if (this.tabIndex === 1) {
apiUrl = `${API.home}/m/dist/commission_ranking_list`
}
http.get(apiUrl).then((res) => {
if (res.data.code !== 200) {
this.setState({ isLoading: false });
this.setState({isLoading: false});
return;
}
let newData = [];
if(this.tabIndex === 0) {
if (this.tabIndex === 0) {
if (!res.data.data.list || res.data.data.list.length === 0) {
this.setState({ isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1 });
this.setState({isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1});
return;
}
newData = res.data.data.list;
} else {
if (!res.data.data || res.data.data.length === 0) {
this.setState({ isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1 });
this.setState({isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1});
return;
}
newData = res.data.data;
......@@ -164,23 +166,24 @@ class _Scholarship extends Component {
dataSource: this.state.dataSource.cloneWithRows(this.rData),
isLoading: false,
// hasMore: newData.length >= 10,
hasMore: false
hasMore: false,
});
})
.catch(() => {
this.setState({ isLoading: false });
this.setState({isLoading: false});
});
}
componentDidMount() {
if (this.state.useBodyScroll) {
document.body.style.overflow = 'auto';
} else {
document.body.style.overflow = 'hidden';
}
http.get(`${API.home}/m/user_account`).then(res=>{
if(res.data.code === 200) {
http.get(`${API.home}/m/user_account`).then(res => {
if (res.data.code === 200) {
this.setState({
...res.data.data
...res.data.data,
});
}
});
......@@ -188,16 +191,14 @@ class _Scholarship extends Component {
}
toCourseDetail = (id) => {
const { dispatch, history } = this.props;
// dispatch(getCourses(id, () => {
const {history} = this.props;
history.push(`/detail?id=${id}`)
// }));
}
render() {
const row = (
rowData,
rowID
rowID,
) => {
return (
<CategoryItem
......@@ -211,14 +212,15 @@ class _Scholarship extends Component {
const row1 = (
rowData,
rowID
rowID,
) => {
return <SortItem {...rowData} sortNum={this.rData.indexOf(rowData) + 1} key={rowID} />;
return <SortItem {...rowData} sortNum={this.rData.indexOf(rowData) + 1} key={rowID}/>;
};
/* eslint-disable-next-line no-unused-vars*/
const separator = (sectionID, rowID) => (
<div key={`${sectionID}-${rowID}`}>
<WhiteSpace />
<WhiteSpace/>
</div>
);
const {
......@@ -229,7 +231,7 @@ class _Scholarship extends Component {
waitMoneyDetail,
codeSrc,
} = this.state;
const { hasError } = this.props.user;
const {hasError} = this.props.user;
return (
<div className={'scholarship'}>
<div className={'account-container'}>
......@@ -258,7 +260,7 @@ class _Scholarship extends Component {
</>
) : (
<>
<Flex justify='center' align='baseline' className={"drawCash"} >
<Flex justify='center' align='baseline' className={"drawCash"}>
<span className={'common-ft-25'}>{account}</span>
<span className={'common-ft-15'}></span>
</Flex>
......@@ -271,15 +273,14 @@ class _Scholarship extends Component {
}
</div>
<div className={'over-am-list-item'} >
<div className={'over-am-list-item'}>
{
hasError ? (null) : (
<>
hasError ? null : <>
<div>
<List>
<Item
arrow="horizontal"
style={{ padding: '0 0 0 15px' }}
style={{padding: '0 0 0 15px'}}
onClick={this.showDetail}
>
<Flex direction='row' justify='between'>
......@@ -291,9 +292,8 @@ class _Scholarship extends Component {
</div>
<WhiteSpace></WhiteSpace>
</>
)
}
<div style={{ backgroundColor: '#FFF' }}>
<div style={{backgroundColor: '#FFF'}}>
<Tabs tabs={this.tabList}
initialPage={0}
swipeable={false}
......@@ -312,28 +312,26 @@ class _Scholarship extends Component {
},
() => {
this.onEndReached();
}
},
);
}}
>
</Tabs>
{
this.state.tab === 0 ? (
<div style={{ marginTop: '15px', backgroundColor: '#FFF' }}>
<div style={{marginTop: '15px', backgroundColor: '#FFF'}}>
{
this.state.dataSource._cachedRowCount !== 0 ? (
<ListView
useBodyScroll={this.state.useBodyScroll}
dataSource={this.state.dataSource}
renderRow={row}
renderBodyComponent={() => <div />}
renderBodyComponent={() => <div/>}
onEndReached={this.onEndReached}
pageSize={4}
onEndReachedThreshold={100}
/>
) : (
null
)
) : null
}
</div>
......@@ -350,14 +348,12 @@ class _Scholarship extends Component {
useBodyScroll={this.state.useBodyScroll}
dataSource={this.state.dataSource}
renderRow={row1}
renderBodyComponent={() => <div />}
renderBodyComponent={() => <div/>}
onEndReached={this.onEndReached}
pageSize={4}
onEndReachedThreshold={100}
/>
) : (
null
)
) : null
}
</div>
) : null
......@@ -371,16 +367,20 @@ class _Scholarship extends Component {
maskClosable={true}
onClose={this.closeModal}
title="提现"
footer={[{ text: '确认', onPress: () => { this.closeModal() } }]}
footer={[{
text: '确认', onPress: () => {
this.closeModal()
},
}]}
className={'wechatModal'}
style={{ width: '300px' }}
style={{width: '300px'}}
>
<p style={{ fontSize: '13px', color: '#666666' }}>
<p style={{fontSize: '13px', color: '#666666'}}>
提现金额将通过微信零钱转账给您,识别下方二维码,关注【七月在线】服务号申请提现。
</p>
<WhiteSpace size='sm'></WhiteSpace>
<Flex justify='center'>
<img src={codeSrc} style={{ width: '90px', height: '90px', backgroundColor: '#666' }} alt="二维码" />
<img src={codeSrc} style={{width: '90px', height: '90px', backgroundColor: '#666'}} alt="二维码"/>
</Flex>
</Modal>
......@@ -389,20 +389,28 @@ class _Scholarship extends Component {
transparent
maskClosable={true}
onClose={this.closeModal}
style={{ width: '300px'}}
style={{width: '300px'}}
>
<p style={{color: '#333333', fontSize: '16px', textAlign: 'center'}}>提现</p>
<WhiteSpace size='lg'></WhiteSpace>
<p style={{ fontSize: '12px', color: '#666666', textAlign: 'left' }}>
<p style={{fontSize: '12px', color: '#666666', textAlign: 'left'}}>
提现金额将通过微信零钱转账给您,请微信扫码关注【七月在线】服务号后申请提现。
</p>
<WhiteSpace size='lg'></WhiteSpace>
<Flex justify='center'>
<img src={codeSrc} style={{ width: '90px', height: '90px' }} alt="二维码" />
<img src={codeSrc} style={{width: '90px', height: '90px'}} alt="二维码"/>
</Flex>
<WhiteSpace size='sm'></WhiteSpace>
<Flex justify='center' style={{color: '#333333', fontSize: '12px'}}>长按二维码保存到相册</Flex>
<i onClick={this.closeModal} className='iconfont iconiconfront-2' style={{zIndex: 99, fontSize: '40px', color: '#fff', position: "fixed", top: '70%', left: '50%', transform: 'translateX(-50%)'}}></i>
<i onClick={this.closeModal} className='iconfont iconiconfront-2' style={{
zIndex: 99,
fontSize: '40px',
color: '#fff',
position: "fixed",
top: '70%',
left: '50%',
transform: 'translateX(-50%)',
}}></i>
</Modal>
<Modal
......@@ -412,18 +420,22 @@ class _Scholarship extends Component {
onClose={this.closeModal}
title="待确认金额"
footer={[
{ text: '知道了', onPress: () => { this.closeModal() } }
{
text: '知道了', onPress: () => {
this.closeModal()
},
},
]}
style={{ width: '300px' }}
style={{width: '300px'}}
>
<p style={{ fontSize: '13px', color: '#666666', textAlign: 'left', lineHeight: '20px' }}>
<p style={{fontSize: '13px', color: '#666666', textAlign: 'left', lineHeight: '20px'}}>
1.尚未开课的直播课程,用户购买后归属您的佣金会暂时存放在『待确认金额』中。
</p>
<p style={{ fontSize: '13px', color: '#666666', textAlign: 'left', lineHeight: '20px' }}>
<p style={{fontSize: '13px', color: '#666666', textAlign: 'left', lineHeight: '20px'}}>
2.该课程正式开课时,如果用户没有退款,对应的订单金额会自动转入您的账号余额,否则该佣金会自动收回。
</p>
<WhiteSpace></WhiteSpace>
<Flex style={{ fontSize: '14px', color: '#0099FF' }} justify='center'>
<Flex style={{fontSize: '14px', color: '#0099FF'}} justify='center'>
<span style={{color: "#333", marginRight: '10px'}}>待确认订单详情可</span>
<OpenApp className='toApp' text='前往APP查看'/>
</Flex>
......@@ -432,6 +444,7 @@ class _Scholarship extends Component {
)
}
}
// const mapStateToProps = (state) => {
// return {
// user: {
......
import React, {Component, useState, useEffect, useLayoutEffect, useRef} from 'react';
import {withRouter, RouteComponentProps} from 'react-router-dom'
import React, { useState} from 'react';
import {withRouter} from 'react-router-dom'
const TSTest: React.FC = () => {
const [count, setCount] = useState(0);
......@@ -23,14 +23,4 @@ const TSTest: React.FC = () => {
);
}
function Message({text}: { text: string }) {
const [message, setMessage] = useState<string | null>(null)
useEffect(() => {
setMessage(text)
})
return <span>{message}</span>
}
export default withRouter(TSTest);
\ No newline at end of file
const config = require('./utils/proxy-config')
const proxy = require('http-proxy-middleware')
module.exports = function (app) {
Object.keys(config).forEach(item => {
app.use(proxy(
config[item]['development'], {
target: config[item]['test'],
changeOrigin: true,
// secure: false,
pathRewrite: {
[`^${config[item]['development']}`]: ''
},
// cookieDomainRewrite: 'localhost',
...config[item]['proxy']
}
))
})
};
\ No newline at end of file
export const getParam = (key, str) => {
const _s = str ? str : location.href;
const re = new RegExp(`(?:\\?|#|&)(${key})=([^=&#\\?]+)`, 'ig');
let found;
return (found = re.exec(_s)) ? found[2] : null;
const _s = str ? str : window.location.href;
const re = new RegExp(`[?#&](${key})=([^=&#?]+)`, 'ig');
let found = re.exec(_s);
return found ? found[2] : null;
}
const html = content => ({
......@@ -23,8 +23,8 @@ function getTimestamp(msec) {
}
function loadScript(src, cb) {
var head = document.head || document.getElementsByTagName('head')[0]
var script = document.createElement('script')
let head = document.head || document.getElementsByTagName('head')[0]
let script = document.createElement('script')
cb = cb || function () {
}
......@@ -52,7 +52,7 @@ function initCaptcha(cb) {
if (window.initNECaptcha) {
cb()
} else {
const url = '//cstaticdun.126.net/load.min.js' + '?t=' + getTimestamp(1 * 60 * 1000)
const url = '//cstaticdun.126.net/load.min.js?t=' + getTimestamp(60 * 1000)
loadScript(url, cb)
}
......@@ -62,26 +62,17 @@ function initCaptchaNC(cb) {
if (window.NoCaptcha && typeof window.NoCaptcha.init === 'function') {
cb()
} else {
const url = '//g.alicdn.com/sd/nch5/index.js' + '?t=' + getTimestamp(1 * 60 * 1000)
const url = '//g.alicdn.com/sd/nch5/index.js?t=' + getTimestamp(60 * 1000)
loadScript(url, cb)
}
}
export const is_weixin = () => {
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
return true;
}
return false;
}
function validateTel(tel) {
return /^1[3-9](\d{9})$/.test(tel)
}
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
let re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
......@@ -98,7 +89,7 @@ const browser = (function () {
})()
const isValidUrl = (str) => {
return /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/.test(str)
return /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/.test(str)
}
......
const config = {
home: {
development: '/local-api',
test: 'http://fast-test.julyedu.com',
pre: 'https://fast-pre.julyedu.com',
production: 'https://fast.julyedu.com',
proxy: {}
},
'search-api': {
development: '/search-api',
test: 'https://search.julyedu.com',
pre: 'https://search.julyedu.com',
production: 'https://search.julyedu.com',
proxy: {}
},
'passport-api': {
development: '/passport-api',
test: 'http://passport-test.julyedu.com',
pre: 'https://passport-pre.julyedu.com',
production: 'http://passport.julyedu.com',
proxy: {}
},
'base-api': {
development: '/base-api',
test: 'http://api-test.julyedu.com',
pre: 'https://api-pre.julyedu.com',
production: 'https://api.julyedu.com',
proxy: {
secure: false
}
},
}
module.exports = config
\ No newline at end of file
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