From 961e882a8926b3bbc3dc0b1173725ae5930ccd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8?= Date: Thu, 28 May 2026 13:37:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E5=81=87=E6=97=A5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 17 +++++++---------- src/views/trade/holidays/index.vue | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index bc8c1f0..3e3d694 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -97,11 +97,8 @@ const responseInterceptor = (response: AxiosResponse switch (data.code) { case 1: // 跳转到注册页 - router.push('/user/register') - if (!data.msg) { - data.msg = '未知的错误!' - } - break + window.location.href = '/user/register' + throw new Error(data.msg || '未知的错误!') case -100: // 退出登录 data.msg = 'token过期!' @@ -109,15 +106,15 @@ const responseInterceptor = (response: AxiosResponse removeStorage('userInfo') removeStorage('menusInfo') removeStorage('permissionsInfo') - router.push({ name: 'Login' }) - break + window.location.href = '/user/login' + throw new Error(data.msg) case -101: data.msg = 'token错误!' removeStorage('token') - router.push({ name: 'Login' }) - break + window.location.href = '/user/login' + throw new Error(data.msg) default: - break; + throw new Error(data.msg || '操作失败!') } // 其他业务失败:弹错误提示并拒绝Promise diff --git a/src/views/trade/holidays/index.vue b/src/views/trade/holidays/index.vue index 18436c0..3c6c69a 100644 --- a/src/views/trade/holidays/index.vue +++ b/src/views/trade/holidays/index.vue @@ -10,6 +10,9 @@ 搜索 重置 + + 同步 +
@@ -24,7 +27,7 @@ 编辑 删除 + v-auth="'contractVariety_addHoliday'">删除 @@ -56,6 +59,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import { usePageLoading } from '@/composables/useLoading' import Table from '@/components/common/Table.vue' import Form from '@/components/common/Form.vue' +import { syncRiskControlApi } from '@/api/modules/risk' defineOptions({ name: 'Holidays' @@ -213,6 +217,16 @@ const getList = async () => { } } +// 同步风控模板 +const syncLoading = ref(false) +const handleSyncRiskControl = async () => { + syncLoading.value = true + try { + await syncRiskControlApi() + } finally { + syncLoading.value = false + } +} /** * @description: 搜索 */