hookehuyr

解析URL参数

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