|
@@ -32,15 +32,17 @@ export const browser = () => {
|
|
|
}
|
|
|
|
|
|
// 获取授权的code码
|
|
|
-/* eslint-disable */
|
|
|
export const getUrlCode = (name: any) => {
|
|
|
- return (
|
|
|
- decodeURIComponent(
|
|
|
- (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
|
|
|
- location.href
|
|
|
- ) || [, ""])[1].replace(/\+/g, "%20")
|
|
|
- ) || null
|
|
|
- );
|
|
|
+ // return (
|
|
|
+ // decodeURIComponent(
|
|
|
+ // (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
|
|
|
+ // location.href
|
|
|
+ // ) || [, ""])[1].replace(/\+/g, "%20")
|
|
|
+ // ) || null
|
|
|
+ // );
|
|
|
+ const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
|
|
|
+ const r = window.location.search.substr(1).match(reg); //匹配目标参数
|
|
|
+ if (r != null) return unescape(r[2]); return null; //返回参数值
|
|
|
};
|
|
|
|
|
|
|