test: 预发布加载路由异常测试

This commit is contained in:
wangxuefeng 2025-03-13 18:25:18 +08:00
parent 11591eefcf
commit 1c6ac05f16
4 changed files with 15 additions and 13 deletions

View File

@ -9,6 +9,7 @@ export type LowCodeFileSchema = {
file_path?: string; file_path?: string;
project_id: number; project_id: number;
publish: boolean; publish: boolean;
published_dsl: BlockSchema;
}; };
function transformFile(file: LowCodeFileSchema): LowCodeFileSchema { function transformFile(file: LowCodeFileSchema): LowCodeFileSchema {

View File

@ -13,8 +13,6 @@ instance.interceptors.request.use(
(config) => { (config) => {
// 可在此处添加统一请求头等配置 // 可在此处添加统一请求头等配置
const userStore = useUserStore(); const userStore = useUserStore();
console.log(localStorage.getItem('y-code-access-token'));
console.log(userStore.token);
config.headers.Authorization = `Bearer ${userStore.token}`; config.headers.Authorization = `Bearer ${userStore.token}`;
return config; return config;
}, },

View File

@ -6,7 +6,7 @@ import { ElConfigProvider } from 'element-plus';
import { elementLocale } from '#/locales'; import { elementLocale } from '#/locales';
import { useUserStore } from '#/store/user'; import { useUserStore } from '#/store/user';
defineOptions({ name: 'App' }); defineOptions({ name: 'YCode' });
useElementPlusDesignTokens(); useElementPlusDesignTokens();

View File

@ -33,6 +33,7 @@ const routes: Array<RouteRecordRaw> = [
}, },
component: () => { component: () => {
const userStore = useUserStore(); const userStore = useUserStore();
console.log(userStore.token);
return h(RendererAdapter, { return h(RendererAdapter, {
url: VITE_RENDERER_URL, url: VITE_RENDERER_URL,
name: 'y-code-platform-project-list', name: 'y-code-platform-project-list',
@ -44,8 +45,8 @@ const routes: Array<RouteRecordRaw> = [
}, },
}, },
{ {
path: 'file', path: 'DSLFileList',
name: `${moduleName}-file`, name: `${moduleName}-DSL-file-list`,
meta: { meta: {
title: 'dsl 文件列表', title: 'dsl 文件列表',
keepAlive: false, keepAlive: false,
@ -53,14 +54,16 @@ const routes: Array<RouteRecordRaw> = [
}, },
component: () => { component: () => {
const userStore = useUserStore(); const userStore = useUserStore();
return h(RendererAdapter, { return Promise.resolve(
url: VITE_RENDERER_URL, h(RendererAdapter, {
name: 'y-code-platform-project-file', url: VITE_RENDERER_URL,
applicationId: LOW_CODE_APPLICATION_ID, name: 'y-code-platform-project-DSL-file-list',
projectId: LOW_CODE_PROJECT_ID, applicationId: LOW_CODE_APPLICATION_ID,
fileId: '7pftwojzu', projectId: LOW_CODE_PROJECT_ID,
accessToken: userStore.token, fileId: '7pftwojzu',
}); accessToken: userStore.token,
}),
);
}, },
}, },
], ],