diff --git a/pages/detail/detail.js b/pages/detail/detail.js index eb0f293..7fd7eed 100644 --- a/pages/detail/detail.js +++ b/pages/detail/detail.js @@ -111,6 +111,25 @@ function toastForEventStatus(es) { return '当前不可报名'; } +function showRefereeApplyFailure(message, fallbackMessage) { + const content = String(message || fallbackMessage || '报名执裁失败'); + const isTimeConflict = content.includes('执裁时间') && + (content.includes('重叠') || content.includes('冲突')); + if (isTimeConflict) { + wx.hideLoading(); + wx.hideToast(); + wx.showModal({ + title: '报名提示', + content, + showCancel: false, + confirmText: '我知道了' + }); + return; + } + + wx.showToast({ title: content, icon: 'none' }); +} + function registrationModeText(mode) { const m = mode === undefined || mode === null ? null : Number(mode); if (m === 1) return '只允许个人报名'; @@ -913,11 +932,11 @@ Page({ return; } if (quota && (quota.isFull || quota.canApply === false) && !quota.applied4Me) { - wx.showToast({ title: quota.message || '裁判报名名额已满', icon: 'none' }); + showRefereeApplyFailure(quota.message, '裁判报名名额已满'); return; } this._confirmRefereeApply(); - }).catch((err) => wx.showToast({ title: (err && err.message) || '裁判资格校验失败', icon: 'none' })) + }).catch((err) => showRefereeApplyFailure(err && err.message, '裁判资格校验失败')) .finally(() => wx.hideLoading()); }, @@ -942,7 +961,7 @@ Page({ this.setData({ isRegistered: true, applyDisabled: true, applyGrey: true, applyButtonText: '已报名执裁' }); wx.showToast({ title: '报名执裁成功', icon: 'success' }); }).catch((err) => { - wx.showToast({ title: (err && err.message) || '报名执裁失败', icon: 'none' }); + showRefereeApplyFailure(err && err.message, '报名执裁失败'); }).finally(() => wx.hideLoading()); } }); diff --git a/project.private.config.json b/project.private.config.json index 8c72078..1aeb947 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -21,12 +21,19 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/detail/detail", + "pathName": "pages/detail/detail", + "query": "id=479551071346693", + "scene": null, + "launchMode": "default" + }, { "name": "subpackages/mine/checkin/checkin", "pathName": "subpackages/mine/checkin/checkin", "query": "", - "scene": null, - "launchMode": "default" + "launchMode": "default", + "scene": null }, { "name": "subpackages/mine/auth/auth", diff --git a/subpackages/mine/auth/auth.js b/subpackages/mine/auth/auth.js index e145e72..ad88d99 100644 --- a/subpackages/mine/auth/auth.js +++ b/subpackages/mine/auth/auth.js @@ -306,13 +306,13 @@ Page({ wx.showToast({ title: '验证码已发送', icon: 'success' }); this._startCountdown(60); }) - .catch(() => { - wx.showToast({ title: '发送失败', icon: 'none' }); + .catch((res) => { + wx.showToast({ title: res, icon: 'none' }); }) - .finally(() => { - this.setData({ codeSending: false }); - // wx.hideLoading(); - }); + // .finally(() => { + // this.setData({ codeSending: false }); + // // wx.hideLoading(); + // }); }, _startCountdown(sec) { diff --git a/subpackages/mine/checkin/checkin.wxml b/subpackages/mine/checkin/checkin.wxml index 7a88e34..cfcbba7 100644 --- a/subpackages/mine/checkin/checkin.wxml +++ b/subpackages/mine/checkin/checkin.wxml @@ -13,7 +13,7 @@ 当前项目 - {{currentProjectName || '请选择项目'}} + {{projects[projectIndex].projectName || '请选择项目'}} @@ -58,7 +58,7 @@ 待检录按秩序册顺序 - {{item.teamName || '个人参赛'}}{{item.venueName}} + {{item.teamName || '个人参赛'}}第{{item.sessionIndex}}场 · {{item.venueName}} 单位{{item.unitName}} {{athlete.name}} 确认检录 @@ -67,7 +67,7 @@ 等待前序检录前一检通过后可操作 - {{item.teamName || '个人参赛'}}{{item.venueName}} + {{item.teamName || '个人参赛'}}第{{item.sessionIndex}}场 · {{item.venueName}} 单位{{item.unitName}} {{athlete.name}} {{item.lockReason}} @@ -75,15 +75,11 @@ 已检录{{checkedUnits.length}} 项 - 展示当前项目全部组别的已检录结果 + 仅展示当前项目,按场次顺序排列 - - - {{checkedGroup.projectName}}{{checkedGroup.groupName}} - {{checkedGroup.units.length}} 项 - - - {{item.teamName || '个人参赛'}}{{item.venueName}} + + + {{item.teamName || '个人参赛'}}第{{item.sessionIndex}}场 · {{item.venueName}} 单位{{item.unitName}} {{athlete.name}} diff --git a/utils/competition.js b/utils/competition.js index e017b7f..76f7410 100644 --- a/utils/competition.js +++ b/utils/competition.js @@ -25,48 +25,47 @@ function rejectWith(message) { return Promise.reject(new Error(message)); } -function withScope(data, eventProjectId, groupId) { +function withProjectScope(data, eventProjectId) { if (!isEmptyValue(eventProjectId)) data.eventProjectId = eventProjectId; - if (!isEmptyValue(groupId)) data.groupId = groupId; return data; } -function fetchCurrentCheckin({ eventProjectId, groupId } = {}) { - return request({ path: API.checkinContext, method: 'GET', data: withScope({}, eventProjectId, groupId), needAuth: true }); +function fetchCurrentCheckin({ eventProjectId } = {}) { + return request({ path: API.checkinContext, method: 'GET', data: withProjectScope({}, eventProjectId), needAuth: true }); } -function updateCheckinStatus({ unitKey, eventProjectId, groupId, checked }) { - return request({ path: API.checkinStatus, method: 'POST', data: withScope({ unitKey, checked }, eventProjectId, groupId), needAuth: true }); +function updateCheckinStatus({ unitKey, eventProjectId, checked }) { + return request({ path: API.checkinStatus, method: 'POST', data: withProjectScope({ unitKey, checked }, eventProjectId), needAuth: true }); } -function startCheckin({ eventProjectId, groupId } = {}) { +function startCheckin({ eventProjectId } = {}) { if (isEmptyValue(eventProjectId)) return rejectWith('请选择检录项目'); return request({ path: API.checkinStart, method: 'POST', - data: withScope({ eventProjectId }, eventProjectId, groupId), + data: { eventProjectId }, needAuth: true }); } -function scanCheckin({ code, eventProjectId, groupId } = {}) { +function scanCheckin({ code, eventProjectId } = {}) { if (isEmptyValue(code)) return rejectWith('未识别到有效检录码'); const normalizedCode = String(code).trim(); if (!normalizedCode) return rejectWith('未识别到有效检录码'); return request({ path: API.checkinScan, method: 'POST', - data: withScope({ code: normalizedCode }, eventProjectId, groupId), + data: withProjectScope({ code: normalizedCode }, eventProjectId), needAuth: true }); } -function markCheckinOnStage({ unitKey, eventProjectId, groupId } = {}) { +function markCheckinOnStage({ unitKey, eventProjectId } = {}) { if (isEmptyValue(unitKey)) return rejectWith('缺少参赛单位标识'); return request({ path: API.checkinOnStage, method: 'POST', - data: withScope({ unitKey }, eventProjectId, groupId), + data: withProjectScope({ unitKey }, eventProjectId), needAuth: true }); } diff --git a/utils/constants.js b/utils/constants.js index b05f0ea..f24c44f 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -30,6 +30,7 @@ const API = { updateProfile: '/api/my/avatar/url', myAuth: '/api/my/auth', myRegistrations: '/api/my/registrations', + myRegistrationDetail: (registrationId) => `/api/eventclient/my-registration/${registrationId}`, myPoints: '/api/my/points', myOrders: '/api/my/orders', myTeams: '/api/my/teams',