hookehuyr

解析URL参数

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-26 23:52:36 3 * @Date: 2022-05-26 23:52:36
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-12-06 16:41:55 5 + * @LastEditTime: 2022-12-06 16:52:33
6 * @FilePath: /data-table/src/App.vue 6 * @FilePath: /data-table/src/App.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -27,7 +27,7 @@ import vConsole from "@/utils/vconsole"; ...@@ -27,7 +27,7 @@ import vConsole from "@/utils/vconsole";
27 // import wx from 'weixin-js-sdk' 27 // import wx from 'weixin-js-sdk'
28 // import { wxJsAPI } from '@/api/wx/config' 28 // import { wxJsAPI } from '@/api/wx/config'
29 // import { apiList } from '@/api/wx/jsApiList.js' 29 // import { apiList } from '@/api/wx/jsApiList.js'
30 -import { wxInfo } from "@/utils/tools"; 30 +import { wxInfo, getUrlParams } from "@/utils/tools";
31 import { styleColor } from "@/constant.js"; 31 import { styleColor } from "@/constant.js";
32 import { getFormSettingAPI } from "@/api/form.js"; 32 import { getFormSettingAPI } from "@/api/form.js";
33 33
...@@ -72,7 +72,7 @@ onMounted(async () => { ...@@ -72,7 +72,7 @@ onMounted(async () => {
72 // console.warn(err); 72 // console.warn(err);
73 // }); 73 // });
74 // 数据收集设置 74 // 数据收集设置
75 - const code = $route.query.code; 75 + const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
76 const { data, extend } = await getFormSettingAPI({ form_code: code }); 76 const { data, extend } = await getFormSettingAPI({ form_code: code });
77 const form_setting = {}; 77 const form_setting = {};
78 if (data.length) { 78 if (data.length) {
......
1 /* 1 /*
2 * @Date: 2022-04-18 15:59:42 2 * @Date: 2022-04-18 15:59:42
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-21 15:42:14 4 + * @LastEditTime: 2022-12-06 16:51:59
5 * @FilePath: /data-table/src/utils/tools.js 5 * @FilePath: /data-table/src/utils/tools.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -101,4 +101,15 @@ const changeURLArg = (url, arg, arg_val) => { ...@@ -101,4 +101,15 @@ const changeURLArg = (url, arg, arg_val) => {
101 return url + '\n' + arg + '\n' + arg_val; 101 return url + '\n' + arg + '\n' + arg_val;
102 } 102 }
103 103
104 -export { formatDate, wxInfo, hasEllipsis, parseQueryString, strExist, changeURLArg }; 104 +const getUrlParams = (url) => {
105 + let arr = url.split('?');
106 + let res = arr[1].split('&');
107 + let items = {};
108 + for (let i = 0; i < res.length; i++) {
109 + let a = res[i].split('=');
110 + items[a[0]] = a[1];
111 + }
112 + return items
113 +}
114 +
115 +export { formatDate, wxInfo, hasEllipsis, parseQueryString, strExist, changeURLArg, getUrlParams };
......