Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/pages/admin-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,24 @@ import {
import dayjs from 'dayjs';
import { useEffect, useRef, useState } from 'react';
import { type Content, JSONEditor, type OnChange } from 'vanilla-jsoneditor';
import { quotas } from '@/constants/quotas';
import { adminApi } from '@/services/admin-api';

const { Title } = Typography;

const tierOptions = [
{ value: 'free', label: '免费版' },
{ value: 'standard', label: '标准版' },
{ value: 'premium', label: '高级版' },
{ value: 'pro', label: '专业版' },
{ value: 'vip1', label: '大客户VIP1版' },
{ value: 'vip2', label: '大客户VIP2版' },
{ value: 'vip3', label: '大客户VIP3版' },
{ value: 'custom', label: '定制版' },
];

const tierLabelMap = new Map(tierOptions.map((option) => [option.value, option.label]));

// JSON Editor wrapper component for quota editing
const JsonEditorWrapper = ({
value,
Expand Down Expand Up @@ -188,7 +202,8 @@ export const Component = () => {
title: '套餐',
dataIndex: 'tier',
key: 'tier',
width: 100,
width: 120,
render: (tier: string) => tierLabelMap.get(tier) || tier || '-',
},
{
title: '套餐过期时间',
Expand Down Expand Up @@ -278,13 +293,9 @@ export const Component = () => {
</Form.Item>
<Form.Item name="tier" label="套餐" className="mb-0!">
<Select
options={[
{ value: 'free', label: '免费版' },
{ value: 'standard', label: '标准版' },
{ value: 'premium', label: '高级版' },
{ value: 'pro', label: '专业版' },
{ value: 'custom', label: '定制版' },
]}
options={tierOptions}
optionFilterProp="label"
showSearch
/>
</Form.Item>
<Form.Item name="status" label="状态" className="mb-0!">
Expand Down