From 7f4c0d3fa1428758722ada48fb5c39558d6876d9 Mon Sep 17 00:00:00 2001 From: ktianc Date: Mon, 19 Jun 2023 13:38:07 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9A=E5=89=8D=E7=AB=AF=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BA=8B=E4=BB=B6=E4=BC=98=E5=8C=96=E4=BD=BF=E7=94=A8?= =?UTF-8?q?try/finally=EF=BC=8C=E7=BC=96=E8=BE=91=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/Login/components/LoginForm.vue | 2 +- .../Login/components/TelephoneCodeForm.vue | 4 +- kinit-admin/src/views/Reset/Reset.vue | 2 +- .../src/views/vadmin/auth/menu/index.vue | 2 +- .../src/views/vadmin/auth/role/index.vue | 14 +++--- .../src/views/vadmin/auth/user/index.vue | 12 +++-- .../src/views/vadmin/help/issue/index.vue | 12 +++-- .../views/vadmin/help/issueCategory/index.vue | 12 +++-- .../screen/air/components/CenterTop.vue | 5 +- .../src/views/vadmin/system/dict/detail.vue | 50 +++++++++++-------- .../src/views/vadmin/system/dict/index.vue | 10 ++-- .../views/vadmin/system/settings/email.vue | 13 +++-- .../views/vadmin/system/settings/index.vue | 4 +- 13 files changed, 81 insertions(+), 61 deletions(-) diff --git a/kinit-admin/src/views/Login/components/LoginForm.vue b/kinit-admin/src/views/Login/components/LoginForm.vue index 9d6a020..b5664f3 100644 --- a/kinit-admin/src/views/Login/components/LoginForm.vue +++ b/kinit-admin/src/views/Login/components/LoginForm.vue @@ -143,7 +143,7 @@ const signIn = async () => { } else { loading.value = false } - } catch (e: any) { + } finally { loading.value = false } } diff --git a/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue b/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue index 0916b5d..e9131de 100644 --- a/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue +++ b/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue @@ -111,7 +111,7 @@ const telephoneCodeLogin = async () => { } else { loading.value = false } - } catch (e: any) { + } finally { loading.value = false } } @@ -143,7 +143,7 @@ const getSMSCode = async () => { ElMessage.error('发送失败,请联系管理员') SMSCodeStatus.value = true } - } catch (e: any) { + } finally { SMSCodeStatus.value = true } } diff --git a/kinit-admin/src/views/Reset/Reset.vue b/kinit-admin/src/views/Reset/Reset.vue index bb5b130..dac37d6 100644 --- a/kinit-admin/src/views/Reset/Reset.vue +++ b/kinit-admin/src/views/Reset/Reset.vue @@ -110,7 +110,7 @@ const save = async () => { } else { loading.value = false } - } catch (e: any) { + } finally { loading.value = false } } diff --git a/kinit-admin/src/views/vadmin/auth/menu/index.vue b/kinit-admin/src/views/vadmin/auth/menu/index.vue index 3468319..86059e8 100644 --- a/kinit-admin/src/views/vadmin/auth/menu/index.vue +++ b/kinit-admin/src/views/vadmin/auth/menu/index.vue @@ -96,8 +96,8 @@ const save = async () => { if (isValid) { loading.value = true const data = await write?.getFormData() - const res = ref({}) try { + const res = ref({}) if (actionType.value === 'add') { res.value = await addMenuListApi(data) if (res.value) { diff --git a/kinit-admin/src/views/vadmin/auth/role/index.vue b/kinit-admin/src/views/vadmin/auth/role/index.vue index f065658..4782544 100644 --- a/kinit-admin/src/views/vadmin/auth/role/index.vue +++ b/kinit-admin/src/views/vadmin/auth/role/index.vue @@ -56,11 +56,13 @@ const addAction = () => { // 编辑事件 const updateAction = async (row: any) => { const res = await getRoleApi(row.id) - dialogTitle.value = '编辑' - tableObject.currentRow = res.data - defaultCheckedKeys.value = res.data.menus.map((item: any) => item.id) - dialogVisible.value = true - actionType.value = 'edit' + if (res) { + dialogTitle.value = '编辑' + tableObject.currentRow = res.data + defaultCheckedKeys.value = res.data.menus.map((item: any) => item.id) + dialogVisible.value = true + actionType.value = 'edit' + } } // 删除事件 @@ -82,8 +84,8 @@ const save = async () => { return ElMessage.error('未获取到数据') } data.menu_ids = write?.getTreeCheckedKeys() - const res = ref({}) try { + const res = ref({}) if (actionType.value === 'add') { res.value = await addRoleListApi(data) if (res.value) { diff --git a/kinit-admin/src/views/vadmin/auth/user/index.vue b/kinit-admin/src/views/vadmin/auth/user/index.vue index 45acd0c..957b2c9 100644 --- a/kinit-admin/src/views/vadmin/auth/user/index.vue +++ b/kinit-admin/src/views/vadmin/auth/user/index.vue @@ -95,11 +95,13 @@ const addAction = () => { // 编辑事件 const updateAction = async (row: any) => { const res = await getUserApi(row.id) - dialogTitle.value = '编辑' - res.data.role_ids = res.data.roles.map((item: any) => item.id) - tableObject.currentRow = res.data - dialogVisible.value = true - actionType.value = 'edit' + if (res) { + dialogTitle.value = '编辑' + res.data.role_ids = res.data.roles.map((item: any) => item.id) + tableObject.currentRow = res.data + dialogVisible.value = true + actionType.value = 'edit' + } } // 删除事件 diff --git a/kinit-admin/src/views/vadmin/help/issue/index.vue b/kinit-admin/src/views/vadmin/help/issue/index.vue index b63cf8c..42039e5 100644 --- a/kinit-admin/src/views/vadmin/help/issue/index.vue +++ b/kinit-admin/src/views/vadmin/help/issue/index.vue @@ -62,11 +62,13 @@ const searchSetSchemaList = ref([] as FormSetPropsType[]) const getOptions = async () => { const res = await getIssueCategoryOptionsApi() - searchSetSchemaList.value.push({ - field: 'category_id', - path: 'componentProps.options', - value: res.data - }) + if (res) { + searchSetSchemaList.value.push({ + field: 'category_id', + path: 'componentProps.options', + value: res.data + }) + } } getOptions() diff --git a/kinit-admin/src/views/vadmin/help/issueCategory/index.vue b/kinit-admin/src/views/vadmin/help/issueCategory/index.vue index a24604c..6e6f8fc 100644 --- a/kinit-admin/src/views/vadmin/help/issueCategory/index.vue +++ b/kinit-admin/src/views/vadmin/help/issueCategory/index.vue @@ -95,10 +95,12 @@ const addAction = async () => { // 编辑事件 const updateAction = async (row: any) => { const res = await getIssueCategoryApi(row.id) - dialogTitle.value = '编辑' - tableObject.currentRow = res.data - dialogVisible.value = true - actionType.value = 'edit' + if (res) { + dialogTitle.value = '编辑' + tableObject.currentRow = res.data + dialogVisible.value = true + actionType.value = 'edit' + } } // 删除事件 @@ -116,8 +118,8 @@ const save = async () => { if (isValid) { loading.value = true let data = await write?.getFormData() - const res = ref({}) try { + const res = ref({}) if (actionType.value === 'add') { res.value = await addIssueCategoryApi(data) if (res.value) { diff --git a/kinit-admin/src/views/vadmin/screen/air/components/CenterTop.vue b/kinit-admin/src/views/vadmin/screen/air/components/CenterTop.vue index 9a5c38e..dab5c89 100644 --- a/kinit-admin/src/views/vadmin/screen/air/components/CenterTop.vue +++ b/kinit-admin/src/views/vadmin/screen/air/components/CenterTop.vue @@ -1,8 +1,7 @@