Commit bf9b1473 by zhanghaozhe

Merge branch 'no-trace-validation'

parents a068005d c19303f6
......@@ -8,6 +8,8 @@ import {
closeCaptchaModal,
showCaptchaModal,
validationPassed,
startFetchNoTrace,
endFetchNoTrace,
} from '@/store/no-trace-validation/reducer'
import { initialState } from '@/store/userReducer'
import { withRouter } from 'react-router-dom'
......@@ -116,7 +118,7 @@ class App extends Component {
componentDidUpdate(prevProps, prevState) {
this.setPreviousLocation()
const {user, noTraceValidation: {isShowCaptcha}} = this.props
const {user, noTraceValidation: {isShowCaptcha, isFetching: isNoTraceFetching}} = this.props
if (!user.hasError && getParam('redirect')) {
window.location.href = decodeURIComponent(getParam('redirect'))
}
......@@ -128,7 +130,10 @@ class App extends Component {
})
}
if (prevProps.user.isFetching !== user.isFetching && !user.isFetching) {
if (
!user.isFetching &&
!isNoTraceFetching
) {
document.body.style.pointerEvents = 'auto'
}
}
......@@ -210,6 +215,7 @@ class App extends Component {
getUser = () => {
document.body.style.pointerEvents = 'none'
this.props.startFetchNoTrace()
//获取用户信息
this.props.startFetchUser()
......@@ -230,6 +236,7 @@ class App extends Component {
});
this.setupNoTraceValidate()
} else {
this.props.endFetchNoTrace()
this.props.updateCaptchaState({
isNeedValidation: false,
isFetching: false,
......@@ -241,6 +248,7 @@ class App extends Component {
}
}
} else {
this.props.endFetchNoTrace()
this.props.updateCaptchaState({
isNeedValidation: false,
isFetching: false,
......@@ -252,6 +260,7 @@ class App extends Component {
} else {
if (this.props.location.pathname !== '/my') {
http.get(`${API.home}/m/user_info_sample/0`).then(res => {
this.props.endFetchNoTrace()
this.props.setCurrentUser(this.transformUser(res))
})
}
......@@ -327,6 +336,7 @@ class App extends Component {
Toast.info(msg)
}
this.props.endFetchUser()
this.props.endFetchNoTrace()
})
}
......@@ -468,6 +478,8 @@ export default compose(
showCaptchaModal,
validationPassed,
endFetchUser,
startFetchNoTrace,
endFetchNoTrace,
}),
withRouter,
)(App)
import React, {Component} from 'react';
import React, { Component } from 'react';
import './index.scss'
import {connect} from "react-redux";
import {compose} from "redux";
import {HeaderBar} from "@common/index"
import {getParam, http, browser, wxShare} from "@/utils"
import {Toast} from "antd-mobile";
import {CopyToClipboard} from "react-copy-to-clipboard";
import {Link} from 'react-router-dom'
import { connect } from "react-redux";
import { compose } from "redux";
import { HeaderBar } from "@common/index"
import { getParam, http, browser, wxShare } from "@/utils"
import { Toast } from "antd-mobile";
import { CopyToClipboard } from "react-copy-to-clipboard";
import { Link } from 'react-router-dom'
import storage from 'store2'
import {CaptchaAli} from "@common/index"
import {showCaptchaModal} from "@/store/no-trace-validation/reducer";
import { CaptchaAli } from "@common/index"
import { showCaptchaModal } from "@/store/no-trace-validation/reducer";
class Invitation extends Component {
......@@ -125,7 +125,6 @@ class Invitation extends Component {
if (data.token && data.sig) {
_data = {..._data, ...data}
}
http.post(`${API.home}/activity/anniversary/joinTeam`, _data)
.then(res => {
const {code, msg} = res.data
......
......@@ -8,8 +8,8 @@ import { Link } from "react-router-dom"
import { connect } from "react-redux"
import { HeaderBar } from "@/common"
import { http } from "@/utils"
import { getCourses } from './../detail/actions';
import { setCurrentUser, startFetchUser } from "@/store/userAction"
import {endFetchNoTrace} from '@/store/no-trace-validation/reducer'
const Item = List.Item;
......@@ -17,7 +17,7 @@ const Brief = Item.Brief;
@connect(state => ({
user: state.user,
}), {startFetchUser, setCurrentUser})
}), {startFetchUser, setCurrentUser, endFetchNoTrace})
class My extends PureComponent {
constructor(props) {
super(props)
......@@ -34,6 +34,7 @@ class My extends PureComponent {
getUser = () => {
this.props.startFetchUser()
http.get(`${API.home}/m/user_info_sample/1`).then(res => {
this.props.endFetchNoTrace()
this.props.setCurrentUser(this.transformUser(res))
})
}
......
......@@ -27,9 +27,20 @@ export const validationPassed = () => {
}
}
const START_FETCH = 'START_FETCH'
export const startFetchNoTrace = () => ({
type: START_FETCH,
})
const END_FETCH = 'END_FETCH'
export const endFetchNoTrace = () => ({
type: END_FETCH,
})
const initialState = {
isShowCaptcha: false,
isNeedValidation: false,
isFetching: false,
}
export default function noTraceValidation(state = initialState, action) {
......@@ -55,6 +66,16 @@ export default function noTraceValidation(state = initialState, action) {
isShowCaptcha: false,
isFetching: false,
}
case START_FETCH:
return {
...state,
isFetching: true,
}
case END_FETCH:
return {
...state,
isFetching: false,
}
default:
return state
}
......
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