2026-06-22 13:48:12 +08:00
|
|
|
|
import { setJJBCommonAntdMessage } from "@cqsjjb/jjb-common-lib";
|
|
|
|
|
|
import { setup } from "@cqsjjb/jjb-dva-runtime";
|
|
|
|
|
|
import { message } from "antd";
|
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
|
import { getFileUrlFromServer } from "zy-react-library/utils";
|
|
|
|
|
|
import "dayjs/locale/zh-cn";
|
2026-07-01 15:21:13 +08:00
|
|
|
|
|
2026-06-22 13:48:12 +08:00
|
|
|
|
|
2026-06-30 15:59:15 +08:00
|
|
|
|
|
2026-06-22 13:48:12 +08:00
|
|
|
|
|
|
|
|
|
|
dayjs.locale("zh-cn");
|
|
|
|
|
|
setJJBCommonAntdMessage(message);
|
|
|
|
|
|
|
|
|
|
|
|
const app = setup();
|
2026-06-26 17:28:06 +08:00
|
|
|
|
|
|
|
|
|
|
// jjb.config contextInject.fileUrl 优先,避免启动时请求网关附件接口失败触发 dev overlay
|
|
|
|
|
|
if (process.env.app?.fileUrl) {
|
|
|
|
|
|
window.fileUrl = process.env.app.fileUrl;
|
|
|
|
|
|
}
|
|
|
|
|
|
getFileUrlFromServer().catch((err) => {
|
|
|
|
|
|
console.warn("[getFileUrlFromServer] failed:", err?.message || err);
|
|
|
|
|
|
});
|
2026-06-22 13:48:12 +08:00
|
|
|
|
// 非底座环境运行
|
|
|
|
|
|
if (!window.__POWERED_BY_QIANKUN__) {
|
|
|
|
|
|
// 云组件默认依赖
|
|
|
|
|
|
window.__coreLib = {};
|
|
|
|
|
|
window.__coreLib.React = require("react");
|
|
|
|
|
|
window.__coreLib.ReactDOM = require("react-dom");
|
|
|
|
|
|
window.__coreLib.jjbCommonLib = require("@cqsjjb/jjb-common-lib");
|
2026-06-25 09:18:55 +08:00
|
|
|
|
|
|
|
|
|
|
// 本地开发时注入 Token,使 API 请求可携带认证信息
|
2026-07-03 16:17:39 +08:00
|
|
|
|
|
2026-06-22 13:48:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description 挂载
|
|
|
|
|
|
* @param props {{ setGlobalState: ({ rendered: boolean }) => void }}
|
|
|
|
|
|
* @returns {Promise<*>} ''
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const mount = async (props) => {
|
|
|
|
|
|
// 云组件默认依赖
|
|
|
|
|
|
window.__coreLib.React = require("react");
|
|
|
|
|
|
window.__coreLib.ReactDOM = require("react-dom");
|
|
|
|
|
|
window.__coreLib.jjbCommonLib = require("@cqsjjb/jjb-common-lib");
|
|
|
|
|
|
app.mount(props);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description 卸载
|
|
|
|
|
|
* @param props {object}
|
|
|
|
|
|
* @returns {Promise<*>} ''
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const unmount = async props => app.unmount(props);
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description 启动
|
|
|
|
|
|
* @param props
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const bootstrap = async props => app.bootstrap(props);
|