Commit 8a9e2d81 authored by kaitly205422@163.com's avatar kaitly205422@163.com

修复参数传递问题

parent 1789f962
No preview for this file type
...@@ -30,12 +30,12 @@ service.interceptors.request.use(config => { ...@@ -30,12 +30,12 @@ service.interceptors.request.use(config => {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
} }
// // get请求映射params参数 // // get请求映射params参数
// if (config.method === 'get' && config.params) { if (config.method === 'get' && config.params) {
// let url = config.url + '?' + tansParams(config.params); let url = config.url + '?' + tansParams(config.params);
// url = url.slice(0, -1); url = url.slice(0, -1);
// config.params = {}; config.params = {};
// config.url = url; config.url = url;
// } }
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = { const requestObj = {
url: config.url, url: config.url,
......
...@@ -88,7 +88,7 @@ export function selectDictLabel(datas, value) { ...@@ -88,7 +88,7 @@ export function selectDictLabel(datas, value) {
// 回显数据字典(字符串、数组) // 回显数据字典(字符串、数组)
export function selectDictLabels(datas, value, separator) { export function selectDictLabels(datas, value, separator) {
if (value === undefined || value.length ===0) { if (value === undefined || value.length === 0) {
return ""; return "";
} }
if (Array.isArray(value)) { if (Array.isArray(value)) {
...@@ -206,11 +206,13 @@ export function handleTree(data, id, parentId, children) { ...@@ -206,11 +206,13 @@ export function handleTree(data, id, parentId, children) {
* @param {*} params 参数 * @param {*} params 参数
*/ */
export function tansParams(params) { export function tansParams(params) {
console.log(params)
let result = '' let result = ''
for (const propName of Object.keys(params)) { for (const propName of Object.keys(params)) {
const value = params[propName]; const value = params[propName];
var part = encodeURIComponent(propName) + "="; var part = encodeURIComponent(propName) + "=";
if (value !== null && value !== "" && typeof (value) !== "undefined") { // && value !== "" 有的接口需要默认传空值
if (value !== null && typeof (value) !== "undefined") {
if (typeof value === 'object') { if (typeof value === 'object') {
for (const key of Object.keys(value)) { for (const key of Object.keys(value)) {
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
......
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