diff --git a/app.js b/app.js
index 62253c0..2ae0d29 100644
--- a/app.js
+++ b/app.js
@@ -1,6 +1,7 @@
App({
globalData: {
baseUrl: 'http://8.153.108.90:9996',
+ // baseUrl: 'https://event.yuedongsports.com',
accessToken: '',
refreshToken: '',
openid: '',
diff --git a/pages/detail/detail.js b/pages/detail/detail.js
index 36528b5..e9af151 100644
--- a/pages/detail/detail.js
+++ b/pages/detail/detail.js
@@ -168,12 +168,15 @@ function toNonNegInt(v) {
return i >= 0 ? i : null;
}
-function buildRegistrationLimitLines(detail, projects) {
+function buildRegistrationLimitLines(detail, projects, registrationType) {
const d = detail && typeof detail === 'object' ? detail : {};
+ const regType = registrationType == null ? null : Number(registrationType);
+ // regType === 0:只允许个人报名,隐藏团队限报
+ const isIndividualOnly = regType === 0;
const lines = [];
const individualLimit = toNonNegInt(pick(d, ['individualProjectLimit', 'IndividualProjectLimit']));
- const teamLimit = toNonNegInt(pick(d, ['teamProjectLimit', 'TeamProjectLimit']));
+ const teamLimit = isIndividualOnly ? null : toNonNegInt(pick(d, ['teamProjectLimit', 'TeamProjectLimit']));
if (individualLimit != null || teamLimit != null) {
const a = individualLimit != null ? `个人项目${individualLimit}个` : null;
const b = teamLimit != null ? `团队项目${teamLimit}个` : null;
@@ -181,7 +184,7 @@ function buildRegistrationLimitLines(detail, projects) {
if (joined) lines.push(`每人/单位限报:${joined}`);
}
- if (Array.isArray(projects) && projects.length) {
+ if (!isIndividualOnly && Array.isArray(projects) && projects.length) {
const segs = [];
projects.forEach((p) => {
const name = p && (p.name || p.Name) ? (p.name || p.Name) : '';
@@ -334,7 +337,7 @@ function normalizeEventDetail(raw) {
}
// 若接口未提供文本规则,则由结构化字段拼接
if (!registrationLimitLines.length) {
- registrationLimitLines = buildRegistrationLimitLines(d, projects);
+ registrationLimitLines = buildRegistrationLimitLines(d, projects, registrationType);
}
const participationPointsLabel =
@@ -399,6 +402,8 @@ Page({
/** 0未开始 1报名中 2报名结束 3比赛中 4已结束;null 表示接口未返回 */
eventStatus: null,
registrationType: null,
+ /** 是否显示上传素材截止时间(isNeedMaterial=false 时隐藏) */
+ showMaterialRange: true,
/** 是否灰态展示(不等同于 disabled) */
applyGrey: false,
/** 是否原生禁用(禁用后无法点击) */
@@ -546,6 +551,15 @@ Page({
const { canApply, applyButtonText } = applyUiFromEventStatus(eventStatus);
const registrationType = parseRegistrationType(detail);
+ // isNeedMaterial:接口未返回时默认显示;明确为 false/0 时隐藏
+ const isNeedMaterialRaw = pick(detail, ['isNeedMaterial', 'IsNeedMaterial']);
+ const showMaterialRange =
+ isNeedMaterialRaw == null ||
+ (isNeedMaterialRaw !== false &&
+ isNeedMaterialRaw !== 0 &&
+ isNeedMaterialRaw !== '0' &&
+ isNeedMaterialRaw !== 'false');
+
// 报名按钮逻辑:eventStatus 先拦截;再按 registrationType 决定是否可在小程序端报名
let applyDisabled = !canApply; // 原生禁用:不可点
let applyGrey = !canApply; // 灰态:视觉置灰
@@ -602,6 +616,7 @@ Page({
unitGroups,
eventStatus,
registrationType,
+ showMaterialRange,
applyGrey,
applyDisabled,
applyBlockedByAdmin,
diff --git a/pages/detail/detail.wxml b/pages/detail/detail.wxml
index 64c914b..ba91380 100644
--- a/pages/detail/detail.wxml
+++ b/pages/detail/detail.wxml
@@ -33,7 +33,7 @@
报名时间:
{{registrationStartText}}~{{registrationEndText}}
-
+
上传素材截止时间:
{{materialRangeText}}
@@ -131,7 +131,7 @@
赛事简介
- {{introductionText}}
+ {{introductionText}}