import { ImportCore } from "@cqsjjb/jjb-common-decorator/module"; import { theme as antdTheme, App, ConfigProvider } from "antd"; import language from "antd/locale/zh_CN"; import React from "react"; import { InjectContext } from "~/enumerate/context"; export default class Container extends React.Component { state = window?.base?.themeConfig || { algorithm: window.process.env.app.antd.algorithm, borderRadius: window.process.env.app.antd.borderRadius, colorPrimary: window.process.env.app.antd.colorPrimary, }; get token() { const { colorPrimary, borderRadius, } = this.state; return { fontFamily: window.process.env.app.antd.fontFamily, colorPrimary, borderRadius, }; } get algorithm() { return antdTheme[this.state.algorithm]; } componentDidMount() { if (window.__IN_BASE__) { // eslint-disable-next-line react-web-api/no-leaked-event-listener window.base.addEventListener("EVENT_THEME_CONTROL", (e) => { const config = e.data; this.setState({ [config.field]: config.value }); }); } } render() { return ( ); } } function AppMiddle(props) { return ( {process.env.NODE_ENV === "development" ? props.children : ( {props.children} )} ); } class Interceptor extends React.Component { state = { Component: undefined, }; componentDidMount() { if (process.env.app.appKey) { ImportCore({ name: "$", from: "https://cdn.cqjjb.cn/jcloud/use/plugin/b31c9840a57f11ef91cf7f3cabbb7484/latest", }).then(async (res) => { if (res.status) { this.setState({ Component: res.module?.PageCover }); } }); } } render() { const { Component } = this.state; return (Component && process.env.app.appKey && process.env.NODE_ENV === "development") ? ( {this.props.children} ) : this.props.children; } }