Skip to content

Commit 4ad20ea

Browse files
authored
fix: add vip123 options to admin user management (#18)
* fix: unify admin user tier options * fix: add vip tiers to admin user management
1 parent 0e256d1 commit 4ad20ea

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

src/pages/admin-users.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,24 @@ import {
1717
import dayjs from 'dayjs';
1818
import { useEffect, useRef, useState } from 'react';
1919
import { type Content, JSONEditor, type OnChange } from 'vanilla-jsoneditor';
20+
import { quotas } from '@/constants/quotas';
2021
import { adminApi } from '@/services/admin-api';
2122

2223
const { Title } = Typography;
2324

25+
const tierOptions = [
26+
{ value: 'free', label: '免费版' },
27+
{ value: 'standard', label: '标准版' },
28+
{ value: 'premium', label: '高级版' },
29+
{ value: 'pro', label: '专业版' },
30+
{ value: 'vip1', label: '大客户VIP1版' },
31+
{ value: 'vip2', label: '大客户VIP2版' },
32+
{ value: 'vip3', label: '大客户VIP3版' },
33+
{ value: 'custom', label: '定制版' },
34+
];
35+
36+
const tierLabelMap = new Map(tierOptions.map((option) => [option.value, option.label]));
37+
2438
// JSON Editor wrapper component for quota editing
2539
const JsonEditorWrapper = ({
2640
value,
@@ -188,7 +202,8 @@ export const Component = () => {
188202
title: '套餐',
189203
dataIndex: 'tier',
190204
key: 'tier',
191-
width: 100,
205+
width: 120,
206+
render: (tier: string) => tierLabelMap.get(tier) || tier || '-',
192207
},
193208
{
194209
title: '套餐过期时间',
@@ -278,13 +293,9 @@ export const Component = () => {
278293
</Form.Item>
279294
<Form.Item name="tier" label="套餐" className="mb-0!">
280295
<Select
281-
options={[
282-
{ value: 'free', label: '免费版' },
283-
{ value: 'standard', label: '标准版' },
284-
{ value: 'premium', label: '高级版' },
285-
{ value: 'pro', label: '专业版' },
286-
{ value: 'custom', label: '定制版' },
287-
]}
296+
options={tierOptions}
297+
optionFilterProp="label"
298+
showSearch
288299
/>
289300
</Form.Item>
290301
<Form.Item name="status" label="状态" className="mb-0!">

0 commit comments

Comments
 (0)