feat: 完善企业试用用户欢迎弹窗逻辑
- 添加试用到期时间检查 - 仅在试用未过期且有到期时间时显示欢迎弹窗 - 试用过期或无到期时间则显示邀请码弹窗 - 修复窗口重载后弹窗标记丢失问题
This commit is contained in:
@ -539,25 +539,30 @@ export async function showICHelperPanel(
|
|||||||
// 检查是否需要显示欢迎弹窗
|
// 检查是否需要显示欢迎弹窗
|
||||||
{
|
{
|
||||||
console.log("[ICHelperPanel] 收到 checkWelcomeModal 消息");
|
console.log("[ICHelperPanel] 收到 checkWelcomeModal 消息");
|
||||||
const showWelcome = context.globalState.get("showWelcomeModal");
|
const userInfo = getCachedUserInfo();
|
||||||
console.log(
|
const hasWelcomed = context.globalState.get("pluginTrialWelcomed");
|
||||||
"[ICHelperPanel] showWelcomeModal 标记值:",
|
|
||||||
showWelcome,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (showWelcome) {
|
console.log("[ICHelperPanel] 用户信息:", userInfo);
|
||||||
// 清除标记并显示欢迎弹窗
|
console.log("[ICHelperPanel] isPluginTrial:", userInfo?.isPluginTrial);
|
||||||
await context.globalState.update("showWelcomeModal", undefined);
|
console.log("[ICHelperPanel] pluginTrialExpiresAt:", userInfo?.pluginTrialExpiresAt);
|
||||||
console.log(
|
console.log("[ICHelperPanel] hasWelcomed:", hasWelcomed);
|
||||||
"[ICHelperPanel] ✅ 发送 showWelcomeModal 命令到前端",
|
|
||||||
);
|
if (userInfo?.isPluginTrial === true && userInfo.pluginTrialExpiresAt !== null && userInfo.pluginTrialExpiresAt !== undefined) {
|
||||||
panel.webview.postMessage({
|
const now = Date.now();
|
||||||
command: "showWelcomeModal",
|
const isExpired = now >= userInfo.pluginTrialExpiresAt;
|
||||||
});
|
console.log("[ICHelperPanel] 是否过期:", isExpired);
|
||||||
|
|
||||||
|
if (!isExpired && !hasWelcomed) {
|
||||||
|
await context.globalState.update("pluginTrialWelcomed", true);
|
||||||
|
console.log("[ICHelperPanel] ✅ 发送 showWelcomeModal 命令到前端");
|
||||||
|
panel.webview.postMessage({
|
||||||
|
command: "showWelcomeModal",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("[ICHelperPanel] 已过期或已显示过欢迎弹窗");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log("[ICHelperPanel] 非试用用户或无过期时间");
|
||||||
"[ICHelperPanel] showWelcomeModal 标记为 false,不显示弹窗",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user