update:赛事详情显示

This commit is contained in:
ltx 2026-05-14 16:11:48 +08:00
parent f8a2b3fce7
commit 0df37d0ca7
3 changed files with 116 additions and 62 deletions

View File

@ -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 : '-'
});
});

View File

@ -107,23 +107,23 @@
<view class="limit-item">
<text class="limit-num">2.</text>
<view class="limit-text">
<text class="limit-text">项目限报(每个单位针对项目下的各组别可报名x个人/队)</text>
<view class="table-wrap project-limit-table" wx:if="{{projectLimitTableRows.length}}">
<text class="limit-text">项目限报(每个单位针对项目下的各组别可报名x个人/x队)</text>
</view>
</view>
<view class="table-wrap project-limit-table" wx:if="{{projectLimitTableRows.length}}">
<view class="table-head table-head--light">
<text class="th th-limit-proj">项目</text>
<text class="th th-limit-group">组别</text>
<text class="th th-limit-proj">项目类型</text>
<text class="th th-limit-count">限报</text>
</view>
<view class="table-body">
<view class="tr" wx:for="{{projectLimitTableRows}}" wx:key="rowKey">
<text class="td td-limit-proj">{{item.projectName}}</text>
<text class="td td-limit-group">{{item.groupName}}</text>
<text class="td td-limit-proj">{{item.typeName}}</text>
<text class="td td-limit-count">{{item.limitText}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
@ -136,16 +136,22 @@
</view>
<view class="table-wrap">
<view class="table-head">
<text class="th th-type">类型</text>
<text class="th th-proj">项目</text>
<text class="th th-group" wx:if="{{chargeMode !== 3}}">组别</text>
<text class="th th-proj" >项目类型</text>
<text class="th th-group" >组别</text>
<!-- <text class="th th-age">年龄限制</text> -->
<!-- <text class="th th-gender">性别</text> -->
<text class="th th-fee" wx:if="{{feeModeLabel == '单价(项目)'}}">费用(元)</text>
</view>
<view class="table-body">
<view class="tr" wx:for="{{projectTableRows}}" wx:key="rowKey">
<text class="td td-type">{{item.typeName}}</text>
<text class="td td-proj">{{item.projectName}}</text>
<text class="td td-group" wx:if="{{chargeMode !== 3}}">{{item.groupName}}</text>
<text class="td td-proj">{{item.typeName}}</text>
<view class="td td-group">
<text wx:for="{{item.groupNames}}" wx:key="*this" class="group-name-line">{{item}}</text>
</view>
<!-- <text class="td td-age">{{item.ageRange}}</text> -->
<!-- <text class="td td-gender">{{item.genderText}}</text> -->
<text class="td td-fee" wx:if="{{feeModeLabel == '单价(项目)'}}">{{item.fee}}</text>
</view>
</view>

View File

@ -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 {