lixuliang
2024-08-29 11cd6f4d30fbae557d18aaa44afc0b32de54ad32
更新登录
已修改8个文件
106 ■■■■ 文件已修改
se-ui/.env.development 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/.env.production 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/src/layout/components/Navbar.vue 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/src/permission.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/src/router/index.js 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/src/utils/request.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/src/views/login.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/vue.config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-ui/.env.development
@@ -5,7 +5,10 @@
ENV = 'development'
# 管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = '/prod-api'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
#项目子路径
VUE_APP_ITEM_PATH = '/sys'
se-ui/.env.production
@@ -6,3 +6,6 @@
# 管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
#项目子路径
VUE_APP_ITEM_PATH = '/sys'
se-ui/src/layout/components/Navbar.vue
@@ -73,41 +73,42 @@
      'sidebar',
      'avatar',
      'device'
    ]),
    setting: {
    ]),    setting: {
      get() {
        return this.$store.state.settings.showSettings
        return this.$store.state.settings.showSettings;
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'showSettings',
        this.$store.dispatch("settings/changeSetting", {
          key: "showSettings",
          value: val
        })
        });
      }
    },
    topNav: {
      get() {
        return this.$store.state.settings.topNav
        return this.$store.state.settings.topNav;
      }
    }
  },
  methods: {
    toggleSideBar() {
      this.$store.dispatch('app/toggleSideBar')
      this.$store.dispatch("app/toggleSideBar");
    },
    async logout() {
      this.$confirm('确定注销并退出系统吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
          location.href = '/index';
      this.$confirm("确定注销并退出系统吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$store.dispatch("LogOut").then(() => {
            location.href = window.location.origin + '/sso/login'
          });
        })
      }).catch(() => {});
        .catch(() => {});
    }
  }
}
};
</script>
<style lang="scss" scoped>
@@ -116,18 +117,18 @@
  overflow: hidden;
  position: relative;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,21,41,.08);
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  .hamburger-container {
    line-height: 46px;
    height: 100%;
    float: left;
    cursor: pointer;
    transition: background .3s;
    -webkit-tap-highlight-color:transparent;
    transition: background 0.3s;
    -webkit-tap-highlight-color: transparent;
    &:hover {
      background: rgba(0, 0, 0, .025)
      background: rgba(0, 0, 0, 0.025);
    }
  }
@@ -164,10 +165,10 @@
      &.hover-effect {
        cursor: pointer;
        transition: background .3s;
        transition: background 0.3s;
        &:hover {
          background: rgba(0, 0, 0, .025)
          background: rgba(0, 0, 0, 0.025);
        }
      }
    }
se-ui/src/permission.js
@@ -32,11 +32,12 @@
            next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
          })
        }).catch(err => {
            store.dispatch('LogOut').then(() => {
              Message.error(err)
              next({ path: '/' })
            })
          store.dispatch('LogOut').then(() => {
            Message.error(err)
            window.location.href = window.location.origin + '/sso/login'
            // next({ path: '/' })
          })
        })
      } else {
        next()
      }
@@ -47,7 +48,8 @@
      // 在免登录白名单,直接进入
      next()
    } else {
      next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
      // next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
      window.location.href = window.location.origin + '/sso/login'
      NProgress.done()
    }
  }
se-ui/src/router/index.js
@@ -41,11 +41,11 @@
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login'),
    hidden: true
  },
  // {
  //   path: '/login',
  //   component: () => import('@/views/login'),
  //   hidden: true
  // },
  {
    path: '/register',
    component: () => import('@/views/register'),
@@ -64,15 +64,15 @@
  {
    path: '',
    component: Layout,
    redirect: 'index',
    children: [
      {
        path: 'index',
        component: () => import('@/views/index'),
        name: 'Index',
        meta: { title: '首页', icon: 'dashboard', affix: true }
      }
    ]
    redirect: 'system/user',
    // children: [
    //   {
    //     path: 'index',
    //     component: () => import('@/views/index'),
    //     name: 'Index',
    //     meta: { title: '首页', icon: 'dashboard', affix: true }
    //   }
    // ]
  },
  {
    path: '/user',
@@ -178,6 +178,7 @@
export default new Router({
  mode: 'history', // 去掉url中的#
  base: process.env.VUE_APP_ITEM_PATH,
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
se-ui/src/utils/request.js
@@ -15,8 +15,8 @@
// 创建axios实例
const service = axios.create({
  // axios中请求配置有baseURL选项,表示请求URL公共部分
  // baseURL: process.env.VUE_APP_BASE_API,
  baseURL: 'http://192.168.11.203:8090/prod-api',
  baseURL: process.env.VUE_APP_BASE_API,
  // baseURL: 'http://192.168.11.203:8090/prod-api',
  // 超时
  timeout: 10000
})
se-ui/src/views/login.vue
@@ -47,7 +47,7 @@
</template>
<script>
import { getCodeImg } from "@/api/login";
// import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
se-ui/vue.config.js
@@ -17,7 +17,7 @@
  // 部署生产环境和开发环境下的URL。
  // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
  // 例如 https://www.se.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.se.vip/admin/,则设置 baseUrl 为 /admin/。
  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
  publicPath: process.env.NODE_ENV === "production" ? process.env.VUE_APP_ITEM_PATH : "/",
  // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
  outputDir: 'dist',
  // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
@@ -37,7 +37,7 @@
        target: `http://192.168.11.203:8090`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_BASE_API]: ''
          ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API
        }
      }
    },