功能:优化用户地址账户名称展示

This commit is contained in:
czl231
2026-08-11 21:33:20 +08:00
parent e375e9851b
commit 8d6ffca1e2
9 changed files with 281 additions and 22 deletions

View File

@@ -0,0 +1,31 @@
/**
* 功能:静态检查用户地址列表的账户名称展示、标识降级与复制入口。
* 版本v1.0.0
*/
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const appRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
function source(path) {
return readFileSync(resolve(appRoot, path), 'utf8');
}
function expectIncludes(content, marker, message) {
if (!content.includes(marker)) throw new Error(`用户地址展示检查失败:${message}`);
}
const resources = source('src/api/resources.ts');
const listPage = source('src/views/shared/CrudListPage.vue');
const relationName = source('src/views/shared/RelationNameText.vue');
const fieldDisplay = source('src/views/shared/resource-list-field-display.ts');
expectIncludes(resources, "listLabel: '用户账户'", '列表列名未改为用户账户');
expectIncludes(resources, 'listRelationNameOnly: true', '用户地址未启用账户名称展示');
expectIncludes(listPage, '<RelationNameText', '列表未使用账户名称组件');
expectIncludes(fieldDisplay, 'return match ? optionLabel(match) : identity;', '关系名称缺失时未降级显示标识');
expectIncludes(relationName, '用户唯一标识:${identity}', '缺少完整标识悬停提示');
expectIncludes(relationName, '@click.stop="copyIdentity"', '缺少标识复制入口');
console.log('用户地址展示检查通过:账户名称、标识降级、悬停与复制入口均已覆盖。');