diff --git a/src/router/index.js b/src/router/index.js index 85e2cd7..0e48b1d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -61,15 +61,6 @@ const router = new Router({ router.beforeEach((to, from, next) => {console.log(Vue.prototype.$store) - // const token = localStorage.getItem('token'); - // const isLogin = to.name === 'login'; // 判断是否是登录页 - // - // // 保存原始路径(仅在未登录状态下保存) - // if (!token && !isLogin) { - // console.log('保存重定向路径:', to.fullPath); - // localStorage.setItem('redirectPath', to.fullPath); - // } - // 添加动态(菜单)路由 // 1. 已经添加 or 全局路由, 直接访问 // 2. 获取菜单列表, 添加并保存本地存储 @@ -102,6 +93,15 @@ router.beforeEach((to, from, next) => {console.log(Vue.prototype.$store) router.push({ name: 'login' }) }) } + + const token = localStorage.getItem('token'); + const isLogin = to.name === 'login'; // 判断是否是登录页 + + // 保存原始路径(仅在未登录状态下保存) + if (!token && !isLogin) { + console.log('保存重定向路径:', to.fullPath); + localStorage.setItem('redirectPath', to.fullPath); + } }) /** diff --git a/src/views/common/login.vue b/src/views/common/login.vue index 64dd02b..54b24a3 100644 --- a/src/views/common/login.vue +++ b/src/views/common/login.vue @@ -105,13 +105,20 @@ import { getUUID } from '@/utils' }) }).then(({data}) => { if (data && data.code === 0) { - // console.log('跳转前路径:', localStorage.getItem('redirectPath')); // 检查路径是否正确 + console.log('跳转前路径:', localStorage.getItem('redirectPath')); // 检查路径是否正确 this.$cookie.set('token', data.token) // 动态跳转逻辑 - // const redirectPath = localStorage.getItem('redirectPath') || '/home'; - // console.log('Redirecting to:', redirectPath); // 调试输出 - // this.$router.replace(redirectPath); // 根据保存的路径跳转 - this.$router.replace({name: 'home'}) + const redirectPath = localStorage.getItem('redirectPath') || ''; + + // 设置需要判断的路径 + const pathsToRedirect = ['/auth-authQuote', '/auth-authInquiry']; + + if (pathsToRedirect.some(path => redirectPath.indexOf(path) !== -1)) { + this.$router.replace(redirectPath); + } else { + this.$router.replace({ name: 'home' }); + } + console.log('Redirecting to:', redirectPath); // 调试输出 this.$i18n.locale=data.language localStorage.setItem('locale', data.language) localStorage.setItem('refresh', "0") diff --git a/src/views/modules/auth/authInquiry.vue b/src/views/modules/auth/authInquiry.vue index 3491a3a..2a4fed5 100644 --- a/src/views/modules/auth/authInquiry.vue +++ b/src/views/modules/auth/authInquiry.vue @@ -315,13 +315,13 @@ import OssComponents from "../oss/ossComponents.vue"; import {getTableDefaultListLanguage, getTableUserListLanguage, updateColumnSize} from "../../../api/table"; export default { - // beforeRouteEnter(to, from, next) { - // next((vm) => { - // // 跳转后清除 redirectPath - // localStorage.removeItem('redirectPath'); - // console.log('redirectPath 已清除'); - // }); - // }, + beforeRouteEnter(to, from, next) { + next((vm) => { + // 跳转后清除 redirectPath + localStorage.removeItem('redirectPath'); + console.log('redirectPath 已清除'); + }); + }, computed: { statusDisplay() { return this.inquiryInfoData.status === 'C' ? '草稿' : (this.inquiryInfoData.status === 'B' ? '已下达' : '已报价') diff --git a/src/views/modules/auth/authQuote.vue b/src/views/modules/auth/authQuote.vue index 6484c8c..e5db904 100644 --- a/src/views/modules/auth/authQuote.vue +++ b/src/views/modules/auth/authQuote.vue @@ -218,13 +218,13 @@ import QuoteDetail from "../quote/detail/quoteDetail.vue"; import {getTableDefaultListLanguage, getTableUserListLanguage, updateColumnSize} from "../../../api/table"; export default { - // beforeRouteEnter(to, from, next) { - // next((vm) => { - // // 跳转后清除 redirectPath - // localStorage.removeItem('redirectPath'); - // console.log('redirectPath 已清除'); - // }); - // }, + beforeRouteEnter(to, from, next) { + next((vm) => { + // 跳转后清除 redirectPath + localStorage.removeItem('redirectPath'); + console.log('redirectPath 已清除'); + }); + }, computed: { // quotationInformationFlag () { // return (value) => { diff --git a/src/views/modules/inquiry/inquiryApplication.vue b/src/views/modules/inquiry/inquiryApplication.vue index 6657fb9..ae8683d 100644 --- a/src/views/modules/inquiry/inquiryApplication.vue +++ b/src/views/modules/inquiry/inquiryApplication.vue @@ -954,6 +954,24 @@ export default { fixed: '', columnWidth: 100 }, + { + userId: this.$store.state.user.name, + functionId: 5022, + serialNumber: '5022Table1BomStatus', + tableId: '5022Table1', + tableName: '询价信息表', + columnProp: 'bomStatus', + headerAlign: 'center', + align: 'center', + columnLabel: 'BOM状态', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, { userId: this.$store.state.user.name, functionId: 5022,