diff --git a/pages/detail/detail.js b/pages/detail/detail.js index c87513b..654f3ec 100644 --- a/pages/detail/detail.js +++ b/pages/detail/detail.js @@ -28,16 +28,16 @@ var DETAIL_UI_FALLBACK = { }; var DEMO_PROJECT_TABLE_ROWS = [ - { rowKey: 'fb-1', typeName: '个人', projectName: '30秒单摇', groupName: '少年组', fee: '23' }, - { rowKey: 'fb-2', typeName: '团队', projectName: '少年儿童组', groupName: '成年组', fee: '411' }, - { rowKey: 'fb-3', typeName: '团队', projectName: '少年儿童组', groupName: '32', fee: '32' }, - { rowKey: 'fb-4', typeName: '团队', projectName: '成年组', groupName: '12', fee: '12' } + { rowKey: 'fb-1', projectName: '30秒单摇', groupNames: ['少年组'], ageRange: '8-12岁', genderText: '不限', fee: '23' }, + { rowKey: 'fb-2', projectName: '少年儿童组', groupNames: ['成年组', '青年组'], ageRange: '18岁以上', genderText: '男', fee: '411' }, + { rowKey: 'fb-3', projectName: '少年儿童组', groupNames: ['青少年组'], ageRange: '13-17岁', genderText: '女', fee: '32' }, + { rowKey: 'fb-4', projectName: '成年组', groupNames: ['公开组'], ageRange: '-', genderText: '不限', fee: '12' } ]; var DEMO_PROJECT_LIMIT_TABLE_ROWS = [ - { rowKey: 'pl-1', projectName: '30秒单摇', groupName: '少年组', limitText: '2人/队' }, - { rowKey: 'pl-2', projectName: '2*30秒双摇接力', groupName: '少年组', limitText: '1人/队' }, - { rowKey: 'pl-3', projectName: '4*30秒交互绳接力', groupName: '青年组', limitText: '1人/队' } + { rowKey: 'pl-1', projectName: '30秒单摇', limitText: '0人/队' }, + { rowKey: 'pl-2', projectName: '2*30秒双摇接力', limitText: '0人/队' }, + { rowKey: 'pl-3', projectName: '4*30秒交互绳接力', limitText: '0人/队' } ]; function isEmptyDisplayTime(s) { @@ -174,6 +174,15 @@ function toNonNegInt(v) { return i >= 0 ? i : null; } +function genderRequirementText(v) { + if (v === undefined || v === null || v === '') return '不限'; + const s = String(v).trim(); + if (s === '0' || s === '男' || s.toUpperCase() === 'M') return '男'; + if (s === '1' || s === '女' || s.toUpperCase() === 'F') return '女'; + if (s === '2' || s === '不限' || s === '全部') return '不限'; + return s || '不限'; +} + function buildRegistrationLimitLines(detail, projects, registrationType) { const d = detail && typeof detail === 'object' ? detail : {}; const regType = registrationType == null ? null : Number(registrationType); @@ -210,29 +219,16 @@ function buildProjectLimitTableRows(projects) { if (!Array.isArray(projects) || !projects.length) return []; const rows = []; projects.forEach((p, pi) => { + console.log('buildProjectLimitTableRows p:', p,pi); const projectName = p && (p.name || p.Name) ? (p.name || p.Name) : '-'; + const typeName = p && (p.typeName || p.TypeName) ? (p.typeName || p.TypeName) : '-'; const projectLimit = toNonNegInt(pick(p, ['projectLimitCount', 'ProjectLimitCount'])); if (projectLimit == null) return; - - const rawGroups = Array.isArray(p.groups) ? p.groups : Array.isArray(p.Groups) ? p.Groups : []; - if (!rawGroups.length) { - rows.push({ - rowKey: `limit-${pi}-0`, - projectName, - groupName: '-', - limitText: `${projectLimit}人/队` - }); - return; - } - - rawGroups.forEach((g, gi) => { - const groupName = g && (g.groupName || g.GroupName || g.groupId || g.GroupId || '-'); - rows.push({ - rowKey: `limit-${pi}-${gi}`, - projectName, - groupName, - limitText: `${projectLimit}人/队` - }); + rows.push({ + rowKey: `limit-${pi}`, + projectName, + typeName, + limitText: `${projectLimit}${p.projectType == 1003 || p.projectType == 1004 ? '人/组' : '队/组'}` }); }); return rows; @@ -245,26 +241,40 @@ function flattenProjectTableRows(projects, chargeMode) { const byProject = chargeMode === 3; projects.forEach((p) => { const pid = p.id != null ? p.id : p.Id; - if (byProject) { + console.log('flattenProjectTableRows p:', p); + const rawGroups = Array.isArray(p.groups) ? p.groups : Array.isArray(p.Groups) ? p.Groups : []; + const groups = rawGroups.length ? rawGroups : [null]; + // if (byProject) { + const groupNamesArr = rawGroups + .map((g) => g && (g.groupName || g.GroupName)) + .filter(Boolean); rows.push({ rowKey: `p-${pid}`, - typeName: p.typeName || p.TypeName || '-', projectName: p.name || p.Name || '-', - groupName: '', + groupNames: groupNamesArr.length ? groupNamesArr : ['-'], + ageRange: '-', + genderText: '不限', + typeName: p && (p.typeName || p.TypeName) ? (p.typeName || p.TypeName) : '-', fee: p.fee != null ? p.fee : p.Fee != null ? p.Fee : '-' }); return; - } - const rawGroups = Array.isArray(p.groups) ? p.groups : Array.isArray(p.Groups) ? p.Groups : []; - const groups = rawGroups.length ? rawGroups : [null]; + // } + groups.forEach((g, gi) => { const gid = g && (g.groupId != null ? g.groupId : g.GroupId != null ? g.GroupId : null); const gname = g && (g.groupName || g.GroupName); + const ageRange = g + ? (g.ageRange || g.AgeRange || g.ageRequirement || g.AgeRequirement || '-') + : '-'; + const genderRaw = g + ? (g.genderRequirement != null ? g.genderRequirement : g.GenderRequirement != null ? g.GenderRequirement : null) + : null; rows.push({ rowKey: `p-${pid}-${gi}-${gid != null ? gid : gname || 'g'}`, - typeName: p.typeName || p.TypeName || '-', projectName: p.name || p.Name || '-', - groupName: g ? gname || gid || '-' : '-', + groupNames: [g ? gname || gid || '-' : '-'], + ageRange, + genderText: genderRequirementText(genderRaw), fee: p.fee != null ? p.fee : p.Fee != null ? p.Fee : '-' }); }); diff --git a/pages/detail/detail.wxml b/pages/detail/detail.wxml index f4544ac..8dbd735 100644 --- a/pages/detail/detail.wxml +++ b/pages/detail/detail.wxml @@ -107,23 +107,23 @@ 2. - 项目限报(每个单位针对项目下的各组别可报名x个人/队) - + 项目限报(每个单位针对项目下的各组别可报名x个人/x队) + + + 项目 - 组别 + 项目类型 限报 {{item.projectName}} - {{item.groupName}} + {{item.typeName}} {{item.limitText}} - - @@ -136,16 +136,22 @@ - 类型 项目 - 组别 + 项目类型 + 组别 + + 费用(元) - {{item.typeName}} {{item.projectName}} - {{item.groupName}} + {{item.typeName}} + + {{item}} + + + {{item.fee}} diff --git a/pages/detail/detail.wxss b/pages/detail/detail.wxss index 601e541..365b4b3 100644 --- a/pages/detail/detail.wxss +++ b/pages/detail/detail.wxss @@ -354,11 +354,6 @@ page { flex: 1.2; } -.th-limit-group, -.td-limit-group { - flex: 1; -} - .th-limit-count, .td-limit-count { flex: 0.9; @@ -385,16 +380,20 @@ page { line-height: 1.35; } -.th-type { - flex: 0.9; -} - .th-proj { - flex: 1.15; + flex: 1.2; } .th-group { - flex: 1.15; + flex: 0.9; +} + +.th-age { + flex: 1.2; +} + +.th-gender { + flex: 0.9; } .th-fee { @@ -414,27 +413,66 @@ page { color: #666666; } +.tr--multigroup { + align-items: stretch; +} + .tr:last-child { border-bottom: none; } .td { text-align: center; - line-height: 1.45; + /* line-height: 1.45; */ word-break: break-all; + display: flex; + align-items: center; + justify-content: center; } -.td-type { - flex: 0.9; - color: #666666; +.td-multiline { + display: flex; + flex-direction: column; +} + +.td-line { + display: block; + text-align: center; + line-height: 1.45; + padding: 4rpx 0; +} + +.td-line + .td-line { + border-top: 1rpx solid #f0f0f0; } .td-proj { - flex: 1.15; + flex: 1.2; } .td-group { - flex: 1.15; + flex: 0.9; + display: flex; + flex-direction: column; + align-items: center; + gap: 6rpx; +} + +.group-name-line { + display: block; + font-size: 24rpx; + color: #666666; + line-height: 1.45; + word-break: break-all; + text-align: center; +} + +.td-age { + flex: 1.2; +} + +.td-gender { + flex: 0.9; } .td-fee {