feat(ui): remove unused code and unused files

This commit is contained in:
LH_R
2025-06-23 16:26:38 +08:00
parent e93d894f04
commit 6ec7caf5ea
27 changed files with 207 additions and 846 deletions

View File

@@ -1,4 +1,3 @@
/* eslint-disable */
import Vue from 'vue'
import router from './router'
import store from './store'
@@ -11,16 +10,23 @@ import i18n from '@/lang'
NProgress.configure({ showSpinner: false })
// 不用认证的页面
const whitePath = ['/user/login', '/user/logout', '/user/register', '/api/sso/login', '/api/sso/logout', '/user/forgetPassword']
// pages that do not require authentication
const whitePath = [
'/user/login',
'/user/logout',
'/user/register',
'/api/sso/login',
'/api/sso/logout',
'/user/forgetPassword'
]
// 此处不处理登录, 只处理 是否有用户信息的认证 前端permission的处理 axios处理401 -> 登录
// 登录页面处理处理 是否使用单点登录
// Only handle user info authentication here, not login logic.
// Frontend permission handling; axios handles 401 -> login.
// Login page handles whether to use SSO.
router.beforeEach(async (to, from, next) => {
NProgress.start() // start progress bar
to.meta && (!!to.meta.title && setDocumentTitle(`${i18n.t(to.meta.title)} - ${domTitle}`))
const authed = store.state.authed
const auth_type = localStorage.getItem('ops_auth_type')
if (whitePath.includes(to.path)) {
next()
@@ -28,17 +34,17 @@ router.beforeEach(async (to, from, next) => {
store.dispatch('GetAuthDataEnable')
store.dispatch('GetInfo').then(res => {
const roles = res.result && res.result.role
store.dispatch("loadAllUsers")
store.dispatch("loadAllEmployees")
store.dispatch("loadAllDepartments")
store.dispatch('loadAllUsers')
store.dispatch('loadAllEmployees')
store.dispatch('loadAllDepartments')
store.dispatch('GenerateRoutes', { roles }).then(() => {
router.addRoutes(store.getters.appRoutes)
const redirect = decodeURIComponent(from.query.redirect || to.path)
if (to.path === redirect) {
// hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
// Ensure addRoutes is complete, set replace: true so navigation will not leave a history record
next({ ...to, replace: true })
} else {
// 跳转到目的路由
// Redirect to the target route
next({ path: redirect })
}
})