update:上传时间
This commit is contained in:
parent
d429fe2aca
commit
1a98a4a6de
1
app.js
1
app.js
@ -1,6 +1,7 @@
|
||||
App({
|
||||
globalData: {
|
||||
baseUrl: 'http://8.153.108.90:9996',
|
||||
// baseUrl: 'https://event.yuedongsports.com',
|
||||
accessToken: '',
|
||||
refreshToken: '',
|
||||
openid: '',
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
<text class="info-label">报名时间:</text>
|
||||
<text class="info-value info-value--wrap">{{registrationStartText}}~{{registrationEndText}}</text>
|
||||
</view>
|
||||
<view class="info-row" wx:if="{{materialRangeText}}">
|
||||
<view class="info-row" wx:if="{{showMaterialRange && materialRangeText}}">
|
||||
<text class="info-label">上传素材截止时间:</text>
|
||||
<text class="info-value info-value--wrap">{{materialRangeText}}</text>
|
||||
</view>
|
||||
@ -131,7 +131,7 @@
|
||||
<text class="section-title">赛事简介</text>
|
||||
</view>
|
||||
<view class="intro-block">
|
||||
<text class="intro-text" wx:if="{{introductionText}}">{{introductionText}}</text>
|
||||
<rich-text type="text" class="intro-text" wx:if="{{introductionText}}">{{introductionText}}</rich-text>
|
||||
<image wx:if="{{introImage}}" class="intro-image" src="{{introImage}}" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user