浏览代码

feta 增加拜访设置

Young 4 月之前
父节点
当前提交
e4db44f747
共有 5 个文件被更改,包括 146 次插入1 次删除
  1. 1 1
      config/proxy.ts
  2. 10 0
      config/routes.ts
  3. 2 0
      src/locales/zh-CN/menu.ts
  4. 59 0
      src/pages/Settings/Vest.tsx
  5. 74 0
      src/pages/Settings/Visit.tsx

+ 1 - 1
config/proxy.ts

@@ -5,7 +5,7 @@
 export default {
   dev: {
     '/apis/': {
-      target: 'https://sect.nosum.cn',
+      target: 'http://127.0.0.1:8010',
       changeOrigin: true,
     },
   },

+ 10 - 0
config/routes.ts

@@ -93,6 +93,16 @@ export default [
         name: 'sign',
         component: './Settings/Sign',
       },
+      {
+        path: '/settings/platform/vest',
+        name: 'vest',
+        component: './Settings/Vest',
+      },
+      {
+        path: '/settings/platform/visit',
+        name: 'visit',
+        component: './Settings/Visit',
+      },
     ],
   },
   {

+ 2 - 0
src/locales/zh-CN/menu.ts

@@ -14,6 +14,8 @@ export default {
 
   'menu.settings.platform': '平台设置',
   'menu.settings.platform.sign': '签到设置',
+  'menu.settings.platform.vest': '掉马甲设置',
+  'menu.settings.platform.visit': '拜访设置',
 
   'menu.peak': '峰管理',
   'menu.peak.peaks': '峰管理',

+ 59 - 0
src/pages/Settings/Vest.tsx

@@ -0,0 +1,59 @@
+import {ProForm, ProFormInstance, ProFormText} from '@ant-design/pro-components';
+import {message} from 'antd';
+import React, {useRef} from 'react';
+import {getConfigGetApi, postConfigSaveApi} from "@/services/swagger/configAdmin";
+
+
+type VestSettings = {
+  dropDelayTime: number;
+  dropCnt: number;
+};
+
+export default () => {
+  const formRef = useRef<ProFormInstance>();
+  return (
+    <ProForm
+      layout="horizontal"
+      title="签到设置"
+      formRef={formRef}
+      submitter={{}}
+      request={async () => {
+        const res = await getConfigGetApi({"code": "platform.vest.drop"})
+        if (res.success && res.data.content) {
+          const result: VestSettings = JSON.parse(res.data.content)
+          return result;
+        }
+
+        return {
+          dropDelayTime: 0,
+          dropCnt: 0,
+        }
+      }}
+      onFinish={async (values) => {
+        const result: VestSettings = {
+          dropDelayTime: parseInt(values.dropDelayTime),
+          dropCnt: parseInt(values.dropCnt),
+        };
+        console.log("value " + values);
+
+        const res = await postConfigSaveApi({
+          "type": "json",
+          "code": "platform.vest.drop",
+          "remark": "马甲掉落配置",
+          "content": JSON.stringify(result)
+        })
+
+        if (res.success) {
+          message.success('提交成功');
+        } else {
+          message.error(res.errorMessage)
+        }
+        return res.success;
+      }}
+    >
+
+      <ProFormText name="dropDelayTime" width="md" label={`间隔时间`} addonAfter={"分钟"}/>
+      <ProFormText name="dropCnt" width="md" label={`数量`}/>
+    </ProForm>
+  );
+};

+ 74 - 0
src/pages/Settings/Visit.tsx

@@ -0,0 +1,74 @@
+import {ProForm, ProFormInstance, ProFormSelect, ProFormText} from '@ant-design/pro-components';
+import {message} from 'antd';
+import React, {useRef} from 'react';
+import {getConfigGetApi, postConfigSaveApi} from "@/services/swagger/configAdmin";
+
+const options = [
+  {
+    value: 1,
+    label: '紫币',
+  },
+  {
+    value: 2,
+    label: '紫晶',
+  },
+]
+
+type VisitSettings = {
+  expendCnt: number;
+  expendType: number;
+  expendTime: number;
+};
+
+export default () => {
+  const formRef = useRef<ProFormInstance>();
+  return (
+    <ProForm
+      layout="horizontal"
+      title="拜访设置"
+      formRef={formRef}
+      submitter={{}}
+      request={async () => {
+        const res = await getConfigGetApi({"code": "platform.visit.expend"})
+        if (res.success && res.data.content) {
+          const result: VisitSettings = JSON.parse(res.data.content)
+          return result;
+        }
+
+        return {
+          expendCnt: 0,
+          expendTime: 0,
+        }
+      }}
+      onFinish={async (values) => {
+        const result: VisitSettings = {
+          expendCnt: parseInt(values.expendCnt),
+          expendType: parseInt(values.expendType),
+          expendTime: parseInt(values.expendTime),
+        };
+        console.log("value " + values);
+
+        const res = await postConfigSaveApi({
+          "type": "json",
+          "code": "platform.visit.expend",
+          "remark": "拜访消费设置",
+          "content": JSON.stringify(result)
+        })
+
+        if (res.success) {
+          message.success('提交成功');
+        } else {
+          message.error(res.errorMessage)
+        }
+        return res.success;
+      }}
+    >
+
+      <ProForm.Group key="expend">
+        <ProFormText name="expendCnt" width="md" label="消耗值"/>
+        <ProFormSelect name="expendType" options={options} initialValue='1' width="xs"/>
+      </ProForm.Group>
+      <ProFormText name="expendTime" width="md" label={`拜访时间`} addonAfter={"分钟"}/>
+    </ProForm>
+  );
+};