From 74ba681fee30c8b7937db0c1c053189f48e4ae64 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 15 Nov 2022 14:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=9E=E6=98=BE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AD=97=E5=85=B8=E6=95=B0=E7=BB=84=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98(I60UYQ)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/request.js | 41 ++++++++++------------------------- ruoyi-ui/src/utils/ruoyi.js | 7 ++++-- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 80ee3c3..ad9923c 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -78,37 +78,24 @@ service.interceptors.response.use(res => { if (code === 401) { if (!isRelogin.show) { isRelogin.show = true; - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { - confirmButtonText: '重新登录', - cancelButtonText: '取消', - type: 'warning' - } - ).then(() => { - isRelogin.show = false; - store.dispatch('LogOut').then(() => { - location.href = '/index'; - }) + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { + isRelogin.show = false; + store.dispatch('LogOut').then(() => { + location.href = '/index'; + }) }).catch(() => { isRelogin.show = false; }); } return Promise.reject('无效的会话,或者会话已过期,请重新登录。') } else if (code === 500) { - Message({ - message: msg, - type: 'error' - }) + Message({ message: msg, type: 'error' }) return Promise.reject(new Error(msg)) } else if (code === 601) { - Message({ - message: msg, - type: 'warning' - }) + Message({ message: msg, type: 'warning' }) return Promise.reject('error') } else if (code !== 200) { - Notification.error({ - title: msg - }) + Notification.error({ title: msg }) return Promise.reject('error') } else { return res.data @@ -119,18 +106,12 @@ service.interceptors.response.use(res => { let { message } = error; if (message == "Network Error") { message = "后端接口连接异常"; - } - else if (message.includes("timeout")) { + } else if (message.includes("timeout")) { message = "系统接口请求超时"; - } - else if (message.includes("Request failed with status code")) { + } else if (message.includes("Request failed with status code")) { message = "系统接口" + message.substr(message.length - 3) + "异常"; } - Message({ - message: message, - type: 'error', - duration: 5 * 1000 - }) + Message({ message: message, type: 'error', duration: 5 * 1000 }) return Promise.reject(error) } ) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index d2cd2a0..243c4c7 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -86,11 +86,14 @@ export function selectDictLabel(datas, value) { return actions.join(''); } -// 回显数据字典(字符串数组) +// 回显数据字典(字符串、数组) export function selectDictLabels(datas, value, separator) { - if (value === undefined) { + if (value === undefined || value.length ===0) { return ""; } + if (Array.isArray(value)) { + value = value.join(","); + } var actions = []; var currentSeparator = undefined === separator ? "," : separator; var temp = value.split(currentSeparator);