无人机管理后台前端(已迁走)
罗广辉
2025-04-19 1e06a9f9cf8c2c43121d3e40ebaa1ffc17d3ee79
feat: 添加重定向
2 files modified
9 ■■■■■ changed files
src/page/index/index.vue 5 ●●●●● patch | view | raw | blame | history
src/permission.js 4 ●●●● patch | view | raw | blame | history
src/page/index/index.vue
@@ -76,6 +76,11 @@
      this.$store.dispatch('GetMenu', item.id).then(data => {
        if (data.length !== 0) {
          this.$router.$avueRouter.formatRoutes(data, true);
          const redirect = decodeURIComponent(to.query.redirect || '');
          if (redirect){
            console.log('redirect',redirect);
            this.$router.push({ path: redirect})
          }
        }
        //当点击顶部菜单后默认打开第一个菜单
        /*if (!this.validatenull(item)) {
src/permission.js
@@ -20,7 +20,6 @@
router.beforeEach((to, from, next) => {
  const meta = to.meta || {};
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
  const redirect = decodeURIComponent(to.query.redirect || '');
  store.commit('SET_IS_MENU', isMenu === undefined);
  if (getToken()) {
    if (store.getters.isLock && to.path !== lockPage) {
@@ -29,9 +28,6 @@
    } else if (to.path === '/login') {
      //如果登录成功访问登录页跳转到主页
      next({ path: '/' });
    } else if (redirect){
      console.log('redirect',redirect);
      next({ path: redirect})
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {