update:详情
This commit is contained in:
parent
b408c873eb
commit
3efeb5fa6b
@ -116,6 +116,31 @@ function splitLines(text) {
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function normalizePointsRuleDetail(raw) {
|
||||
const d = raw && typeof raw === 'object' ? raw : null;
|
||||
if (!d) return null;
|
||||
const detailsRaw = Array.isArray(d.details) ? d.details : Array.isArray(d.Details) ? d.Details : [];
|
||||
const details = detailsRaw
|
||||
.map((x) => {
|
||||
const startRank = toNonNegInt(pick(x, ['startRank', 'StartRank']));
|
||||
const endRank = toNonNegInt(pick(x, ['endRank', 'EndRank']));
|
||||
const points = toNonNegInt(pick(x, ['points', 'Points']));
|
||||
if (startRank == null && endRank == null && points == null) return null;
|
||||
return {
|
||||
startRank: startRank != null ? startRank : endRank,
|
||||
endRank: endRank != null ? endRank : startRank,
|
||||
points
|
||||
};
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
return {
|
||||
ruleName: pick(d, ['ruleName', 'RuleName']) || '',
|
||||
participationPoints: pick(d, ['participationPoints', 'ParticipationPoints']),
|
||||
details
|
||||
};
|
||||
}
|
||||
|
||||
function toNonNegInt(v) {
|
||||
const n = Number(v);
|
||||
if (Number.isNaN(n)) return null;
|
||||
@ -186,22 +211,8 @@ function normalizeEventDetail(raw) {
|
||||
'RegistrationMethodDescription'
|
||||
]) || registrationModeText(pick(d, ['registrationMode', 'RegistrationMode']));
|
||||
|
||||
const feeModeLabel =
|
||||
pick(d, ['feeModeText', 'FeeModeText', 'feeModeDescription', 'FeeModeDescription', 'pricingModeText', 'PricingModeText']) ||
|
||||
pick(d, ['feeMode', 'FeeMode', 'pricingMode', 'PricingMode']) ||
|
||||
'';
|
||||
|
||||
const priceRaw = pick(d, [
|
||||
'displayPrice',
|
||||
'DisplayPrice',
|
||||
'eventPrice',
|
||||
'EventPrice',
|
||||
'price',
|
||||
'Price',
|
||||
'minFee',
|
||||
'MinFee'
|
||||
]);
|
||||
let priceDisplay = priceRaw != null && priceRaw !== '' ? priceRaw : null;
|
||||
const feeModeLabel =d.chargeMode == 0 ? '免费' : d.chargeMode == 1 ? '定价模式(赛事)' : d.chargeMode == 2 ? '单价(赛事)' : '单价(项目)';
|
||||
let priceDisplay = d && d.feeConfig ? d.feeConfig.price : null;
|
||||
if (priceDisplay == null && projects.length) {
|
||||
const fees = projects.map((p) => p.fee).filter((f) => f != null && f !== '');
|
||||
if (fees.length) {
|
||||
@ -222,17 +233,41 @@ function normalizeEventDetail(raw) {
|
||||
);
|
||||
|
||||
const refundRulesText = pick(d, ['refundRules', 'RefundRules', 'refundDescription', 'RefundDescription']);
|
||||
const participationPoints = pick(d, ['participationPoints', 'ParticipationPoints']);
|
||||
const rankingPointsRaw = pick(d, [
|
||||
'rankingPointsText',
|
||||
'RankingPointsText',
|
||||
'rankingPointsDescription',
|
||||
'RankingPointsDescription',
|
||||
'rankingPoints',
|
||||
'RankingPoints'
|
||||
]);
|
||||
|
||||
const pointsRuleDetailRaw = pick(d, ['pointsRuleDetail', 'PointsRuleDetail']);
|
||||
const pointsRuleDetail = normalizePointsRuleDetail(pointsRuleDetailRaw);
|
||||
|
||||
const participationPoints = pointsRuleDetail
|
||||
? pick(pointsRuleDetail, ['participationPoints', 'ParticipationPoints'])
|
||||
: pick(d, ['participationPoints', 'ParticipationPoints']);
|
||||
|
||||
const rankingPointsRaw = pointsRuleDetail
|
||||
? pointsRuleDetail.details
|
||||
: pick(d, [
|
||||
'rankingPointsText',
|
||||
'RankingPointsText',
|
||||
'rankingPointsDescription',
|
||||
'RankingPointsDescription',
|
||||
'rankingPoints',
|
||||
'RankingPoints'
|
||||
]);
|
||||
let rankingPointsLines = [];
|
||||
if (typeof rankingPointsRaw === 'string') {
|
||||
if (Array.isArray(rankingPointsRaw) && rankingPointsRaw.length && typeof rankingPointsRaw[0] === 'object') {
|
||||
rankingPointsLines = rankingPointsRaw
|
||||
.map((it) => {
|
||||
const sr = toNonNegInt(pick(it, ['startRank', 'StartRank']));
|
||||
const er = toNonNegInt(pick(it, ['endRank', 'EndRank']));
|
||||
const pts = toNonNegInt(pick(it, ['points', 'Points']));
|
||||
if (pts == null) return null;
|
||||
const a = sr != null ? sr : er;
|
||||
const b = er != null ? er : sr;
|
||||
if (a == null && b == null) return `${pts}积分`;
|
||||
if (a != null && b != null && a === b) return `${a} ${pts}积分`;
|
||||
if (a != null && b != null) return `${a}--${b} ${pts}积分`;
|
||||
return `${a != null ? a : b} ${pts}积分`;
|
||||
})
|
||||
.filter(Boolean);
|
||||
} else if (typeof rankingPointsRaw === 'string') {
|
||||
rankingPointsLines = splitLines(rankingPointsRaw);
|
||||
} else if (Array.isArray(rankingPointsRaw)) {
|
||||
rankingPointsLines = rankingPointsRaw.map((x) => String(x)).filter(Boolean);
|
||||
@ -393,7 +428,7 @@ Page({
|
||||
|
||||
var materialRangeText = n.materialRangeText || fb.materialRangeText;
|
||||
|
||||
var uploadMaterialRemark =
|
||||
var uploadMaterialRemark =
|
||||
pick(detail, [
|
||||
'uploadMaterialRemark',
|
||||
'UploadMaterialRemark',
|
||||
|
||||
@ -41,12 +41,13 @@ function normalizeBannerItem(raw) {
|
||||
}
|
||||
|
||||
function canCancelByEventStatus(rawEventStatus) {
|
||||
return true;
|
||||
// 仅报名中(Enrolling / 1)允许取消
|
||||
if (rawEventStatus === 'Enrolling') return true;
|
||||
const n = Number(rawEventStatus);
|
||||
if (!Number.isNaN(n)) return n === 1;
|
||||
const s = rawEventStatus == null ? '' : String(rawEventStatus).toLowerCase();
|
||||
return s === 'enrolling' || s === '1';
|
||||
// if (rawEventStatus === 'Enrolling') return true;
|
||||
// const n = Number(rawEventStatus);
|
||||
// if (!Number.isNaN(n)) return n === 1;
|
||||
// const s = rawEventStatus == null ? '' : String(rawEventStatus).toLowerCase();
|
||||
// return s === 'enrolling' || s === '1';
|
||||
}
|
||||
|
||||
Page({
|
||||
|
||||
@ -1,97 +1,45 @@
|
||||
<view class="page-home">
|
||||
<scroll-view
|
||||
class="home-scroll"
|
||||
scroll-y="{{true}}"
|
||||
enhanced
|
||||
show-scrollbar="{{false}}"
|
||||
lower-threshold="100"
|
||||
bindscrolltolower="onScrollToLower"
|
||||
refresher-enabled="{{true}}"
|
||||
refresher-threshold="{{80}}"
|
||||
refresher-default-style="black"
|
||||
refresher-triggered="{{refresherTriggered}}"
|
||||
bindrefresherrefresh="onRefresherRefresh"
|
||||
>
|
||||
<swiper
|
||||
class="banner"
|
||||
indicator-dots="{{banners.length > 1}}"
|
||||
autoplay="{{banners.length > 1}}"
|
||||
interval="4000"
|
||||
circular="{{banners.length > 1}}"
|
||||
indicator-color="rgba(255,255,255,0.55)"
|
||||
indicator-active-color="#1a57b2"
|
||||
>
|
||||
<scroll-view class="home-scroll" scroll-y="{{true}}" enhanced show-scrollbar="{{false}}" lower-threshold="100" bindscrolltolower="onScrollToLower" refresher-enabled="{{true}}" refresher-threshold="{{80}}" refresher-default-style="black" refresher-triggered="{{refresherTriggered}}" bindrefresherrefresh="onRefresherRefresh">
|
||||
<swiper class="banner" indicator-dots="{{banners.length > 1}}" autoplay="{{banners.length > 1}}" interval="4000" circular="{{banners.length > 1}}" indicator-color="rgba(255,255,255,0.55)" indicator-active-color="#1a57b2">
|
||||
<block wx:for="{{banners}}" wx:key="_bannerKey">
|
||||
<swiper-item>
|
||||
<view
|
||||
class="banner-item"
|
||||
bindtap="onBannerTap"
|
||||
data-linktype="{{item.linkType}}"
|
||||
data-eventid="{{item.eventId}}"
|
||||
data-linkurl="{{item.linkUrl}}"
|
||||
>
|
||||
<view class="banner-item" bindtap="onBannerTap" data-linktype="{{item.linkType}}" data-eventid="{{item.eventId}}" data-linkurl="{{item.linkUrl}}">
|
||||
<image class="banner-image" src="{{item.imageUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
|
||||
<view class="sticky-header">
|
||||
<view class="search-wrap">
|
||||
<image class="search-img" src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/event_miniapp/search-left.png" />
|
||||
<input
|
||||
class="search-input"
|
||||
placeholder="搜索关键字"
|
||||
placeholder-class="search-ph"
|
||||
value="{{keyword}}"
|
||||
confirm-type="search"
|
||||
bindconfirm="onSearch"
|
||||
bindinput="onKeywordInput"
|
||||
/>
|
||||
<input class="search-input" placeholder="搜索关键字" placeholder-class="search-ph" value="{{keyword}}" confirm-type="search" bindconfirm="onSearch" bindinput="onKeywordInput" />
|
||||
<view class="search-btn" bindtap="onSearch">
|
||||
<mp-icon icon="search" size="22" color="#ffffff" />
|
||||
<text class="search-btn-text">搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-tabs">
|
||||
<view
|
||||
class="section-tab {{sectionTab === 'list' ? 'is-active' : ''}}"
|
||||
data-tab="list"
|
||||
bindtap="onSectionTab"
|
||||
>
|
||||
<view class="section-tab {{sectionTab === 'list' ? 'is-active' : ''}}" data-tab="list" bindtap="onSectionTab">
|
||||
<text class="section-tab-text">赛事报名</text>
|
||||
<image class="section-tab-img" wx:if="{{sectionTab === 'list'}}" src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/event_miniapp/home-title-b.png" />
|
||||
</view>
|
||||
<view
|
||||
class="section-tab {{sectionTab === 'registered' ? 'is-active' : ''}}"
|
||||
data-tab="registered"
|
||||
bindtap="onSectionTab"
|
||||
>
|
||||
<view class="section-tab {{sectionTab === 'registered' ? 'is-active' : ''}}" data-tab="registered" bindtap="onSectionTab">
|
||||
<text class="section-tab-text">已报赛事</text>
|
||||
<image class="section-tab-img" wx:if="{{sectionTab === 'registered'}}" src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/event_miniapp/home-title-b.png" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="status-filters" wx:if="{{sectionTab === 'list'}}">
|
||||
<view
|
||||
class="status-pill {{status === 1 ? 'is-on' : ''}}"
|
||||
data-status="1"
|
||||
bindtap="onStatusTap"
|
||||
>报名中</view>
|
||||
<view
|
||||
class="status-pill {{status === 3 ? 'is-1' : ''}}"
|
||||
data-status="3"
|
||||
bindtap="onStatusTap"
|
||||
>比赛中</view>
|
||||
<view
|
||||
class="status-pill {{status === 4 ? 'is-2' : ''}}"
|
||||
data-status="4"
|
||||
bindtap="onStatusTap"
|
||||
>已结束</view>
|
||||
<view class="status-pill {{status === 1 ? 'is-on' : ''}}" data-status="1" bindtap="onStatusTap">
|
||||
报名中
|
||||
</view>
|
||||
<view class="status-pill {{status === 3 ? 'is-1' : ''}}" data-status="3" bindtap="onStatusTap">
|
||||
比赛中
|
||||
</view>
|
||||
<view class="status-pill {{status === 4 ? 'is-2' : ''}}" data-status="4" bindtap="onStatusTap">
|
||||
已结束
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list-section">
|
||||
<block wx:if="{{sectionTab === 'registered' && !loggedIn}}">
|
||||
<view class="login-hint">
|
||||
@ -99,67 +47,58 @@
|
||||
<button class="login-hint-btn" type="primary" bindtap="goLogin">去登录</button>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{rows.length === 0 && !loading}}">
|
||||
<view class="empty">暂无数据</view>
|
||||
</block>
|
||||
|
||||
<block wx:for="{{rows}}" wx:key="rowKey">
|
||||
<view
|
||||
class="event-card"
|
||||
bindtap="onEventTap"
|
||||
data-id="{{item.id}}"
|
||||
>
|
||||
<view class="event-card" bindtap="onEventTap" data-id="{{item.id}}">
|
||||
<view class="event-card-media">
|
||||
<image class="event-card-cover" src="{{item.coverImage}}" mode="aspectFill" />
|
||||
<view class="addr-pill" wx:if="{{item.address}}">{{item.address}}</view>
|
||||
<view class="status-pill-top status-pill-top-{{item.eventStatus}}">{{item.eventStatusText}}</view>
|
||||
<view class="status-pill-top status-pill-top-{{item.eventStatus}}">
|
||||
{{item.eventStatusText}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="event-card-body">
|
||||
<view class="title-row">
|
||||
<text class="event-title">{{item.eventName || '-'}}</text>
|
||||
<view class="format-tag" wx:if="{{item.eventFormatText}}">{{item.eventFormatText}}</view>
|
||||
<view class="format-tag" wx:if="{{item.eventFormatText}}">
|
||||
{{item.eventFormatText}}
|
||||
</view>
|
||||
</view>
|
||||
<block wx:if="{{sectionTab === 'list'}}">
|
||||
<view class="meta-line">报名时间:{{item.registrationStartText}}~{{item.registrationEndText}}</view>
|
||||
<view class="meta-line">
|
||||
报名时间:{{item.registrationStartText}}~{{item.registrationEndText}}
|
||||
</view>
|
||||
<view class="meta-line">比赛时间:{{item.matchStartText}}~{{item.matchEndText}}</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="meta-line">报名时间:{{item.registrationTimeText}}</view>
|
||||
<view class="meta-line" wx:if="{{item.projectCount != null}}">已报项目:{{item.projectCount}} 项</view>
|
||||
<view class="meta-line" wx:if="{{item.projectCount != null}}">
|
||||
已报项目:{{item.projectCount}} 项
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view class="card-actions" wx:if="{{sectionTab === 'registered'}}" catchtap>
|
||||
<view
|
||||
class="action-btn action-btn--ghost"
|
||||
catchtap="onUploadMaterialTap"
|
||||
data-registrationid="{{item.registrationId}}"
|
||||
>上传素材</view>
|
||||
|
||||
<view class="action-btn action-btn--ghost" catchtap="onUploadMaterialTap" data-registrationid="{{item.registrationId}}">
|
||||
上传素材
|
||||
</view>
|
||||
<block wx:if="{{item.paymentStatus === 1}}">
|
||||
<view class="action-btn action-btn--paid" catchtap>已支付</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view
|
||||
class="action-btn action-btn--ghost"
|
||||
catchtap="onUploadVoucherTap"
|
||||
data-registrationid="{{item.registrationId}}"
|
||||
>上传付款凭证</view>
|
||||
<view class="action-btn action-btn--ghost" catchtap="onUploadVoucherTap" data-registrationid="{{item.registrationId}}">
|
||||
上传付款凭证
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="action-btn action-btn--ghost" catchtap>更改参赛人</view>
|
||||
<view
|
||||
class="action-btn action-btn--danger"
|
||||
wx:if="{{item.canCancel}}"
|
||||
catchtap="onCancelRegistrationTap"
|
||||
data-registrationid="{{item.registrationId}}"
|
||||
>取消报名</view>
|
||||
<view class="action-btn action-btn--danger" wx:if="{{item.canCancel}}" catchtap="onCancelRegistrationTap" data-registrationid="{{item.registrationId}}">
|
||||
取消报名
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="loading" wx:if="{{loading}}">{{loadingText}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
@ -304,10 +304,10 @@ page {
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
font-size: 22rpx;
|
||||
border-radius: 10rpx;
|
||||
border: 2rpx solid #e1e3e6;
|
||||
background: #fff;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user