feat: 增加了页面

main
cc 2025-05-10 14:07:05 +08:00
parent f8ce2138d5
commit e9a5ba74d9
15 changed files with 136 additions and 18 deletions

View File

@ -16,15 +16,6 @@ export async function refreshTokenApi() {
});
}
/**
* 退
*/
export async function logoutApi() {
return baseRequestClient.post('/auth/logout', {
withCredentials: true,
});
}
/**
*
*/

View File

@ -37,3 +37,10 @@ export async function loginApi(data: AuthApi.LoginParams) {
responseReturn: 'data',
});
}
/**
* 退
*/
export async function logoutApi() {
return cdcmRequestClient.post('/auth/logout', {});
}

View File

@ -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;

View File

@ -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;

View File

@ -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'),
},

View File

@ -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,
};
}

View File

@ -0,0 +1,3 @@
<template>
<page> 设备详情 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 采集驱动 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 历史数据 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 逻辑编程 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 网络配置 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 实时数据 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 上报管理 </page>
</template>

View File

@ -0,0 +1,3 @@
<template>
<page> 数据模板 </page>
</template>

View File

@ -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,
},
},