From 46a84cd26645eb41ea50c13e737e82700b180c52 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 13 Oct 2023 14:57:01 +0800 Subject: [PATCH] fix --- src/layout/components/AppSidebar/Menu.vue | 2 +- src/permission.ts | 6 ++++++ src/router/index.ts | 2 +- src/views/product/bank/CardList.vue | 18 ++++++++++++++++-- src/views/product/strategy/150.vue | 17 +++++++---------- src/views/product/strategy/151.vue | 12 +++++------- src/views/product/strategy/CardList.vue | 23 ++++++----------------- 7 files changed, 42 insertions(+), 38 deletions(-) diff --git a/src/layout/components/AppSidebar/Menu.vue b/src/layout/components/AppSidebar/Menu.vue index aad0c83..149e01d 100644 --- a/src/layout/components/AppSidebar/Menu.vue +++ b/src/layout/components/AppSidebar/Menu.vue @@ -34,7 +34,7 @@

产品风控配置

  • + @click="toPage('/product/strategy?type=&i=2&role=42')"> diff --git a/src/permission.ts b/src/permission.ts index ca66c5c..d7404df 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -33,3 +33,9 @@ router.afterEach((to: RouteLocationNormalized) => { // finish progress bar NProgress.done(); }); + +router.onError((error, to) => { + if (error.message.includes('Failed to fetch dynamically imported module')) { + window.location = to.fullPath; + } +}); diff --git a/src/router/index.ts b/src/router/index.ts index b31b733..91d28ad 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -30,7 +30,7 @@ export const routes: Array = [ children: [ { path: 'index', component: () => import('@/views/product/List.vue'), meta: { title: '产品列表' } }, { path: 'bank/:action', component: () => import('@/views/product/bank/CardList.vue'), meta: { title: '产品列表' } }, - { path: 'strategy/:action', component: () => import('@/views/product/strategy/CardList.vue'), meta: { title: '产品列表' } }, + { path: 'strategy', component: () => import('@/views/product/strategy/CardList.vue'), meta: { title: '产品列表' } }, ], }, { diff --git a/src/views/product/bank/CardList.vue b/src/views/product/bank/CardList.vue index eb39633..87ecdbd 100644 --- a/src/views/product/bank/CardList.vue +++ b/src/views/product/bank/CardList.vue @@ -39,8 +39,15 @@
    - + + + + +
    @@ -52,10 +59,17 @@ import { Plus } from '@element-plus/icons-vue'; import { bankingProductsList, batchDeletion } from '@/api/bank'; import { useRouter, useRoute } from 'vue-router'; import { getStatus } from '@/store/useProduct'; +import Config from './Config.vue'; +import Detail from './Detail.vue'; +import Add from './Add.vue'; +import Approve from './Approve.vue'; const router = useRouter(); const route = useRoute(); const action = ref(''); + +// const modules: any = import.meta.glob('./*.vue'); +// let currentSubApp = defineAsyncComponent(modules[`./${route.params.action}.vue`]); const list = ref>([]); const loading = ref(false); const productType = computed(() => route.query.type); // 个人/企业 diff --git a/src/views/product/strategy/150.vue b/src/views/product/strategy/150.vue index dd20bb6..4c90153 100644 --- a/src/views/product/strategy/150.vue +++ b/src/views/product/strategy/150.vue @@ -126,7 +126,6 @@ const router = useRouter(); const route = useRoute(); const projectId = +Cookies.get('sand-projectId'); const levelId = +Cookies.get('sand-level'); -const id = computed(() => +route.query.id); const form = ref[]>([]); const info = ref[]>([]); const height = window.innerHeight - 270; @@ -167,8 +166,8 @@ const getConfig = async () => { otherFamilyMembersHitRejected: !!cur?.otherFamilyMembersHitRejected, parentsHitRejected: !!cur?.parentsHitRejected, personalHitBlacklist: !!cur?.personalHitBlacklist, - symbol: isRule(e.id) ? symbol[0] : '>=', - had: e.id === 167 && had.length ? had[0] : '', + symbol: isRule(e.id) && symbol?.length ? symbol[0] : '>=', + had: e.id === 167 && had?.length ? had[0] : '', num: isRule(e.id) && num?.length ? num[0] : '', ruleOne: '', ruleTwo: '', @@ -192,13 +191,11 @@ const getConfig = async () => { }; // 详情 const getDetail = async () => { - if (id.value) { - try { - const { data } = await accessStrategyGovernmentBlacklistFind(levelId, projectId); - info.value = data; - getConfig(); - } finally { - } + try { + const { data } = await accessStrategyGovernmentBlacklistFind(levelId, projectId); + info.value = data; + getConfig(); + } finally { } }; diff --git a/src/views/product/strategy/151.vue b/src/views/product/strategy/151.vue index 8e4c5a9..2d39541 100644 --- a/src/views/product/strategy/151.vue +++ b/src/views/product/strategy/151.vue @@ -158,13 +158,11 @@ const getConfig = async () => { }; // 详情 const getDetail = async () => { - if (id.value) { - try { - const { data } = await accessStrategyGovernmentBlacklistFind(levelId, projectId); - info.value = data; - getConfig(); - } finally { - } + try { + const { data } = await accessStrategyGovernmentBlacklistFind(levelId, projectId); + info.value = data; + getConfig(); + } finally { } }; diff --git a/src/views/product/strategy/CardList.vue b/src/views/product/strategy/CardList.vue index bbf7276..38bc8c1 100644 --- a/src/views/product/strategy/CardList.vue +++ b/src/views/product/strategy/CardList.vue @@ -18,8 +18,8 @@
    - + +
    @@ -36,15 +36,13 @@ import { computed, onMounted, ref, watch, defineAsyncComponent } from 'vue'; import type { TabsPaneContext } from 'element-plus'; import { getProcessInformationBasedOnRoles } from '@/api/judgment'; import { useRouter, useRoute } from 'vue-router'; +import Com1 from './150.vue'; +import Com2 from './151.vue'; const router = useRouter(); const route = useRoute(); const curTab = ref('tab1'); -const action = ref(''); const list = ref>([]); -const loading = ref(false); -const productType = computed(() => route.query.type); // 个人/企业 -const role = computed(() => +route.query.role || 41); const id = computed(() => +route.query.id); // 列表 @@ -52,7 +50,7 @@ const getList = async () => { const { process } = await getProcessInformationBasedOnRoles(67); id.value || router.push({ - path: `/product/strategy/config`, + path: `/product/strategy`, query: { ...route.query, id: process[0].recordChildren[0].id, @@ -64,19 +62,10 @@ onMounted(() => { getList(); }); -watch( - route, - (route: any) => { - action.value = route.params.action; - }, - { - immediate: true, - }, -); // 产品切换 const switchProduct = (id: number) => { router.push({ - path: `/product/strategy/config`, + path: `/product/strategy`, query: { ...route.query, id,