index.vue
10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<template>
<div class="app-container">
<!-- 我是 赛事 -->
<div class="kind mt20">
<div class="box">
<el-card>
<ul>
<li>
<label>{{ language==0?'类型':'Type' }}:</label>
<el-radio-group v-model="query.type" @change="getList">
<el-radio-button value="-1">{{ language==0?'全部':'All' }}</el-radio-button>
<el-radio-button value="0">{{ language==0?'独立赛':'Station race' }}</el-radio-button>
<el-radio-button value="1">{{ language==0?'联赛':'League' }}</el-radio-button>
</el-radio-group>
</li>
<li>
<label>{{ language==0?'状态':'Status' }}:</label>
<el-radio-group
v-model="query.progressStatusCode"
@change="getList"
>
<el-radio-button value="-1">{{ language==0?'全部':'All' }}</el-radio-button>
<el-radio-button value="2">{{ language==0?'报名中':'Registering now' }}</el-radio-button>
<el-radio-button value="3">{{ language==0?'赛事即将开始':'Begin in a minute' }}</el-radio-button>
<el-radio-button value="4">{{ language==0?'赛事进行中':'In progress' }}</el-radio-button>
<el-radio-button value="5">{{ language==0?'已结束':'Ended' }}</el-radio-button>
</el-radio-group>
</li>
<li>
<label>{{ language==0?'时间':'Date' }}:</label>
<el-radio-group v-model="query.month" @change="getList">
<el-radio-button value="">{{ language==0?'全部':'All' }}</el-radio-button>
<el-radio-button v-for="m in monthList" :key="m" :value="m">{{m}}</el-radio-button>
</el-radio-group>
</li>
</ul>
</el-card>
</div>
</div>
<div class="box">
<div class="listTitle">
<h3>{{ language==0?'赛事列表':'List' }}</h3>
<div class="search">
<el-input
v-model="query.name"
:placeholder="language==0?'请输入赛事名称查询':'Search'"
class="input-with-select" @change="getList"
>
<template #append>
<el-button type="success" round @click="getList">{{ language==0?'查询':'Search' }}</el-button>
</template>
</el-input>
</div>
</div>
<div v-loading="loading">
<div class="matchItem" v-for="n in list" :key="n.id" @click="goDetail(n.id)">
<el-row :gutter="15" align="middle">
<el-col :lg="7" :md="24" :xl="6">
<div class="popo">
<el-tag v-if="n.signType==0">{{ language==0?'个人':'Individual' }}</el-tag>
<el-tag v-if="n.signType==1">{{ language==0?'团体':'Team' }}</el-tag>
<el-tag v-if="n.signType==2">{{ language==0?'个人/团体':'Individual/Team' }}</el-tag>
</div>
<img class="mauto mw100 coverLimitHeight" :src="fillImgUrl(n.coverUrl)">
</el-col>
<el-col :lg="9" :md="12" :xl="12">
<div class="info">
<h3 class="esp">{{ n.name }}</h3>
<p class="ppl"><label>{{language==0?'赛事级别':'Level'}}:</label>{{n.level}}</p>
<p class="ppl esp"><label>{{ language==0?'比赛时间':'Playing Time' }}:</label>{{n.beginTime?.slice(0,10)}} ~ {{ n.endTime?.slice(0,10) }}</p>
<!-- <p class="ppl" v-if="n.address"><label>{{ language==0?'地    点':'Location' }}:</label>{{ n.address }}</p>-->
<!-- <p class="ppl"><label>{{ language==0?'报名截止':'Registration Deadline' }}:</label>{{ n.signEndTime?.slice(0,10) }}</p>-->
<p class="ppl"><label>{{ language==0?'联 系 人':'Contact Person' }}:</label>{{ n.contactPerson }}</p>
<p class="ppl"><label>{{ language==0?'联系电话':'Phone' }}:</label>086-{{ n.contactTelno }}</p>
<p class="ppl esp"><label>{{ language==0?'邮    箱':'E-mail' }}:</label>{{ n.contactEmail }}</p>
<p class="ppl" v-if="n.type=='1'">
<label>{{ language==0?'分 站 赛':'Station race' }}:</label>{{n.cptsSize}}
</p>
</div>
</el-col>
<el-col :lg="8" :md="12" :xl="6">
<p class="countDownTitle">
<span v-if="language==0">报名截止倒计时</span>
<span v-else>Registration deadline countdown</span>
</p>
<van-count-down :time="n.time" format="DD 天 HH 时 mm 分 ss 秒">
<template #default="timeData">
<span class="block">{{ timeData.days }}</span>
<span class="colon">{{ language==0?'天':'Days' }}</span>
<span class="block">{{ timeData.hours }}</span>
<span class="colon">{{ language==0?'时':'Hrs' }}</span>
<span class="block">{{ timeData.minutes }}</span>
<span class="colon">{{ language==0?'分':'Min' }}</span>
<span class="block">{{ timeData.seconds }}</span>
<span class="colon">{{ language==0?'秒':'Sec' }}</span>
</template>
</van-count-down>
<div class="text-center mt30">
<a class="btn-lineG mb20 mauto" v-if="n.time>0" style="display: block;">
{{ language==0?'我要报名':'Register' }}</a>
<div v-else style="opacity: 0.5;" class="btn-lineG mb20 mauto">{{ language==0?'报名已结束':'Registration has ended' }}</div>
<p class="text-gray">{{ language==0?'报名截止':'Registration Deadline' }}:{{ n.signEndTime?.slice(0,10) }}</p>
</div>
</el-col>
</el-row>
</div>
<el-empty :image="`/img/order_no.png`" :image-size="228" v-if="list?.length == 0" description=" "/>
</div>
<div v-if="total>10" class="pc-page-box mb20">
<PaginationPc v-model:page="query.pageNum" v-model:limit="query.pageSize" :total="total" @pagination="getList" />
</div>
<div class="mb20"></div>
</div>
</div>
</template>
<script setup>
import { getCurrentInstance, ref } from 'vue'
import { reactive, onMounted } from '@vue/runtime-core'
import { useRouter } from 'vue-router'
import { dayjs } from 'element-plus'
const router = useRouter()
const { proxy } = getCurrentInstance()
import * as match from '@/apiPc/match'
import {useStorage} from "@vueuse/core/index";
const language= useStorage('language',0)
const typeList = ref([{ label: '全部', id: '0' }])
const list = ref([])
const projectList = ref([])
const monthList = ref([])
const loading = ref(false)
const activeName = ref('')
const total = ref(0)
const query = ref({
type:'-1',
projectId: '',
progressStatusCode: '-1',
month: '',
pageNum: 1,
pageSize: 18
})
onMounted(() => {
activeName.value = typeList.value[0].id
getMonthList()
getList()
})
function getMonthList() {
// const date = new Date()
const arr = []
// 获取年
let year = dayjs().year()
// 获取月
let mon = dayjs().month() - 6
if (mon < 1) {
year = year - 1
mon = 12 + mon
}
for (var i = 0; i <= 11; i++) {
if (++mon > 12) {
mon = 1
year++
}
if (mon < 10) {
mon = '0' + mon
}
// console.log(year + '-' + mon)
arr.push(year + '-' + mon)
}
monthList.value = arr
}
function getList() {
loading.value = true
match.getMaList(query.value).then((res) => {
list.value = res.rows
for(let n of list.value){
var today = dayjs().format('YYYY-MM-DD HH:mm:ss')
n.time = dayjs(n.signEndTime).diff(today, 'millisecond')
}
total.value = res.total
loading.value = false
})
}
function goDetail(id) {
const routeLocation = router.resolve({
name: 'matchDetail',
params: {
id: id
}
})
window.open(routeLocation.href, '_blank')
}
</script>
<style scoped lang="scss">
.app-container {
background: #f5f7f9;
padding: 0;
}
.matchItem {
cursor: pointer;padding:10px 20px 20px;box-shadow: 0 0 6px #eee;
background: #FFFFFF;margin: 0 0 20px;
position: relative;
.el-col{padding-top: 20px}
.countDownTitle{margin: 0}
&:last-child {
border-bottom: none;
}
.el-avatar {
position: absolute;
left: 20px;
top: 30px;
img {
background: #fff;
}
}
.info {
p {
font-size: 14px;
}
}
.typeTag {
position: absolute;
right: 0;
top: 0;
}
h3 {
font-weight: 500;margin: 0 0 10px;
font-size: 18px;
color: #000000;
text-overflow: ellipsis;
}
&:hover h3 {
color: var(--el-color-primary);
}
}
.countDownTitle {
text-align: center;
color: #525F6B;
position: relative;
width: 100%;
left: 0;
font-size: 14px;
}
.countDownTitle span {
background: #fff;
padding: 0 10px;
position: relative;
z-index: 1;
}
.countDownTitle::after {
position: absolute;
background: #ccc;
height: 1px;
content: '';
top: 0;
bottom: 0;
margin: auto;
width: 100%;
left: 0;
}
.info h3{margin: 0 0 15px}
.info .ppl{margin: 6px 0;}
.ppl{color: #29343C;
label{color: #929AA0;}
}
.van-count-down {
text-align: center;
margin: 20px 0;
}
.colon {
display: inline-block;
font-size: 14px;
margin: 0 8px;
color: #7B7F83;
}
.block {
display: inline-block; opacity: 0.7;
width: 52px;
color: #fff;
font-size: 26px;
font-weight: bold;
border-radius: 10px;
background: url(@/assets/img/djs_bg.png) left;
background-size: 100% 100%;
line-height: 50px;
text-align: center;
}
@media (max-width: 1450px) {
.block{width: 44px;font-size: 20px;}
}
.el-pagination {
--el-pagination-button-disabled-bg-color: transparent;
justify-content: center;
--el-pagination-bg-color: transparent;
}
.kind {
.el-radio-group{width: 90%;}
ul {
list-style: none;
li {
margin: 0 0 10px;
display: flex;
align-items: flex-start;
& > label {padding: 8px 0;
width:5em;text-align: right;font-weight: normal;
}
.el-radio-button{min-width: 90px;text-align: center;}
&:last-child{border-bottom: none;margin: 0}
}
}
}
.listTitle {
display: flex;
justify-content: space-between;
align-items: center;
}
.goldbtn {
color: #fff;
border: #D5AC5A;
background: #D5AC5A;
}
.el-button--primary:hover {
background: var(--el-color-primary)
}
.mw100{max-width: 100%;}
</style>