From 024d08555b5d0168d9eb29168e970bb2f38d2829 Mon Sep 17 00:00:00 2001 From: AKING <2734339436@qq.com> Date: Wed, 24 Jan 2024 02:44:33 +0000 Subject: [PATCH 1/3] =?UTF-8?q?update=20src/permission.ts.=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E4=BA=86=E8=B7=B3=E8=BD=AC=E4=B8=8D=E5=B8=A6=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: AKING <2734339436@qq.com> --- src/permission.ts | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/permission.ts b/src/permission.ts index 0698dc88..d538303b 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -12,6 +12,40 @@ import { usePermissionStoreWithOut } from '@/store/modules/permission' const { start, done } = useNProgress() const { loadStart, loadDone } = usePageLoading() + +const parseURL = ( + url: string | null | undefined +): { basePath: string; paramsObject: { [key: string]: string } } => { + // 如果输入为 null 或 undefined,返回空字符串和空对象 + if (url == null) { + return { basePath: '', paramsObject: {} } + } + + // 找到问号 (?) 的位置,它之前是基础路径,之后是查询参数 + const questionMarkIndex = url.indexOf('?') + let basePath = url + const paramsObject: { [key: string]: string } = {} + + // 如果找到了问号,说明有查询参数 + if (questionMarkIndex !== -1) { + // 获取 basePath + basePath = url.substring(0, questionMarkIndex) + + // 从 URL 中获取查询字符串部分 + const queryString = url.substring(questionMarkIndex + 1) + + // 使用 URLSearchParams 遍历参数 + const searchParams = new URLSearchParams(queryString) + searchParams.forEach((value, key) => { + // 封装进 paramsObject 对象 + paramsObject[key] = value + }) + } + + // 返回 basePath 和 paramsObject + return { basePath, paramsObject } +} + // 路由不重定向白名单 const whiteList = [ '/login', @@ -47,8 +81,10 @@ router.beforeEach(async (to, from, next) => { router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表 }) const redirectPath = from.query.redirect || to.path + // 修复跳转时不带参数的问题 const redirect = decodeURIComponent(redirectPath as string) - const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect } + const { basePath, paramsObject: query } = parseURL(redirect) + const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect, query } next(nextData) } else { next() From a0ce1f3a5b5ed2cbd5a99788b9c5d7791bd03f4a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 26 Jan 2024 21:53:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=94=A5=202.0.0=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=91=E5=B8=83=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c521cafe..9bcd5c65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yudao-ui-admin-vue3", - "version": "1.8.3-snapshot", + "version": "2.0.0-snapshot", "description": "基于vue3、vite4、element-plus、typesScript", "author": "xingyu", "private": false, From df7806d8d3b2096fc6a4fd72be854b6971eea0c2 Mon Sep 17 00:00:00 2001 From: NiceShow Date: Mon, 29 Jan 2024 15:44:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20label=E9=94=99=E8=AF=AF-=E7=A0=8D?= =?UTF-8?q?=E4=BB=B7=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/bargain/activity/bargainActivity.data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/mall/promotion/bargain/activity/bargainActivity.data.ts b/src/views/mall/promotion/bargain/activity/bargainActivity.data.ts index 5d967287..2b124c4e 100644 --- a/src/views/mall/promotion/bargain/activity/bargainActivity.data.ts +++ b/src/views/mall/promotion/bargain/activity/bargainActivity.data.ts @@ -133,7 +133,7 @@ const crudSchemas = reactive([ } }, { - label: '拼团商品', + label: '砍价商品', field: 'spuId', isSearch: false, form: {