|
|
@ -42,6 +42,12 @@ service.interceptors.request.use(config => {
|
|
|
|
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
|
|
|
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
|
|
|
time: new Date().getTime()
|
|
|
|
time: new Date().getTime()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小
|
|
|
|
|
|
|
|
const limitSize = 5 * 1024 * 1024; // 限制存放数据5M
|
|
|
|
|
|
|
|
if (requestSize >= limitSize) {
|
|
|
|
|
|
|
|
console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制,无法进行防重复提交验证。')
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
|
|
|
}
|
|
|
|
const sessionObj = cache.session.getJSON('sessionObj')
|
|
|
|
const sessionObj = cache.session.getJSON('sessionObj')
|
|
|
|
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
|
|
|
|
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
|
|
|
|
cache.session.setJSON('sessionObj', requestObj)
|
|
|
|
cache.session.setJSON('sessionObj', requestObj)
|
|
|
|