diff --git a/apps/web-ele/src/api/core/auth.ts b/apps/web-ele/src/api/core/auth.ts index e0dccaa..b75ab3b 100644 --- a/apps/web-ele/src/api/core/auth.ts +++ b/apps/web-ele/src/api/core/auth.ts @@ -16,15 +16,6 @@ export async function refreshTokenApi() { }); } -/** - * 退出登录 - */ -export async function logoutApi() { - return baseRequestClient.post('/auth/logout', { - withCredentials: true, - }); -} - /** * 获取用户权限码 */ diff --git a/apps/web-ele/src/api/core/cdcm.ts b/apps/web-ele/src/api/core/cdcm.ts index 46ebbd1..5f8ce5c 100644 --- a/apps/web-ele/src/api/core/cdcm.ts +++ b/apps/web-ele/src/api/core/cdcm.ts @@ -37,3 +37,10 @@ export async function loginApi(data: AuthApi.LoginParams) { responseReturn: 'data', }); } + +/** + * 退出登录 + */ +export async function logoutApi() { + return cdcmRequestClient.post('/auth/logout', {}); +} diff --git a/apps/web-ele/src/api/request.ts b/apps/web-ele/src/api/request.ts index faa398f..8dbca1e 100644 --- a/apps/web-ele/src/api/request.ts +++ b/apps/web-ele/src/api/request.ts @@ -64,7 +64,6 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) { client.addRequestInterceptor({ fulfilled: async (config) => { const accessStore = useAccessStore(); - config.headers.Authorization = formatToken(accessStore.accessToken); config.headers['Accept-Language'] = preferences.app.locale; return config; diff --git a/apps/web-ele/src/router/routes/modules/cdcm.ts b/apps/web-ele/src/router/routes/modules/cdcm.ts new file mode 100644 index 0000000..b196c91 --- /dev/null +++ b/apps/web-ele/src/router/routes/modules/cdcm.ts @@ -0,0 +1,96 @@ +import type { RouteRecordRaw } from 'vue-router'; + +const routes: RouteRecordRaw[] = [ + { + meta: { + badgeType: 'dot', + affixTab: true, + icon: 'lucide:layout-dashboard', + order: -1, + keepAlive: true, + title: '设备详细', + }, + name: 'detail', + path: '/detail', + component: () => import('#/views/detail/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 100, + keepAlive: true, + title: '网络配置', + }, + name: 'network', + path: '/network', + component: () => import('#/views/network/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 110, + keepAlive: true, + title: '数据模板', + }, + name: 'template', + path: '/template', + component: () => import('#/views/template/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 120, + keepAlive: true, + title: '采集驱动', + }, + name: 'driver', + path: '/driver', + component: () => import('#/views/driver/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 130, + keepAlive: true, + title: '实时数据', + }, + name: 'realtime', + path: '/realtime', + component: () => import('#/views/realtime/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 140, + keepAlive: true, + title: '上报管理', + }, + name: 'reporting', + path: '/reporting', + component: () => import('#/views/reporting/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 150, + keepAlive: true, + title: '逻辑编程', + }, + name: 'logic', + path: '/logic', + component: () => import('#/views/logic/index.vue'), + }, + { + meta: { + icon: 'lucide:layout-dashboard', + order: 160, + keepAlive: true, + title: '历史数据', + }, + name: 'history', + path: '/history', + component: () => import('#/views/history/index.vue'), + }, +]; + +export default routes; diff --git a/apps/web-ele/src/router/routes/modules/dashboard.ts b/apps/web-ele/src/router/routes/modules/dashboard.ts index 5254dc6..3706ab0 100644 --- a/apps/web-ele/src/router/routes/modules/dashboard.ts +++ b/apps/web-ele/src/router/routes/modules/dashboard.ts @@ -6,7 +6,7 @@ const routes: RouteRecordRaw[] = [ { meta: { icon: 'lucide:layout-dashboard', - order: -1, + order: 500, title: $t('page.dashboard.title'), }, name: 'Dashboard', @@ -17,7 +17,6 @@ const routes: RouteRecordRaw[] = [ path: '/analytics', component: () => import('#/views/dashboard/analytics/index.vue'), meta: { - affixTab: true, icon: 'lucide:area-chart', title: $t('page.dashboard.analytics'), }, diff --git a/apps/web-ele/src/store/auth.ts b/apps/web-ele/src/store/auth.ts index 5e0eb06..3f68c88 100644 --- a/apps/web-ele/src/store/auth.ts +++ b/apps/web-ele/src/store/auth.ts @@ -4,7 +4,6 @@ import { ref } from 'vue'; import { useRouter } from 'vue-router'; import { LOGIN_PATH } from '@vben/constants'; -import { preferences } from '@vben/preferences'; import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; import { ElNotification } from 'element-plus'; @@ -35,7 +34,8 @@ export const useAuthStore = defineStore('auth', () => { // // 异步处理用户登录操作并获取 accessToken const userInfo: UserInfo = {} as UserInfo; userInfo.realName = params.username; - userInfo.homePath = '/cdcm/details'; + userInfo.homePath = '/detail'; + // userInfo.roles = ['admin']; try { loginLoading.value = true; @@ -47,7 +47,7 @@ export const useAuthStore = defineStore('auth', () => { // // 如果成功获取到 accessToken // if (accessToken) { // // 将 accessToken 存储到 accessStore 中 - // accessStore.setAccessToken(accessToken); + accessStore.setAccessToken(params.username); // // 获取用户信息并存储到 accessStore 中 // const [fetchUserInfoResult, accessCodes] = await Promise.all([ @@ -64,7 +64,8 @@ export const useAuthStore = defineStore('auth', () => { onSuccess ? await onSuccess?.() : await router.push( - userInfo.homePath || preferences.app.defaultHomePath, + '/detail', + // userInfo.homePath || preferences.app.defaultHomePath, ); // } @@ -81,7 +82,7 @@ export const useAuthStore = defineStore('auth', () => { } return { - // userInfo, + userInfo, }; } diff --git a/apps/web-ele/src/views/detail/index.vue b/apps/web-ele/src/views/detail/index.vue new file mode 100644 index 0000000..6c69b92 --- /dev/null +++ b/apps/web-ele/src/views/detail/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/driver/index.vue b/apps/web-ele/src/views/driver/index.vue new file mode 100644 index 0000000..c50cf4e --- /dev/null +++ b/apps/web-ele/src/views/driver/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/history/index.vue b/apps/web-ele/src/views/history/index.vue new file mode 100644 index 0000000..d49d251 --- /dev/null +++ b/apps/web-ele/src/views/history/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/logic/index.vue b/apps/web-ele/src/views/logic/index.vue new file mode 100644 index 0000000..01e56e5 --- /dev/null +++ b/apps/web-ele/src/views/logic/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/network/index.vue b/apps/web-ele/src/views/network/index.vue new file mode 100644 index 0000000..1f21e11 --- /dev/null +++ b/apps/web-ele/src/views/network/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/realtime/index.vue b/apps/web-ele/src/views/realtime/index.vue new file mode 100644 index 0000000..0419725 --- /dev/null +++ b/apps/web-ele/src/views/realtime/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/reporting/index.vue b/apps/web-ele/src/views/reporting/index.vue new file mode 100644 index 0000000..d7b94f7 --- /dev/null +++ b/apps/web-ele/src/views/reporting/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/src/views/template/index.vue b/apps/web-ele/src/views/template/index.vue new file mode 100644 index 0000000..9f552b0 --- /dev/null +++ b/apps/web-ele/src/views/template/index.vue @@ -0,0 +1,3 @@ + diff --git a/apps/web-ele/vite.config.mts b/apps/web-ele/vite.config.mts index 1ee1a67..dc1b5ce 100644 --- a/apps/web-ele/vite.config.mts +++ b/apps/web-ele/vite.config.mts @@ -17,7 +17,8 @@ export default defineConfig(async () => { changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), // mock代理目标地址 - target: 'http://10.10.10.41:5566/api', + // target: 'http://10.10.10.41:5566/api', + target: 'http://api.shikicc.com:8900/api', ws: true, }, },