diff --git a/.env b/.env index 9116802..468ede3 100644 --- a/.env +++ b/.env @@ -1,5 +1,6 @@ VITE_BASE_API_SYSTEM = '/remote/admin-api/system' VITE_BASE_API_EAM = '/remote/admin-api/eam' VITE_BASE_API_INFRA = '/remote/admin-api/infra' +VITE_BASE_API_DOC= '/remote/admin-api/document' VITE_DEVICE_INFO_INTERVAL = 35000 \ No newline at end of file diff --git a/.env.development b/.env.development index 76f6148..cd7cc83 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,2 @@ -VITE_BASE_URL = 'http://192.168.1.3:48080' -VITE_SOCKET_SERVER = 'http://192.168.1.3:7080' +VITE_BASE_URL = 'http://192.168.1.17:48081' +VITE_SOCKET_SERVER = 'http://192.168.1.17:48081' diff --git a/.env.production b/.env.production index bb23583..4a79a99 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,2 @@ -VITE_BASE_URL = 'http://192.168.1.3:48080' -VITE_SOCKET_SERVER = 'http://192.168.1.3:48080' \ No newline at end of file +VITE_BASE_URL = 'http://192.168.1.17:10393' +VITE_SOCKET_SERVER = 'http://192.168.1.17:10393' \ No newline at end of file diff --git a/auto-imports.d.ts b/auto-imports.d.ts index fb0c411..995e21f 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -6,9 +6,7 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] - const ElLoading: typeof import('element-plus/es')['ElLoading'] const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] - const ElNotification: typeof import('element-plus/es')['ElNotification'] const computed: typeof import('vue')['computed'] const createApp: typeof import('vue')['createApp'] const customRef: typeof import('vue')['customRef'] diff --git a/src/api/module/eam/device/document.ts b/src/api/module/eam/device/document.ts new file mode 100644 index 0000000..3503581 --- /dev/null +++ b/src/api/module/eam/device/document.ts @@ -0,0 +1,91 @@ +import { documentServer } from '../../index' + +export function getFileList(params: { parentId: number }) { + return documentServer({ + url: '/folder/list-children', + method: 'get', + params: params, + }) +} + +interface DocFileVO { + id: number + name: string + parentId: number +} + +export function createFolder(data: Omit) { + return documentServer({ + url: '/folder/add-folder', + method: 'post', + data: data, + }) +} + +export function updateFolder(data: DocFileVO) { + return documentServer({ + url: '/folder/update-folder', + method: 'put', + data: data, + }) +} + +export function deleteFolder(params: { id: number }) { + return documentServer({ + url: '/folder/delete-folder', + method: 'delete', + params: params, + }) +} + +export function createdFile(data: Omit) { + return documentServer({ + url: '/folder/add-file', + method: 'post', + data: data, + }) +} +export function updateFile(data: DocFileVO) { + return documentServer({ + url: '/folder/update-file', + method: 'put', + data: data, + }) +} + +export function deleteFile(params: { id: number }) { + return documentServer({ + url: '/folder/delete-file', + method: 'delete', + params: params, + }) +} + +interface MarkdownVO { + folderId: number + content: string + id: number + isDraft: 0 | 1 // 0: 文章 1: 草稿 +} +export interface ContentType { + content: string + createTime: number + description: string + id: number + title: string +} +export function getMarkdown(params: Pick) { + return documentServer({ + url: '/article/get-by-folder-id', + method: 'get', + params: params, + }) +} + +export function updateMarkdown(data: MarkdownVO) { + return documentServer({ + url: '/article/edit', + method: 'put', + data: data, + }) +} diff --git a/src/api/module/index.ts b/src/api/module/index.ts index 1a6ae80..00b5293 100644 --- a/src/api/module/index.ts +++ b/src/api/module/index.ts @@ -4,5 +4,6 @@ import { API_Config } from '@/api/server/config' const systemServer = axiosInstance('system', API_Config.system) const eamServer = axiosInstance('eam', API_Config.eam) const infraServer = axiosInstance('infra', API_Config.infra) +const documentServer = axiosInstance('document', API_Config.document) -export { systemServer, eamServer, infraServer } +export { systemServer, eamServer, infraServer, documentServer } diff --git a/src/api/server/axiosInstance.ts b/src/api/server/axiosInstance.ts index 300d184..3cbc86b 100644 --- a/src/api/server/axiosInstance.ts +++ b/src/api/server/axiosInstance.ts @@ -183,7 +183,7 @@ const createAxiosInstance = (module: APIConfigKeys, config: Config) => { const unKnowError = `连接出错(${error.response.status})!` if (status === 401) { localStorage.removeItem(Keys.STORAGE_TOKEN) - router.push('/login') + router.push('/file/document') } const msg = networkErrMap[status] ? networkErrMap[status] : unKnowError @@ -229,7 +229,7 @@ async function logout() { removeToken() isShowLogout = false deleteUserCache() - window.location.href = '/login' + window.location.href = '/file/document' } export default createAxiosInstance diff --git a/src/api/server/config.ts b/src/api/server/config.ts index 057ba55..0d71c58 100644 --- a/src/api/server/config.ts +++ b/src/api/server/config.ts @@ -2,6 +2,7 @@ export interface APIConfig { system: Config eam: Config infra: Config + document: Config } interface Config { @@ -19,6 +20,9 @@ const API_Config: APIConfig = { infra: { baseAPI: import.meta.env.VITE_BASE_API_INFRA, }, + document: { + baseAPI: import.meta.env.VITE_BASE_API_DOC, + } } export type APIConfigKeys = keyof typeof API_Config diff --git a/src/components/dashboard/Edfs-exception.vue b/src/components/dashboard/Edfs-exception.vue index 98bc27b..9dd3ed3 100644 --- a/src/components/dashboard/Edfs-exception.vue +++ b/src/components/dashboard/Edfs-exception.vue @@ -10,7 +10,7 @@ type="primary" @click=" () => { - router.push('/home') + router.push('/file/document') } " >返回首页 + + +
+
+
+
+ + + + + + diff --git a/src/pages/fileDoc/index.vue b/src/pages/fileDoc/index.vue index 34cbba1..36b1cc3 100644 --- a/src/pages/fileDoc/index.vue +++ b/src/pages/fileDoc/index.vue @@ -6,7 +6,7 @@ @@ -18,7 +18,7 @@ @visibleChange="onVisibleChange" ref="contextMenuRef" > -
+
@@ -30,18 +30,22 @@ >
- + + +
- {{ item.name }} + {{ item.name }}
@@ -66,33 +70,42 @@
+ - - diff --git a/src/pages/fileDoc/utils.ts b/src/pages/fileDoc/utils.ts new file mode 100644 index 0000000..2933c45 --- /dev/null +++ b/src/pages/fileDoc/utils.ts @@ -0,0 +1,19 @@ +import Folder from '@/assets/image/dashboard/file/folder.svg' +import Upload from '@/assets/image/dashboard/file/upload.svg' +import Document from '@/assets/image/dashboard/file/document.svg' +export enum floeType { + folder, + file, +} +export const breadcrumbList = ref([{ name: '全部文件', id: 0 }]) + +export const fileDropdownMenu = [ + { command: 'open', label: '打开', icon: '' }, + { command: 'rename', label: '重命名', icon: '' }, + { command: 'delete', label: '删除', icon: '' }, +] +export const operationDropdownMenu = [ + { command: 'newFolder', label: '新建文件夹', icon: Folder }, + // { command: 'upload', label: '上传', icon: Upload }, + { command: 'newMarkdown', label: '新建文档', icon: Document }, +] diff --git a/src/pages/layout.vue b/src/pages/layout.vue index ff2a7a8..90c13df 100644 --- a/src/pages/layout.vue +++ b/src/pages/layout.vue @@ -91,7 +91,7 @@ - +
@@ -232,7 +232,7 @@ async function loginOut() { type: 'warning', }) await userStore.loginout() - push('/login') + push('/file/document') } catch {} } diff --git a/src/pages/system/login/index.vue b/src/pages/system/login/index.vue index 05fa179..eed40df 100644 --- a/src/pages/system/login/index.vue +++ b/src/pages/system/login/index.vue @@ -83,7 +83,7 @@ async function onLogin() { } isLoading.value = false - router.push('/home') + router.push('/file/document') } async function loginByAccount() { diff --git a/src/router/index.ts b/src/router/index.ts index f21cb0a..7ce70c0 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,16 +6,6 @@ import { useDictStore } from '@/stores/dict' import { getToken } from '@/utils/auth' export const defaultRoute = [ - { - path: '/login', - component: () => import('@/pages/system/login/index.vue'), - name: 'Login', - meta: { - hidden: true, - title: '登录', - noTagsView: true, - }, - }, { path: '/404', name: 'NoFound', @@ -25,28 +15,7 @@ export const defaultRoute = [ title: '404', }, }, - { - path: '/user', - component: () => import('@/pages/layout.vue'), - name: 'UserInfo', - meta: { - hidden: true, - }, - children: [ - { - path: 'profile', - component: () => import('@/pages/Profile/index.vue'), - name: 'Profile', - meta: { - canTo: true, - hidden: true, - noTagsView: false, - icon: 'ep:user', - title: '个人中心', - }, - }, - ], - }, + { path: '/file', component: () => import('@/pages/layout.vue'), @@ -68,94 +37,8 @@ export const defaultRoute = [ title: '文档管理', }, }, - { - path:'test', - component:()=>import('@/pages/fileDoc/test.vue'), - name:'Test', - meta:{ - icon:'ep:user', - title:'测试' - } - } ], }, - - // { - // path: '/device', - // component: () => import('@/pages/layout.vue'), - // name: 'UserInfo', - // meta: { - // canTo: true, - // hidden: true, - // noTagsView: false, - // icon: 'ep:user', - // title: '系统管理', - // }, - // children: [ - // { - // path: 'deviceOperation', - // component: () => import('@/pages/deviceInfo/info.vue'), - // name: 'deviceOperation', - // meta: { - // icon: 'ep:user', - // hidden: true, - // title: '设备xx', - // }, - // }, - // ], - // }, - // { - // path: '/user', - // component: () => import('@/pages/layout.vue'), - // name: 'UserInfo', - // meta: { - // canTo: true, - // hidden: false, - // noTagsView: false, - // icon: 'ep:user', - // title: '系统管理', - // }, - // children: [ - // { - // path: 'deviceField', - // component: () => import('@/pages/system/deviceField/index.vue'), - // name: 'DeviceField', - // meta: { - // icon: 'ep:user', - // title: '字段管理', - // }, - // }, - // { - // path: 'device', - // component: () => import('@/pages/deviceInfo/index.vue'), - // name: 'Device', - // meta: { - // icon: 'ep:user', - // title: '设备管理', - // }, - // }, - - // }, - // { - // path: 'manufacturer', - // component: () => import('@/pages/system/manufacturer/index.vue'), - // name: 'Manufacturer', - // meta: { - // icon: 'ep:user', - // title: '厂商管理', - // }, - // }, - // { - // path: 'deviceTemplate', - // component: () => import('@/pages/deviceTest/testPlan/index.vue'), - // name: 'DeviceTemplate', - // meta: { - // icon: 'ep:user', - // title: '模板管理', - // }, - // } - // ], - // }, ] const router = createRouter({ @@ -166,43 +49,48 @@ const router = createRouter({ const whiteList = ['/login'] router.beforeEach(async (to, from, next) => { - if (!getToken()) { - if (whiteList.indexOf(to.path) !== -1) { - next() - } else { - next('/login') - } + // if (!getToken()) { + // if (whiteList.indexOf(to.path) !== -1) { + // next() + // } else { + // next('/file/document') + // } + // return + // } + if (to.path === '/') { + next('/file/document') return } - if (to.path === '/login' || to.path === '/') { - next('/home') - return - } - const userStore = useUserStore() + // if (to.path === '/login' || to.path === '/') { + // next('/file/document') + // return + // } + // const userStore = useUserStore() const permissionStore = usePermissionStore() - const dictStore = useDictStore() - if (!dictStore.getIsSetDict) { - await dictStore.setDictMap() - } + // const dictStore = useDictStore() + // if (!dictStore.getIsSetDict) { + // await dictStore.setDictMap() + // } - if (!userStore.getIsSetUser) { - await userStore.setUserInfoAction() - // 后端过滤菜单 + // if (!userStore.getIsSetUser) { + // await userStore.setUserInfoAction() + // // 后端过滤菜单 await permissionStore.generateRoutes() permissionStore.getAddRouters.forEach(route => { router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表 }) - const redirectPath = from.query.redirect || to.path - // 修复跳转时不带参数的问题 - const redirect = decodeURIComponent(redirectPath as string) - const { basePath, paramsObject: query } = parseURL(redirect) - const nextData = - to.path === redirect ? { ...to, replace: true } : { path: redirect, query } - next(nextData) - } else { - next() - } + // const redirectPath = from.query.redirect || to.path + // // 修复跳转时不带参数的问题 + // const redirect = decodeURIComponent(redirectPath as string) + // const { basePath, paramsObject: query } = parseURL(redirect) + // const nextData = + // to.path === redirect ? { ...to, replace: true } : { path: redirect, query } + // next(nextData) + // } else { + // next() + // } + next() }) export default router diff --git a/src/stores/permission.ts b/src/stores/permission.ts index d1bec1b..1861cca 100644 --- a/src/stores/permission.ts +++ b/src/stores/permission.ts @@ -13,7 +13,7 @@ export interface PermissionState { } export const usePermissionStore = defineStore('permission', () => { - const routers = ref([]) + const routers = ref([]) const addRouters = ref([]) const menuTabRouters = ref([]) @@ -25,11 +25,12 @@ export const usePermissionStore = defineStore('permission', () => { return new Promise(async resolve => { let res = [] - const roleRouters = getRoleRouters() - if (roleRouters.length > 0) { - res = roleRouters - } - const routerMap = generateRoute(res) + // const roleRouters = getRoleRouters() + // if (roleRouters.length > 0) { + // res = roleRouters + // } + // const routerMap = generateRoute(res) + const routerMap = generateRoute([]) addRouters.value = routerMap.concat([ { path: '/:path(.*)*',