feat: 完成70%全局样式与可读性优化
This commit is contained in:
@@ -1079,6 +1079,12 @@ const lineageDatePart = (value, label) => {
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
const compactLineageYears = (birthDate, deathDate) => {
|
||||
const birthYear = birthDate ? birthDate.slice(0, 4) : ''
|
||||
const deathYear = deathDate ? deathDate.slice(0, 4) : ''
|
||||
return birthYear || deathYear ? `${birthYear}—${deathYear}` : '生卒待补'
|
||||
}
|
||||
|
||||
const normalizeLineageTree = (value) => {
|
||||
if (!Array.isArray(value)) throw lineageTreeError('世系树响应不是列表')
|
||||
const seen = new Set()
|
||||
@@ -1117,6 +1123,7 @@ const normalizeLineageTree = (value) => {
|
||||
birthDate || deathDate
|
||||
? `${birthDate}—${deathDate}`
|
||||
: '生卒待补',
|
||||
treeYears: compactLineageYears(birthDate, deathDate),
|
||||
sex: normalizeLineageText(node.sex, '性别'),
|
||||
personStatus: normalizeLineageText(node.personStatus, '人物状态')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export const DEFAULT_MALE_AVATAR =
|
||||
"/static/assets/foundation/transparent/mjpc0703_A_cartoon_illustration_of_a_boy_wearing_a_red_Chinese__0@2x.png";
|
||||
|
||||
export const DEFAULT_FEMALE_AVATAR =
|
||||
"/static/assets/foundation/transparent/loyel003_Ancient_Beauty_Wearing_Tang_Dynasty_ClothingLooking_to_07cb98a9-ec37-4620-a032-ebe511fa93b5@2x.png";
|
||||
|
||||
export const getDefaultAvatar = (sex) =>
|
||||
String(sex ?? "").trim() === "1"
|
||||
? DEFAULT_FEMALE_AVATAR
|
||||
: DEFAULT_MALE_AVATAR;
|
||||
Reference in New Issue
Block a user