20241113-a

This commit is contained in:
unknown
2024-11-13 09:05:45 +08:00
commit 3bcaa20bc4
186 changed files with 100169 additions and 0 deletions

41
src/pages/Schema.tsx Normal file
View File

@@ -0,0 +1,41 @@
import React, { useEffect, useState } from 'react';
import { inject, observer } from 'mobx-react';
import { RouteComponentProps, useParams } from 'react-router-dom';
import { IMainStore } from '../stores/index';
import AMisRenderer from '../components/AMisRenderer';
import loadPageByPath from '../utils/loadPageByPath';
export default inject('store')(
observer(function ({
store,
}: { store: IMainStore } & RouteComponentProps<{
id: string;
}>) {
let { centre_id, id } = useParams<any>();
const [schema, setSchema] = useState({
type: 'page',
body: {
type: 'spinner',
},
});
useEffect(() => {
setSchema({
type: 'page',
body: {
type: 'spinner',
},
});
let nav: any = store.flat_navigations
.filter((x: any) => x.path !== null)
.find((x: any) => x.id.toString() === id);
let pagePath = nav ? nav.schema_path : '';
loadPageByPath(pagePath).then((page: any) => {
setSchema(page.schema);
});
}, [id]);
// TODO: schema中的api有时没自动加载
return <AMisRenderer schema={schema} centre_id={centre_id} />;
})
);