feat(client): improve system settings module
This commit is contained in:
parent
730a5e5735
commit
8d4a519e4a
@ -16,7 +16,6 @@ export const useCollectionField = () => {
|
|||||||
}
|
}
|
||||||
const resourceName = `${ctx?.collectionName || collection?.name}.${ctx.name}`;
|
const resourceName = `${ctx?.collectionName || collection?.name}.${ctx.name}`;
|
||||||
const resource = api?.resource(resourceName, record[ctx.sourceKey]);
|
const resource = api?.resource(resourceName, record[ctx.sourceKey]);
|
||||||
debugger;
|
|
||||||
return {
|
return {
|
||||||
...ctx,
|
...ctx,
|
||||||
uiSchema: compile(ctx.uiSchema),
|
uiSchema: compile(ctx.uiSchema),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { css } from '@emotion/css';
|
||||||
import { Layout } from 'antd';
|
import { Layout } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import { useHistory, useRouteMatch } from 'react-router-dom';
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
||||||
@ -34,7 +35,16 @@ const InternalAdminLayout = (props: any) => {
|
|||||||
<Layout>
|
<Layout>
|
||||||
<Layout.Header style={{ height: 46, lineHeight: '46px', position: 'relative', paddingLeft: 0 }}>
|
<Layout.Header style={{ height: 46, lineHeight: '46px', position: 'relative', paddingLeft: 0 }}>
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex' }}>
|
||||||
<div style={{ display: 'inline-flex', color: '#fff', padding: '0 24px' }}>{result?.data?.data?.title}</div>
|
<div style={{ width: 200, display: 'inline-flex', color: '#fff', padding: '0', alignItems: 'center' }}>
|
||||||
|
<img
|
||||||
|
className={css`
|
||||||
|
height: 20px;
|
||||||
|
padding: 0 16px;
|
||||||
|
`}
|
||||||
|
src={result?.data?.data?.logo?.url}
|
||||||
|
/>
|
||||||
|
{/* {result?.data?.data?.title} */}
|
||||||
|
</div>
|
||||||
<RemoteSchemaComponent
|
<RemoteSchemaComponent
|
||||||
hidden={hidden}
|
hidden={hidden}
|
||||||
uid={route.uiSchemaUid}
|
uid={route.uiSchemaUid}
|
||||||
|
@ -65,7 +65,6 @@ export const FilterAction = observer((props: any) => {
|
|||||||
onSubmit={() => {
|
onSubmit={() => {
|
||||||
const { filter } = form.values;
|
const { filter } = form.values;
|
||||||
console.log('Table.Filter====', form.values);
|
console.log('Table.Filter====', form.values);
|
||||||
debugger;
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -11,7 +11,7 @@ export const useSystemSettings = () => {
|
|||||||
|
|
||||||
export const SystemSettingsProvider: React.FC = (props) => {
|
export const SystemSettingsProvider: React.FC = (props) => {
|
||||||
const result = useRequest({
|
const result = useRequest({
|
||||||
url: 'systemSettings:get/1',
|
url: 'systemSettings:get/1?appends=logo',
|
||||||
});
|
});
|
||||||
if (result.loading) {
|
if (result.loading) {
|
||||||
return <Spin />;
|
return <Spin />;
|
||||||
|
@ -3,7 +3,7 @@ import { ISchema, useForm } from '@formily/react';
|
|||||||
import { uid } from '@formily/shared';
|
import { uid } from '@formily/shared';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useSystemSettings } from '.';
|
import { useSystemSettings } from '.';
|
||||||
import { PluginManager, useRequest } from '..';
|
import { PluginManager, useAPIClient, useRequest } from '..';
|
||||||
import { ActionContext, SchemaComponent, useActionContext } from '../schema-component';
|
import { ActionContext, SchemaComponent, useActionContext } from '../schema-component';
|
||||||
|
|
||||||
const useCloseAction = () => {
|
const useCloseAction = () => {
|
||||||
@ -16,7 +16,7 @@ const useCloseAction = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const useSystemSettingsValues = (props, options) => {
|
const useSystemSettingsValues = (options) => {
|
||||||
const result = useSystemSettings();
|
const result = useSystemSettings();
|
||||||
return useRequest(() => Promise.resolve(result.data), {
|
return useRequest(() => Promise.resolve(result.data), {
|
||||||
...options,
|
...options,
|
||||||
@ -27,6 +27,7 @@ const useSaveSystemSettingsValues = () => {
|
|||||||
const { setVisible } = useActionContext();
|
const { setVisible } = useActionContext();
|
||||||
const form = useForm();
|
const form = useForm();
|
||||||
const { mutate } = useSystemSettings();
|
const { mutate } = useSystemSettings();
|
||||||
|
const api = useAPIClient();
|
||||||
return {
|
return {
|
||||||
async run() {
|
async run() {
|
||||||
await form.submit();
|
await form.submit();
|
||||||
@ -34,6 +35,11 @@ const useSaveSystemSettingsValues = () => {
|
|||||||
mutate({
|
mutate({
|
||||||
data: form.values,
|
data: form.values,
|
||||||
});
|
});
|
||||||
|
await api.request({
|
||||||
|
url: 'systemSettings:update/1',
|
||||||
|
method: 'post',
|
||||||
|
data: form.values,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -63,6 +69,7 @@ const schema: ISchema = {
|
|||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Upload.Attachment',
|
'x-component': 'Upload.Attachment',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
|
'action': 'attachments:upload'
|
||||||
// accept: 'jpg,png'
|
// accept: 'jpg,png'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user