Commit 9976fabc by zhangleyuan

feat:处理获取url中的参数的方式

parent 98cc1a4a
/*
* @Author: zhangleyuan
* @Date: 2021-01-05 17:30:54
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-01-05 17:34:34
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
window.getParameterByName = function (name) {
name = name.replace(/[\\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
const results = regex.exec(window.location.href);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-01-04 18:23:21
* @LastEditTime: 2021-01-05 17:36:15
* @Description:
*/
......@@ -20,6 +20,7 @@ import { VerifyInfo } from '@/domains/basic-domain/interface';
import 'antd/dist/antd.less';
import '@/common/less/index.less';
import '@/common/js/function';
import App from './App';
......
......@@ -14,8 +14,11 @@ class Authorize extends React.Component {
}
}
componentDidMount() {
const searchParams = this.props.location.search;
const {code,ticket} = queryString.parse(searchParams);
// console.log("ticket",window.getParameterByName('ticket'))
// const searchParams = this.props.location.search;
// const {code,ticket} = queryString.parse(searchParams);
const code = window.getParameterByName('code');
const ticket = window.getParameterByName('ticket');
this.setState({
code,
ticket
......
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