Преглед на файлове

feat 修改用户列表查询

Young преди 4 месеца
родител
ревизия
274cd15ed3
променени са 6 файла, в които са добавени 99 реда и са изтрити 21 реда
  1. 18 15
      config/routes.ts
  2. 9 6
      src/locales/zh-CN/menu.ts
  3. 72 0
      src/pages/Settings/Sign.tsx
  4. 0 0
      src/pages/System/Menu.tsx
  5. 0 0
      src/pages/System/Role.tsx
  6. 0 0
      src/pages/System/Staff.tsx

+ 18 - 15
config/routes.ts

@@ -84,33 +84,36 @@ export default [
     ],
   },
   {
-    path: '/settings',
-    name: 'settings',
+    path: '/settings/platform',
+    name: 'settings.platform',
     icon: 'crown',
     routes: [
       {
-        path: '/settings',
-        redirect: '/settings/members',
+        path: '/settings/platform/sign',
+        name: 'sign',
+        component: './Settings/Sign',
       },
+    ],
+  },
+  {
+    path: '/system',
+    name: 'system',
+    icon: 'crown',
+    routes: [
       {
-        path: '/settings/staff',
+        path: '/system/staff',
         name: 'staff',
-        component: './Settings/Staff',
+        component: './System/Staff',
       },
       {
-        path: '/settings/role',
+        path: '/system/role',
         name: 'role',
-        component: './Settings/Role',
+        component: './System/Role',
       },
       {
-        path: '/settings/menu',
+        path: '/system/menu',
         name: 'menu',
-        component: './Settings/Menu',
-      },
-      {
-        path: '/settings/settings',
-        name: 'settings',
-        component: './Settings/Settings',
+        component: './System/Menu',
       },
     ],
   },

+ 9 - 6
src/locales/zh-CN/menu.ts

@@ -5,12 +5,15 @@ export default {
   'menu.content': '内容管理',
   'menu.content.headlines': '头条管理',
 
-  'menu.settings': '系统设置',
-  'menu.settings.users': '用户管理',
-  'menu.settings.settings': '字典设置',
-  'menu.settings.staff': '管理员管理',
-  'menu.settings.role': '角色管理',
-  'menu.settings.menu': '菜单管理',
+  'menu.system': '系统管理',
+  'menu.system.users': '用户管理',
+  'menu.system.settings': '字典设置',
+  'menu.system.staff': '管理员管理',
+  'menu.system.role': '角色管理',
+  'menu.system.menu': '菜单管理',
+
+  'menu.settings.platform': '平台设置',
+  'menu.settings.platform.sign': '签到设置',
 
   'menu.peak': '峰管理',
   'menu.peak.peaks': '峰管理',

+ 72 - 0
src/pages/Settings/Sign.tsx

@@ -0,0 +1,72 @@
+import {ProFormInstance, ProFormSelect} from '@ant-design/pro-components';
+import {
+  ProForm,
+  ProFormText,
+} from '@ant-design/pro-components';
+import {message} from 'antd';
+import React, {useRef} from 'react';
+import {postConfigSaveApi} from "@/services/swagger/configAdmin";
+import {Button, Card, Modal} from 'antd';
+
+const options = [
+  {
+    value: '1',
+    label: '紫币',
+  },
+  {
+    value: '2',
+    label: '紫晶',
+  },
+]
+
+type SignSetting = {
+  dayCnt: number;
+  awardCnt: number;
+  awardType: number;
+};
+
+export default () => {
+  const formRef = useRef<ProFormInstance>();
+  const days = Array.from({length: 7}, (_, i) => i + 1);
+  const [form] = ProForm.useForm();
+
+  return (
+    <ProForm
+      layout="horizontal"
+      title="签到设置"
+      formRef={formRef}
+      submitter={{}}
+      onFinish={async (values) => {
+        const result: SignSetting[] = days.map(day => ({
+          dayCnt: day,
+          awardCnt: values[`day${day}AwardCnt`],
+          awardType: values[`day${day}AwardType`],
+        }));
+        console.log("value " + values);
+        console.log("result " + result);
+
+        const res = await postConfigSaveApi({
+          "type": "json",
+          "code": "platform.sign.award",
+          "remark": "签到奖励配置",
+          "content": JSON.stringify(result)
+        })
+
+        if (res.success) {
+          message.success('提交成功');
+        } else {
+          message.error(res.errorMessage)
+        }
+        return res.success;
+      }}
+    >
+
+      {days.map(day => (
+        <ProForm.Group key={day}>
+          <ProFormText name={`day${day}AwardCnt`} width="md" label={`第${day}天`}/>
+          <ProFormSelect name={`day${day}AwardType`} options={options} initialValue="1" width="xs"/>
+        </ProForm.Group>
+      ))}
+    </ProForm>
+  );
+};

src/pages/Settings/Menu.tsx → src/pages/System/Menu.tsx


src/pages/Settings/Role.tsx → src/pages/System/Role.tsx


src/pages/Settings/Staff.tsx → src/pages/System/Staff.tsx