Commit 97faa944 authored by 张海景's avatar 张海景

update:修改统一传参处理

parent b237daa6
......@@ -2,6 +2,7 @@
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作
import {filterObj} from '@/utils/ruoyi'
const install = (Vue, vm) => {
// 通用请求头设定
const ajaxHeader = 'x-ajax';
......@@ -21,6 +22,7 @@ const install = (Vue, vm) => {
// 请求拦截,配置Token等参数
Vue.prototype.$u.http.interceptor.request = (req) => {
req.data = filterObj(req.data);
if (!req.header) {
req.header = [];
}
......
......@@ -224,6 +224,25 @@ export function tansParams(params) {
return result
}
/**
* 过滤对象中为空的属性
* @param obj
* @returns {*}
*/
export function filterObj(obj) {
if (!(typeof obj === 'object')) {
return
}
for (const key in obj) {
if (obj.hasOwnProperty(key) &&
(obj[key] === null || obj[key] === undefined)) {
obj[key] = ''
}
}
return obj
}
// 验证是否为blob格式
export async function blobValidate(data) {
try {
......
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