|
@@ -1,12 +1,7 @@
|
|
-import {ProFormInstance, ProFormSelect} from '@ant-design/pro-components';
|
|
|
|
-import {
|
|
|
|
- ProForm,
|
|
|
|
- ProFormText,
|
|
|
|
-} from '@ant-design/pro-components';
|
|
|
|
|
|
+import {ProForm, ProFormInstance, ProFormSelect, ProFormText} from '@ant-design/pro-components';
|
|
import {message} from 'antd';
|
|
import {message} from 'antd';
|
|
import React, {useRef} from 'react';
|
|
import React, {useRef} from 'react';
|
|
-import {postConfigSaveApi} from "@/services/swagger/configAdmin";
|
|
|
|
-import {Button, Card, Modal} from 'antd';
|
|
|
|
|
|
+import {getConfigGetApi, postConfigSaveApi} from "@/services/swagger/configAdmin";
|
|
|
|
|
|
const options = [
|
|
const options = [
|
|
{
|
|
{
|
|
@@ -28,7 +23,6 @@ type SignSetting = {
|
|
export default () => {
|
|
export default () => {
|
|
const formRef = useRef<ProFormInstance>();
|
|
const formRef = useRef<ProFormInstance>();
|
|
const days = Array.from({length: 7}, (_, i) => i + 1);
|
|
const days = Array.from({length: 7}, (_, i) => i + 1);
|
|
- const [form] = ProForm.useForm();
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
<ProForm
|
|
<ProForm
|
|
@@ -36,6 +30,19 @@ export default () => {
|
|
title="签到设置"
|
|
title="签到设置"
|
|
formRef={formRef}
|
|
formRef={formRef}
|
|
submitter={{}}
|
|
submitter={{}}
|
|
|
|
+ request={async () => {
|
|
|
|
+ const res = await getConfigGetApi({"code": "platform.sign.award"})
|
|
|
|
+ if (res.success && res.data.content) {
|
|
|
|
+ const result: SignSetting[] = JSON.parse(res.data.content)
|
|
|
|
+ return result.reduce((acc: any, item: SignSetting) => {
|
|
|
|
+ acc[`day${item.dayCnt}AwardCnt`] = item.awardCnt;
|
|
|
|
+ acc[`day${item.dayCnt}AwardType`] = item.awardType.toString();
|
|
|
|
+ return acc;
|
|
|
|
+ }, {});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Promise.resolve({});
|
|
|
|
+ }}
|
|
onFinish={async (values) => {
|
|
onFinish={async (values) => {
|
|
const result: SignSetting[] = days.map(day => ({
|
|
const result: SignSetting[] = days.map(day => ({
|
|
dayCnt: day,
|
|
dayCnt: day,
|