企业微信
This commit is contained in:
1 parent
46ac70f4c5
commit
a9fc852abb
33 files changed
+4875
-106
No files matched your search
@@ -5,7 +5,10 @@ export const config = {
|
||||
enabled: true,
|
||||
authorizeApi: '/api/user/wecom/authorize-url',
|
||||
loginApi: '/api/user/wecom/login',
|
||||
callbackPath: '/workspace'
|
||||
completeBindApi: '/api/user/wecom/complete-bind',
|
||||
callbackPath: '/workspace',
|
||||
deeplinkTraceApi: '/api/user/wecom/deeplink-opened',
|
||||
taskCompleteApi: '/api/user/wecom/task-complete'
|
||||
}
|
||||
},
|
||||
workspace: {
|
||||
|
||||
+694
-16
@@ -43,7 +43,71 @@ const messages = {
|
||||
wecomStateExpired: 'WeCom login session expired, please try again.',
|
||||
wecomBindRequired: 'Current WeCom account is not bound to a local user, please contact admin.',
|
||||
wecomAccountDisabled: 'Account is disabled, please contact admin.',
|
||||
wecomLoginFailed: 'WeCom login failed'
|
||||
wecomLoginFailed: 'WeCom login failed',
|
||||
wecomMatchAmbiguous: 'Multiple local users matched this WeCom account. Please contact admin.',
|
||||
wecomMatchAttrMissing: 'Required account attributes are missing in WeCom. Please contact admin.',
|
||||
wecomRetry: 'Retry WeCom Login',
|
||||
wecomTechnicalInfo: 'Technical info: {detail}',
|
||||
wecomBindPromptTitle: 'Verify and bind your local account',
|
||||
wecomBindPromptDesc: 'This is your first WeCom login for {name}. Enter one allowed field below to bind your local account.',
|
||||
wecomBindField: 'Verification field',
|
||||
wecomBindValue: 'Verification value',
|
||||
wecomBindValuePlaceholder: 'Enter your {field}',
|
||||
wecomBindPromptHint: 'The value must exactly match an existing local account. After success, this WeCom account will be bound automatically.',
|
||||
wecomBindSubmit: 'Verify and sign in',
|
||||
wecomBindInputNotFound: 'No local account matched the value you entered.',
|
||||
wecomBindInputAmbiguous: 'The value you entered matched multiple local accounts. Please contact the administrator.',
|
||||
wecomBindSessionExpired: 'This WeCom binding session expired. Please restart WeCom login.',
|
||||
wecomBindConflict: 'This WeCom account is already bound to another local account.',
|
||||
wecomBindFieldNotAllowed: 'The selected verification field is not allowed.',
|
||||
wecomBindValueRequired: 'Please enter a verification value.',
|
||||
wecomFieldLabels: {
|
||||
employee_id: 'employee ID',
|
||||
mobile: 'mobile number',
|
||||
email: 'email',
|
||||
match_rules: 'match rules'
|
||||
},
|
||||
wecomRuleJoin: {
|
||||
and: 'and',
|
||||
or: 'or'
|
||||
},
|
||||
wecomFieldGuides: {
|
||||
employee_id: 'Ask the administrator to verify the employee ID source configuration and make sure this member can return an employee ID.',
|
||||
mobile: 'Ask the administrator to fill in the mobile number in the WeCom directory, or adjust the matching rules to stop requiring mobile.',
|
||||
email: 'Ask the administrator to maintain the email field in the WeCom directory, or adjust the matching rules.',
|
||||
default: 'Ask the administrator to verify the WeCom directory fields and the current matching rules.'
|
||||
},
|
||||
wecomDialogTitles: {
|
||||
matchAttrMissing: 'WeCom profile is incomplete',
|
||||
matchAmbiguous: 'Multiple local accounts matched',
|
||||
bindRequired: 'No local account can be linked',
|
||||
bindInputRequired: 'Verification is required before binding',
|
||||
bindConflict: 'This WeCom account is already linked elsewhere',
|
||||
notInScope: 'This member is not authorized for the app',
|
||||
stateExpired: 'WeCom login expired',
|
||||
accountDisabled: 'Local account is disabled',
|
||||
loginFailed: 'WeCom login failed'
|
||||
},
|
||||
wecomDialogSummaries: {
|
||||
matchAttrMissing: 'WeCom did not return "{field}", so the system cannot match your local account automatically.',
|
||||
matchAmbiguous: 'This WeCom account matched multiple local accounts, so the system cannot decide which one to sign in.',
|
||||
matchAmbiguousWithCount: 'This WeCom account matched {count} local accounts, so the system cannot decide which one to sign in.',
|
||||
bindRequired: 'WeCom authentication succeeded, but no local account matched the current rules.',
|
||||
bindInputRequired: 'WeCom authentication succeeded. Please verify one local account field to complete the first binding.',
|
||||
bindConflict: 'This WeCom account is already bound to another local account.',
|
||||
notInScope: 'This member is outside the app visibility scope, or is not a member of this enterprise.'
|
||||
},
|
||||
wecomDialogDetails: {
|
||||
currentRules: 'Current matching rules: {rules}',
|
||||
bindFallback: 'If you already have a local account, ask the administrator to bind this WeCom account manually.',
|
||||
ambiguousAction: 'Ask the administrator to clean duplicated employee ID/mobile/email data, or tighten the matching rules.',
|
||||
bindRequiredAction: 'Ask the administrator to create or bind the local account first, or enable auto-create users.',
|
||||
bindInputRequiredAction: 'Enter your employee ID, mobile number, or email on the next step to bind this WeCom account to your existing local account.',
|
||||
bindConflictAction: 'Ask the administrator to unbind the old account before binding this WeCom account again.',
|
||||
notInScopeAction: 'Ask the administrator to add this member or the member’s department into the WeCom app visibility scope.',
|
||||
retryLogin: 'Start a new WeCom login and try again.',
|
||||
contactAdmin: 'Please contact the administrator for assistance.'
|
||||
}
|
||||
},
|
||||
landing: {
|
||||
hero: {
|
||||
@@ -142,7 +206,8 @@ const messages = {
|
||||
denied: 'You do not have permission, please request access.',
|
||||
reason: 'Reason for request',
|
||||
submit: 'Submit Request'
|
||||
}
|
||||
},
|
||||
wecomEntryNotice: 'Opened from WeCom message. Related context is ready.'
|
||||
},
|
||||
admin: {
|
||||
title: 'Admin Console',
|
||||
@@ -381,6 +446,16 @@ const messages = {
|
||||
wecom: {
|
||||
title: 'WeCom Binding Management',
|
||||
subtitle: 'Manually bind/unbind WeCom accounts and review login audit records',
|
||||
systemSettings: 'WeCom System Settings',
|
||||
integrationCopyTitle: 'WeCom Console Copy Helper',
|
||||
integrationCopyDesc: 'Copy these values directly into WeCom console fields.',
|
||||
integrationCopySecretsNote:
|
||||
'Token and EncodingAESKey are empty until you set them above (or in env) and save. They must match the WeCom console; use Generate if you want random values, then paste the same values into WeCom.',
|
||||
publicBasePlaceholder: 'https://your-public-domain.com',
|
||||
generateAddresses: 'Generate URLs',
|
||||
generateToken: 'Generate',
|
||||
generateEncodingKey: 'Generate',
|
||||
copy: 'Copy',
|
||||
refresh: 'Refresh',
|
||||
quickBind: 'Quick Bind',
|
||||
bind: 'Bind',
|
||||
@@ -389,13 +464,71 @@ const messages = {
|
||||
boundOnly: 'Bound only',
|
||||
noData: 'No data',
|
||||
auditTitle: 'Login Audit (latest 200)',
|
||||
notifySettings: 'Notify Settings',
|
||||
notifyEnabled: 'Enable WeCom event notifications',
|
||||
notifyBaseUrl: 'Deep link base URL (e.g. https://ai.company.com)',
|
||||
notifyEvents: 'Enabled events (comma separated)',
|
||||
notifyMetrics: 'Delivery Metrics (30 days)',
|
||||
metricTotal: 'Total',
|
||||
metricSuccessRate: 'Send success',
|
||||
metricOpenedRate: 'Opened rate',
|
||||
metricWindowDays: 'Window(days)',
|
||||
exportAudit: 'Export Audit',
|
||||
noAuditData: 'No audit records',
|
||||
confirmUnbind: 'Confirm unbinding this user from WeCom?',
|
||||
fields: {
|
||||
userId: 'User ID (user_id)',
|
||||
wecomUserId: 'WeCom UserId',
|
||||
wecomUnionId: 'UnionId (optional)'
|
||||
wecomUnionId: 'UnionId (optional)',
|
||||
enabled: 'Enable WeCom login',
|
||||
autoCreateUser: 'Auto create local user',
|
||||
corpId: 'Corp ID',
|
||||
agentId: 'Agent ID',
|
||||
secret: 'App Secret',
|
||||
redirectUri: 'OAuth Redirect URI',
|
||||
matchRules: 'Match Rules',
|
||||
matchOperator: 'Match Operator',
|
||||
firstLoginBindMode: 'First login bind mode',
|
||||
firstLoginInputFields: 'First login input fields',
|
||||
employeeIdSource: 'Employee ID Source',
|
||||
mobileNormalize: 'Normalize mobile number',
|
||||
publicBaseUrl: 'Public HTTPS base (extranet)'
|
||||
},
|
||||
bindModes: {
|
||||
match_rules: 'Match automatically',
|
||||
input_verify: 'Ask user to verify'
|
||||
},
|
||||
copyFields: {
|
||||
publicBaseUrl: 'Public base URL',
|
||||
callbackUrl: 'Callback URL',
|
||||
callbackToken: 'Token',
|
||||
encodingAesKey: 'EncodingAESKey',
|
||||
oauthRedirectUri: 'OAuth Redirect URI',
|
||||
homepageUrl: 'Application Homepage URL',
|
||||
trustedDomain: 'Trusted Domain',
|
||||
authorizeApi: 'Authorize API (GET)',
|
||||
loginApi: 'Login API (POST)'
|
||||
},
|
||||
tips: {
|
||||
enabled: 'Master switch for WeCom OAuth login.',
|
||||
autoCreateUser: 'If no local user matches, automatically create one.',
|
||||
corpId: 'From WeCom app credentials.',
|
||||
agentId: 'Self-built app AgentId in WeCom.',
|
||||
secret: 'App secret used to get access token.',
|
||||
redirectUri: 'Must match WeCom trusted callback URL.',
|
||||
matchRules: 'Supported values: employee_id,mobile,email.',
|
||||
matchOperator: 'AND = all fields required, OR = any field matched.',
|
||||
firstLoginBindMode: 'match_rules = use WeCom profile to auto-match. input_verify = ask the user to enter one allowed field on first login.',
|
||||
firstLoginInputFields: 'Allowed fields for first-login verification, comma separated. Supported: employee_id,mobile,email.',
|
||||
employeeIdSource: 'userid or extattr:<name>.',
|
||||
mobileNormalize: 'Normalize 86/0086 and symbols before matching.',
|
||||
callbackToken: 'Used to verify callback signatures.',
|
||||
encodingAesKey: 'Used for encrypted callback mode.',
|
||||
callbackUrl: 'WeCom callback receiver URL for messages/events.',
|
||||
homepageUrl: 'Application homepage opened in WeCom.',
|
||||
trustedDomain: 'OAuth trusted domain configured in WeCom.',
|
||||
publicBaseUrl:
|
||||
'HTTPS origin reachable from the internet (WeCom servers). Used to build callback and OAuth URLs. Priority: this field → notify base URL → current request host.'
|
||||
},
|
||||
headers: {
|
||||
user: 'User',
|
||||
@@ -424,12 +557,43 @@ const messages = {
|
||||
success: 'Success',
|
||||
failed: 'Failed'
|
||||
},
|
||||
auditMessages: {
|
||||
loginSuccess: 'Login succeeded',
|
||||
matchAttrMissing: 'Missing required match field: {field}',
|
||||
matchAmbiguous: 'Matched multiple local accounts',
|
||||
bindRequired: 'No local account can be linked',
|
||||
bindInputRequired: 'Waiting for the user to verify a local account field',
|
||||
bindInputNotFound: 'No local account matched the user-entered verification value',
|
||||
bindInputAmbiguous: 'The user-entered verification value matched multiple local accounts',
|
||||
bindConflict: 'This WeCom account is already linked to another local account',
|
||||
notInScope: 'Member is outside the app visibility scope or not in this enterprise',
|
||||
invalidState: 'Invalid or expired login state',
|
||||
missingCode: 'Callback is missing code',
|
||||
accountDisabled: 'Local account is disabled',
|
||||
authFailed: 'WeCom authorization failed: {detail}',
|
||||
userFetchFailed: 'Failed to fetch WeCom member profile: {detail}',
|
||||
exception: 'Exception: {detail}'
|
||||
},
|
||||
auditMeta: {
|
||||
rules: 'Rules: {rules}',
|
||||
result: 'Result: {result}',
|
||||
errorCode: 'Code: {code}'
|
||||
},
|
||||
auditResults: {
|
||||
already_bound: 'Logged in through an already bound WeCom account',
|
||||
matched_and_bound: 'Matched and bound the local account by rules',
|
||||
auto_created: 'Auto-created and bound a new local account',
|
||||
input_verified_and_bound: 'Verified one field on first login and bound the local account'
|
||||
},
|
||||
msg: {
|
||||
bindInputRequired: 'Please enter user_id and wecom_userid',
|
||||
bindFailed: 'Bind failed',
|
||||
bindSuccess: 'Bind succeeded',
|
||||
unbindFailed: 'Unbind failed',
|
||||
boundConflict: 'This WeCom account is already bound: {detail}'
|
||||
boundConflict: 'This WeCom account is already bound: {detail}',
|
||||
copySuccess: 'Copied',
|
||||
copyFailed: 'Copy failed',
|
||||
publicBaseRequired: 'Enter a valid public HTTPS domain or host (e.g. https://ai.company.com).'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -731,7 +895,71 @@ const messages = {
|
||||
wecomStateExpired: '企业微信登录会话已过期,请重试。',
|
||||
wecomBindRequired: '当前企业微信账号未绑定本地用户,请联系管理员。',
|
||||
wecomAccountDisabled: '账号已禁用,请联系管理员。',
|
||||
wecomLoginFailed: '企业微信登录失败'
|
||||
wecomLoginFailed: '企业微信登录失败',
|
||||
wecomMatchAmbiguous: '该企业微信账号匹配到多个本地账号,请联系管理员处理。',
|
||||
wecomMatchAttrMissing: '企业微信缺少必要匹配字段,请联系管理员。',
|
||||
wecomRetry: '重新发起企业微信登录',
|
||||
wecomTechnicalInfo: '技术信息:{detail}',
|
||||
wecomBindPromptTitle: '首次登录请校验并绑定本站账号',
|
||||
wecomBindPromptDesc: '当前企业微信身份为 {name}。请输入一个允许的字段,用来绑定你已有的本站账号。',
|
||||
wecomBindField: '校验字段',
|
||||
wecomBindValue: '校验值',
|
||||
wecomBindValuePlaceholder: '请输入你的{field}',
|
||||
wecomBindPromptHint: '输入值必须和本站已有账号完全匹配。绑定成功后,当前企业微信账号会自动写回该用户表。',
|
||||
wecomBindSubmit: '校验并登录',
|
||||
wecomBindInputNotFound: '没有找到与你输入内容匹配的本站账号。',
|
||||
wecomBindInputAmbiguous: '你输入的内容匹配到了多个本站账号,请联系管理员处理。',
|
||||
wecomBindSessionExpired: '本次企业微信绑定会话已过期,请重新发起企业微信登录。',
|
||||
wecomBindConflict: '当前企业微信账号已绑定到其他本站账号。',
|
||||
wecomBindFieldNotAllowed: '当前选择的校验字段不被允许。',
|
||||
wecomBindValueRequired: '请输入校验值。',
|
||||
wecomFieldLabels: {
|
||||
employee_id: '工号',
|
||||
mobile: '手机号',
|
||||
email: '邮箱',
|
||||
match_rules: '匹配规则'
|
||||
},
|
||||
wecomRuleJoin: {
|
||||
and: '且',
|
||||
or: '或'
|
||||
},
|
||||
wecomFieldGuides: {
|
||||
employee_id: '请管理员检查“工号来源字段”配置,并确认该成员在企业微信里能返回工号。',
|
||||
mobile: '请管理员在企业微信通讯录中补齐该成员手机号,或调整匹配规则,不再强依赖手机号。',
|
||||
email: '请管理员在企业微信通讯录中维护该成员邮箱,或调整匹配规则。',
|
||||
default: '请管理员检查企业微信通讯录字段是否齐全,以及当前匹配规则是否合理。'
|
||||
},
|
||||
wecomDialogTitles: {
|
||||
matchAttrMissing: '企业微信资料不完整',
|
||||
matchAmbiguous: '匹配到了多个本站账号',
|
||||
bindRequired: '未找到可绑定的本站账号',
|
||||
bindInputRequired: '首次绑定前需要人工校验',
|
||||
bindConflict: '该企业微信账号已绑定到别的账号',
|
||||
notInScope: '当前成员未被该应用授权',
|
||||
stateExpired: '企业微信登录已过期',
|
||||
accountDisabled: '本地账号已被禁用',
|
||||
loginFailed: '企业微信登录失败'
|
||||
},
|
||||
wecomDialogSummaries: {
|
||||
matchAttrMissing: '企业微信没有返回“{field}”,所以系统无法按当前规则自动匹配你的本站账号。',
|
||||
matchAmbiguous: '当前企业微信账号匹配到了多个本站账号,系统无法自动判断该登录哪一个。',
|
||||
matchAmbiguousWithCount: '当前企业微信账号匹配到了 {count} 个本站账号,系统无法自动判断该登录哪一个。',
|
||||
bindRequired: '企业微信侧认证已经成功,但本站没有找到符合当前规则的账号。',
|
||||
bindInputRequired: '企业微信侧认证已经成功,请先输入一个本站字段完成首次绑定。',
|
||||
bindConflict: '当前企业微信账号已经绑定到其他本站账号。',
|
||||
notInScope: '当前成员不在企业微信应用可见范围内,或不是本企业成员。'
|
||||
},
|
||||
wecomDialogDetails: {
|
||||
currentRules: '当前匹配规则:{rules}',
|
||||
bindFallback: '如果你已经有本站账号,可以请管理员先手动绑定当前企业微信账号。',
|
||||
ambiguousAction: '请管理员清理重复的工号、手机号或邮箱数据,或者收紧匹配规则。',
|
||||
bindRequiredAction: '请管理员先创建或绑定本站账号,或者开启自动创建用户。',
|
||||
bindInputRequiredAction: '下一步请输入你的工号、手机号或邮箱中的一个,校验成功后就会把当前企业微信账号绑定到已有本站账号。',
|
||||
bindConflictAction: '请管理员先解除旧绑定,再重新绑定当前企业微信账号。',
|
||||
notInScopeAction: '请管理员到企业微信后台,把该成员或其所在部门加入该应用的可见范围。',
|
||||
retryLogin: '请重新发起一次企业微信登录。',
|
||||
contactAdmin: '如需帮助,请联系管理员。'
|
||||
}
|
||||
},
|
||||
landing: {
|
||||
hero: {
|
||||
@@ -827,7 +1055,8 @@ const messages = {
|
||||
denied: '您没有该应用的访问权限,请提交申请。',
|
||||
reason: '申请理由',
|
||||
submit: '提交申请'
|
||||
}
|
||||
},
|
||||
wecomEntryNotice: '已从企业微信消息进入,已为你准备好相关上下文。'
|
||||
},
|
||||
admin: {
|
||||
title: '管理控制台',
|
||||
@@ -1066,6 +1295,16 @@ const messages = {
|
||||
wecom: {
|
||||
title: '企业微信绑定管理',
|
||||
subtitle: '手动绑定/解绑企业微信账号,并查看登录审计记录',
|
||||
systemSettings: '企业微信系统配置',
|
||||
integrationCopyTitle: '企微后台复制助手',
|
||||
integrationCopyDesc: '以下字段可直接复制到企业微信管理后台对应配置项。',
|
||||
integrationCopySecretsNote:
|
||||
'Token 与 EncodingAESKey 在未填写并保存前会显示为空:需与企微后台完全一致。可在上方填写后保存,或使用「生成」随机生成,再将相同值填入企微后台。',
|
||||
publicBasePlaceholder: 'https://你的外网域名',
|
||||
generateAddresses: '生成地址',
|
||||
generateToken: '生成',
|
||||
generateEncodingKey: '生成',
|
||||
copy: '复制',
|
||||
refresh: '刷新',
|
||||
quickBind: '快速绑定',
|
||||
bind: '绑定',
|
||||
@@ -1074,13 +1313,71 @@ const messages = {
|
||||
boundOnly: '只看已绑定',
|
||||
noData: '暂无数据',
|
||||
auditTitle: '登录审计(最近 200 条)',
|
||||
notifySettings: '触达设置',
|
||||
notifyEnabled: '启用企微事件通知',
|
||||
notifyBaseUrl: '深链基地址(例如:https://ai.company.com)',
|
||||
notifyEvents: '启用事件(英文逗号分隔)',
|
||||
notifyMetrics: '触达指标(近30天)',
|
||||
metricTotal: '总触达',
|
||||
metricSuccessRate: '发送成功率',
|
||||
metricOpenedRate: '回流打开率',
|
||||
metricWindowDays: '统计窗口(天)',
|
||||
exportAudit: '导出审计',
|
||||
noAuditData: '暂无审计记录',
|
||||
confirmUnbind: '确认解绑该用户的企业微信账号?',
|
||||
fields: {
|
||||
userId: '用户ID (user_id)',
|
||||
wecomUserId: '企业微信 UserId',
|
||||
wecomUnionId: 'UnionId (可选)'
|
||||
wecomUnionId: 'UnionId (可选)',
|
||||
enabled: '启用企业微信登录',
|
||||
autoCreateUser: '无匹配用户时自动创建',
|
||||
corpId: '企业ID (CorpID)',
|
||||
agentId: '应用AgentID',
|
||||
secret: '应用Secret',
|
||||
redirectUri: 'OAuth 回调地址',
|
||||
matchRules: '匹配规则',
|
||||
matchOperator: '匹配运算符',
|
||||
firstLoginBindMode: '首次登录绑定模式',
|
||||
firstLoginInputFields: '首次登录可输入字段',
|
||||
employeeIdSource: '工号来源字段',
|
||||
mobileNormalize: '手机号归一化',
|
||||
publicBaseUrl: '外网 HTTPS 基地址'
|
||||
},
|
||||
bindModes: {
|
||||
match_rules: '按规则自动匹配',
|
||||
input_verify: '要求用户输入校验'
|
||||
},
|
||||
copyFields: {
|
||||
publicBaseUrl: '外网基地址',
|
||||
callbackUrl: '回调URL',
|
||||
callbackToken: 'Token',
|
||||
encodingAesKey: 'EncodingAESKey',
|
||||
oauthRedirectUri: 'OAuth 回调地址',
|
||||
homepageUrl: '应用主页URL',
|
||||
trustedDomain: '可信域名',
|
||||
authorizeApi: '授权说明接口 (GET)',
|
||||
loginApi: '登录接口 (POST)'
|
||||
},
|
||||
tips: {
|
||||
enabled: '企业微信登录总开关。',
|
||||
autoCreateUser: '未匹配到本地账号时,是否自动创建账号。',
|
||||
corpId: '来自企业微信应用凭据。',
|
||||
agentId: '企业微信自建应用中的 AgentId。',
|
||||
secret: '用于获取 access_token 的应用密钥。',
|
||||
redirectUri: '必须与企业微信配置的可信回调地址一致。',
|
||||
matchRules: '支持 employee_id,mobile,email,英文逗号分隔。',
|
||||
matchOperator: 'AND 表示全部字段都匹配,OR 表示任一字段匹配。',
|
||||
firstLoginBindMode: 'match_rules 表示继续用企微资料自动匹配;input_verify 表示首次登录时要求员工输入一个字段完成绑定。',
|
||||
firstLoginInputFields: '首次绑定允许员工输入的字段,英文逗号分隔。支持 employee_id,mobile,email。',
|
||||
employeeIdSource: '可填 userid 或 extattr:<名称>。',
|
||||
mobileNormalize: '匹配前会清洗 86/0086 前缀和分隔符。',
|
||||
callbackToken: '用于回调签名校验。',
|
||||
encodingAesKey: '用于安全模式消息解密。',
|
||||
callbackUrl: '企业微信消息/事件回调接收地址。',
|
||||
homepageUrl: '员工在企微内打开应用时访问的地址。',
|
||||
trustedDomain: '企业微信 OAuth 可信域名。',
|
||||
publicBaseUrl:
|
||||
'企微服务器可访问的 HTTPS 根地址,用于生成回调与 OAuth 相关地址。优先级:本字段 → 触达深链基地址 → 当前访问主机。'
|
||||
},
|
||||
headers: {
|
||||
user: '用户',
|
||||
@@ -1109,12 +1406,43 @@ const messages = {
|
||||
success: '成功',
|
||||
failed: '失败'
|
||||
},
|
||||
auditMessages: {
|
||||
loginSuccess: '登录成功',
|
||||
matchAttrMissing: '缺少用于匹配的字段:{field}',
|
||||
matchAmbiguous: '匹配到了多个本站账号',
|
||||
bindRequired: '未找到可绑定的本站账号',
|
||||
bindInputRequired: '等待员工输入一个本站字段完成首次绑定',
|
||||
bindInputNotFound: '员工输入的校验值未匹配到本站账号',
|
||||
bindInputAmbiguous: '员工输入的校验值匹配到了多个本站账号',
|
||||
bindConflict: '该企业微信账号已绑定到其他本站账号',
|
||||
notInScope: '成员不在应用可见范围内,或不是本企业成员',
|
||||
invalidState: '登录 state 无效或已过期',
|
||||
missingCode: '回调中缺少 code',
|
||||
accountDisabled: '本地账号已被禁用',
|
||||
authFailed: '企业微信授权失败:{detail}',
|
||||
userFetchFailed: '获取企业微信成员资料失败:{detail}',
|
||||
exception: '异常:{detail}'
|
||||
},
|
||||
auditMeta: {
|
||||
rules: '规则:{rules}',
|
||||
result: '结果:{result}',
|
||||
errorCode: '代码:{code}'
|
||||
},
|
||||
auditResults: {
|
||||
already_bound: '通过已绑定的企业微信账号直接登录',
|
||||
matched_and_bound: '按规则匹配并完成账号绑定',
|
||||
auto_created: '自动创建本站账号并完成绑定',
|
||||
input_verified_and_bound: '首次登录时经员工输入字段校验后完成绑定'
|
||||
},
|
||||
msg: {
|
||||
bindInputRequired: '请输入 user_id 与 wecom_userid',
|
||||
bindFailed: '绑定失败',
|
||||
bindSuccess: '绑定成功',
|
||||
unbindFailed: '解绑失败',
|
||||
boundConflict: '该企业微信账号已被绑定:{detail}'
|
||||
boundConflict: '该企业微信账号已被绑定:{detail}',
|
||||
copySuccess: '已复制',
|
||||
copyFailed: '复制失败',
|
||||
publicBaseRequired: '请填写有效的外网 HTTPS 地址或域名(例如 https://ai.company.com)。'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1399,7 +1727,77 @@ const messages = {
|
||||
forgotPasswordDesc: '輸入您的郵箱以重設密碼',
|
||||
findPassword: '找回密碼',
|
||||
wecomLogin: '企業微信登錄',
|
||||
wecomConnecting: '正在連接企業微信...'
|
||||
wecomConnecting: '正在連接企業微信...',
|
||||
wecomStartFailed: '啟動企業微信登錄失敗',
|
||||
wecomInvalidState: '企業微信登入狀態無效',
|
||||
wecomStateExpired: '企業微信登入會話已過期,請重試。',
|
||||
wecomBindRequired: '當前企業微信帳號未綁定本地用戶,請聯繫管理員。',
|
||||
wecomAccountDisabled: '帳號已被禁用,請聯繫管理員。',
|
||||
wecomMatchAmbiguous: '該企業微信帳號匹配到多個本地帳號,請聯繫管理員處理。',
|
||||
wecomMatchAttrMissing: '企業微信缺少必要匹配字段,請聯繫管理員。',
|
||||
wecomLoginFailed: '企業微信登錄失敗',
|
||||
wecomRetry: '重新發起企業微信登入',
|
||||
wecomTechnicalInfo: '技術資訊:{detail}',
|
||||
wecomBindPromptTitle: '首次登入請校驗並綁定本站帳號',
|
||||
wecomBindPromptDesc: '當前企業微信身份為 {name}。請輸入一個允許的字段,用來綁定你已有的本站帳號。',
|
||||
wecomBindField: '校驗字段',
|
||||
wecomBindValue: '校驗值',
|
||||
wecomBindValuePlaceholder: '請輸入你的{field}',
|
||||
wecomBindPromptHint: '輸入值必須和本站已有帳號完全匹配。綁定成功後,當前企業微信帳號會自動寫回該用戶表。',
|
||||
wecomBindSubmit: '校驗並登入',
|
||||
wecomBindInputNotFound: '沒有找到與你輸入內容匹配的本站帳號。',
|
||||
wecomBindInputAmbiguous: '你輸入的內容匹配到了多個本站帳號,請聯繫管理員處理。',
|
||||
wecomBindSessionExpired: '本次企業微信綁定會話已過期,請重新發起企業微信登入。',
|
||||
wecomBindConflict: '當前企業微信帳號已綁定到其他本站帳號。',
|
||||
wecomBindFieldNotAllowed: '當前選擇的校驗字段不被允許。',
|
||||
wecomBindValueRequired: '請輸入校驗值。',
|
||||
wecomFieldLabels: {
|
||||
employee_id: '工號',
|
||||
mobile: '手機號',
|
||||
email: '郵箱',
|
||||
match_rules: '匹配規則'
|
||||
},
|
||||
wecomRuleJoin: {
|
||||
and: '且',
|
||||
or: '或'
|
||||
},
|
||||
wecomFieldGuides: {
|
||||
employee_id: '請管理員檢查「工號來源字段」配置,並確認該成員在企業微信中能返回工號。',
|
||||
mobile: '請管理員在企業微信通訊錄中補齊該成員手機號,或調整匹配規則,不再強依賴手機號。',
|
||||
email: '請管理員在企業微信通訊錄中維護該成員郵箱,或調整匹配規則。',
|
||||
default: '請管理員檢查企業微信通訊錄字段是否齊全,以及當前匹配規則是否合理。'
|
||||
},
|
||||
wecomDialogTitles: {
|
||||
matchAttrMissing: '企業微信資料不完整',
|
||||
matchAmbiguous: '匹配到了多個本站帳號',
|
||||
bindRequired: '未找到可綁定的本站帳號',
|
||||
bindInputRequired: '首次綁定前需要人工校驗',
|
||||
bindConflict: '該企業微信帳號已綁定到其他帳號',
|
||||
notInScope: '當前成員未被該應用授權',
|
||||
stateExpired: '企業微信登入已過期',
|
||||
accountDisabled: '本地帳號已被禁用',
|
||||
loginFailed: '企業微信登入失敗'
|
||||
},
|
||||
wecomDialogSummaries: {
|
||||
matchAttrMissing: '企業微信沒有返回「{field}」,所以系統無法按當前規則自動匹配你的本站帳號。',
|
||||
matchAmbiguous: '當前企業微信帳號匹配到了多個本站帳號,系統無法自動判斷該登入哪一個。',
|
||||
matchAmbiguousWithCount: '當前企業微信帳號匹配到了 {count} 個本站帳號,系統無法自動判斷該登入哪一個。',
|
||||
bindRequired: '企業微信側驗證已成功,但本站沒有找到符合當前規則的帳號。',
|
||||
bindInputRequired: '企業微信側驗證已成功,請先輸入一個本站字段完成首次綁定。',
|
||||
bindConflict: '當前企業微信帳號已經綁定到其他本站帳號。',
|
||||
notInScope: '當前成員不在企業微信應用可見範圍內,或不是本企業成員。'
|
||||
},
|
||||
wecomDialogDetails: {
|
||||
currentRules: '當前匹配規則:{rules}',
|
||||
bindFallback: '如果你已經有本站帳號,可以請管理員先手動綁定當前企業微信帳號。',
|
||||
ambiguousAction: '請管理員清理重複的工號、手機號或郵箱資料,或者收緊匹配規則。',
|
||||
bindRequiredAction: '請管理員先建立或綁定本站帳號,或者開啟自動建立使用者。',
|
||||
bindInputRequiredAction: '下一步請輸入你的工號、手機號或郵箱中的一個,校驗成功後就會把當前企業微信帳號綁定到已有本站帳號。',
|
||||
bindConflictAction: '請管理員先解除舊綁定,再重新綁定當前企業微信帳號。',
|
||||
notInScopeAction: '請管理員到企業微信後台,把該成員或其所在部門加入該應用的可見範圍。',
|
||||
retryLogin: '請重新發起一次企業微信登入。',
|
||||
contactAdmin: '如需協助,請聯繫管理員。'
|
||||
}
|
||||
},
|
||||
landing: {
|
||||
hero: {
|
||||
@@ -1490,7 +1888,8 @@ const messages = {
|
||||
denied: '您沒有該應用的訪問權限,請提交申請。',
|
||||
reason: '申請理由',
|
||||
submit: '提交申請'
|
||||
}
|
||||
},
|
||||
wecomEntryNotice: '已從企業微信消息進入,已為你準備好相關上下文。'
|
||||
},
|
||||
admin: {
|
||||
title: '管理控制台',
|
||||
@@ -1729,6 +2128,16 @@ const messages = {
|
||||
wecom: {
|
||||
title: '企業微信綁定管理',
|
||||
subtitle: '手動綁定/解綁企業微信帳號,並查看登入審計記錄',
|
||||
systemSettings: '企業微信系統配置',
|
||||
integrationCopyTitle: '企微後台複製助手',
|
||||
integrationCopyDesc: '以下字段可直接複製到企業微信管理後台對應配置項。',
|
||||
integrationCopySecretsNote:
|
||||
'Token 與 EncodingAESKey 在未填寫並保存前會顯示為空:需與企微後台完全一致。可在上方填寫後保存,或使用「生成」隨機生成,再將相同值填入企微後台。',
|
||||
publicBasePlaceholder: 'https://你的外網域名',
|
||||
generateAddresses: '生成地址',
|
||||
generateToken: '生成',
|
||||
generateEncodingKey: '生成',
|
||||
copy: '複製',
|
||||
refresh: '刷新',
|
||||
quickBind: '快速綁定',
|
||||
bind: '綁定',
|
||||
@@ -1737,13 +2146,76 @@ const messages = {
|
||||
boundOnly: '僅看已綁定',
|
||||
noData: '暫無資料',
|
||||
auditTitle: '登入審計(最近 200 條)',
|
||||
notifySettings: '觸達設置',
|
||||
notifyEnabled: '啟用企微事件通知',
|
||||
notifyBaseUrl: '深鏈基地址(例如:https://ai.company.com)',
|
||||
notifyEvents: '啟用事件(英文逗號分隔)',
|
||||
notifyMetrics: '觸達指標(近30天)',
|
||||
metricTotal: '總觸達',
|
||||
metricSuccessRate: '發送成功率',
|
||||
metricOpenedRate: '回流打開率',
|
||||
metricWindowDays: '統計窗口(天)',
|
||||
exportAudit: '導出審計',
|
||||
noAuditData: '暫無審計記錄',
|
||||
confirmUnbind: '確認解綁該用戶的企業微信帳號?',
|
||||
fields: {
|
||||
userId: '用戶ID (user_id)',
|
||||
wecomUserId: '企業微信 UserId',
|
||||
wecomUnionId: 'UnionId (可選)'
|
||||
wecomUnionId: 'UnionId (可選)',
|
||||
enabled: '啟用企業微信登入',
|
||||
autoCreateUser: '無匹配用戶時自動建立',
|
||||
corpId: '企業ID (CorpID)',
|
||||
agentId: '應用AgentID',
|
||||
secret: '應用Secret',
|
||||
redirectUri: 'OAuth 回調地址',
|
||||
matchRules: '匹配規則',
|
||||
matchOperator: '匹配運算符',
|
||||
firstLoginBindMode: '首次登入綁定模式',
|
||||
firstLoginInputFields: '首次登入可輸入字段',
|
||||
employeeIdSource: '工號來源字段',
|
||||
mobileNormalize: '手機號歸一化',
|
||||
callbackToken: '回調 Token',
|
||||
encodingAesKey: 'EncodingAESKey',
|
||||
callbackUrl: '回調URL',
|
||||
homepageUrl: '應用主頁URL',
|
||||
trustedDomain: '可信域名',
|
||||
publicBaseUrl: '外網 HTTPS 基地址'
|
||||
},
|
||||
bindModes: {
|
||||
match_rules: '按規則自動匹配',
|
||||
input_verify: '要求用戶輸入校驗'
|
||||
},
|
||||
copyFields: {
|
||||
publicBaseUrl: '外網基地址',
|
||||
callbackUrl: '回調URL',
|
||||
callbackToken: 'Token',
|
||||
encodingAesKey: 'EncodingAESKey',
|
||||
oauthRedirectUri: 'OAuth 回調地址',
|
||||
homepageUrl: '應用主頁URL',
|
||||
trustedDomain: '可信域名',
|
||||
authorizeApi: '授權說明接口 (GET)',
|
||||
loginApi: '登入接口 (POST)'
|
||||
},
|
||||
tips: {
|
||||
enabled: '企業微信登入總開關。',
|
||||
autoCreateUser: '未匹配到本地帳號時,是否自動建立帳號。',
|
||||
corpId: '來自企業微信應用憑據。',
|
||||
agentId: '企業微信自建應用中的 AgentId。',
|
||||
secret: '用於取得 access_token 的應用密鑰。',
|
||||
redirectUri: '必須與企業微信配置的可信回調地址一致。',
|
||||
matchRules: '支援 employee_id,mobile,email,英文逗號分隔。',
|
||||
matchOperator: 'AND 表示全部字段都匹配,OR 表示任一字段匹配。',
|
||||
firstLoginBindMode: 'match_rules 表示繼續用企微資料自動匹配;input_verify 表示首次登入時要求員工輸入一個字段完成綁定。',
|
||||
firstLoginInputFields: '首次綁定允許員工輸入的字段,英文逗號分隔。支援 employee_id,mobile,email。',
|
||||
employeeIdSource: '可填 userid 或 extattr:<名稱>。',
|
||||
mobileNormalize: '匹配前會清洗 86/0086 前綴和分隔符。',
|
||||
callbackToken: '用於回調簽章校驗。',
|
||||
encodingAesKey: '用於安全模式訊息解密。',
|
||||
callbackUrl: '企業微信訊息/事件回調接收地址。',
|
||||
homepageUrl: '員工在企微內打開應用時訪問的地址。',
|
||||
trustedDomain: '企業微信 OAuth 可信域名。',
|
||||
publicBaseUrl:
|
||||
'企微伺服器可訪問的 HTTPS 根地址,用於生成回調與 OAuth 相關地址。優先級:本字段 → 觸達深鏈基地址 → 當前訪問主機。'
|
||||
},
|
||||
headers: {
|
||||
user: '用戶',
|
||||
@@ -1772,12 +2244,43 @@ const messages = {
|
||||
success: '成功',
|
||||
failed: '失敗'
|
||||
},
|
||||
auditMessages: {
|
||||
loginSuccess: '登入成功',
|
||||
matchAttrMissing: '缺少用於匹配的字段:{field}',
|
||||
matchAmbiguous: '匹配到了多個本站帳號',
|
||||
bindRequired: '未找到可綁定的本站帳號',
|
||||
bindInputRequired: '等待員工輸入一個本站字段完成首次綁定',
|
||||
bindInputNotFound: '員工輸入的校驗值未匹配到本站帳號',
|
||||
bindInputAmbiguous: '員工輸入的校驗值匹配到了多個本站帳號',
|
||||
bindConflict: '該企業微信帳號已綁定到其他本站帳號',
|
||||
notInScope: '成員不在應用可見範圍內,或不是本企業成員',
|
||||
invalidState: '登入 state 無效或已過期',
|
||||
missingCode: '回調中缺少 code',
|
||||
accountDisabled: '本地帳號已被禁用',
|
||||
authFailed: '企業微信授權失敗:{detail}',
|
||||
userFetchFailed: '獲取企業微信成員資料失敗:{detail}',
|
||||
exception: '異常:{detail}'
|
||||
},
|
||||
auditMeta: {
|
||||
rules: '規則:{rules}',
|
||||
result: '結果:{result}',
|
||||
errorCode: '代碼:{code}'
|
||||
},
|
||||
auditResults: {
|
||||
already_bound: '透過已綁定的企業微信帳號直接登入',
|
||||
matched_and_bound: '按規則匹配並完成帳號綁定',
|
||||
auto_created: '自動建立本站帳號並完成綁定',
|
||||
input_verified_and_bound: '首次登入時經員工輸入字段校驗後完成綁定'
|
||||
},
|
||||
msg: {
|
||||
bindInputRequired: '請輸入 user_id 與 wecom_userid',
|
||||
bindFailed: '綁定失敗',
|
||||
bindSuccess: '綁定成功',
|
||||
unbindFailed: '解綁失敗',
|
||||
boundConflict: '該企業微信帳號已被綁定:{detail}'
|
||||
boundConflict: '該企業微信帳號已被綁定:{detail}',
|
||||
copySuccess: '已複製',
|
||||
copyFailed: '複製失敗',
|
||||
publicBaseRequired: '請填寫有效的外網 HTTPS 地址或域名(例如 https://ai.company.com)。'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2062,7 +2565,77 @@ const messages = {
|
||||
forgotPasswordDesc: 'กรอกอีเมลเพื่อรีเซ็ตรหัสผ่าน',
|
||||
findPassword: 'ค้นหารหัสผ่าน',
|
||||
wecomLogin: 'เข้าสู่ระบบด้วย WeCom',
|
||||
wecomConnecting: 'กำลังเชื่อมต่อ WeCom...'
|
||||
wecomConnecting: 'กำลังเชื่อมต่อ WeCom...',
|
||||
wecomStartFailed: 'เริ่มต้นการเข้าสู่ระบบด้วย WeCom ไม่สำเร็จ',
|
||||
wecomInvalidState: 'สถานะการเข้าสู่ระบบ WeCom ไม่ถูกต้อง',
|
||||
wecomStateExpired: 'เซสชันการเข้าสู่ระบบ WeCom หมดอายุแล้ว กรุณาลองใหม่',
|
||||
wecomBindRequired: 'บัญชี WeCom นี้ยังไม่เชื่อมกับผู้ใช้ในระบบ กรุณาติดต่อผู้ดูแลระบบ',
|
||||
wecomAccountDisabled: 'บัญชีนี้ถูกปิดใช้งาน กรุณาติดต่อผู้ดูแลระบบ',
|
||||
wecomMatchAmbiguous: 'บัญชี WeCom นี้ตรงกับผู้ใช้หลายบัญชี กรุณาติดต่อผู้ดูแลระบบ',
|
||||
wecomMatchAttrMissing: 'ข้อมูลที่จำเป็นจาก WeCom ไม่ครบ กรุณาติดต่อผู้ดูแลระบบ',
|
||||
wecomLoginFailed: 'เข้าสู่ระบบด้วย WeCom ล้มเหลว',
|
||||
wecomRetry: 'ลองเข้าสู่ระบบ WeCom ใหม่',
|
||||
wecomTechnicalInfo: 'ข้อมูลทางเทคนิค: {detail}',
|
||||
wecomBindPromptTitle: 'ยืนยันและผูกบัญชีของคุณในการเข้าสู่ระบบครั้งแรก',
|
||||
wecomBindPromptDesc: 'บัญชี WeCom ปัจจุบันคือ {name} กรุณากรอกข้อมูลที่อนุญาต 1 รายการเพื่อผูกกับบัญชีเดิมของคุณในระบบ',
|
||||
wecomBindField: 'ฟิลด์สำหรับยืนยัน',
|
||||
wecomBindValue: 'ค่ายืนยัน',
|
||||
wecomBindValuePlaceholder: 'กรอก{field}ของคุณ',
|
||||
wecomBindPromptHint: 'ค่าที่กรอกต้องตรงกับบัญชีที่มีอยู่ในระบบทุกตัวอักษร หากสำเร็จ ระบบจะผูกบัญชี WeCom นี้ให้อัตโนมัติ',
|
||||
wecomBindSubmit: 'ยืนยันและเข้าสู่ระบบ',
|
||||
wecomBindInputNotFound: 'ไม่พบบัญชีในระบบที่ตรงกับค่าที่คุณกรอก',
|
||||
wecomBindInputAmbiguous: 'ค่าที่คุณกรอกตรงกับหลายบัญชีในระบบ กรุณาติดต่อผู้ดูแลระบบ',
|
||||
wecomBindSessionExpired: 'เซสชันการผูกบัญชี WeCom นี้หมดอายุแล้ว กรุณาเริ่มการเข้าสู่ระบบ WeCom ใหม่',
|
||||
wecomBindConflict: 'บัญชี WeCom นี้ถูกผูกกับบัญชีในระบบอื่นอยู่แล้ว',
|
||||
wecomBindFieldNotAllowed: 'ไม่อนุญาตให้ใช้ฟิลด์นี้ในการยืนยัน',
|
||||
wecomBindValueRequired: 'กรุณากรอกค่ายืนยัน',
|
||||
wecomFieldLabels: {
|
||||
employee_id: 'รหัสพนักงาน',
|
||||
mobile: 'หมายเลขโทรศัพท์',
|
||||
email: 'อีเมล',
|
||||
match_rules: 'กฎการจับคู่'
|
||||
},
|
||||
wecomRuleJoin: {
|
||||
and: 'และ',
|
||||
or: 'หรือ'
|
||||
},
|
||||
wecomFieldGuides: {
|
||||
employee_id: 'ให้ผู้ดูแลตรวจสอบการตั้งค่าแหล่งที่มาของรหัสพนักงาน และยืนยันว่าระบบ WeCom ส่งค่ารหัสพนักงานของสมาชิกคนนี้กลับมาได้',
|
||||
mobile: 'ให้ผู้ดูแลกรอกหมายเลขโทรศัพท์ของสมาชิกคนนี้ในสมุดรายชื่อ WeCom หรือปรับกฎการจับคู่ไม่ให้บังคับใช้หมายเลขโทรศัพท์',
|
||||
email: 'ให้ผู้ดูแลเพิ่มอีเมลของสมาชิกคนนี้ในสมุดรายชื่อ WeCom หรือปรับกฎการจับคู่',
|
||||
default: 'ให้ผู้ดูแลตรวจสอบข้อมูลในสมุดรายชื่อ WeCom และกฎการจับคู่ปัจจุบัน'
|
||||
},
|
||||
wecomDialogTitles: {
|
||||
matchAttrMissing: 'ข้อมูลโปรไฟล์ WeCom ไม่ครบ',
|
||||
matchAmbiguous: 'ตรงกับหลายบัญชีในระบบ',
|
||||
bindRequired: 'ไม่พบบัญชีในระบบที่เชื่อมได้',
|
||||
bindInputRequired: 'ต้องยืนยันก่อนผูกบัญชีครั้งแรก',
|
||||
bindConflict: 'บัญชี WeCom นี้เชื่อมกับบัญชีอื่นอยู่แล้ว',
|
||||
notInScope: 'สมาชิกคนนี้ยังไม่ได้รับสิทธิ์ในแอป',
|
||||
stateExpired: 'การเข้าสู่ระบบ WeCom หมดอายุแล้ว',
|
||||
accountDisabled: 'บัญชีในระบบถูกปิดใช้งาน',
|
||||
loginFailed: 'เข้าสู่ระบบด้วย WeCom ล้มเหลว'
|
||||
},
|
||||
wecomDialogSummaries: {
|
||||
matchAttrMissing: 'WeCom ไม่ได้ส่งค่า "{field}" กลับมา จึงไม่สามารถจับคู่กับบัญชีในระบบของคุณโดยอัตโนมัติได้',
|
||||
matchAmbiguous: 'บัญชี WeCom นี้ตรงกับหลายบัญชีในระบบ จึงไม่สามารถเลือกบัญชีที่จะเข้าสู่ระบบได้อัตโนมัติ',
|
||||
matchAmbiguousWithCount: 'บัญชี WeCom นี้ตรงกับ {count} บัญชีในระบบ จึงไม่สามารถเลือกบัญชีที่จะเข้าสู่ระบบได้อัตโนมัติ',
|
||||
bindRequired: 'การยืนยันตัวตนผ่าน WeCom สำเร็จแล้ว แต่ไม่พบบัญชีในระบบที่ตรงกับกฎปัจจุบัน',
|
||||
bindInputRequired: 'การยืนยันตัวตนผ่าน WeCom สำเร็จแล้ว กรุณากรอกข้อมูลของบัญชีในระบบ 1 รายการเพื่อทำการผูกครั้งแรกให้เสร็จ',
|
||||
bindConflict: 'บัญชี WeCom นี้เชื่อมกับบัญชีในระบบอื่นอยู่แล้ว',
|
||||
notInScope: 'สมาชิกคนนี้อยู่นอกขอบเขตการมองเห็นของแอป หรือไม่ใช่สมาชิกขององค์กรนี้'
|
||||
},
|
||||
wecomDialogDetails: {
|
||||
currentRules: 'กฎการจับคู่ปัจจุบัน: {rules}',
|
||||
bindFallback: 'หากคุณมีบัญชีในระบบอยู่แล้ว ให้ผู้ดูแลช่วยผูกบัญชี WeCom นี้ด้วยตนเอง',
|
||||
ambiguousAction: 'ให้ผู้ดูแลล้างข้อมูลรหัสพนักงาน หมายเลขโทรศัพท์ หรืออีเมลที่ซ้ำกัน หรือปรับกฎการจับคู่ให้เข้มขึ้น',
|
||||
bindRequiredAction: 'ให้ผู้ดูแลสร้างหรือผูกบัญชีในระบบก่อน หรือเปิดการสร้างผู้ใช้อัตโนมัติ',
|
||||
bindInputRequiredAction: 'ในขั้นตอนถัดไป ให้กรอกรหัสพนักงาน หมายเลขโทรศัพท์ หรืออีเมลอย่างใดอย่างหนึ่ง เพื่อผูกบัญชี WeCom นี้กับบัญชีเดิมในระบบ',
|
||||
bindConflictAction: 'ให้ผู้ดูแลยกเลิกการผูกเดิมก่อน แล้วจึงผูกบัญชี WeCom นี้อีกครั้ง',
|
||||
notInScopeAction: 'ให้ผู้ดูแลเพิ่มสมาชิกคนนี้หรือแผนกของสมาชิกเข้าไปในขอบเขตการมองเห็นของแอป WeCom',
|
||||
retryLogin: 'เริ่มต้นการเข้าสู่ระบบ WeCom ใหม่อีกครั้ง',
|
||||
contactAdmin: 'กรุณาติดต่อผู้ดูแลระบบเพื่อขอความช่วยเหลือ'
|
||||
}
|
||||
},
|
||||
landing: {
|
||||
hero: {
|
||||
@@ -2153,7 +2726,8 @@ const messages = {
|
||||
denied: 'คุณไม่มีสิทธิ์เข้าถึงตัวแทนนี้ โปรดส่งคำขอ',
|
||||
reason: 'เหตุผลในการขอ',
|
||||
submit: 'ส่งคำขอ'
|
||||
}
|
||||
},
|
||||
wecomEntryNotice: 'เปิดมาจากข้อความ WeCom และเตรียมบริบทที่เกี่ยวข้องไว้ให้แล้ว'
|
||||
},
|
||||
admin: {
|
||||
title: 'คอนโซลผู้ดูแลระบบ',
|
||||
@@ -2392,6 +2966,16 @@ const messages = {
|
||||
wecom: {
|
||||
title: 'การจัดการการผูกบัญชี WeCom',
|
||||
subtitle: 'ผูก/ยกเลิกการผูกบัญชี WeCom แบบแมนนวล และตรวจสอบบันทึกการเข้าสู่ระบบ',
|
||||
systemSettings: 'การตั้งค่าระบบ WeCom',
|
||||
integrationCopyTitle: 'ตัวช่วยคัดลอกค่าไปยังคอนโซล WeCom',
|
||||
integrationCopyDesc: 'คัดลอกค่าด้านล่างไปใส่ในช่องที่ตรงกันในคอนโซลผู้ดูแล WeCom ได้โดยตรง',
|
||||
integrationCopySecretsNote:
|
||||
'Token และ EncodingAESKey จะแสดงค่าว่างจนกว่าจะตั้งค่าและบันทึกด้านบน ต้องใช้ค่าเดียวกับในคอนโซล WeCom หากต้องการสุ่มค่าใหม่ ให้กดสร้าง แล้วนำค่าเดียวกันไปใส่ใน WeCom',
|
||||
publicBasePlaceholder: 'https://your-public-domain.com',
|
||||
generateAddresses: 'สร้าง URL',
|
||||
generateToken: 'สร้าง',
|
||||
generateEncodingKey: 'สร้าง',
|
||||
copy: 'คัดลอก',
|
||||
refresh: 'รีเฟรช',
|
||||
quickBind: 'ผูกแบบรวดเร็ว',
|
||||
bind: 'ผูก',
|
||||
@@ -2400,13 +2984,76 @@ const messages = {
|
||||
boundOnly: 'แสดงเฉพาะที่ผูกแล้ว',
|
||||
noData: 'ไม่มีข้อมูล',
|
||||
auditTitle: 'บันทึกการเข้าสู่ระบบ (ล่าสุด 200 รายการ)',
|
||||
notifySettings: 'การตั้งค่าการแจ้งเตือน',
|
||||
notifyEnabled: 'เปิดใช้การแจ้งเตือนเหตุการณ์ WeCom',
|
||||
notifyBaseUrl: 'Base URL สำหรับ deep link (เช่น https://ai.company.com)',
|
||||
notifyEvents: 'เหตุการณ์ที่เปิดใช้ (คั่นด้วยจุลภาค)',
|
||||
notifyMetrics: 'สถิติการส่ง (30 วัน)',
|
||||
metricTotal: 'ทั้งหมด',
|
||||
metricSuccessRate: 'อัตราส่งสำเร็จ',
|
||||
metricOpenedRate: 'อัตราการเปิด',
|
||||
metricWindowDays: 'ช่วงเวลา(วัน)',
|
||||
exportAudit: 'ส่งออกบันทึก',
|
||||
noAuditData: 'ไม่มีบันทึกการตรวจสอบ',
|
||||
confirmUnbind: 'ยืนยันยกเลิกการผูกบัญชี WeCom ของผู้ใช้นี้หรือไม่?',
|
||||
fields: {
|
||||
userId: 'รหัสผู้ใช้ (user_id)',
|
||||
wecomUserId: 'WeCom UserId',
|
||||
wecomUnionId: 'UnionId (ไม่บังคับ)'
|
||||
wecomUnionId: 'UnionId (ไม่บังคับ)',
|
||||
enabled: 'เปิดใช้การเข้าสู่ระบบ WeCom',
|
||||
autoCreateUser: 'สร้างผู้ใช้ในระบบอัตโนมัติเมื่อไม่พบการจับคู่',
|
||||
corpId: 'Corp ID',
|
||||
agentId: 'Agent ID',
|
||||
secret: 'App Secret',
|
||||
redirectUri: 'OAuth Redirect URI',
|
||||
matchRules: 'กฎการจับคู่',
|
||||
matchOperator: 'ตัวดำเนินการจับคู่',
|
||||
firstLoginBindMode: 'โหมดการผูกบัญชีครั้งแรก',
|
||||
firstLoginInputFields: 'ฟิลด์ที่ใช้กรอกในครั้งแรก',
|
||||
employeeIdSource: 'แหล่งที่มาของรหัสพนักงาน',
|
||||
mobileNormalize: 'ปรับรูปแบบเบอร์โทรศัพท์',
|
||||
callbackToken: 'Callback Token',
|
||||
encodingAesKey: 'EncodingAESKey',
|
||||
callbackUrl: 'Callback URL',
|
||||
homepageUrl: 'Application Homepage URL',
|
||||
trustedDomain: 'Trusted Domain',
|
||||
publicBaseUrl: 'Public HTTPS base'
|
||||
},
|
||||
bindModes: {
|
||||
match_rules: 'จับคู่อัตโนมัติ',
|
||||
input_verify: 'ให้ผู้ใช้ยืนยันเอง'
|
||||
},
|
||||
copyFields: {
|
||||
publicBaseUrl: 'Public base URL',
|
||||
callbackUrl: 'Callback URL',
|
||||
callbackToken: 'Token',
|
||||
encodingAesKey: 'EncodingAESKey',
|
||||
oauthRedirectUri: 'OAuth Redirect URI',
|
||||
homepageUrl: 'Application Homepage URL',
|
||||
trustedDomain: 'Trusted Domain',
|
||||
authorizeApi: 'Authorize API (GET)',
|
||||
loginApi: 'Login API (POST)'
|
||||
},
|
||||
tips: {
|
||||
enabled: 'สวิตช์หลักสำหรับการเข้าสู่ระบบ WeCom',
|
||||
autoCreateUser: 'หากไม่พบผู้ใช้ในระบบ ให้สร้างใหม่อัตโนมัติ',
|
||||
corpId: 'รับมาจากข้อมูลแอป WeCom',
|
||||
agentId: 'AgentId ของแอปที่สร้างเองใน WeCom',
|
||||
secret: 'ความลับของแอปสำหรับขอ access token',
|
||||
redirectUri: 'ต้องตรงกับ trusted callback URL ที่ตั้งไว้ใน WeCom',
|
||||
matchRules: 'รองรับ employee_id,mobile,email คั่นด้วยจุลภาค',
|
||||
matchOperator: 'AND = ต้องตรงทุกฟิลด์, OR = ตรงอย่างน้อยหนึ่งฟิลด์',
|
||||
firstLoginBindMode: 'match_rules = ใช้ข้อมูลจาก WeCom จับคู่อัตโนมัติ, input_verify = ให้ผู้ใช้กรอกหนึ่งฟิลด์ในครั้งแรกเพื่อผูกบัญชี',
|
||||
firstLoginInputFields: 'ฟิลด์ที่อนุญาตให้กรอกในการผูกครั้งแรก คั่นด้วยจุลภาค รองรับ employee_id,mobile,email',
|
||||
employeeIdSource: 'ใช้ userid หรือ extattr:<name>',
|
||||
mobileNormalize: 'ล้างคำนำหน้า 86/0086 และสัญลักษณ์ก่อนจับคู่',
|
||||
callbackToken: 'ใช้สำหรับตรวจสอบลายเซ็น callback',
|
||||
encodingAesKey: 'ใช้กับ callback แบบเข้ารหัส',
|
||||
callbackUrl: 'URL สำหรับรับ callback ของข้อความ/เหตุการณ์จาก WeCom',
|
||||
homepageUrl: 'หน้าแรกของแอปที่เปิดใน WeCom',
|
||||
trustedDomain: 'โดเมนที่เชื่อถือได้สำหรับ OAuth ใน WeCom',
|
||||
publicBaseUrl:
|
||||
'ต้นทาง HTTPS ที่เข้าถึงได้จากภายนอกสำหรับเซิร์ฟเวอร์ WeCom ใช้สร้าง URL callback และ OAuth ลำดับความสำคัญ: ช่องนี้ → notify base URL → host ปัจจุบัน'
|
||||
},
|
||||
headers: {
|
||||
user: 'ผู้ใช้',
|
||||
@@ -2435,12 +3082,43 @@ const messages = {
|
||||
success: 'สำเร็จ',
|
||||
failed: 'ล้มเหลว'
|
||||
},
|
||||
auditMessages: {
|
||||
loginSuccess: 'เข้าสู่ระบบสำเร็จ',
|
||||
matchAttrMissing: 'ขาดฟิลด์ที่จำเป็นสำหรับการจับคู่: {field}',
|
||||
matchAmbiguous: 'ตรงกับหลายบัญชีในระบบ',
|
||||
bindRequired: 'ไม่พบบัญชีในระบบที่เชื่อมได้',
|
||||
bindInputRequired: 'กำลังรอให้ผู้ใช้กรอกข้อมูลบัญชีในระบบเพื่อผูกครั้งแรก',
|
||||
bindInputNotFound: 'ค่าที่ยืนยันโดยผู้ใช้ไม่ตรงกับบัญชีใดในระบบ',
|
||||
bindInputAmbiguous: 'ค่าที่ยืนยันโดยผู้ใช้ตรงกับหลายบัญชีในระบบ',
|
||||
bindConflict: 'บัญชี WeCom นี้เชื่อมกับบัญชีในระบบอื่นอยู่แล้ว',
|
||||
notInScope: 'สมาชิกอยู่นอกขอบเขตการมองเห็นของแอป หรือไม่ใช่สมาชิกขององค์กรนี้',
|
||||
invalidState: 'สถานะการเข้าสู่ระบบไม่ถูกต้องหรือหมดอายุ',
|
||||
missingCode: 'callback ไม่มี code',
|
||||
accountDisabled: 'บัญชีในระบบถูกปิดใช้งาน',
|
||||
authFailed: 'การยืนยันตัวตนผ่าน WeCom ล้มเหลว: {detail}',
|
||||
userFetchFailed: 'ดึงข้อมูลสมาชิกจาก WeCom ไม่สำเร็จ: {detail}',
|
||||
exception: 'ข้อผิดพลาด: {detail}'
|
||||
},
|
||||
auditMeta: {
|
||||
rules: 'กฎ: {rules}',
|
||||
result: 'ผลลัพธ์: {result}',
|
||||
errorCode: 'โค้ด: {code}'
|
||||
},
|
||||
auditResults: {
|
||||
already_bound: 'เข้าสู่ระบบผ่านบัญชี WeCom ที่ผูกไว้แล้ว',
|
||||
matched_and_bound: 'จับคู่ตามกฎและผูกบัญชีสำเร็จ',
|
||||
auto_created: 'สร้างบัญชีในระบบอัตโนมัติและผูกสำเร็จ',
|
||||
input_verified_and_bound: 'ยืนยันหนึ่งฟิลด์ในการเข้าสู่ระบบครั้งแรกและผูกบัญชีสำเร็จ'
|
||||
},
|
||||
msg: {
|
||||
bindInputRequired: 'กรุณากรอก user_id และ wecom_userid',
|
||||
bindFailed: 'ผูกบัญชีไม่สำเร็จ',
|
||||
bindSuccess: 'ผูกบัญชีสำเร็จ',
|
||||
unbindFailed: 'ยกเลิกการผูกไม่สำเร็จ',
|
||||
boundConflict: 'บัญชี WeCom นี้ถูกผูกไว้แล้ว: {detail}'
|
||||
boundConflict: 'บัญชี WeCom นี้ถูกผูกไว้แล้ว: {detail}',
|
||||
copySuccess: 'คัดลอกแล้ว',
|
||||
copyFailed: 'คัดลอกไม่สำเร็จ',
|
||||
publicBaseRequired: 'กรอกโดเมนหรือที่อยู่ HTTPS ภายนอกที่ถูกต้อง เช่น https://ai.company.com'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
export type WecomMatchField = 'employee_id' | 'mobile' | 'email';
|
||||
|
||||
export interface WecomNormalizedMatchRules {
|
||||
operator: 'AND' | 'OR';
|
||||
fields: WecomMatchField[];
|
||||
}
|
||||
|
||||
export interface WecomLoginErrorPayload {
|
||||
error?: string | null;
|
||||
error_code?: string | null;
|
||||
reason?: string | null;
|
||||
missing_field?: string | null;
|
||||
candidate_count?: number | null;
|
||||
match_rules?: unknown;
|
||||
}
|
||||
|
||||
export interface WecomLoginDialogContent {
|
||||
title: string;
|
||||
summary: string;
|
||||
details: string[];
|
||||
technical?: string;
|
||||
}
|
||||
|
||||
export interface WecomAuditRowLike {
|
||||
status?: string | null;
|
||||
reason?: string | null;
|
||||
error_code?: string | null;
|
||||
match_rules?: string | null;
|
||||
match_operator?: string | null;
|
||||
match_result?: string | null;
|
||||
}
|
||||
|
||||
type TranslateFn = (key: string, params?: Record<string, unknown>) => string;
|
||||
|
||||
const KNOWN_MATCH_FIELDS: WecomMatchField[] = ['employee_id', 'mobile', 'email'];
|
||||
|
||||
function cleanText(value: unknown): string {
|
||||
return typeof value === 'string' ? value.trim() : String(value ?? '').trim();
|
||||
}
|
||||
|
||||
function normalizeMatchField(value: unknown): WecomMatchField | null {
|
||||
const normalized = cleanText(value).toLowerCase();
|
||||
return KNOWN_MATCH_FIELDS.includes(normalized as WecomMatchField)
|
||||
? (normalized as WecomMatchField)
|
||||
: null;
|
||||
}
|
||||
|
||||
function getFieldGuide(field: WecomMatchField | null, t: TranslateFn): string {
|
||||
if (field === 'mobile') return t('login.wecomFieldGuides.mobile');
|
||||
if (field === 'email') return t('login.wecomFieldGuides.email');
|
||||
if (field === 'employee_id') return t('login.wecomFieldGuides.employee_id');
|
||||
return t('login.wecomFieldGuides.default');
|
||||
}
|
||||
|
||||
function extractMissingField(reason: string): WecomMatchField | null {
|
||||
if (!reason.startsWith('missing_attr:')) return null;
|
||||
return normalizeMatchField(reason.split(':', 2)[1]);
|
||||
}
|
||||
|
||||
function formatRuleList(fields: WecomMatchField[], operator: 'AND' | 'OR', t: TranslateFn): string {
|
||||
if (fields.length === 0) return t('login.wecomFieldLabels.match_rules');
|
||||
const labels = fields.map((field) => formatWecomFieldLabel(field, t));
|
||||
if (labels.length === 1) return labels[0] || t('login.wecomFieldLabels.match_rules');
|
||||
const joiner = operator === 'OR' ? ` ${t('login.wecomRuleJoin.or')} ` : ` ${t('login.wecomRuleJoin.and')} `;
|
||||
return labels.join(joiner);
|
||||
}
|
||||
|
||||
function buildTechnicalInfo(errorCode: string, rawError: string): string | undefined {
|
||||
const parts: string[] = [];
|
||||
if (errorCode) parts.push(`code=${errorCode}`);
|
||||
if (rawError) parts.push(rawError);
|
||||
return parts.length ? parts.join(' | ') : undefined;
|
||||
}
|
||||
|
||||
export function normalizeWecomMatchRules(
|
||||
input: unknown,
|
||||
fallbackOperator: unknown = 'AND',
|
||||
): WecomNormalizedMatchRules {
|
||||
let fieldsSource: unknown[] = [];
|
||||
let operator: 'AND' | 'OR' = cleanText(fallbackOperator).toUpperCase() === 'OR' ? 'OR' : 'AND';
|
||||
|
||||
if (Array.isArray(input)) {
|
||||
fieldsSource = input;
|
||||
} else if (typeof input === 'string') {
|
||||
fieldsSource = input.split(',');
|
||||
} else if (input && typeof input === 'object') {
|
||||
const maybeRules = input as Record<string, unknown>;
|
||||
fieldsSource = Array.isArray(maybeRules.fields) ? maybeRules.fields : [];
|
||||
operator = cleanText(maybeRules.operator).toUpperCase() === 'OR' ? 'OR' : operator;
|
||||
}
|
||||
|
||||
const fields = fieldsSource
|
||||
.map((value) => normalizeMatchField(value))
|
||||
.filter((value): value is WecomMatchField => Boolean(value));
|
||||
|
||||
return { operator, fields };
|
||||
}
|
||||
|
||||
export function formatWecomFieldLabel(field: unknown, t: TranslateFn): string {
|
||||
const normalized = normalizeMatchField(field);
|
||||
if (normalized === 'employee_id') return t('login.wecomFieldLabels.employee_id');
|
||||
if (normalized === 'mobile') return t('login.wecomFieldLabels.mobile');
|
||||
if (normalized === 'email') return t('login.wecomFieldLabels.email');
|
||||
return t('login.wecomFieldLabels.match_rules');
|
||||
}
|
||||
|
||||
export function formatWecomRuleText(
|
||||
input: unknown,
|
||||
t: TranslateFn,
|
||||
fallbackOperator: unknown = 'AND',
|
||||
): string {
|
||||
const rules = normalizeWecomMatchRules(input, fallbackOperator);
|
||||
return formatRuleList(rules.fields, rules.operator, t);
|
||||
}
|
||||
|
||||
export function buildWecomLoginDialogContent(
|
||||
payload: WecomLoginErrorPayload,
|
||||
t: TranslateFn,
|
||||
): WecomLoginDialogContent {
|
||||
const rawError = cleanText(payload.error);
|
||||
const errorCode = cleanText(payload.error_code);
|
||||
const reason = cleanText(payload.reason);
|
||||
const rulesText = formatWecomRuleText(payload.match_rules, t);
|
||||
const technical = buildTechnicalInfo(errorCode, rawError);
|
||||
|
||||
if (errorCode === 'WECOM_MATCH_ATTR_MISSING') {
|
||||
const missingField = normalizeMatchField(payload.missing_field) || extractMissingField(reason);
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.matchAttrMissing'),
|
||||
summary: t('login.wecomDialogSummaries.matchAttrMissing', {
|
||||
field: formatWecomFieldLabel(missingField, t),
|
||||
}),
|
||||
details: [
|
||||
t('login.wecomDialogDetails.currentRules', { rules: rulesText }),
|
||||
getFieldGuide(missingField, t),
|
||||
t('login.wecomDialogDetails.bindFallback'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_MATCH_AMBIGUOUS') {
|
||||
const candidateCount = Number(payload.candidate_count || 0);
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.matchAmbiguous'),
|
||||
summary: candidateCount > 1
|
||||
? t('login.wecomDialogSummaries.matchAmbiguousWithCount', { count: candidateCount })
|
||||
: t('login.wecomDialogSummaries.matchAmbiguous'),
|
||||
details: [
|
||||
t('login.wecomDialogDetails.currentRules', { rules: rulesText }),
|
||||
t('login.wecomDialogDetails.ambiguousAction'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_REQUIRED') {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.bindRequired'),
|
||||
summary: t('login.wecomDialogSummaries.bindRequired'),
|
||||
details: [
|
||||
t('login.wecomDialogDetails.currentRules', { rules: rulesText }),
|
||||
t('login.wecomDialogDetails.bindRequiredAction'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_INPUT_REQUIRED') {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.bindInputRequired'),
|
||||
summary: t('login.wecomDialogSummaries.bindInputRequired'),
|
||||
details: [
|
||||
t('login.wecomDialogDetails.bindInputRequiredAction'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_CONFLICT') {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.bindConflict'),
|
||||
summary: t('login.wecomDialogSummaries.bindConflict'),
|
||||
details: [
|
||||
rawError || t('login.wecomDialogDetails.bindConflictAction'),
|
||||
t('login.wecomDialogDetails.bindConflictAction'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_NOT_IN_AGENT_SCOPE') {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.notInScope'),
|
||||
summary: t('login.wecomDialogSummaries.notInScope'),
|
||||
details: [
|
||||
rawError || t('login.wecomDialogDetails.notInScopeAction'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (rawError.includes('Invalid or expired WeCom state')) {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.stateExpired'),
|
||||
summary: t('login.wecomStateExpired'),
|
||||
details: [t('login.wecomDialogDetails.retryLogin')],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (rawError.includes('Account is disabled')) {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.accountDisabled'),
|
||||
summary: t('login.wecomAccountDisabled'),
|
||||
details: [t('login.wecomDialogDetails.contactAdmin')],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
if (rawError.includes('bind WeCom account') || rawError.includes('No linked account found')) {
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.bindRequired'),
|
||||
summary: t('login.wecomDialogSummaries.bindRequired'),
|
||||
details: [
|
||||
t('login.wecomDialogDetails.currentRules', { rules: rulesText }),
|
||||
t('login.wecomDialogDetails.bindRequiredAction'),
|
||||
],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: t('login.wecomDialogTitles.loginFailed'),
|
||||
summary: rawError || t('login.wecomLoginFailed'),
|
||||
details: [t('login.wecomDialogDetails.retryLogin')],
|
||||
technical,
|
||||
};
|
||||
}
|
||||
|
||||
function formatWecomMatchResult(result: string, t: TranslateFn): string {
|
||||
if (result === 'already_bound') return t('admin.wecom.auditResults.already_bound');
|
||||
if (result === 'matched_and_bound') return t('admin.wecom.auditResults.matched_and_bound');
|
||||
if (result === 'auto_created') return t('admin.wecom.auditResults.auto_created');
|
||||
if (result === 'input_verified_and_bound') return t('admin.wecom.auditResults.input_verified_and_bound');
|
||||
return result || '-';
|
||||
}
|
||||
|
||||
export function formatWecomAuditReason(row: WecomAuditRowLike, t: TranslateFn): string {
|
||||
const reason = cleanText(row.reason);
|
||||
const errorCode = cleanText(row.error_code);
|
||||
|
||||
if (cleanText(row.status) === 'success') {
|
||||
const result = cleanText(row.match_result);
|
||||
return result ? formatWecomMatchResult(result, t) : t('admin.wecom.auditMessages.loginSuccess');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_MATCH_ATTR_MISSING') {
|
||||
const field = extractMissingField(reason);
|
||||
return t('admin.wecom.auditMessages.matchAttrMissing', {
|
||||
field: formatWecomFieldLabel(field, t),
|
||||
});
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_MATCH_AMBIGUOUS') {
|
||||
return t('admin.wecom.auditMessages.matchAmbiguous');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_REQUIRED') {
|
||||
return t('admin.wecom.auditMessages.bindRequired');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_CONFLICT') {
|
||||
return t('admin.wecom.auditMessages.bindConflict');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_INPUT_REQUIRED') {
|
||||
return t('admin.wecom.auditMessages.bindInputRequired');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_INPUT_NOT_FOUND') {
|
||||
return t('admin.wecom.auditMessages.bindInputNotFound');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_BIND_INPUT_AMBIGUOUS') {
|
||||
return t('admin.wecom.auditMessages.bindInputAmbiguous');
|
||||
}
|
||||
|
||||
if (errorCode === 'WECOM_NOT_IN_AGENT_SCOPE') {
|
||||
return t('admin.wecom.auditMessages.notInScope');
|
||||
}
|
||||
|
||||
if (reason === 'invalid_state') return t('admin.wecom.auditMessages.invalidState');
|
||||
if (reason === 'missing_code') return t('admin.wecom.auditMessages.missingCode');
|
||||
if (reason === 'account_disabled') return t('admin.wecom.auditMessages.accountDisabled');
|
||||
if (reason.startsWith('auth_failed:')) {
|
||||
return t('admin.wecom.auditMessages.authFailed', {
|
||||
detail: reason.split(':', 2)[1] || '-',
|
||||
});
|
||||
}
|
||||
if (reason.startsWith('user_fetch_failed:')) {
|
||||
return t('admin.wecom.auditMessages.userFetchFailed', {
|
||||
detail: reason.split(':', 2)[1] || '-',
|
||||
});
|
||||
}
|
||||
if (reason.startsWith('not_in_agent_scope:')) return t('admin.wecom.auditMessages.notInScope');
|
||||
if (reason.startsWith('exception:')) {
|
||||
return t('admin.wecom.auditMessages.exception', {
|
||||
detail: reason.split(':', 2)[1] || '-',
|
||||
});
|
||||
}
|
||||
|
||||
return reason || '-';
|
||||
}
|
||||
|
||||
export function buildWecomAuditMeta(row: WecomAuditRowLike, t: TranslateFn): string[] {
|
||||
const items: string[] = [];
|
||||
const rulesText = formatWecomRuleText(row.match_rules, t, row.match_operator);
|
||||
if (cleanText(row.match_rules)) {
|
||||
items.push(t('admin.wecom.auditMeta.rules', { rules: rulesText }));
|
||||
}
|
||||
if (cleanText(row.match_result)) {
|
||||
items.push(t('admin.wecom.auditMeta.result', {
|
||||
result: formatWecomMatchResult(cleanText(row.match_result), t),
|
||||
}));
|
||||
}
|
||||
if (cleanText(row.error_code)) {
|
||||
items.push(t('admin.wecom.auditMeta.errorCode', { code: cleanText(row.error_code) }));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import { config } from '../config';
|
||||
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
||||
import { loadReportLayoutPref, saveReportLayoutPref } from '../composables/useReportLayoutStorage';
|
||||
import { buildWecomAuditMeta, formatWecomAuditReason } from '../utils/wecom';
|
||||
import {
|
||||
ArrowLeft,
|
||||
// Save,
|
||||
@@ -38,7 +39,8 @@ import {
|
||||
Megaphone,
|
||||
Link2,
|
||||
Unlink2,
|
||||
RefreshCw
|
||||
RefreshCw,
|
||||
CircleHelp
|
||||
} from 'lucide-vue-next';
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
@@ -157,6 +159,61 @@ interface LoginAuditRow {
|
||||
ip?: string | null;
|
||||
user_agent?: string | null;
|
||||
created_at?: string | null;
|
||||
error_code?: string | null;
|
||||
match_rules?: string | null;
|
||||
match_operator?: string | null;
|
||||
match_result?: string | null;
|
||||
}
|
||||
|
||||
interface WecomNotifySettings {
|
||||
enabled: boolean;
|
||||
base_url: string;
|
||||
events: string[];
|
||||
}
|
||||
|
||||
interface WecomNotifyMetrics {
|
||||
window_days: number;
|
||||
total: number;
|
||||
sent: number;
|
||||
failed: number;
|
||||
send_success_rate: number;
|
||||
opened_24h: number;
|
||||
opened_24h_rate: number;
|
||||
by_event: Record<string, { sent: number; failed: number }>;
|
||||
}
|
||||
|
||||
interface WecomSystemSettings {
|
||||
enabled: boolean;
|
||||
corp_id: string;
|
||||
agent_id: string;
|
||||
secret: string;
|
||||
redirect_uri: string;
|
||||
auto_create_user: boolean;
|
||||
match_rules: string;
|
||||
match_operator: 'AND' | 'OR';
|
||||
first_login_bind_mode: 'match_rules' | 'input_verify';
|
||||
first_login_input_fields: string;
|
||||
employee_id_source: string;
|
||||
mobile_normalize: boolean;
|
||||
callback_token: string;
|
||||
encoding_aes_key: string;
|
||||
callback_url: string;
|
||||
homepage_url: string;
|
||||
trusted_domain: string;
|
||||
/** HTTPS origin shown to WeCom (e.g. https://ai.company.com) */
|
||||
public_base_url: string;
|
||||
}
|
||||
|
||||
interface WecomIntegrationManifest {
|
||||
public_base_url: string;
|
||||
callback_url: string;
|
||||
callback_token: string;
|
||||
encoding_aes_key: string;
|
||||
oauth_redirect_uri: string;
|
||||
homepage_url: string;
|
||||
trusted_domain: string;
|
||||
authorize_api: string;
|
||||
login_api: string;
|
||||
}
|
||||
|
||||
// 获取路由实例,用于页面跳转
|
||||
@@ -316,6 +373,34 @@ const wecomBoundOnly = ref(false);
|
||||
const wecomAuditSourceFilter = ref<'all' | 'wecom' | 'password'>('all');
|
||||
const wecomAuditStatusFilter = ref<'all' | 'success' | 'failed'>('all');
|
||||
const filteredWecomLoginAudits = computed(() => wecomLoginAudits.value);
|
||||
const wecomNotifySettings = ref<WecomNotifySettings>({
|
||||
enabled: true,
|
||||
base_url: '',
|
||||
events: [],
|
||||
});
|
||||
const wecomNotifyEventsText = ref('');
|
||||
const wecomNotifyMetrics = ref<WecomNotifyMetrics | null>(null);
|
||||
const wecomSystemSettings = ref<WecomSystemSettings>({
|
||||
enabled: true,
|
||||
corp_id: '',
|
||||
agent_id: '',
|
||||
secret: '',
|
||||
redirect_uri: '',
|
||||
auto_create_user: true,
|
||||
match_rules: 'employee_id,mobile',
|
||||
match_operator: 'AND',
|
||||
first_login_bind_mode: 'match_rules',
|
||||
first_login_input_fields: 'employee_id,mobile,email',
|
||||
employee_id_source: 'userid',
|
||||
mobile_normalize: true,
|
||||
callback_token: '',
|
||||
encoding_aes_key: '',
|
||||
callback_url: '',
|
||||
homepage_url: '',
|
||||
trusted_domain: '',
|
||||
public_base_url: '',
|
||||
});
|
||||
const wecomIntegrationManifest = ref<WecomIntegrationManifest | null>(null);
|
||||
|
||||
// Batch Operation Refs
|
||||
const selectedUserIds = ref<number[]>([]);
|
||||
@@ -750,8 +835,210 @@ const loadWecomAudits = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadWecomSystemSettings = async () => {
|
||||
try {
|
||||
const res = await fetch('/api/admin/wecom/system-settings', { headers: getAuthHeaders() });
|
||||
if (res.ok) {
|
||||
wecomSystemSettings.value = await res.json();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error loading WeCom system settings:', e);
|
||||
}
|
||||
};
|
||||
|
||||
const loadWecomIntegrationManifest = async () => {
|
||||
try {
|
||||
const res = await fetch('/api/admin/wecom/integration-manifest', { headers: getAuthHeaders() });
|
||||
if (res.ok) {
|
||||
wecomIntegrationManifest.value = await res.json();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error loading WeCom integration manifest:', e);
|
||||
}
|
||||
};
|
||||
|
||||
const copyText = async (text: string) => {
|
||||
if (!text) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
alert(t('admin.wecom.msg.copySuccess'));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert(t('admin.wecom.msg.copyFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
const getWecomAuditReasonText = (row: LoginAuditRow) => formatWecomAuditReason(row, t);
|
||||
|
||||
const getWecomAuditMetaText = (row: LoginAuditRow) => buildWecomAuditMeta(row, t).join(' | ');
|
||||
|
||||
function normalizeWecomPublicBase(input: string): string | null {
|
||||
const raw = (input || '').trim();
|
||||
if (!raw) return null;
|
||||
let url = raw;
|
||||
if (!/^https?:\/\//i.test(url)) url = `https://${url}`;
|
||||
url = url.replace(/\/+$/, '');
|
||||
try {
|
||||
const u = new URL(url);
|
||||
if (!u.hostname) return null;
|
||||
return `${u.protocol}//${u.host}`;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function ensureWecomIntegrationManifest() {
|
||||
if (!wecomIntegrationManifest.value) {
|
||||
wecomIntegrationManifest.value = {
|
||||
public_base_url: '',
|
||||
callback_url: '',
|
||||
callback_token: '',
|
||||
encoding_aes_key: '',
|
||||
oauth_redirect_uri: '',
|
||||
homepage_url: '',
|
||||
trusted_domain: '',
|
||||
authorize_api: '',
|
||||
login_api: '',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function patchWecomIntegrationManifestFromSettings() {
|
||||
ensureWecomIntegrationManifest();
|
||||
const s = wecomSystemSettings.value;
|
||||
const base = normalizeWecomPublicBase(s.public_base_url);
|
||||
const prev = wecomIntegrationManifest.value!;
|
||||
wecomIntegrationManifest.value = {
|
||||
...prev,
|
||||
callback_token: s.callback_token || '',
|
||||
encoding_aes_key: s.encoding_aes_key || '',
|
||||
};
|
||||
if (!base) return;
|
||||
wecomIntegrationManifest.value = {
|
||||
...wecomIntegrationManifest.value!,
|
||||
public_base_url: base,
|
||||
callback_url: s.callback_url || `${base}/api/user/wecom/callback`,
|
||||
oauth_redirect_uri: s.redirect_uri || `${base}/workspace`,
|
||||
homepage_url: s.homepage_url || `${base}/workspace`,
|
||||
trusted_domain: s.trusted_domain || new URL(base).hostname,
|
||||
authorize_api: `${base}/api/user/wecom/authorize-url`,
|
||||
login_api: `${base}/api/user/wecom/login`,
|
||||
};
|
||||
}
|
||||
|
||||
function generateWecomAddressesFromPublicBase() {
|
||||
const base = normalizeWecomPublicBase(wecomSystemSettings.value.public_base_url);
|
||||
if (!base) {
|
||||
alert(t('admin.wecom.msg.publicBaseRequired'));
|
||||
return;
|
||||
}
|
||||
const host = new URL(base).hostname;
|
||||
wecomSystemSettings.value.callback_url = `${base}/api/user/wecom/callback`;
|
||||
wecomSystemSettings.value.homepage_url = `${base}/workspace`;
|
||||
wecomSystemSettings.value.trusted_domain = host;
|
||||
wecomSystemSettings.value.redirect_uri = `${base}/workspace`;
|
||||
patchWecomIntegrationManifestFromSettings();
|
||||
}
|
||||
|
||||
function generateWecomCallbackToken() {
|
||||
const bytes = new Uint8Array(24);
|
||||
crypto.getRandomValues(bytes);
|
||||
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
||||
wecomSystemSettings.value.callback_token = hex;
|
||||
patchWecomIntegrationManifestFromSettings();
|
||||
}
|
||||
|
||||
function generateWecomEncodingAesKey() {
|
||||
const bytes = new Uint8Array(32);
|
||||
crypto.getRandomValues(bytes);
|
||||
let bin = '';
|
||||
for (let i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]!);
|
||||
const b64 = btoa(bin);
|
||||
const key43 = b64.replace(/=+$/, '');
|
||||
wecomSystemSettings.value.encoding_aes_key = key43;
|
||||
patchWecomIntegrationManifestFromSettings();
|
||||
}
|
||||
|
||||
const saveWecomSystemSettings = async () => {
|
||||
isSaving.value = true;
|
||||
try {
|
||||
const payload = {
|
||||
...wecomSystemSettings.value,
|
||||
match_operator: (wecomSystemSettings.value.match_operator || 'AND').toUpperCase(),
|
||||
};
|
||||
const res = await fetch('/api/admin/wecom/system-settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(data.error || t('admin.msg.failed'));
|
||||
wecomSystemSettings.value = data.settings || wecomSystemSettings.value;
|
||||
await loadWecomIntegrationManifest();
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
alert(e.message || t('admin.msg.requestFailed'));
|
||||
} finally {
|
||||
isSaving.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadWecomNotifySettings = async () => {
|
||||
try {
|
||||
const res = await fetch('/api/admin/wecom/notify-settings', { headers: getAuthHeaders() });
|
||||
if (res.ok) {
|
||||
wecomNotifySettings.value = await res.json();
|
||||
wecomNotifyEventsText.value = (wecomNotifySettings.value.events || []).join(',');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error loading WeCom notify settings:', e);
|
||||
}
|
||||
};
|
||||
|
||||
const saveWecomNotifySettings = async () => {
|
||||
isSaving.value = true;
|
||||
try {
|
||||
wecomNotifySettings.value.events = wecomNotifyEventsText.value
|
||||
.split(',')
|
||||
.map((x) => x.trim())
|
||||
.filter(Boolean);
|
||||
const res = await fetch('/api/admin/wecom/notify-settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(wecomNotifySettings.value),
|
||||
});
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(data.error || t('admin.msg.failed'));
|
||||
wecomNotifySettings.value = data.settings || wecomNotifySettings.value;
|
||||
await loadWecomNotifyMetrics();
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
alert(e.message || t('admin.msg.requestFailed'));
|
||||
} finally {
|
||||
isSaving.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadWecomNotifyMetrics = async () => {
|
||||
try {
|
||||
const res = await fetch('/api/admin/wecom/notify-metrics', { headers: getAuthHeaders() });
|
||||
if (res.ok) {
|
||||
wecomNotifyMetrics.value = await res.json();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error loading WeCom notify metrics:', e);
|
||||
}
|
||||
};
|
||||
|
||||
const refreshWecomData = async () => {
|
||||
await Promise.all([loadWecomBindings(), loadWecomAudits()]);
|
||||
await Promise.all([
|
||||
loadWecomBindings(),
|
||||
loadWecomAudits(),
|
||||
loadWecomSystemSettings(),
|
||||
loadWecomIntegrationManifest(),
|
||||
loadWecomNotifySettings(),
|
||||
loadWecomNotifyMetrics(),
|
||||
]);
|
||||
};
|
||||
|
||||
const bindWecomUser = async () => {
|
||||
@@ -819,7 +1106,12 @@ const exportWecomAudits = () => {
|
||||
Source: row.source || '',
|
||||
Username: row.username || '',
|
||||
Status: row.status || '',
|
||||
Reason: row.reason || '',
|
||||
Reason: getWecomAuditReasonText(row),
|
||||
Meta: getWecomAuditMetaText(row),
|
||||
ErrorCode: row.error_code || '',
|
||||
MatchRules: row.match_rules || '',
|
||||
MatchOperator: row.match_operator || '',
|
||||
MatchResult: row.match_result || '',
|
||||
IP: row.ip || '',
|
||||
WecomUserId: row.wecom_userid || '',
|
||||
UserAgent: row.user_agent || '',
|
||||
@@ -2864,6 +3156,227 @@ const handlePermissionImport = async (event: Event) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm p-5 space-y-4">
|
||||
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.systemSettings') }}</h3>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<label class="inline-flex items-center gap-2 text-sm text-gray-700">
|
||||
<input v-model="wecomSystemSettings.enabled" type="checkbox" class="w-4 h-4 rounded text-blue-600 border-gray-300" />
|
||||
{{ t('admin.wecom.fields.enabled') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.enabled')" />
|
||||
</label>
|
||||
<label class="inline-flex items-center gap-2 text-sm text-gray-700">
|
||||
<input v-model="wecomSystemSettings.auto_create_user" type="checkbox" class="w-4 h-4 rounded text-blue-600 border-gray-300" />
|
||||
{{ t('admin.wecom.fields.autoCreateUser') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.autoCreateUser')" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.corpId') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.corpId')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.corp_id" class="input-field" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.agentId') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.agentId')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.agent_id" class="input-field" />
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.secret') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.secret')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.secret" type="password" class="input-field" />
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.redirectUri') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.redirectUri')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.redirect_uri" class="input-field" />
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.publicBaseUrl') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.publicBaseUrl')" />
|
||||
</label>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<input
|
||||
v-model="wecomSystemSettings.public_base_url"
|
||||
:placeholder="t('admin.wecom.publicBasePlaceholder')"
|
||||
class="input-field flex-1 min-w-[200px]"
|
||||
/>
|
||||
<button type="button" class="btn-secondary px-4 shrink-0" @click="generateWecomAddressesFromPublicBase">
|
||||
{{ t('admin.wecom.generateAddresses') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.callbackToken') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.callbackToken')" />
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
<input v-model="wecomSystemSettings.callback_token" class="input-field flex-1 min-w-0" />
|
||||
<button type="button" class="btn-secondary px-3 shrink-0 text-xs" @click="generateWecomCallbackToken">
|
||||
{{ t('admin.wecom.generateToken') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.encodingAesKey') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.encodingAesKey')" />
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
<input v-model="wecomSystemSettings.encoding_aes_key" class="input-field flex-1 min-w-0 font-mono text-xs" />
|
||||
<button type="button" class="btn-secondary px-3 shrink-0 text-xs" @click="generateWecomEncodingAesKey">
|
||||
{{ t('admin.wecom.generateEncodingKey') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.callbackUrl') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.callbackUrl')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.callback_url" class="input-field" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.homepageUrl') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.homepageUrl')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.homepage_url" class="input-field" />
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.trustedDomain') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.trustedDomain')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.trusted_domain" class="input-field" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.matchRules') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.matchRules')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.match_rules" class="input-field" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.matchOperator') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.matchOperator')" />
|
||||
</label>
|
||||
<select v-model="wecomSystemSettings.match_operator" class="input-field">
|
||||
<option value="AND">AND</option>
|
||||
<option value="OR">OR</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.firstLoginBindMode') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.firstLoginBindMode')" />
|
||||
</label>
|
||||
<select v-model="wecomSystemSettings.first_login_bind_mode" class="input-field">
|
||||
<option value="match_rules">{{ t('admin.wecom.bindModes.match_rules') }}</option>
|
||||
<option value="input_verify">{{ t('admin.wecom.bindModes.input_verify') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.firstLoginInputFields') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.firstLoginInputFields')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.first_login_input_fields" class="input-field" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-gray-500">
|
||||
{{ t('admin.wecom.fields.employeeIdSource') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.employeeIdSource')" />
|
||||
</label>
|
||||
<input v-model="wecomSystemSettings.employee_id_source" class="input-field" />
|
||||
</div>
|
||||
<label class="inline-flex items-center gap-2 text-sm text-gray-700 pt-7">
|
||||
<input v-model="wecomSystemSettings.mobile_normalize" type="checkbox" class="w-4 h-4 rounded text-blue-600 border-gray-300" />
|
||||
{{ t('admin.wecom.fields.mobileNormalize') }}
|
||||
<CircleHelp class="w-3.5 h-3.5 text-gray-400" :title="t('admin.wecom.tips.mobileNormalize')" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button @click="saveWecomSystemSettings" :disabled="isSaving" class="btn-primary px-5 py-2 disabled:opacity-60">
|
||||
{{ t('admin.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
|
||||
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm p-5 space-y-4">
|
||||
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.notifySettings') }}</h3>
|
||||
<label class="inline-flex items-center gap-2 text-sm text-gray-700">
|
||||
<input v-model="wecomNotifySettings.enabled" type="checkbox" class="w-4 h-4 rounded text-blue-600 border-gray-300" />
|
||||
{{ t('admin.wecom.notifyEnabled') }}
|
||||
</label>
|
||||
<input v-model="wecomNotifySettings.base_url" :placeholder="t('admin.wecom.notifyBaseUrl')" class="input-field" />
|
||||
<input v-model="wecomNotifyEventsText" :placeholder="t('admin.wecom.notifyEvents')" class="input-field" />
|
||||
<div class="flex justify-end">
|
||||
<button @click="saveWecomNotifySettings" :disabled="isSaving" class="btn-primary px-5 py-2 disabled:opacity-60">
|
||||
{{ t('admin.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm p-5 space-y-4">
|
||||
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.notifyMetrics') }}</h3>
|
||||
<div v-if="wecomNotifyMetrics" class="grid grid-cols-2 gap-3 text-sm">
|
||||
<div class="rounded-lg bg-gray-50 px-3 py-2">
|
||||
<div class="text-gray-500">{{ t('admin.wecom.metricTotal') }}</div>
|
||||
<div class="text-lg font-semibold text-gray-900">{{ wecomNotifyMetrics.total }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-gray-50 px-3 py-2">
|
||||
<div class="text-gray-500">{{ t('admin.wecom.metricSuccessRate') }}</div>
|
||||
<div class="text-lg font-semibold text-emerald-700">{{ wecomNotifyMetrics.send_success_rate }}%</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-gray-50 px-3 py-2">
|
||||
<div class="text-gray-500">{{ t('admin.wecom.metricOpenedRate') }}</div>
|
||||
<div class="text-lg font-semibold text-blue-700">{{ wecomNotifyMetrics.opened_24h_rate }}%</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-gray-50 px-3 py-2">
|
||||
<div class="text-gray-500">{{ t('admin.wecom.metricWindowDays') }}</div>
|
||||
<div class="text-lg font-semibold text-gray-900">{{ wecomNotifyMetrics.window_days }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm p-5 space-y-4">
|
||||
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.integrationCopyTitle') }}</h3>
|
||||
<p class="text-xs text-gray-500">{{ t('admin.wecom.integrationCopyDesc') }}</p>
|
||||
<p class="text-xs text-amber-800 bg-amber-50 border border-amber-100 rounded-lg px-3 py-2">{{ t('admin.wecom.integrationCopySecretsNote') }}</p>
|
||||
<div v-if="wecomIntegrationManifest" class="grid grid-cols-1 gap-3">
|
||||
<div v-for="item in [
|
||||
{ key: 'public_base_url', label: t('admin.wecom.copyFields.publicBaseUrl') },
|
||||
{ key: 'callback_url', label: t('admin.wecom.copyFields.callbackUrl') },
|
||||
{ key: 'callback_token', label: t('admin.wecom.copyFields.callbackToken') },
|
||||
{ key: 'encoding_aes_key', label: t('admin.wecom.copyFields.encodingAesKey') },
|
||||
{ key: 'oauth_redirect_uri', label: t('admin.wecom.copyFields.oauthRedirectUri') },
|
||||
{ key: 'homepage_url', label: t('admin.wecom.copyFields.homepageUrl') },
|
||||
{ key: 'trusted_domain', label: t('admin.wecom.copyFields.trustedDomain') },
|
||||
{ key: 'authorize_api', label: t('admin.wecom.copyFields.authorizeApi') },
|
||||
{ key: 'login_api', label: t('admin.wecom.copyFields.loginApi') },
|
||||
]" :key="item.key">
|
||||
<label class="mb-1.5 block text-xs text-gray-500">{{ item.label }}</label>
|
||||
<div class="flex gap-2">
|
||||
<input :value="(wecomIntegrationManifest as any)[item.key] || ''" readonly class="input-field flex-1 bg-gray-50 font-mono text-xs" />
|
||||
<button class="btn-secondary px-3" @click="copyText(String((wecomIntegrationManifest as any)[item.key] || ''))">{{ t('admin.wecom.copy') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden">
|
||||
<div class="px-5 py-4 border-b border-gray-100 flex items-center justify-between">
|
||||
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.bindingList') }}</h3>
|
||||
@@ -2959,7 +3472,14 @@ const handlePermissionImport = async (event: Event) => {
|
||||
{{ t('admin.wecom.auditStatus.' + row.status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-xs text-gray-600 max-w-[360px] truncate" :title="row.reason || ''">{{ row.reason || '-' }}</td>
|
||||
<td class="px-4 py-3 text-xs text-gray-600 max-w-[360px] align-top">
|
||||
<div class="max-w-[360px] whitespace-normal break-words">
|
||||
<div class="text-xs text-gray-700 leading-5">{{ getWecomAuditReasonText(row) }}</div>
|
||||
<div v-if="getWecomAuditMetaText(row)" class="mt-1 text-[11px] text-gray-400 leading-5" :title="getWecomAuditMetaText(row)">
|
||||
{{ getWecomAuditMetaText(row) }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-xs text-gray-600 font-mono">{{ row.ip || '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -3708,4 +4228,3 @@ const handlePermissionImport = async (event: Event) => {
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -9,6 +9,13 @@ import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { config } from '../config';
|
||||
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
||||
import {
|
||||
buildWecomLoginDialogContent,
|
||||
formatWecomFieldLabel,
|
||||
normalizeWecomMatchRules,
|
||||
type WecomLoginDialogContent,
|
||||
type WecomMatchField,
|
||||
} from '../utils/wecom';
|
||||
import {
|
||||
Settings,
|
||||
LayoutGrid,
|
||||
@@ -81,6 +88,16 @@ interface Announcement {
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
interface WecomBindPromptState {
|
||||
binding_token: string;
|
||||
allowed_fields: WecomMatchField[];
|
||||
wecom_name?: string;
|
||||
field: WecomMatchField;
|
||||
value: string;
|
||||
submitting: boolean;
|
||||
error: string;
|
||||
}
|
||||
|
||||
// State
|
||||
const isLoading = ref(true);
|
||||
const currentUser = ref<{ id: number; username: string; role: string; default_agent_id?: number | null } | null>(null);
|
||||
@@ -118,6 +135,14 @@ const registerForm = ref({ username: '', password: '', email: '', real_name: '',
|
||||
const forgotPasswordForm = ref({ email: '' });
|
||||
const pendingAgentId = ref<number | null>(null);
|
||||
const isWecomLoggingIn = ref(false);
|
||||
const wecomEntryHint = ref('');
|
||||
const wecomLoginDialog = ref<WecomLoginDialogContent | null>(null);
|
||||
const wecomBindPrompt = ref<WecomBindPromptState | null>(null);
|
||||
|
||||
const clearWecomCallbackQuery = () => {
|
||||
const nextUrl = `${window.location.pathname}${window.location.hash || ''}`;
|
||||
window.history.replaceState({}, '', nextUrl);
|
||||
};
|
||||
|
||||
const handleForgotPassword = async () => {
|
||||
if (!forgotPasswordForm.value.email) {
|
||||
@@ -452,6 +477,85 @@ const handleWecomLogin = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const openWecomLoginDialog = (payload: Record<string, unknown>) => {
|
||||
wecomLoginDialog.value = buildWecomLoginDialogContent(payload, t);
|
||||
};
|
||||
|
||||
const openWecomBindPrompt = (payload: Record<string, unknown>) => {
|
||||
const allowedFields = normalizeWecomMatchRules(payload.allowed_fields).fields;
|
||||
const fallbackFields: WecomMatchField[] = ['employee_id', 'mobile', 'email'];
|
||||
const fields: WecomMatchField[] = allowedFields.length ? allowedFields : fallbackFields;
|
||||
wecomBindPrompt.value = {
|
||||
binding_token: String(payload.binding_token || ''),
|
||||
allowed_fields: fields,
|
||||
wecom_name: String(payload.wecom_name || ''),
|
||||
field: fields[0] || 'employee_id',
|
||||
value: '',
|
||||
submitting: false,
|
||||
error: '',
|
||||
};
|
||||
};
|
||||
|
||||
const formatWecomBindPromptError = (payload: Record<string, unknown>) => {
|
||||
const errorCode = String(payload.error_code || '');
|
||||
if (errorCode === 'WECOM_BIND_INPUT_NOT_FOUND') return t('login.wecomBindInputNotFound');
|
||||
if (errorCode === 'WECOM_BIND_INPUT_AMBIGUOUS') return t('login.wecomBindInputAmbiguous');
|
||||
if (errorCode === 'WECOM_BIND_SESSION_EXPIRED') return t('login.wecomBindSessionExpired');
|
||||
if (errorCode === 'WECOM_BIND_CONFLICT') return t('login.wecomBindConflict');
|
||||
if (errorCode === 'WECOM_BIND_FIELD_NOT_ALLOWED') return t('login.wecomBindFieldNotAllowed');
|
||||
if (errorCode === 'WECOM_BIND_INPUT_VALUE_REQUIRED') return t('login.wecomBindValueRequired');
|
||||
if (String(payload.error || '').includes('Account is disabled')) return t('login.wecomAccountDisabled');
|
||||
return String(payload.error || t('login.wecomLoginFailed'));
|
||||
};
|
||||
|
||||
const submitWecomCompleteBind = async () => {
|
||||
if (!wecomBindPrompt.value) return;
|
||||
if (!wecomBindPrompt.value.value.trim()) {
|
||||
wecomBindPrompt.value.error = t('login.wecomBindValueRequired');
|
||||
return;
|
||||
}
|
||||
|
||||
wecomBindPrompt.value.submitting = true;
|
||||
wecomBindPrompt.value.error = '';
|
||||
try {
|
||||
const api = config.auth.wecom.completeBindApi || '/api/user/wecom/complete-bind';
|
||||
const res = await fetch(api, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
binding_token: wecomBindPrompt.value.binding_token,
|
||||
field: wecomBindPrompt.value.field,
|
||||
value: wecomBindPrompt.value.value.trim(),
|
||||
}),
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
wecomBindPrompt.value.error = formatWecomBindPromptError(data);
|
||||
if (String(data.error_code || '') === 'WECOM_BIND_SESSION_EXPIRED') {
|
||||
openWecomLoginDialog(data);
|
||||
wecomBindPrompt.value = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
wecomLoginDialog.value = null;
|
||||
persistLoginUser(data);
|
||||
sessionStorage.removeItem('hxops_wecom_state');
|
||||
wecomBindPrompt.value = null;
|
||||
window.history.replaceState({}, '', '/workspace');
|
||||
await fetchHome();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (wecomBindPrompt.value) {
|
||||
wecomBindPrompt.value.error = t('login.wecomLoginFailed');
|
||||
}
|
||||
} finally {
|
||||
if (wecomBindPrompt.value) {
|
||||
wecomBindPrompt.value.submitting = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const tryWecomCallbackLogin = async () => {
|
||||
if (!config.auth?.wecom?.enabled) return false;
|
||||
|
||||
@@ -462,7 +566,8 @@ const tryWecomCallbackLogin = async () => {
|
||||
|
||||
const expectedState = sessionStorage.getItem('hxops_wecom_state');
|
||||
if (expectedState && state && state !== expectedState) {
|
||||
alert(t('login.wecomInvalidState'));
|
||||
openWecomLoginDialog({ error: 'Invalid or expired WeCom state' });
|
||||
clearWecomCallbackQuery();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -476,19 +581,18 @@ const tryWecomCallbackLogin = async () => {
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
const rawError = String(data.error || '');
|
||||
let friendly = rawError || t('login.wecomLoginFailed');
|
||||
if (rawError.includes('Invalid or expired WeCom state')) {
|
||||
friendly = t('login.wecomStateExpired');
|
||||
} else if (rawError.includes('bind WeCom account') || rawError.includes('No linked account found')) {
|
||||
friendly = t('login.wecomBindRequired');
|
||||
} else if (rawError.includes('Account is disabled')) {
|
||||
friendly = t('login.wecomAccountDisabled');
|
||||
sessionStorage.removeItem('hxops_wecom_state');
|
||||
if (String(data.error_code || '') === 'WECOM_BIND_INPUT_REQUIRED') {
|
||||
openWecomBindPrompt(data);
|
||||
clearWecomCallbackQuery();
|
||||
return true;
|
||||
}
|
||||
alert(friendly);
|
||||
openWecomLoginDialog(data);
|
||||
clearWecomCallbackQuery();
|
||||
return true;
|
||||
}
|
||||
|
||||
wecomLoginDialog.value = null;
|
||||
persistLoginUser(data);
|
||||
sessionStorage.removeItem('hxops_wecom_state');
|
||||
window.history.replaceState({}, '', '/workspace');
|
||||
@@ -496,7 +600,9 @@ const tryWecomCallbackLogin = async () => {
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert(t('login.wecomLoginFailed'));
|
||||
sessionStorage.removeItem('hxops_wecom_state');
|
||||
openWecomLoginDialog({ error: t('login.wecomLoginFailed') });
|
||||
clearWecomCallbackQuery();
|
||||
return true;
|
||||
} finally {
|
||||
isWecomLoggingIn.value = false;
|
||||
@@ -572,6 +678,45 @@ const navigateWithQuickQuestion = (agentId: number, question: string) => {
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
|
||||
const handleWecomDeeplinkContext = async () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const traceId = params.get('wecom_trace');
|
||||
const target = params.get('target');
|
||||
const agentIdRaw = params.get('agent_id');
|
||||
const preset = params.get('preset');
|
||||
|
||||
if (!traceId && !target) return;
|
||||
wecomEntryHint.value = t('workspace.wecomEntryNotice');
|
||||
|
||||
if (traceId && isLoggedIn.value) {
|
||||
try {
|
||||
const api = config.auth?.wecom?.deeplinkTraceApi || '/api/user/wecom/deeplink-opened';
|
||||
await fetch(api, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify({ trace_id: traceId }),
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('Failed to mark WeCom deeplink opened', e);
|
||||
}
|
||||
}
|
||||
|
||||
if (target === 'chat' && agentIdRaw && isLoggedIn.value) {
|
||||
const agentId = Number(agentIdRaw);
|
||||
if (Number.isInteger(agentId) && agents.value.some((a) => a.id === agentId)) {
|
||||
const url = router.resolve({
|
||||
path: `/chat/${agentId}`,
|
||||
query: preset ? { preset } : {},
|
||||
}).href;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
if (traceId || target) {
|
||||
window.history.replaceState({}, '', '/workspace');
|
||||
}
|
||||
};
|
||||
|
||||
// Favorites
|
||||
const toggleFavorite = async (agentId: number) => {
|
||||
if (favoriteAgentIds.value.includes(agentId)) {
|
||||
@@ -697,6 +842,7 @@ onMounted(async () => {
|
||||
loadAuthUser();
|
||||
if (currentUser.value && currentUser.value.role !== 'guest') {
|
||||
await fetchHome();
|
||||
await handleWecomDeeplinkContext();
|
||||
} else {
|
||||
await fetchPublicAgents();
|
||||
isLoading.value = false;
|
||||
@@ -922,6 +1068,9 @@ onMounted(async () => {
|
||||
|
||||
<!-- Logged In Layout -->
|
||||
<div v-else class="space-y-8 animate-fade-in">
|
||||
<div v-if="wecomEntryHint" class="rounded-xl border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-700">
|
||||
{{ wecomEntryHint }}
|
||||
</div>
|
||||
<!-- Draggable Sections -->
|
||||
<div
|
||||
v-for="(section, index) in layoutSections"
|
||||
@@ -1147,6 +1296,79 @@ onMounted(async () => {
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div v-if="wecomLoginDialog" class="fixed inset-0 bg-slate-900/40 dark:bg-slate-950/70 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
|
||||
<div class="bg-white dark:bg-slate-900 rounded-3xl shadow-2xl w-full max-w-lg p-8 animate-slide-up relative border border-slate-200 dark:border-slate-700">
|
||||
<button @click="wecomLoginDialog = null" class="absolute top-4 right-4 text-slate-400 hover:text-slate-600">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
<div class="mb-5">
|
||||
<div class="w-12 h-12 bg-amber-100 text-amber-700 rounded-xl flex items-center justify-center mb-4">
|
||||
<Lock class="w-6 h-6" />
|
||||
</div>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ wecomLoginDialog.title }}</h3>
|
||||
<p class="text-sm text-slate-600 dark:text-slate-300 mt-3 leading-6">{{ wecomLoginDialog.summary }}</p>
|
||||
</div>
|
||||
<div v-if="wecomLoginDialog.details.length" class="rounded-2xl bg-slate-50 dark:bg-slate-800/80 border border-slate-200 dark:border-slate-700 px-4 py-4 space-y-3">
|
||||
<p v-for="(detail, index) in wecomLoginDialog.details" :key="`${detail}-${index}`" class="text-sm text-slate-600 dark:text-slate-300 leading-6">
|
||||
{{ detail }}
|
||||
</p>
|
||||
</div>
|
||||
<p v-if="wecomLoginDialog.technical" class="mt-4 text-xs text-slate-400 break-all">
|
||||
{{ $t('login.wecomTechnicalInfo', { detail: wecomLoginDialog.technical }) }}
|
||||
</p>
|
||||
<div class="flex justify-end gap-3 mt-8">
|
||||
<button @click="wecomLoginDialog = null" class="btn-secondary">{{ $t('admin.close') }}</button>
|
||||
<button @click="wecomLoginDialog = null; handleWecomLogin()" class="btn-primary" :disabled="isWecomLoggingIn">
|
||||
{{ $t('login.wecomRetry') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="wecomBindPrompt" class="fixed inset-0 bg-slate-900/40 dark:bg-slate-950/70 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
|
||||
<div class="bg-white dark:bg-slate-900 rounded-3xl shadow-2xl w-full max-w-lg p-8 animate-slide-up relative border border-slate-200 dark:border-slate-700">
|
||||
<button @click="wecomBindPrompt = null" class="absolute top-4 right-4 text-slate-400 hover:text-slate-600">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
<div class="mb-6">
|
||||
<div class="w-12 h-12 bg-blue-100 text-blue-700 rounded-xl flex items-center justify-center mb-4">
|
||||
<User class="w-6 h-6" />
|
||||
</div>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ $t('login.wecomBindPromptTitle') }}</h3>
|
||||
<p class="text-sm text-slate-600 dark:text-slate-300 mt-3 leading-6">
|
||||
{{ $t('login.wecomBindPromptDesc', { name: wecomBindPrompt.wecom_name || '-' }) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="mb-1.5 block text-xs font-semibold text-slate-600 uppercase">{{ $t('login.wecomBindField') }}</label>
|
||||
<select v-model="wecomBindPrompt.field" class="input-field">
|
||||
<option v-for="field in wecomBindPrompt.allowed_fields" :key="field" :value="field">
|
||||
{{ formatWecomFieldLabel(field, t) }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-1.5 block text-xs font-semibold text-slate-600 uppercase">{{ $t('login.wecomBindValue') }}</label>
|
||||
<input
|
||||
v-model="wecomBindPrompt.value"
|
||||
class="input-field"
|
||||
:placeholder="$t('login.wecomBindValuePlaceholder', { field: formatWecomFieldLabel(wecomBindPrompt.field, t) })"
|
||||
@keyup.enter="submitWecomCompleteBind"
|
||||
/>
|
||||
</div>
|
||||
<p class="text-xs text-slate-500 leading-5">{{ $t('login.wecomBindPromptHint') }}</p>
|
||||
<p v-if="wecomBindPrompt.error" class="text-sm text-red-600 leading-6">{{ wecomBindPrompt.error }}</p>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3 mt-8">
|
||||
<button @click="wecomBindPrompt = null" class="btn-secondary">{{ $t('admin.close') }}</button>
|
||||
<button @click="submitWecomCompleteBind" class="btn-primary" :disabled="wecomBindPrompt.submitting">
|
||||
{{ wecomBindPrompt.submitting ? $t('login.wecomConnecting') : $t('login.wecomBindSubmit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Register Modal -->
|
||||
<div v-if="showRegisterModal" class="fixed inset-0 bg-slate-900/40 dark:bg-slate-950/70 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
|
||||
|
||||
Reference in new issue
Block a user