chore: v1 悦码增加天梯校验
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
"@rushstack/eslint-patch": "^1.10.5",
|
||||
"@tsconfig/node20": "^20.1.4",
|
||||
"@types/node": "^20.17.17",
|
||||
"@types/postmate": "catalog:",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
||||
"@vue/eslint-config-typescript": "^13.0.0",
|
||||
@@ -43,6 +44,7 @@
|
||||
"eslint": "^9.20.1",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
"less": "^4.2.2",
|
||||
"postmate": "catalog:",
|
||||
"semantic-release": "^24.2.2",
|
||||
"typescript": "catalog:",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { createApp } from 'vue';
|
||||
import VueGridLayout from 'vue-grid-layout'; // 引入layout
|
||||
|
||||
import { baseAxios } from '@/utils/request';
|
||||
import { createPinia } from 'pinia';
|
||||
import Postmate from 'postmate';
|
||||
import {
|
||||
qiankunWindow,
|
||||
renderWithQiankun,
|
||||
@@ -12,6 +14,33 @@ import { createProjectRouter } from './router';
|
||||
|
||||
import './global.less';
|
||||
|
||||
// Postmate 握手协议
|
||||
const postmate = new Postmate.Model({
|
||||
sayHi: (data: any) => {
|
||||
console.log('sayHi', data);
|
||||
},
|
||||
});
|
||||
|
||||
// 数据模型
|
||||
const model = {
|
||||
name: '',
|
||||
applicationId: -1,
|
||||
projectId: -1,
|
||||
fileId: '',
|
||||
url: '',
|
||||
accessToken: '',
|
||||
};
|
||||
|
||||
await postmate.then((parent) => {
|
||||
parent.emit('some-event', 'y-code-renderer is ready');
|
||||
Object.assign(model, parent.model);
|
||||
localStorage.setItem('y-code-access-token', model.accessToken || '');
|
||||
baseAxios.interceptors.request.use((config) => {
|
||||
config.headers.Authorization = `Bearer ${model.accessToken}`;
|
||||
return config;
|
||||
});
|
||||
});
|
||||
|
||||
let app;
|
||||
function render(props: object = {}) {
|
||||
app = createApp(App);
|
||||
|
||||
@@ -111,4 +111,4 @@ const put = <T = any>(config?: RequestConfig) =>
|
||||
const del = <T = any>(config?: { url: string }) =>
|
||||
request<ResopnseType<T>>({ ...config, method: 'DELETE' });
|
||||
|
||||
export { del, get, post, put, request };
|
||||
export { baseAxios, del, get, post, put, request };
|
||||
|
||||
Reference in New Issue
Block a user