From e6cbf356e61cd7300c411a044e4512e863c7198a Mon Sep 17 00:00:00 2001 From: Double-_-Z <2492419643@qq.com> Date: Thu, 26 Dec 2024 21:46:34 +0800 Subject: [PATCH] =?UTF-8?q?bug=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 5 +++-- src/views/photos/index.vue | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) 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){