布局修改 部分bug修复
This commit is contained in:
@@ -36,10 +36,25 @@ axios.defaults.baseURL = import.meta.env.VITE_APP_BASE_URL; //配置接口地
|
||||
const CancelToken = axios.CancelToken;
|
||||
const source = CancelToken.source();
|
||||
// console.log(import.meta.env.VITE_APP_BASE_URL);
|
||||
const filterHttpsUrl = ['/api/portfolio/page','/api/portfolio/detail','/api/account/preLogin','/api/account/schoolLogin','/api/account/enterpriseLogin','/api/account/login']
|
||||
let isLoginTime = false
|
||||
const filterHttpsUrl = [
|
||||
// '/api/portfolio/page',
|
||||
'/api/account/resetPwd',
|
||||
'/api/portfolio/detail',
|
||||
'/api/account/preLogin',
|
||||
'/api/account/designWorksRegister',
|
||||
'/api/account/schoolLogin',
|
||||
'/api/account/enterpriseLogin',
|
||||
'/api/account/login',
|
||||
'/api/account/organizationNameSearch',
|
||||
'/api/account/designWorksRegisterCode',
|
||||
'/api/account/sendEmail']
|
||||
//POST传参序列化(添加请求拦截器)
|
||||
axios.interceptors.request.use((config) => {
|
||||
//在发送请求之前做某件事
|
||||
|
||||
|
||||
|
||||
// config.cancelToken = source.token
|
||||
if(config.method === 'post' || config.method === 'put' || config.method === 'delete'){
|
||||
// config.data = qs.stringify(config.data);
|
||||
@@ -47,6 +62,18 @@ axios.interceptors.request.use((config) => {
|
||||
}
|
||||
// config.headers.Authorization = 'Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA';
|
||||
if(filterHttpsUrl.indexOf(config.url) == -1){
|
||||
if (!getCookie('token')) {
|
||||
console.log('无Token,取消请求');
|
||||
if(!isLoginTime){
|
||||
isLoginTime = true
|
||||
router.replace('/')
|
||||
message.warning('Please login and try again~')
|
||||
setTimeout(()=>[
|
||||
isLoginTime = false
|
||||
],2000)
|
||||
}
|
||||
return Promise.reject(new Error('缺少Token,请求被拦截')); // 阻止请求
|
||||
}
|
||||
config.headers.Authorization = getCookie('token');
|
||||
}else{
|
||||
config.headers.Authorization = '';
|
||||
@@ -55,7 +82,6 @@ axios.interceptors.request.use((config) => {
|
||||
},(error) =>{
|
||||
return Promise.reject(error);
|
||||
});
|
||||
let isLoginTime = false
|
||||
const binaryToUrl = (binary,type = 'application/octet-stream',res)=>{
|
||||
let blob = new Blob([binary], {'content-type':res.headers['content-type']});
|
||||
let url = URL.createObjectURL(blob);
|
||||
@@ -101,7 +127,6 @@ axios.interceptors.response.use((res) =>{
|
||||
}
|
||||
}, function(error) {
|
||||
if(error?.response?.status === 401 && router.currentRoute._value.name != 'setIdentification'){//如果是记录浏览器页面就不跳转login
|
||||
return
|
||||
clonAllCookie()
|
||||
if(!isLoginTime){
|
||||
isLoginTime = true
|
||||
@@ -367,6 +392,10 @@ export const Https = {
|
||||
getEachAffiliateGeneratedRevenue:`/api/affiliate/getEachAffiliateGeneratedRevenue`,//affiliate每个用户根据日期查询收益
|
||||
affiliateApproval:`/api/affiliate/approval`,//affiliate同意 审批
|
||||
getPersonalMonthlyIncome:`/api/affiliate/getPersonalMonthlyIncome`,//affiliate图表接口
|
||||
getReferrals:`/api/affiliate/getReferrals`,//affiliate Referral列表
|
||||
editReferral:`/api/affiliate/editReferral`,//affiliate编辑referral
|
||||
batchDeleteReferral:`/api/affiliate/batchDeleteReferral`,//affiliate删除referral
|
||||
// batchDeleteReferral:`/api/affiliate/batchDeleteReferral`,//affiliate删除referral
|
||||
|
||||
getTasksList:`/api/tasks/getList`,//获取w为执行完的所有任务
|
||||
getTasksHistory:`/api/tasks/getAllTask`,//获取所有任务列表
|
||||
|
||||
Reference in New Issue
Block a user