11import { AlipayCircleOutlined } from '@ant-design/icons' ;
22import type { MenuProps } from 'antd' ;
3- import { Button , Descriptions , Dropdown , Popover , Space , Spin } from 'antd' ;
3+ import {
4+ Button ,
5+ Descriptions ,
6+ Dropdown ,
7+ message ,
8+ Popover ,
9+ Space ,
10+ Spin ,
11+ } from 'antd' ;
412import { type ReactNode , useState } from 'react' ;
513import { api } from '@/services/api' ;
614import { useUserInfo } from '@/utils/hooks' ;
@@ -38,6 +46,9 @@ const PurchaseButton = ({
3846 className = "ml-6"
3947 icon = { < AlipayCircleOutlined /> }
4048 onClick = { async ( ) => {
49+ if ( tier === 'custom' ) {
50+ return message . error ( '定制版用户付费请联系客服' ) ;
51+ }
4152 setLoading ( true ) ;
4253 await purchase ( tier ) ;
4354 } }
@@ -122,8 +133,39 @@ function UserPanel() {
122133 </ div >
123134 ) ;
124135 }
125- const { name, email, tier } = user ;
126- const currentQuota = quotas [ tier as keyof typeof quotas ] ;
136+ const { name, email, tier, quota } = user ;
137+ const defaultQuota = quotas [ tier as keyof typeof quotas ] ;
138+ const currentQuota = quota || defaultQuota ;
139+
140+ const tierDisplay = currentQuota . title ;
141+ const quotaTableData = [
142+ { key : 'app' , item : '应用数量' , value : `${ currentQuota . app } 个` } ,
143+ {
144+ key : 'package' ,
145+ item : '每个应用原生包数量' ,
146+ value : `${ currentQuota . package } 个` ,
147+ } ,
148+ {
149+ key : 'packageSize' ,
150+ item : '单个原生包大小' ,
151+ value : currentQuota . packageSize ,
152+ } ,
153+ {
154+ key : 'bundle' ,
155+ item : '每个应用热更包数量' ,
156+ value : `${ currentQuota . bundle } 个` ,
157+ } ,
158+ {
159+ key : 'bundleSize' ,
160+ item : '单个热更包大小' ,
161+ value : currentQuota . bundleSize ,
162+ } ,
163+ {
164+ key : 'pv' ,
165+ item : '每日总查询次数' ,
166+ value : `${ currentQuota . pv . toLocaleString ( ) } 次` ,
167+ } ,
168+ ] ;
127169 return (
128170 < div className = "body" >
129171 < Descriptions
@@ -136,8 +178,10 @@ function UserPanel() {
136178 < Descriptions . Item label = "邮箱" > { email } </ Descriptions . Item >
137179 < Descriptions . Item label = "服务版本" >
138180 < Space >
139- { currentQuota . title }
140- < UpgradeDropdown currentQuota = { currentQuota } />
181+ { tierDisplay }
182+ { ! quota && defaultQuota && (
183+ < UpgradeDropdown currentQuota = { defaultQuota } />
184+ ) }
141185 </ Space >
142186 </ Descriptions . Item >
143187 < Descriptions . Item label = "服务有效期至" >
@@ -165,6 +209,17 @@ function UserPanel() {
165209 ) }
166210 </ Space >
167211 </ Descriptions . Item >
212+ < Descriptions . Item label = "额度详情" >
213+ { quotaTableData . map ( ( { key, item, value } ) => (
214+ < div key = { key } >
215+ { item } :{ value } < br />
216+ </ div >
217+ ) ) }
218+ < div className = "h-px my-4 w-md bg-gray-300" />
219+ < div className = "text-xm text-gray-500" >
220+ 如有定制需求(限高级版以上),请联系 QQ 客服 34731408
221+ </ div >
222+ </ Descriptions . Item >
168223 </ Descriptions >
169224 < br />
170225 < Button href = { PRICING_LINK } target = "_blank" >
0 commit comments