'admin-21.05.08:修复粘贴复制的链接,登录后不跳转到对应的链接的问题'
This commit is contained in:
parent
7c673b9ae6
commit
daaafac7f8
@ -1079,7 +1079,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
NProgress.done();
|
NProgress.done();
|
||||||
} else {
|
} else {
|
||||||
if (!token) {
|
if (!token) {
|
||||||
next('/login');
|
next(`/login?redirect=${to.path}`);
|
||||||
clearSession();
|
clearSession();
|
||||||
resetRoute();
|
resetRoute();
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { toRefs, reactive, defineComponent, computed } from 'vue';
|
import { toRefs, reactive, defineComponent, computed } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { initAllFun, initBackEndControlRoutesFun } from '/@/router/index.ts';
|
import { initAllFun, initBackEndControlRoutesFun } from '/@/router/index.ts';
|
||||||
@ -64,6 +64,7 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
@ -134,7 +135,8 @@ export default defineComponent({
|
|||||||
let currentTimeInfo = currentTime.value;
|
let currentTimeInfo = currentTime.value;
|
||||||
// 登录成功,跳到转首页
|
// 登录成功,跳到转首页
|
||||||
// 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
|
// 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
|
||||||
router.push('/');
|
// 如果是复制粘贴的路径,非首页/登录页,那么登录成功后重定向到对应的路径中
|
||||||
|
route.query?.redirect ? router.push(route.query.redirect) : router.push('/');
|
||||||
// 登录成功提示
|
// 登录成功提示
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 关闭 loading
|
// 关闭 loading
|
||||||
|
Loading…
Reference in New Issue
Block a user