feat(auth): 小程序登录采集微信昵称
This commit is contained in:
@@ -177,6 +177,23 @@ test('account panel uses compact binding cards and keeps logout actions at the b
|
||||
).toBe('true');
|
||||
});
|
||||
|
||||
test('account panel avoids bare bound label when wechat display name is missing', () => {
|
||||
renderAccountModal({
|
||||
entryMode: 'account',
|
||||
user: {
|
||||
...baseUser,
|
||||
wechatDisplayName: null,
|
||||
wechatAccount: 'openid_abcdef123456',
|
||||
},
|
||||
});
|
||||
|
||||
const accountDialog = screen.getByRole('dialog', { name: '账号信息' });
|
||||
expect(within(accountDialog).getByText('绑定微信')).toBeTruthy();
|
||||
expect(within(accountDialog).getByText('微信账号尾号 123456')).toBeTruthy();
|
||||
expect(within(accountDialog).queryByText('openid_abcdef123456')).toBeNull();
|
||||
expect(within(accountDialog).queryByText('已绑定')).toBeNull();
|
||||
});
|
||||
|
||||
test('account actions open in independent panels instead of inline expansion', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
|
||||
@@ -109,6 +109,15 @@ function formatSessionTime(value: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function formatBoundWechatAccount(value: string | null | undefined) {
|
||||
const normalized = value?.trim();
|
||||
if (!normalized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return `微信账号尾号 ${normalized.slice(-6)}`;
|
||||
}
|
||||
|
||||
function SettingsEntryCard({
|
||||
label,
|
||||
detail,
|
||||
@@ -444,7 +453,9 @@ export function AccountModal({
|
||||
const boundPhoneNumber =
|
||||
user.phoneNumber?.trim() || user.phoneNumberMasked || '未绑定';
|
||||
const boundWechatDisplayName =
|
||||
user.wechatDisplayName?.trim() || (user.wechatBound ? '已绑定' : '未绑定');
|
||||
user.wechatDisplayName?.trim() ||
|
||||
formatBoundWechatAccount(user.wechatAccount) ||
|
||||
(user.wechatBound ? '微信账号已绑定' : '未绑定');
|
||||
|
||||
const sectionSummaries: Record<PrimarySettingsSection, string> = {
|
||||
appearance:
|
||||
|
||||
@@ -11806,6 +11806,7 @@ test('creation hub gives jump hop wooden fish and bark battle cards the shared d
|
||||
sourceSessionId: 'jump-hop-session-delete',
|
||||
workTitle: '跳台删除草稿',
|
||||
workDescription: '跳一跳草稿也应接入统一删除。',
|
||||
themeText: '跳台',
|
||||
themeTags: ['跳台'],
|
||||
difficulty: 'standard',
|
||||
stylePreset: 'paper-toy',
|
||||
|
||||
Reference in New Issue
Block a user