fix(license): 试用态隐藏「退出授权」——试用不是授权,点了必报'当前未激活'
CI / Backend (go vet + test) (push) Waiting to run
CI / Frontend (lint + build + test) (push) Waiting to run

canDeactivate 改为:有正式授权(plan=pro 且非 trial)且 admin 才显示;
试用态(库内无码)显示试用提示条而非退出按钮(实测复现:试用态点击退出
toast 报'当前未激活授权',按钮又因 pro=true 未消失,看似'点击没反应')
This commit is contained in:
opsx committed 2026-11-01 05:59:18 +08:00
1 parent 9a477e9c9b
commit 897899305f
1 file changed
+3 -1
@@ -19,7 +19,9 @@ export const LicenseSection = memo(function LicenseSection() {
const { t } = useTranslation('license')
const { pro, info, reload } = useLicense()
const isAdmin = getUser()?.role === 'admin'
const canDeactivate = Boolean(pro) && isAdmin
// 退出授权只对已激活的正式授权有意义;试用态(库内无码)点了必然报"未激活",隐藏按钮
const hasFormalLicense = Boolean(info && info.plan === 'pro' && !info.trial?.active)
const canDeactivate = hasFormalLicense && isAdmin
const [key, setKey] = useState('')
const [activating, setActivating] = useState(false)
const [confirmOpen, setConfirmOpen] = useState(false)