update:提示修改&取消报名
This commit is contained in:
commit
d52744752f
@ -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());
|
||||
}
|
||||
});
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<view class="compact-divider"></view>
|
||||
<view class="compact-status-item group-status-item">
|
||||
<text class="compact-label">当前项目</text>
|
||||
<text class="compact-value">{{currentProjectName || '请选择项目'}}</text>
|
||||
<text class="compact-value">{{projects[projectIndex].projectName || '请选择项目'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
<view class="list-heading"><text class="section-title">待检录</text><text class="list-tip">按秩序册顺序</text></view>
|
||||
<view class="unit-card" wx:for="{{pendingUnits}}" wx:key="unitKey">
|
||||
<view class="unit-head"><text class="unit-title">{{item.teamName || '个人参赛'}}</text><text class="venue-badge">{{item.venueName}}</text></view>
|
||||
<view class="unit-head"><text class="unit-title">{{item.teamName || '个人参赛'}}</text><text class="venue-badge">第{{item.sessionIndex}}场 · {{item.venueName}}</text></view>
|
||||
<view class="unit-meta" wx:if="{{item.unitName}}"><text class="unit-meta-label">单位</text><text class="unit-meta-value">{{item.unitName}}</text></view>
|
||||
<view class="unit-athletes"><text class="athlete-chip" wx:for="{{item.athletes}}" wx:for-item="athlete" wx:key="id">{{athlete.name}}</text></view>
|
||||
<view class="unit-action {{updatingKey === item.unitKey ? 'disabled' : ''}}" data-key="{{item.unitKey}}" bindtap="onToggleUnit">确认检录</view>
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
<view class="list-heading" wx:if="{{lockedUnits.length}}"><text class="section-title">等待前序检录</text><text class="list-tip">前一检通过后可操作</text></view>
|
||||
<view class="unit-card locked" wx:for="{{lockedUnits}}" wx:key="unitKey">
|
||||
<view class="unit-head"><text class="unit-title">{{item.teamName || '个人参赛'}}</text><text class="venue-badge">{{item.venueName}}</text></view>
|
||||
<view class="unit-head"><text class="unit-title">{{item.teamName || '个人参赛'}}</text><text class="venue-badge">第{{item.sessionIndex}}场 · {{item.venueName}}</text></view>
|
||||
<view class="unit-meta" wx:if="{{item.unitName}}"><text class="unit-meta-label">单位</text><text class="unit-meta-value">{{item.unitName}}</text></view>
|
||||
<view class="unit-athletes"><text class="athlete-chip" wx:for="{{item.athletes}}" wx:for-item="athlete" wx:key="id">{{athlete.name}}</text></view>
|
||||
<view class="unit-action disabled">{{item.lockReason}}</view>
|
||||
@ -75,15 +75,11 @@
|
||||
|
||||
<view class="checked-section-head">
|
||||
<view class="checked-section-title"><text class="section-title">已检录</text><text class="checked-count">{{checkedUnits.length}} 项</text></view>
|
||||
<text class="scope-tip">展示当前项目全部组别的已检录结果</text>
|
||||
<text class="scope-tip">仅展示当前项目,按场次顺序排列</text>
|
||||
</view>
|
||||
<block wx:for="{{checkedGroups}}" wx:for-item="checkedGroup" wx:key="key">
|
||||
<view class="checked-group-head">
|
||||
<view class="checked-group-names"><text class="checked-project-name">{{checkedGroup.projectName}}</text><text class="checked-group-name">{{checkedGroup.groupName}}</text></view>
|
||||
<text class="checked-group-count">{{checkedGroup.units.length}} 项</text>
|
||||
</view>
|
||||
<view class="unit-card" wx:for="{{checkedGroup.units}}" wx:for-item="item" wx:key="unitKey">
|
||||
<view class="unit-head"><text class="unit-title">{{item.teamName || '个人参赛'}}</text><text class="venue-badge">{{item.venueName}}</text></view>
|
||||
<block wx:for="{{checkedUnits}}" wx:for-item="item" wx:key="unitKey">
|
||||
<view class="unit-card">
|
||||
<view class="unit-head"><text class="unit-title">{{item.teamName || '个人参赛'}}</text><text class="venue-badge">第{{item.sessionIndex}}场 · {{item.venueName}}</text></view>
|
||||
<view class="unit-meta" wx:if="{{item.unitName}}"><text class="unit-meta-label">单位</text><text class="unit-meta-value">{{item.unitName}}</text></view>
|
||||
<view class="unit-athletes"><text class="athlete-chip checked-chip" wx:for="{{item.athletes}}" wx:for-item="athlete" wx:key="id">{{athlete.name}}</text></view>
|
||||
<view class="checked-actions">
|
||||
|
||||
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
@ -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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user