Commit ea4bd874 by zhanghaozhe

eslint

parent ed0bb3a3
src/
\ No newline at end of file
...@@ -121,7 +121,12 @@ ...@@ -121,7 +121,12 @@
"build-storybook": "build-storybook" "build-storybook": "build-storybook"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app",
"globals": {
"API": "readonly",
"NoCaptcha": "readonly",
"WeixinJSBridge": "readonly"
}
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import {connect} from "react-redux" import { connect } from "react-redux"
import './index.scss'; import './index.scss';
import { http, getParam, is_weixin, wxShare, getC, SendMessageToApp } from 'src/utils'; import { http, getParam, browser, wxShare, SendMessageToApp } from 'src/utils';
import {Toast} from "antd-mobile"; import { Toast } from "antd-mobile";
import jsCookie from 'js-cookie'; import jsCookie from 'js-cookie';
...@@ -16,16 +16,16 @@ class Invite extends Component { ...@@ -16,16 +16,16 @@ class Invite extends Component {
hot_schedule: '', hot_schedule: '',
userList: [], userList: [],
inviteCode: '', inviteCode: '',
isshowAppTip:false isshowAppTip: false,
} }
} }
componentWillMount() { componentWillMount() {
let uid = jsCookie.get('uid'); let uid = jsCookie.get('uid');
let shareuid = getParam('shareuid'); let shareuid = getParam('shareuid');
if(uid === shareuid) { if (uid === shareuid) {
} else { } else {
if(getParam('new')) { if (getParam('new')) {
this.props.history.push(`/activity?shareuid=${shareuid}&inviteCode=${getParam('inviteCode')}`); this.props.history.push(`/activity?shareuid=${shareuid}&inviteCode=${getParam('inviteCode')}`);
} }
} }
...@@ -36,23 +36,25 @@ class Invite extends Component { ...@@ -36,23 +36,25 @@ class Invite extends Component {
distinguishVersion = () => { distinguishVersion = () => {
// plat_form 1ios 2android // plat_form 1ios 2android
// version 1->3.704 2->4.5.1.20191105 // 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')) let version = Number(getParam('version'))
this.setState({ 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) let version = getParam('version').replace(/\./g, '').slice(0, 3)
this.setState({ this.setState({
isshowAppTip: Number(version) < 451 ? true:false isshowAppTip: Number(version) < 451,
}); });
} }
} }
componentDidMount() { componentDidMount() {
if(!this.props.user.hasError) { if (!this.props.user.hasError) {
this.getUserList(); this.getUserList();
this.getHotValue(); this.getHotValue();
this.getInviteCode(); this.getInviteCode();
...@@ -61,7 +63,7 @@ class Invite extends Component { ...@@ -61,7 +63,7 @@ class Invite extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log('componentWillReceiveProps'); console.log('componentWillReceiveProps');
if(!nextProps.user.hasError) { if (!nextProps.user.hasError) {
this.getUserList(); this.getUserList();
this.getHotValue(); this.getHotValue();
this.getInviteCode(); this.getInviteCode();
...@@ -71,9 +73,9 @@ class Invite extends Component { ...@@ -71,9 +73,9 @@ class Invite extends Component {
getUserList = () => { getUserList = () => {
http.get(`${API.home}/sys/user/invite/list`).then(res => { http.get(`${API.home}/sys/user/invite/list`).then(res => {
let {code, data, msg} = res.data; let {code, data, msg} = res.data;
if(code === 200) { if (code === 200) {
this.setState({ this.setState({
userList: data userList: data,
}); });
} else { } else {
Toast.info(msg, 2); Toast.info(msg, 2);
...@@ -84,10 +86,10 @@ class Invite extends Component { ...@@ -84,10 +86,10 @@ class Invite extends Component {
getHotValue = () => { getHotValue = () => {
http.get(`${API.home}/sys/user/hot/value`).then(res => { http.get(`${API.home}/sys/user/hot/value`).then(res => {
let {code, data, msg} = res.data; let {code, data, msg} = res.data;
if(code === 200) { if (code === 200) {
this.setState({ this.setState({
hot_schedule: data.hot_schedule, hot_schedule: data.hot_schedule,
hotValue: data.hot_value hotValue: data.hot_value,
}); });
} else { } else {
Toast.info(msg, 2); Toast.info(msg, 2);
...@@ -98,36 +100,36 @@ class Invite extends Component { ...@@ -98,36 +100,36 @@ class Invite extends Component {
getInviteCode = () => { getInviteCode = () => {
http.get(`${API.home}/sys/user/invite/link`).then(res => { http.get(`${API.home}/sys/user/invite/link`).then(res => {
let {code, data, msg} = res.data; let {code, data, msg} = res.data;
if(code === 200) { if (code === 200) {
let inviteCode = data.blessing_invite_code; let inviteCode = data.blessing_invite_code;
if(is_weixin()) { if (browser.isWeixin) {
wxShare({ wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!', title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线', 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', imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png',
}); });
} }
this.setState(()=>({ this.setState(() => ({
inviteCode: inviteCode inviteCode: inviteCode,
})) }))
}else if(code === 4030 || code === 4040) { } else if (code === 4030 || code === 4040) {
history.push('/passport'); this.props.history.push('/passport');
}else{ } else {
Toast.info(msg, 2); Toast.info(msg, 2);
} }
}); });
} }
inviteFriends = () => { inviteFriends = () => {
const { user, history } = this.props; const {user, history} = this.props;
const {inviteCode,isshowAppTip} = this.state; const {inviteCode, isshowAppTip} = this.state;
// 未登录先去登录 // 未登录先去登录
if (getParam('version')) { if (getParam('version')) {
if(user.hasError) { if (user.hasError) {
SendMessageToApp("toLogin"); SendMessageToApp("toLogin");
}else { } else {
if(isshowAppTip){ if (isshowAppTip) {
Toast.info('请前往h5/pc端使用该功能', 2); Toast.info('请前往h5/pc端使用该功能', 2);
} else { } else {
let data = { let data = {
...@@ -139,23 +141,23 @@ class Invite extends Component { ...@@ -139,23 +141,23 @@ class Invite extends Component {
SendMessageToApp("toShare", data) SendMessageToApp("toShare", data)
} }
} }
}else { } else {
if(user.hasError) { if (user.hasError) {
history.push('/passport'); history.push('/passport');
}else { } else {
if(is_weixin()) { if (browser.isWeixin) {
history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`); history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`);
wxShare({ wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!', title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线', 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', imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png',
}); });
this.setState({ this.setState({
showTip: true, showTip: true,
isWeiXin: true, isWeiXin: true,
}); });
}else{ } else {
history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`); history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`);
this.setState({ this.setState({
showTip: true, showTip: true,
...@@ -215,7 +217,7 @@ class Invite extends Component { ...@@ -215,7 +217,7 @@ class Invite extends Component {
<p className="show__new">(仅显示新用户)</p> <p className="show__new">(仅显示新用户)</p>
</> </>
) : (null) ) : null
} }
{ {
...@@ -226,7 +228,7 @@ class Invite extends Component { ...@@ -226,7 +228,7 @@ class Invite extends Component {
return ( return (
<div className="user__item-info item__con-only" key={index}> <div className="user__item-info item__con-only" key={index}>
<div className="item__con"> <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 className="user_name">{item.user_name}</div>
</div> </div>
</div> </div>
...@@ -239,7 +241,7 @@ class Invite extends Component { ...@@ -239,7 +241,7 @@ class Invite extends Component {
return ( return (
<div className="user__item-info" key={index}> <div className="user__item-info" key={index}>
<div className="item__con"> <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 className="user_name">{item.user_name}</div>
</div> </div>
</div> </div>
...@@ -247,9 +249,7 @@ class Invite extends Component { ...@@ -247,9 +249,7 @@ class Invite extends Component {
}) })
} }
</div> </div>
) : ( ) : null
null
)
} }
</div> </div>
{ {
...@@ -261,9 +261,7 @@ class Invite extends Component { ...@@ -261,9 +261,7 @@ class Invite extends Component {
{ {
isWeiXin ? ( isWeiXin ? (
<div className="share__row"></div> <div className="share__row"></div>
) : ( ) : null
null
)
} }
</div> </div>
) )
...@@ -276,5 +274,5 @@ class Invite extends Component { ...@@ -276,5 +274,5 @@ class Invite extends Component {
export default connect( export default connect(
state => ({user: state.user}), state => ({user: state.user}),
null null,
)(Invite); )(Invite);
import React, { Component } from 'react' import React, { Component } from 'react'
import QRCode from 'qrcode' 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 { Link } from 'react-router-dom'
import { throttle, findIndex, debounce } from 'lodash' import { throttle, findIndex, debounce } from 'lodash'
import RulePopup from './rulePopup/index' import RulePopup from './rulePopup/index'
...@@ -142,14 +142,8 @@ class BlessingPreheat extends Component { ...@@ -142,14 +142,8 @@ class BlessingPreheat extends Component {
} }
componentDidMount() { componentDidMount() {
const _this = this;
this.fetchUserBlessing() this.fetchUserBlessing()
// setTimeout(function(){ if (browser.isWeixin) {
// // 这里有获取ID的步骤,由于运营过多的调整,导致顺序不定,所以包含ID的title必须要放到判断中(防止出现多个title),设置定时器是因为如果返回较慢 获取不到ID导致报错
// _this.setInitialNavActiveStatus()
// }, 50);
// window.addEventListener('scroll', throttle(this.calcNavActive, 100))
if (is_weixin()) {
wxShare({ wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!', title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线', desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
...@@ -163,7 +157,7 @@ class BlessingPreheat extends Component { ...@@ -163,7 +157,7 @@ class BlessingPreheat extends Component {
this.loginInfo(result) this.loginInfo(result)
} }
window['getNewData'] = result => { window['getNewData'] = () => {
this.fetchUserBlessing() this.fetchUserBlessing()
} }
window['QQWXWBshare'] = result => { window['QQWXWBshare'] = result => {
...@@ -208,7 +202,7 @@ class BlessingPreheat extends Component { ...@@ -208,7 +202,7 @@ class BlessingPreheat 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) => {
cookie.set("token", item.token, {expires, path: '/', domain: '.julyedu.com'}) cookie.set("token", item.token, {expires, path: '/', domain: '.julyedu.com'})
cookie.set("plat", item.plat, {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'}) cookie.set("uid", item.uid, {expires, path: '/', domain: '.julyedu.com'})
...@@ -228,7 +222,7 @@ class BlessingPreheat extends Component { ...@@ -228,7 +222,7 @@ class BlessingPreheat extends Component {
transformUser = res => { transformUser = res => {
let payload let payload
res.map((item, index) => { res.forEach((item) => {
payload = { payload = {
hasError: false, hasError: false,
data: { data: {
...@@ -347,21 +341,6 @@ class BlessingPreheat extends Component { ...@@ -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 = () => { handleToSign = () => {
const {userInfo} = this.state const {userInfo} = this.state
http.post(`${API.home}/sys/add/blessing`, { http.post(`${API.home}/sys/add/blessing`, {
...@@ -448,11 +427,6 @@ class BlessingPreheat extends Component { ...@@ -448,11 +427,6 @@ class BlessingPreheat extends Component {
SendMessageToApp("toLogin") SendMessageToApp("toLogin")
} }
} }
onCopy = () => {
Toast.info('复制成功', 2, null, false)
}
toSection = (i, e) => { toSection = (i, e) => {
const {navs} = this.state const {navs} = this.state
e.preventDefault() e.preventDefault()
...@@ -524,6 +498,7 @@ class BlessingPreheat extends Component { ...@@ -524,6 +498,7 @@ class BlessingPreheat extends Component {
http.get(`${API.home}/sys/activity/my_lotteries`) http.get(`${API.home}/sys/activity/my_lotteries`)
.then(res => { .then(res => {
const {code, data, msg} = res.data const {code, data, msg} = res.data
// eslint-disable-next-line eqeqeq
if (code == 200) { if (code == 200) {
this.recordInstance = Popup({ this.recordInstance = Popup({
title: '我的中奖纪录', title: '我的中奖纪录',
...@@ -564,7 +539,8 @@ class BlessingPreheat extends Component { ...@@ -564,7 +539,8 @@ class BlessingPreheat extends Component {
...this.state.address ...this.state.address
}) })
.then(res => { .then(res => {
const {data, code, msg} = res.data const {code, msg} = res.data
// eslint-disable-next-line eqeqeq
if (code == 200) { if (code == 200) {
this.setState({ this.setState({
...@@ -597,6 +573,7 @@ class BlessingPreheat extends Component { ...@@ -597,6 +573,7 @@ class BlessingPreheat extends Component {
http.get(`${API.home}/sys/user_address_info`) http.get(`${API.home}/sys/user_address_info`)
.then(res => { .then(res => {
const {data, code, msg} = res.data const {data, code, msg} = res.data
// eslint-disable-next-line eqeqeq
if (code == 200) { if (code == 200) {
this.recordInstance && this.recordInstance.close() this.recordInstance && this.recordInstance.close()
this.setState({ this.setState({
...@@ -819,8 +796,8 @@ class BlessingPreheat extends Component { ...@@ -819,8 +796,8 @@ class BlessingPreheat extends Component {
}} }}
value={address.address} value={address.address}
/> />
<button type='button' {/* eslint-disable-next-line eqeqeq */}
className={(address.name != '' && address.phone != '' && address.address != '') ? 'active' : ''} <button type='button' className={(address.name != '' && address.phone != '' && address.address != '') ? 'active' : ''}
onClick={this.submitAddress} onClick={this.submitAddress}
>提交 >提交
</button> </button>
......
import React, {Component} from 'react' import React, { Component } from 'react'
import './share.scss' import './share.scss'
import {http, getParam, browser, wxShare,is_weixin} from 'src/utils' import { http, getParam, browser, wxShare } from 'src/utils'
import {Toast} from 'antd-mobile' import { Toast } from 'antd-mobile'
import {connect} from "react-redux"; import { connect } from "react-redux";
import {Link} from "react-router-dom"; import { Link } from "react-router-dom";
import showAlert from 'src/common/deposit/end-expansion-alert' import showAlert from 'src/common/deposit/end-expansion-alert'
class ExpandShare extends Component { class ExpandShare extends Component {
...@@ -21,7 +21,7 @@ class ExpandShare extends Component { ...@@ -21,7 +21,7 @@ class ExpandShare extends Component {
componentDidMount() { componentDidMount() {
this.getListorData() this.getListorData()
this.getCourseList() this.getCourseList()
if(is_weixin()) { if (browser.isWeixin) {
wxShare({ wxShare({
title: 'AI充电节,预热来袭!80元红包送给你,手要快!', title: 'AI充电节,预热来袭!80元红包送给你,手要快!',
desc: '积福气享1折秒课,超10万元奖品来就送--七月在线', desc: '积福气享1折秒课,超10万元奖品来就送--七月在线',
...@@ -35,9 +35,9 @@ class ExpandShare extends Component { ...@@ -35,9 +35,9 @@ class ExpandShare extends Component {
getListorData = () => { getListorData = () => {
http.get(`${API['base-api']}/sys/help_list/${getParam('deposit_code')}`).then((res) => { http.get(`${API['base-api']}/sys/help_list/${getParam('deposit_code')}`).then((res) => {
const {data, errno, msg} = res.data const {data, errno, msg} = res.data
if (errno == 200) { if (errno === 200) {
this.setState({ this.setState({
data: data data: data,
}) })
} else { } else {
Toast.info(msg, 2) Toast.info(msg, 2)
...@@ -51,22 +51,22 @@ class ExpandShare extends Component { ...@@ -51,22 +51,22 @@ class ExpandShare extends Component {
const _this = this const _this = this
http.get(`${API['base-api']}/anniversary2019/pre_course`).then((res) => { http.get(`${API['base-api']}/anniversary2019/pre_course`).then((res) => {
const {data, errno, msg} = res.data const {data, errno, msg} = res.data
if (errno == 200) { if (errno === 200) {
if (JSON.stringify(data) == '{}') { if (JSON.stringify(data) === '{}') {
_this.setState({ _this.setState({
isshowMore: false, isshowMore: false,
courseList: [] courseList: [],
}) })
} else if (data.length <= 6) { } else if (data.length <= 6) {
_this.setState({ _this.setState({
isshowMore: false, isshowMore: false,
courseList: data courseList: data,
}) })
} else { } else {
_this.setState({ _this.setState({
isshowMore: true, isshowMore: true,
courseList: data.slice(0, 6), courseList: data.slice(0, 6),
courseListMore: data courseListMore: data,
}) })
} }
} else { } else {
...@@ -80,12 +80,12 @@ class ExpandShare extends Component { ...@@ -80,12 +80,12 @@ class ExpandShare extends Component {
getMoreCourseList = () => { getMoreCourseList = () => {
this.setState({ this.setState({
courseList: this.state.courseListMore, courseList: this.state.courseListMore,
isshowMore: false isshowMore: false,
}) })
} }
// 立即付定金 // 立即付定金
expandPaydj = (courseId) => { expandPaydj = (courseId) => {
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')
...@@ -95,14 +95,14 @@ class ExpandShare extends Component { ...@@ -95,14 +95,14 @@ class ExpandShare extends Component {
{ {
id: courseId, id: courseId,
isexpand: 1, isexpand: 1,
sourcenum: 1 sourcenum: 1,
} },
) )
} }
} }
// 立即付尾款 // 立即付尾款
expandPaywk = (courseId, time, day) => { expandPaywk = (courseId, time, day) => {
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')
...@@ -113,9 +113,9 @@ class ExpandShare extends Component { ...@@ -113,9 +113,9 @@ class ExpandShare extends Component {
'/final-deposit-order?source=1', '/final-deposit-order?source=1',
{ {
id: courseId, id: courseId,
sourcenum: 1 sourcenum: 1,
} },
) )
} else { } else {
Toast.info("付尾款时间将在" + day + "开启", 2); Toast.info("付尾款时间将在" + day + "开启", 2);
...@@ -131,44 +131,44 @@ class ExpandShare extends Component { ...@@ -131,44 +131,44 @@ class ExpandShare extends Component {
showRule = () => { showRule = () => {
this.setState({ this.setState({
isShow: true, isShow: true,
step: 1 step: 1,
}) })
} }
// 邀请好友 // 邀请好友
share = () => { share = () => {
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')
} else { } else {
this.setState({ this.setState({
isShow: true, isShow: true,
step: 0 step: 0,
}) })
} }
} }
// 帮好友助力 // 帮好友助力
helpFriend = (id) => { helpFriend = (id) => {
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')
} else { } else {
http.post(`${API['base-api']}/sys/help/${id}`).then((res) => { http.post(`${API['base-api']}/sys/help/${id}`).then((res) => {
const {data, errno, msg} = res.data const {data, errno, msg} = res.data
if (errno == 200) { if (errno === 200) {
this.setState({ this.setState({
isShow: true, isShow: true,
step: 2, step: 2,
helpData: data helpData: data,
}) })
this.getListorData() this.getListorData()
} else if (errno === 17018 || errno === 17020) { } else if (errno === 17018 || errno === 17020) {
this.setState({ this.setState({
isShow: true, isShow: true,
step: 4 step: 4,
}) })
} else { } else {
Toast.info(msg, 2) Toast.info(msg, 2)
...@@ -179,7 +179,7 @@ class ExpandShare extends Component { ...@@ -179,7 +179,7 @@ class ExpandShare extends Component {
// 结束助力 // 结束助力
isendExpand = (data) => { isendExpand = (data) => {
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')
...@@ -190,25 +190,25 @@ class ExpandShare extends Component { ...@@ -190,25 +190,25 @@ class ExpandShare extends Component {
limit_amount, limit_amount,
onCancel: () => { onCancel: () => {
this.setState({ this.setState({
isShow: false isShow: false,
}) })
}, },
onConfirm: () => { onConfirm: () => {
http.post(`${API['base-api']}/sys/end_expansion`, { http.post(`${API['base-api']}/sys/end_expansion`, {
id id,
}) })
.then(res => { .then(res => {
const {errno, msg} = res.data const {errno, msg} = res.data
if (errno == 200) { if (errno === 200) {
this.setState({ this.setState({
isShow: false isShow: false,
}) })
this.getListorData() this.getListorData()
} else { } else {
Toast.info(msg) Toast.info(msg)
} }
}) })
} },
}) })
} }
} }
...@@ -216,7 +216,7 @@ class ExpandShare extends Component { ...@@ -216,7 +216,7 @@ class ExpandShare extends Component {
// 关闭弹窗 // 关闭弹窗
close = () => { close = () => {
this.setState({ this.setState({
isShow: false isShow: false,
}) })
} }
...@@ -244,7 +244,7 @@ class ExpandShare extends Component { ...@@ -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}/> <FriendList data={data}/>
} }
{/*预售课程列表*/} {/*预售课程列表*/}
...@@ -569,13 +569,23 @@ function CourseList(props) { ...@@ -569,13 +569,23 @@ function CourseList(props) {
<div className="btn"> <div className="btn">
{ {
item.is_buy === 0 && item.is_buy === 0 &&
/*eslint-disable-next-line*/
<a className="to-expand-buy1" <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 && item.is_buy === 1 &&
/*eslint-disable-next-line*/
<a className="to-expand-buy2" <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 && item.is_buy === 2 &&
...@@ -607,6 +617,6 @@ function CourseList(props) { ...@@ -607,6 +617,6 @@ function CourseList(props) {
export default connect( export default connect(
state => ({ state => ({
user: state.user user: state.user,
}), }),
)(ExpandShare) )(ExpandShare)
import React, { Component } from 'react' import React, { Component } from 'react'
import { Flex, WingBlank, WhiteSpace, List, Radio, Toast, Checkbox } from 'antd-mobile' import { Flex, WingBlank, WhiteSpace, List, Radio, Toast, Checkbox } from 'antd-mobile'
import { http, getParam, is_weixin, browser } from 'src/utils' import { http, getParam, browser } from 'src/utils'
import { OrderItem, HeaderBar } from 'src/common/index' import { HeaderBar } from 'src/common/index'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import './index.scss' import './index.scss'
import { VList } from 'src/common' import { VList } from 'src/common'
...@@ -10,10 +10,10 @@ import classnames from 'classnames' ...@@ -10,10 +10,10 @@ import classnames from 'classnames'
const RadioItem = Radio.RadioItem const RadioItem = Radio.RadioItem
let mockData = [] let mockData
if (browser.isWeixin) { if (browser.isWeixin) {
mockData = [ mockData = [
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'} {value: 1, label: '微信支付', icon: 'iconweixinzhifu'},
] ]
} else { } else {
mockData = [ mockData = [
...@@ -41,7 +41,7 @@ class PayOrder extends Component { ...@@ -41,7 +41,7 @@ class PayOrder extends Component {
{value: 'huabei', qishu: '9', lilv: '7.50%', everyMoney: 100, feiyong: 7.5}, {value: 'huabei', qishu: '9', lilv: '7.50%', everyMoney: 100, feiyong: 7.5},
], ],
categoryList: [], categoryList: [],
agree: false agree: false,
} }
} }
...@@ -59,7 +59,7 @@ class PayOrder extends Component { ...@@ -59,7 +59,7 @@ class PayOrder extends Component {
// 确定购买 // 确定购买
pay = () => { pay = () => {
const {payType, orderId} = this.state const {payType, orderId} = this.state
if(!this.state.agree){ if (!this.state.agree) {
return return
} }
if (payType === 0) { if (payType === 0) {
...@@ -71,7 +71,7 @@ class PayOrder extends Component { ...@@ -71,7 +71,7 @@ class PayOrder extends Component {
// 微信支付 // 微信支付
weixinPay = (orderId) => { 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" 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 { } else {
// 微信外部-支付 // 微信外部-支付
...@@ -89,9 +89,7 @@ class PayOrder extends Component { ...@@ -89,9 +89,7 @@ class PayOrder extends Component {
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') === undefined) { if (getParam('oid') !== undefined) {
return
} else {
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) {
let data = res.data.data let data = res.data.data
...@@ -104,9 +102,10 @@ class PayOrder extends Component { ...@@ -104,9 +102,10 @@ class PayOrder extends Component {
nonceStr: data.nonceStr, //随机串 nonceStr: data.nonceStr, //随机串
package: data.package, package: data.package,
signType: data.signType, //微信签名方式: signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名 paySign: data.paySign, //微信签名
}, },
function (res) { function (res) {
// eslint-disable-next-line eqeqeq
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 () {
...@@ -121,7 +120,7 @@ class PayOrder extends Component { ...@@ -121,7 +120,7 @@ class PayOrder extends Component {
} else { } else {
alert('支付失败') alert('支付失败')
} }
} },
) )
} }
...@@ -162,6 +161,7 @@ class PayOrder extends Component { ...@@ -162,6 +161,7 @@ class PayOrder extends Component {
let _this = this let _this = this
data = data || _this.BridgeData data = data || _this.BridgeData
/* eslint-disable-next-line no-undef */
WeixinJSBridge.invoke( WeixinJSBridge.invoke(
'getBrandWCPayRequest', { 'getBrandWCPayRequest', {
"appId": "wx23dac6775ac82877", //公众号名称,由商户传入 "appId": "wx23dac6775ac82877", //公众号名称,由商户传入
...@@ -169,16 +169,17 @@ class PayOrder extends Component { ...@@ -169,16 +169,17 @@ class PayOrder extends Component {
"nonceStr": data.nonceStr, //随机串 "nonceStr": data.nonceStr, //随机串
"package": data.package, "package": data.package,
"signType": data.signType, //微信签名方式: "signType": data.signType, //微信签名方式:
"paySign": data.paySign //微信签名 "paySign": data.paySign, //微信签名
}, },
function (res) { function (res) {
// eslint-disable-next-line eqeqeq
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.payCallback() _this.payCallback()
} else { } else {
alert('支付失败') alert('支付失败')
} }
} },
) )
} }
// 支付宝支付 // 支付宝支付
...@@ -205,13 +206,14 @@ class PayOrder extends Component { ...@@ -205,13 +206,14 @@ class PayOrder extends Component {
http.post(`${API["base-api"]}/m/deposit/detail`, { http.post(`${API["base-api"]}/m/deposit/detail`, {
order_id: this.state.orderId order_id: this.state.orderId,
}).then(res => { }).then(res => {
const {data} = res const {data} = res
// eslint-disable-next-line eqeqeq
if (data.errno == 200) { if (data.errno == 200) {
this.setState({ this.setState({
categoryList: [data.data.course_info], categoryList: [data.data.course_info],
salePrice: data.data.course_info.sale_price salePrice: data.data.course_info.sale_price,
}) })
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
...@@ -233,7 +235,7 @@ class PayOrder extends Component { ...@@ -233,7 +235,7 @@ class PayOrder extends Component {
singleMoney, singleMoney,
periodNumber, periodNumber,
categoryList, categoryList,
agree agree,
} = this.state } = this.state
return ( return (
<div className='pay-order'> <div className='pay-order'>
...@@ -297,7 +299,7 @@ class PayOrder extends Component { ...@@ -297,7 +299,7 @@ class PayOrder extends Component {
checkPeriod ? ( checkPeriod ? (
<span style={{ <span style={{
color: '#333333', color: '#333333',
fontSize: '12px' fontSize: '12px',
}}>{`${singleMoney}元 × ${periodNumber}期`}</span> }}>{`${singleMoney}元 × ${periodNumber}期`}</span>
) : null ) : null
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Flex, WingBlank, WhiteSpace, List, Radio, Toast } from 'antd-mobile'; import { Flex, WingBlank, WhiteSpace, List, Radio, Toast } from 'antd-mobile';
import { http, getParam, is_weixin, browser } from 'src/utils'; import { http, getParam, browser } from 'src/utils';
import { OrderItem, HeaderBar } from 'src/common/index'; import { HeaderBar } from 'src/common/index';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import './PayOrder.scss'; import './PayOrder.scss';
import { VList } from 'src/common'; import { VList } from 'src/common';
const Item = List.Item;
const Brief = Item.Brief;
const RadioItem = Radio.RadioItem; const RadioItem = Radio.RadioItem;
let mockData = [] let mockData
if (browser.isWeixin) { if (browser.isWeixin) {
mockData = [ mockData = [
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'} {value: 1, label: '微信支付', icon: 'iconweixinzhifu'},
]; ];
} else { } else {
mockData = [ mockData = [
...@@ -58,10 +56,10 @@ export default class PayOrder extends Component { ...@@ -58,10 +56,10 @@ export default class PayOrder extends Component {
// type订单类型 0普通订单 1团购 2小团 3砍价 4单集购买 5定金课定金 6定金课尾款 // type订单类型 0普通订单 1团购 2小团 3砍价 4单集购买 5定金课定金 6定金课尾款
if (parseInt(type, 10) === 2) { if (parseInt(type, 10) === 2) {
history.push(`/togroup?id=${oid}`); history.push(`/togroup?id=${oid}`);
}else if(parseInt(type, 10) === 4) { } else if (parseInt(type, 10) === 4) {
courseId && window.localStorage.setItem('payCourse', courseId);
const courseId = window.localStorage.getItem('payCourse') 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 { } else {
history.push('/purchased'); history.push('/purchased');
} }
...@@ -110,7 +108,7 @@ export default class PayOrder extends Component { ...@@ -110,7 +108,7 @@ export default class PayOrder extends Component {
// 微信支付 // 微信支付
weixinPay = (orderId) => { 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"; 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){ // if(window.location.href.indexOf('aa=bb') === -1){
// localStorage.setItem('a', '第一次'); // localStorage.setItem('a', '第一次');
...@@ -138,9 +136,7 @@ export default class PayOrder extends Component { ...@@ -138,9 +136,7 @@ export default class PayOrder extends Component {
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') === undefined) { if (getParam('oid') !== undefined) {
return
} else {
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) {
let data = res.data.data; let data = res.data.data;
...@@ -153,9 +149,10 @@ export default class PayOrder extends Component { ...@@ -153,9 +149,10 @@ export default class PayOrder extends Component {
nonceStr: data.nonceStr, //随机串 nonceStr: data.nonceStr, //随机串
package: data.package, package: data.package,
signType: data.signType, //微信签名方式: signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名 paySign: data.paySign, //微信签名
}, },
function (res) { function (res) {
// eslint-disable-next-line eqeqeq
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 () {
...@@ -178,7 +175,7 @@ export default class PayOrder extends Component { ...@@ -178,7 +175,7 @@ export default class PayOrder extends Component {
} else { } else {
alert('支付失败') alert('支付失败')
} }
} },
) )
} }
...@@ -235,16 +232,17 @@ export default class PayOrder extends Component { ...@@ -235,16 +232,17 @@ export default class PayOrder extends Component {
"nonceStr": data.nonceStr, //随机串 "nonceStr": data.nonceStr, //随机串
"package": data.package, "package": data.package,
"signType": data.signType, //微信签名方式: "signType": data.signType, //微信签名方式:
"paySign": data.paySign //微信签名 "paySign": data.paySign, //微信签名
}, },
function (res) { function (res) {
// eslint-disable-next-line eqeqeq
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.payCallback(); _this.payCallback();
} else { } else {
alert('支付失败') alert('支付失败')
} }
} },
) )
} }
// 支付宝支付 // 支付宝支付
...@@ -260,7 +258,7 @@ export default class PayOrder extends Component { ...@@ -260,7 +258,7 @@ export default class PayOrder extends Component {
} }
// 花呗分期 暂时不做 // 花呗分期 暂时不做
huabeiPay = (orderId) => { huabeiPay = (orderId) => {
const {singleMoney, periodNumber} = this.state; const {periodNumber} = this.state;
// console.log('花呗分期支付'); // console.log('花呗分期支付');
http.get(`/pay/alipay/wap_charge/oid/${orderId}/plat/{plat} /hb_num/${periodNumber}`).then(res => { 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 { ...@@ -275,25 +273,25 @@ export default class PayOrder extends Component {
componentDidMount() { componentDidMount() {
this.redirectAfterPay() this.redirectAfterPay()
let data = {} let data
if(this.props.location.state && this.props.location.state.group){ if (this.props.location.state && this.props.location.state.group) {
data = { data = {
order_id: this.state.orderId, order_id: this.state.orderId,
type: 2 type: 2,
} }
} else { } else {
data = { data = {
order_id: this.state.orderId, 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) { if (res.data.errno !== 200) {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
return; return;
} }
const {course, pay_amount} = res.data.data; const {course, pay_amount} = res.data.data;
const fenqiList = []; const fenqiList = [];
[1, 2, 3].map((item) => { [1, 2, 3].forEach((item) => {
let obj = {}; let obj = {};
obj.value = item; obj.value = item;
if (item === 1) { if (item === 1) {
...@@ -329,9 +327,9 @@ export default class PayOrder extends Component { ...@@ -329,9 +327,9 @@ export default class PayOrder extends Component {
if (getParam('is_class') === 1 || getParam('weixinpay')) { if (getParam('is_class') === 1 || getParam('weixinpay')) {
this.payCallback() this.payCallback()
} }
if (is_weixin()) { if (browser.isWeixin) {
this.setState({ this.setState({
payType: 1 payType: 1,
}) })
this.isweixinPay() this.isweixinPay()
} }
...@@ -402,7 +400,7 @@ export default class PayOrder extends Component { ...@@ -402,7 +400,7 @@ export default class PayOrder extends Component {
checkPeriod ? ( checkPeriod ? (
<span style={{ <span style={{
color: '#333333', color: '#333333',
fontSize: '12px' fontSize: '12px',
}}>{`${singleMoney}元 × ${periodNumber}期`}</span> }}>{`${singleMoney}元 × ${periodNumber}期`}</span>
) : null ) : null
} }
......
import React, {Component, useState, useEffect, useLayoutEffect, useRef} from 'react'; import React, { useState} from 'react';
import {withRouter, RouteComponentProps} from 'react-router-dom' import {withRouter} from 'react-router-dom'
const TSTest: React.FC = () => { const TSTest: React.FC = () => {
const [count, setCount] = useState(0); const [count, setCount] = useState(0);
...@@ -23,14 +23,4 @@ const TSTest: React.FC = () => { ...@@ -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); 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) => { export const getParam = (key, str) => {
const _s = str ? str : location.href; const _s = str ? str : window.location.href;
const re = new RegExp(`(?:\\?|#|&)(${key})=([^=&#\\?]+)`, 'ig'); const re = new RegExp(`[?#&](${key})=([^=&#?]+)`, 'ig');
let found; let found = re.exec(_s);
return (found = re.exec(_s)) ? found[2] : null; return found ? found[2] : null;
} }
const html = content => ({ const html = content => ({
...@@ -23,8 +23,8 @@ function getTimestamp(msec) { ...@@ -23,8 +23,8 @@ function getTimestamp(msec) {
} }
function loadScript(src, cb) { function loadScript(src, cb) {
var head = document.head || document.getElementsByTagName('head')[0] let head = document.head || document.getElementsByTagName('head')[0]
var script = document.createElement('script') let script = document.createElement('script')
cb = cb || function () { cb = cb || function () {
} }
...@@ -52,7 +52,7 @@ function initCaptcha(cb) { ...@@ -52,7 +52,7 @@ function initCaptcha(cb) {
if (window.initNECaptcha) { if (window.initNECaptcha) {
cb() cb()
} else { } 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) loadScript(url, cb)
} }
...@@ -62,26 +62,17 @@ function initCaptchaNC(cb) { ...@@ -62,26 +62,17 @@ function initCaptchaNC(cb) {
if (window.NoCaptcha && typeof window.NoCaptcha.init === 'function') { if (window.NoCaptcha && typeof window.NoCaptcha.init === 'function') {
cb() cb()
} else { } 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) 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) { function validateTel(tel) {
return /^1[3-9](\d{9})$/.test(tel) return /^1[3-9](\d{9})$/.test(tel)
} }
function validateEmail(email) { 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()); return re.test(String(email).toLowerCase());
} }
...@@ -98,7 +89,7 @@ const browser = (function () { ...@@ -98,7 +89,7 @@ const browser = (function () {
})() })()
const isValidUrl = (str) => { 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