feat: 更新权限管理和首页布局,优化加密库引用

This commit is contained in:
zhanghao 2026-08-25 14:24:47 +08:00
parent 83d817e9e5
commit a74ef03d19
7 changed files with 1091 additions and 6 deletions

View File

@ -19,11 +19,12 @@ const isWhiteList = (path) => {
}
router.beforeEach(async (to, from) => {
if (to.meta?.noLogin) {
const token = getToken()
if (to.meta?.noLogin && !token) {
return true
}
NProgress.start()
if (getToken()) {
if (token) {
to.meta.title && useSettingsStore().setTitle(to.meta.title)
const isLock = useLockStore().isLock
if (to.path === '/login') {

View File

@ -15,9 +15,10 @@ export const constantRoutes = [
{ path: '/401', component: commonView('error/401'), hidden: true },
{ path: '/:pathMatch(.*)*', component: commonView('error/404'), hidden: true },
{
path: '/', component: Layout, redirect: '/intelligenceTest/taskManage',
children: [{ path: '/intelligenceTest/taskManage', component: () => import('@/views/intelligenceTest/taskManage/index.vue'), name: 'IntelligenceTaskManage', meta: { title: '智能测试任务', noLogin: true } }]
path: '/', component: Layout, redirect: '/index',
children: [{ path: 'index', component: () => import('@/views/index.vue'), name: 'Index', meta: { title: '首页', icon: 'dashboard', affix: true } }]
},
{ path: '/flow', component: commonView('flow/index'), hidden: true, meta: { title: '流程编排', noLogin: true } },
{ path: '/lock', component: () => import('@/views/lock'), hidden: true },
{
path: '/user', component: Layout, hidden: true, redirect: 'noredirect',

View File

@ -1,4 +1,4 @@
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
import JSEncrypt from 'jsencrypt'
// 密钥对生成 http://web.chacuo.net/netrsakeypair

1065
src/views/index.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -337,7 +337,7 @@ function cancel() {
function handleDeploy(row) {
const params = { itemId: row.detectItemId, name: row.caseName, state: row.status };
const fullPath = appendParamsToPath("/flow", params);
const p = window.open(fullPath, "_blank");
window.open(fullPath, "_blank", "noopener,noreferrer");
}
getList();

View File

@ -1,7 +1,18 @@
import { defineConfig, loadEnv, normalizePath } from 'vite'
import path from 'path'
import { realpathSync } from 'node:fs'
import createVitePlugins from './vite/plugins'
const isCommonLinked = (() => {
try {
const linkedPath = realpathSync(path.resolve('node_modules/@cmvr/iot-common'))
const localPath = realpathSync(path.resolve('../cmvr-iot-common'))
return path.relative(linkedPath, localPath) === ''
} catch {
return false
}
})()
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd())
@ -12,6 +23,7 @@ export default defineConfig(({ mode, command }) => {
plugins: createVitePlugins(env, command === 'build'),
optimizeDeps: {
exclude: [
...(isCommonLinked ? ['@cmvr/iot-common'] : []),
'monaco-editor',
'monaco-editor/esm/vs/base/worker/workerMain.js',
'monaco-editor/esm/vs/editor/editor.main.js',
@ -57,6 +69,11 @@ export default defineConfig(({ mode, command }) => {
port: Number(VITE_PORT || 80),
host: true,
open: true,
...(isCommonLinked ? {
watch: {
ignored: ['!**/node_modules/@cmvr/iot-common/**']
}
} : {}),
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {

View File

@ -11,6 +11,7 @@ export default function createAutoImport() {
'@/utils/ruoyi': ['selectDictLabel']
}
],
exclude: [/[\\/]cmvr-iot-common[\\/]dist[\\/]/],
dts: false
})
}