diff --git a/src/utils/request.ts b/src/utils/request.ts index b9c5aeb..ab882bc 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -40,14 +40,15 @@ service.interceptors.response.use( // `token` 过期或者账号已在别处登录 if (res.code === 401 || res.code === 4001 || (res.code === 502 && res.errorMsg==='只有登录成功后才可访问')) { // ElMessage.error('该账户已在其它地方登录,请重新登录'); + ElMessageBox.alert('你已被登出,请重新登录', '提示', {}) .then(() => { Session.clear(); // 清除浏览器全部临时缓存 - window.location.href = '/'; // 去登录页 + window.location.href = import.meta.env.MODE === "development" ? '/' : '/pixelAdmin/'; // 去登录页 }) .catch(() => { Session.clear(); // 清除浏览器全部临时缓存 - window.location.href = '/'; // 去登录页 + window.location.href = import.meta.env.MODE === "development" ? '/' : '/pixelAdmin/'; // 去登录页 }); } // else if(res.code === 502 && res.errorMsg){ diff --git a/src/views/photos/index.vue b/src/views/photos/index.vue index 7bdaef5..6588dd6 100644 --- a/src/views/photos/index.vue +++ b/src/views/photos/index.vue @@ -328,8 +328,7 @@ const jpgFormatter = (row: any) => { // } else { // newPath = row.path.replaceAll('\\\\', '/') // } - newPath = newPath.includes(viteUrl)||newPath.includes('http://8.138.171.103/')||newPath.includes('http://guojunjie.oss-cn-hangzhou.aliyuncs.com/') ? - newPath : encodeURI(newPath) + newPath = newPath.includes('://')?newPath : encodeURI(newPath); return `${newPath}`; } @@ -470,7 +469,6 @@ const handleRemove = (file: UploadFile, uploadFiles) => { uploadDisabled.value = false; }; - //下载图片 const download = async(row:any) =>{ state.formData.loading = true; @@ -482,8 +480,7 @@ const download = async(row:any) =>{ // } // newPath = newPath.includes('http://localhost:8888/') ? newPath : viteUrl + newPath let newPath = row?.data ? row.data.path : row.path; - newPath = newPath.includes(viteUrl)||newPath.includes('http://8.138.171.103/')||newPath.includes('http://guojunjie.oss-cn-hangzhou.aliyuncs.com/') ? - newPath : encodeURI(newPath); + newPath = newPath.includes('://')?newPath : encodeURI(newPath); try{ await downloadPhoto(newPath); }catch(error){