|
@@ -1,22 +1,19 @@
|
|
-import {ActionType, PageContainer, ProForm, ProFormSelect, ProFormText, ProTable,} from '@ant-design/pro-components';
|
|
|
|
|
|
+import {ActionType, PageContainer, ProForm, ProFormText, ProTable,} from '@ant-design/pro-components';
|
|
import {Button, Card, Modal} from 'antd';
|
|
import {Button, Card, Modal} from 'antd';
|
|
import React, {useRef} from 'react';
|
|
import React, {useRef} from 'react';
|
|
import {AddOutline} from 'antd-mobile-icons';
|
|
import {AddOutline} from 'antd-mobile-icons';
|
|
import {EditBundle, useEdit} from '@/core/hooks/useEdit';
|
|
import {EditBundle, useEdit} from '@/core/hooks/useEdit';
|
|
-import { deleteUserRemoveApi, getUserDetailsApi, postUserPageApi, postUserSaveApi } from '@/services/swagger/userAdmin';
|
|
|
|
-import {getPeakListApi} from "@/services/swagger/peakAdmin";
|
|
|
|
-import {getUserLevelListApi} from "@/services/swagger/userLevelAdmin";
|
|
|
|
-import {getFactionLevelListApi} from "@/services/swagger/factionLevelAdmin";
|
|
|
|
|
|
+import { deleteFactionLevelRemoveApi, getFactionLevelDetailsApi, postFactionLevelSaveApi,getFactionLevelListApi } from '@/services/swagger/factionLevelAdmin';
|
|
|
|
|
|
const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) => {
|
|
const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) => {
|
|
const {bundle} = props;
|
|
const {bundle} = props;
|
|
- const [form] = ProForm.useForm<SectApi.UserSaveQuery>();
|
|
|
|
|
|
+ const [form] = ProForm.useForm<SectApi.UserLevelSaveQuery>();
|
|
const [loading, setLoading] = React.useState(false);
|
|
const [loading, setLoading] = React.useState(false);
|
|
|
|
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
confirmLoading={loading}
|
|
confirmLoading={loading}
|
|
- title={bundle.id ? '编辑用户' : '添加用户'}
|
|
|
|
|
|
+ title={bundle.id ? '编辑宗门等级' : '添加宗门等级'}
|
|
open={bundle.open}
|
|
open={bundle.open}
|
|
onOk={async () => {
|
|
onOk={async () => {
|
|
await form.validateFields();
|
|
await form.validateFields();
|
|
@@ -24,7 +21,7 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
|
|
try {
|
|
try {
|
|
setLoading(true);
|
|
setLoading(true);
|
|
|
|
|
|
- await postUserSaveApi({
|
|
|
|
|
|
+ await postFactionLevelSaveApi({
|
|
id: bundle.id,
|
|
id: bundle.id,
|
|
...form.getFieldsValue()
|
|
...form.getFieldsValue()
|
|
});
|
|
});
|
|
@@ -49,7 +46,7 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
|
|
request={async () => {
|
|
request={async () => {
|
|
if (bundle.id !== undefined) {
|
|
if (bundle.id !== undefined) {
|
|
console.log(bundle.id, 'bundle');
|
|
console.log(bundle.id, 'bundle');
|
|
- const res = await getUserDetailsApi({id: bundle.id});
|
|
|
|
|
|
+ const res = await getFactionLevelDetailsApi({id: bundle.id});
|
|
|
|
|
|
return {
|
|
return {
|
|
...res.data
|
|
...res.data
|
|
@@ -59,158 +56,48 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
|
|
return Promise.resolve({});
|
|
return Promise.resolve({});
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <ProFormText name="name" label={'用户名称'} rules={[{required: true, message: '请输入用户名称',}]} placeholder={'请输入用户名'}></ProFormText>
|
|
|
|
- <ProFormText name="mobile" label={'手机号'} rules={[{required: true, message: '请输入手机号',}]} placeholder={'请输入手机号'}></ProFormText>
|
|
|
|
- <ProFormText name="nickname" label={'昵称'} rules={[{required: true, message: '请输入昵称',}]} placeholder={'请输入昵称'}></ProFormText>
|
|
|
|
- <ProFormText name="purpleCoin" label={'紫币'} rules={[{required: true, message: '请输入紫币',}]} placeholder={'请输入紫币'}></ProFormText>
|
|
|
|
- <ProFormText name="purpleSpar" label={'紫晶'} rules={[{required: true, message: '请输入紫晶',}]} placeholder={'请输入紫晶'}></ProFormText>
|
|
|
|
-
|
|
|
|
- <ProFormSelect
|
|
|
|
- fieldProps={{
|
|
|
|
- 'mode': 'multiple',
|
|
|
|
- }}
|
|
|
|
- name="peakId"
|
|
|
|
- label="所属峰"
|
|
|
|
- request={async () => {
|
|
|
|
- const res = await getPeakListApi();
|
|
|
|
- const records = res.data ?? []
|
|
|
|
- return records.map(record => ({
|
|
|
|
- label: record.name,
|
|
|
|
- value: record.id,
|
|
|
|
- }))
|
|
|
|
- }}
|
|
|
|
- placeholder="请选择所属峰"
|
|
|
|
- rules={[{required: true, message: '请选择所属峰'}]}
|
|
|
|
- />
|
|
|
|
- <ProFormSelect
|
|
|
|
- fieldProps={{
|
|
|
|
- 'mode': 'multiple',
|
|
|
|
- }}
|
|
|
|
- name="userLevel"
|
|
|
|
- label="会员等级"
|
|
|
|
- request={async () => {
|
|
|
|
- const res = await getUserLevelListApi();
|
|
|
|
- const records = res.data ?? []
|
|
|
|
- return records.map(record => ({
|
|
|
|
- label: record.name,
|
|
|
|
- value: record.id,
|
|
|
|
- }))
|
|
|
|
- }}
|
|
|
|
- placeholder="请选择会员等级"
|
|
|
|
- rules={[{required: true, message: '请选择会员等级'}]}
|
|
|
|
- />
|
|
|
|
- <ProFormSelect
|
|
|
|
- fieldProps={{
|
|
|
|
- 'mode': 'multiple',
|
|
|
|
- }}
|
|
|
|
- name="factionLevel"
|
|
|
|
- label="宗门等级"
|
|
|
|
- request={async () => {
|
|
|
|
- const res = await getFactionLevelListApi();
|
|
|
|
- const records = res.data ?? []
|
|
|
|
- return records.map(record => ({
|
|
|
|
- label: record.name,
|
|
|
|
- value: record.id,
|
|
|
|
- }))
|
|
|
|
- }}
|
|
|
|
- placeholder="请选择宗门等级"
|
|
|
|
- rules={[{required: true, message: '请选择宗门等级'}]}
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
- <ProFormText.Password
|
|
|
|
- name="password"
|
|
|
|
- label="密码"
|
|
|
|
- placeholder={'请输入密码'}
|
|
|
|
- rules={[
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: '请输入密码',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- min: 6,
|
|
|
|
- max: 50,
|
|
|
|
- message: '密码长度必须在6-50之间',
|
|
|
|
- },
|
|
|
|
- ]}
|
|
|
|
- />
|
|
|
|
|
|
+ <ProFormText name="level" label={'等级'} rules={[{required: true, message: '请输入等级',}]} placeholder={'请输入等级'}></ProFormText>
|
|
|
|
+ <ProFormText name="name" label={'名称'} rules={[{required: true, message: '请输入名称',}]} placeholder={'请输入名称'}></ProFormText>
|
|
</ProForm>
|
|
</ProForm>
|
|
</Modal>
|
|
</Modal>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|
|
-const Staff: React.FC = () => {
|
|
|
|
|
|
+const FactionLevel: React.FC = () => {
|
|
const bundle = useEdit();
|
|
const bundle = useEdit();
|
|
const ref = useRef<ActionType>();
|
|
const ref = useRef<ActionType>();
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
<PageContainer content={''}>
|
|
<PageContainer content={''}>
|
|
{bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
|
|
{bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
|
|
<Card>
|
|
<Card>
|
|
- <ProTable<SectApi.StaffVO>
|
|
|
|
|
|
+ <ProTable<SectApi.UserLevelVO>
|
|
rowKey={'id'}
|
|
rowKey={'id'}
|
|
|
|
|
|
request={async (params, ...rest) => {
|
|
request={async (params, ...rest) => {
|
|
console.log(params, ...rest)
|
|
console.log(params, ...rest)
|
|
|
|
|
|
- const res = await postUserPageApi(
|
|
|
|
-
|
|
|
|
- {
|
|
|
|
- current: params.current || 1,
|
|
|
|
- size: params.pageSize || 10,
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
|
|
+ const res = await getFactionLevelListApi();
|
|
return {
|
|
return {
|
|
success: res.success,
|
|
success: res.success,
|
|
- total: res.data.total,
|
|
|
|
- data: res.data.records,
|
|
|
|
|
|
+ data: res.data,
|
|
};
|
|
};
|
|
}}
|
|
}}
|
|
columns={[
|
|
columns={[
|
|
{
|
|
{
|
|
- title: 'ID',
|
|
|
|
- dataIndex: 'id',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '所属峰',
|
|
|
|
- dataIndex: 'peakName',
|
|
|
|
|
|
+ title: '等级',
|
|
|
|
+ dataIndex: 'level',
|
|
|
|
+ render:(text)=>{
|
|
|
|
+ return text + '级'
|
|
|
|
+ }
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '名称',
|
|
title: '名称',
|
|
dataIndex: 'name',
|
|
dataIndex: 'name',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '手机号码',
|
|
|
|
- dataIndex: 'mobile',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '昵称',
|
|
|
|
- dataIndex: 'nickname',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '会员等级',
|
|
|
|
- dataIndex: 'userLevelName',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '宗门等级',
|
|
|
|
- dataIndex: 'factionLevelName',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '紫币',
|
|
|
|
- dataIndex: 'purpleCoin',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '紫晶',
|
|
|
|
- dataIndex: 'purpleSpar',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '状态',
|
|
|
|
- dataIndex: 'status',
|
|
|
|
- render: (text, _) => {
|
|
|
|
- return text === 1 ? "启用" : "禁用"
|
|
|
|
- }
|
|
|
|
|
|
+ title: '人数',
|
|
|
|
+ dataIndex: 'userCnt',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '操作',
|
|
title: '操作',
|
|
@@ -223,7 +110,7 @@ const Staff: React.FC = () => {
|
|
key={'delete'}
|
|
key={'delete'}
|
|
onClick={async () => {
|
|
onClick={async () => {
|
|
if(record.id) {
|
|
if(record.id) {
|
|
- await deleteUserRemoveApi({id: record.id})
|
|
|
|
|
|
+ await deleteFactionLevelRemoveApi({id: record.id})
|
|
ref.current?.reload();
|
|
ref.current?.reload();
|
|
}
|
|
}
|
|
}}
|
|
}}
|
|
@@ -234,9 +121,8 @@ const Staff: React.FC = () => {
|
|
},
|
|
},
|
|
]
|
|
]
|
|
}
|
|
}
|
|
- search={{
|
|
|
|
- labelWidth: 'auto',
|
|
|
|
- }}
|
|
|
|
|
|
+ pagination={false}
|
|
|
|
+ search={false}
|
|
form={{
|
|
form={{
|
|
ignoreRules: false,
|
|
ignoreRules: false,
|
|
}}
|
|
}}
|
|
@@ -258,4 +144,4 @@ const Staff: React.FC = () => {
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|
|
-export default Staff;
|
|
|
|
|
|
+export default FactionLevel;
|