| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -18,48 +18,99 @@ const service = axios.create({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  timeout: 30000
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				})
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				function stripObjectOfSpecialCharsAndCheck(obj,url) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if(url == 'backendApi/login/doLogin'){
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				   return true
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  // 定义要检查的特殊字符正则表达式
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  // const specialCharsRegex = /[<>"'%;()&+]/;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const specialCharsRegex =  /[`~!@#$^&*()=|{}':;',\[\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]/
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  // 检查数组
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if (Array.isArray(obj)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for (const item of obj) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      // 如果元素是字符串且包含特殊字符
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (typeof item === 'string' && specialCharsRegex.test(item)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return false; // 发现特殊字符,立即返回false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      // 如果元素是对象(非null),则递归检查
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (typeof item === 'object' && item !== null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (!stripObjectOfSpecialCharsAndCheck(item)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          return false; // 递归调用返回false,则当前调用也返回false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // 数组中没有发现特殊字符,继续检查其他类型(尽管在这个函数中不会执行到这里,但为了清晰性)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  } else if (typeof obj === 'object' && obj !== null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // 检查对象的每个属性
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for (const key in obj) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (obj.hasOwnProperty(key)) { // 确保属性是对象自身的属性
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        const value = obj[key];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        // 如果值是字符串且包含特殊字符
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (typeof value === 'string' && specialCharsRegex.test(value)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          return false; // 发现特殊字符,立即返回false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        // 如果值是对象(非null),则递归检查
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (typeof value === 'object' && value !== null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          if (!stripObjectOfSpecialCharsAndCheck(value)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return false; // 递归调用返回false,则当前调用也返回false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // 对象中没有发现特殊字符
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  // 如果没有发现特殊字符(包括所有嵌套的对象和数组),则返回true
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// request拦截器
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				service.interceptors.request.use(config => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  // 是否需要防止数据重复提交
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				 let isHave =  stripObjectOfSpecialCharsAndCheck(config.data,config.url)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if(!isHave){
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  alert('禁止输入特殊符号')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }else{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // 是否需要防止数据重复提交
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if (getToken()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (getToken()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      config.headers['Access-Token'] = getToken();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  config.headers['platform'] = 'PC';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    config.headers['platform'] = 'PC';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  // get请求映射params参数
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if (config.method === 'get' && config.params) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    let url = config.url + '?' + tansParams(config.params);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    url = url.slice(0, -1);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    config.params = {};
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    config.url = url;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    const requestObj = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      url: config.url,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      time: new Date().getTime()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // get请求映射params参数
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (config.method === 'get' && config.params) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      let url = config.url + '?' + tansParams(config.params);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      url = url.slice(0, -1);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      config.params = {};
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      config.url = url;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    const sessionObj = cache.session.getJSON('sessionObj')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      cache.session.setJSON('sessionObj', requestObj)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const s_url = sessionObj.url;                  // 请求地址
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const s_data = sessionObj.data;                // 请求数据
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const s_time = sessionObj.time;                // 请求时间
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        const message = '数据正在处理,请耐心等待';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        console.warn(`[${s_url}]: ` + message)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return Promise.reject(new Error(message))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const requestObj = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        url: config.url,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        time: new Date().getTime()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const sessionObj = cache.session.getJSON('sessionObj')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        cache.session.setJSON('sessionObj', requestObj)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        const s_url = sessionObj.url;                  // 请求地址
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        const s_data = sessionObj.data;                // 请求数据
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        const s_time = sessionObj.time;                // 请求时间
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          const message = '数据正在处理,请耐心等待';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          console.warn(`[${s_url}]: ` + message)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          return Promise.reject(new Error(message))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          cache.session.setJSON('sessionObj', requestObj)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return config
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  return config
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}, error => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    console.log(error)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Promise.reject(error)
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |