test: 无界降级测试加载渲染器

This commit is contained in:
wangxuefeng 2025-03-17 20:25:45 +08:00
parent 8e208e7468
commit 3861919c4f
13 changed files with 54 additions and 67 deletions

View File

@ -10,6 +10,6 @@ VITE_PORT = 10011
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'

View File

@ -11,6 +11,6 @@ VITE_PORT = 10011
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'

View File

@ -10,6 +10,6 @@ VITE_BASE_API_URL = 'https://custom-chart-api.shiyuegame.com/'
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'

View File

@ -30,8 +30,8 @@ VITE_PORT=10010
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_V1_URL = 'https://localhost:10013/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'
VITE_V1_URL = 'https://localhost:10013'

View File

@ -11,7 +11,7 @@ VITE_DEBUG_MODE = true
VITE_PORT=10010
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_V1_URL = 'https://localhost:10013/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'
VITE_V1_URL = 'https://localhost:10013'

View File

@ -26,7 +26,7 @@ VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/'
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_V1_URL = 'https://localhost:10013/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'
VITE_V1_URL = 'https://localhost:10013'

View File

@ -2,8 +2,6 @@ import type { RouteRecordRaw } from 'vue-router';
import WujieVueRendererAdapter from '@sy/wujie-vue3-renderer-adapter';
import { VITE_RENDERER_URL } from '#/constants';
const routes: RouteRecordRaw[] = [
{
path: '/static-file',
@ -24,12 +22,15 @@ const routes: RouteRecordRaw[] = [
title: '静态文件列表',
},
props: {
// url: `${VITE_RENDERER_URL}/?fileId=7pfr394d6&projectId=4`,
url: `${VITE_RENDERER_URL}`,
accessToken: localStorage.getItem('y-code-access-token'),
url: `${VITE_RENDERER_URL}?fileId=7pfr394d6&projectId=4`,
// url: `${VITE_RENDERER_URL}`,
// accessToken: localStorage.getItem('y-code-access-token'),
fileId: '7pfr394d6',
projectId: '4',
name: 'y-code-renderer',
name: 'StaticFileList',
sync: true,
degrade: true,
// url: 'https://react.dev/',
},
},
],

View File

@ -10,6 +10,6 @@ VITE_DEBUG_MODE = true
VITE_PORT = 10012
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'

View File

@ -11,6 +11,6 @@ VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/'
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'

View File

@ -11,6 +11,6 @@ VITE_BASE_API_URL = 'https://custom-chart-api.shiyuegame.com/'
VITE_DEBUG_MODE = true
VITE_PLATFORM_URL = 'https://localhost:10010/'
VITE_DESIGNER_URL = 'https://localhost:10011/'
VITE_RENDERER_URL = 'https://localhost:10012/'
VITE_PLATFORM_URL = 'https://localhost:10010'
VITE_DESIGNER_URL = 'https://localhost:10011'
VITE_RENDERER_URL = 'https://localhost:10012'

View File

@ -9,9 +9,6 @@ import Postmate from 'postmate';
import { LowCodeService } from './service';
const test = window.$wujie?.props; // {data: xxx, methods: xxx}
console.log('test', test);
// sessionStorage
sessionStorage.clear();
@ -24,6 +21,7 @@ const accessToken = ref('');
const urlParams = ref(parseUrlParams());
const provider = ref(null);
// URL
function parseUrlParams() {
const urlParams = new URLSearchParams(window.location.search);
const params = {

View File

@ -130,7 +130,7 @@ onMounted(async () => {
<template>
<div style="padding: 20px">
<component :is="renderer" v-if="renderer" />
<component :is="renderer" v-if="renderer" :wujie-props="wujieProps" />
<div
v-else-if="!isLoading"
style="margin-top: 50px; color: red; text-align: center"

View File

@ -4,11 +4,14 @@ import { onBeforeUnmount, onMounted } from 'vue';
import WujieVue from 'wujie-vue3';
const props = defineProps<{
[key: string]: any;
accessToken?: string;
applicationId: number | string;
degrade?: boolean;
fileId: number | string;
name: string;
projectId: number | string;
sync: boolean;
url: string;
}>();
@ -16,14 +19,6 @@ console.log('props', props);
const { bus } = WujieVue;
//
const subAppProps = {
accessToken: props.accessToken,
applicationId: props.applicationId,
fileId: props.fileId,
projectId: props.projectId,
};
//
const beforeLoad = (appWindow: Window) => {
console.log(`${props.name} 开始加载`, appWindow);
@ -46,24 +41,17 @@ onBeforeUnmount(() => {
bus.$off('message', handleMessage);
});
</script>
<template>
<div class="low-code-adapter" style="width: 100%; height: 100%">
{{ url }}
{{ name }}
<WujieVue
:name="name"
:url="url"
width="100%"
height="100%"
:props="subAppProps"
/>
</div>
{{ props }}
<WujieVue
:name="name"
:url="url"
:sync="sync"
:degrade="degrade"
width="100%"
height="100%"
:props="props"
:before-load="beforeLoad"
:after-mount="afterMount"
/>
</template>
<style scoped>
.low-code-adapter {
width: 100%;
height: 100%;
}
</style>