feat(desktop/renderer): surface re-authorize affordance for expired accounts
Replace the generic 重新校验 action with state-aware copy and an arrow icon when authState is expired, and route the click through the bind flow so users land directly on the platform login page. AiPlatformsView gains the same shortcut and an inline alert explaining tasks are paused until re-auth completes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,7 +95,15 @@ function authColor(account: AccountRow | null) {
|
||||
}
|
||||
|
||||
function accountActionAlert(account: AccountRow | null): string | null {
|
||||
if (!account || account.authState !== "challenge_required") {
|
||||
if (!account) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (account.authState === "expired") {
|
||||
return "当前账号授权已过期,相关任务会暂停执行。请点击“重新授权”完成登录后再继续。";
|
||||
}
|
||||
|
||||
if (account.authState !== "challenge_required") {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -111,6 +119,15 @@ function accountActionAlert(account: AccountRow | null): string | null {
|
||||
}
|
||||
|
||||
function verificationLabel(account: AccountRow): string {
|
||||
switch (account.authState) {
|
||||
case "expired":
|
||||
return "需要重新授权";
|
||||
case "revoked":
|
||||
return "已停用";
|
||||
case "challenge_required":
|
||||
return account.authReason === "risk_control" ? "触发风控,需处理" : "需要人工验证";
|
||||
}
|
||||
|
||||
if (account.lastVerifiedAt) {
|
||||
return formatVerifiedAtLabel(account.lastVerifiedAt);
|
||||
}
|
||||
@@ -141,6 +158,10 @@ function sessionLabel(account: AccountRow): string {
|
||||
}
|
||||
}
|
||||
|
||||
function isReauthorizePending(account: AccountRow): boolean {
|
||||
return bindPendingPlatformId.value === account.platform;
|
||||
}
|
||||
|
||||
function onlineLabel(account: AccountRow): string {
|
||||
return account.online ? "客户端在线" : "客户端离线";
|
||||
}
|
||||
@@ -307,6 +328,16 @@ async function unbindPlatform(account: AccountRow) {
|
||||
<a-badge :status="platform.account.online ? 'success' : 'default'" :text="onlineLabel(platform.account)" />
|
||||
</div>
|
||||
<div class="action-group">
|
||||
<a-tooltip v-if="platform.account.authState === 'expired'" title="重新授权" placement="top">
|
||||
<a-button
|
||||
type="text"
|
||||
class="action-btn"
|
||||
:loading="isReauthorizePending(platform.account)"
|
||||
@click="bindPlatform(platform.id)"
|
||||
>
|
||||
<template #icon><ArrowRightOutlined /></template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="打开平台" placement="top">
|
||||
<a-button
|
||||
type="text"
|
||||
|
||||
Reference in New Issue
Block a user