From 94cbeba495513458fe0d18015add8edcf906c897 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 15 Aug 2025 00:11:48 +0800 Subject: [PATCH] chore: comm trial --- .../src/components/vip-button/api.ts | 4 +-- .../src/components/vip-button/index.vue | 26 +++++++++++++------ .../src/locales/langs/en-US/vip.ts | 9 ++++--- .../src/locales/langs/zh-CN/vip.ts | 9 ++++--- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/packages/ui/certd-client/src/components/vip-button/api.ts b/packages/ui/certd-client/src/components/vip-button/api.ts index 200e38ac..151e8fa3 100644 --- a/packages/ui/certd-client/src/components/vip-button/api.ts +++ b/packages/ui/certd-client/src/components/vip-button/api.ts @@ -8,10 +8,10 @@ export async function doActive(form: any) { }); } -export async function getVipTrial() { +export async function getVipTrial(vipType:string) { return await request({ url: "/sys/plus/getVipTrial", method: "post", - data: {}, + data: {vipType}, }); } diff --git a/packages/ui/certd-client/src/components/vip-button/index.vue b/packages/ui/certd-client/src/components/vip-button/index.vue index 67a5533e..388a4715 100644 --- a/packages/ui/certd-client/src/components/vip-button/index.vue +++ b/packages/ui/certd-client/src/components/vip-button/index.vue @@ -165,34 +165,38 @@ function goAccount() { router.push("/sys/account"); } -async function getVipTrial() { - const res = await api.getVipTrial(); +async function getVipTrial(vipType = "plus") { + const res = await api.getVipTrial(vipType); message.success(t("vip.congratulations_vip_trial", { duration: res.duration })); await settingStore.init(); } -function openTrialModal() { +function openTrialModal(vipType = "plus") { Modal.destroyAll(); modal.confirm({ title: t("vip.trial_modal_title"), okText: t("vip.trial_modal_ok_text"), onOk() { - getVipTrial(); + getVipTrial(vipType); }, width: 600, content: () => { return (
{t("vip.trial_modal_thanks")}
-
{t("vip.trial_modal_click_confirm")}
+
{t("vip.trial_modal_click_confirm", { vipType })}
); }, }); } -function openStarModal() { +function openStarModal(vipType: string) { + if (settingStore.isPlus) { + message.error(t("vip.already_vip")); + return; + } Modal.destroyAll(); const goGithub = () => { window.open("https://github.com/certd/certd/"); @@ -203,7 +207,7 @@ function openStarModal() { okText: t("vip.star_now"), onOk() { goGithub(); - openTrialModal(); + openTrialModal(vipType); }, width: 600, content: () => { @@ -255,7 +259,7 @@ function openUpgrade() { trial: { title: t("vip.click_to_get_7_day_trial"), click: () => { - openStarModal(); + openStarModal("plus"); }, }, icon: "stash:thumb-up", @@ -281,6 +285,12 @@ function openUpgrade() { price: productInfo.comm.price, price3: `¥${productInfo.comm.price3}/3${t("vip.years")}`, tooltip: productInfo.comm.tooltip, + trial: { + title: t("vip.click_to_get_7_day_trial"), + click: () => { + openStarModal("comm"); + }, + }, get() { return ( diff --git a/packages/ui/certd-client/src/locales/langs/en-US/vip.ts b/packages/ui/certd-client/src/locales/langs/en-US/vip.ts index 642ca503..a445e415 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/vip.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/vip.ts @@ -32,13 +32,14 @@ export default { successContent: "You have successfully activated {vipLabel}, valid until: {expireDate}", bindAccountTitle: "Bind Your Account", bindAccountContent: "Binding your account helps prevent license loss. Strongly recommended.", - congratulations_vip_trial: "Congratulations, you have received a Pro version {duration} days trial", - trial_modal_title: "7-day Pro version trial acquisition", + congratulations_vip_trial: "Congratulations, you have received a VIP version {duration} days trial", + trial_modal_title: "7-day VIP version trial acquisition", trial_modal_ok_text: "Get now", trial_modal_thanks: "Thank you for supporting the open source project", - trial_modal_click_confirm: "Click confirm to get a 7-day Pro version trial", - get_7_day_pro_trial: "7-day professional version trial", + trial_modal_click_confirm: "Click confirm to get a 7-day VIP({vipType}) version trial", + get_7_day_pro_trial: "7-day VIP version trial", star_now: "Star Now", + already_vip: "Already VIP version, can't trial ", please_help_star: "Could you please help by starring? Thanks a lot!", admin_only_operation: "Admin operation only", enter_activation_code: "Please enter the activation code", diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/vip.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/vip.ts index 88956e34..c252b15f 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/vip.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/vip.ts @@ -32,13 +32,14 @@ export default { successContent: "您已成功激活{vipLabel},有效期至:{expireDate}", bindAccountTitle: "是否绑定袖手账号", bindAccountContent: "绑定账号后,可以避免License丢失,强烈建议绑定", - congratulations_vip_trial: "恭喜,您已获得专业版{duration}天试用", - trial_modal_title: "7天专业版试用获取", + congratulations_vip_trial: "恭喜,您已获得VIP{duration}天试用", + trial_modal_title: "7天VIP试用获取", trial_modal_ok_text: "立即获取", trial_modal_thanks: "感谢您对开源项目的支持", - trial_modal_click_confirm: "点击确认,即可获取7天专业版试用", - get_7_day_pro_trial: "7天专业版试用获取", + trial_modal_click_confirm: "点击确认,即可获取7天VIP({vipType})试用", + get_7_day_pro_trial: "7天VIP试用获取", star_now: "立即去Star", + already_vip: "您已经是VIP了,不能试用", please_help_star: "可以先请您帮忙点个star吗?感谢感谢", admin_only_operation: "仅限管理员操作", enter_activation_code: "请输入激活码",