10 changed files with 146 additions and 19 deletions
@ -0,0 +1,5 @@ |
|||
const proxyUrl = '/mt'; |
|||
import { http } from 'plugins/request/index'; |
|||
|
|||
// 查看比赛列表
|
|||
export const competeTimeList = params => http.post(`${proxyUrl}/compete/competeTimeList`, params); |
@ -0,0 +1,97 @@ |
|||
<template> |
|||
<view > |
|||
<view class="item-box" v-for="(item,index) in list" :key="index" @click="jump(item)"> |
|||
<view class="item-num">{{ index + 1 }}</view> |
|||
<text class="item-content">{{ item.name }}</text> |
|||
<view class="item-infor"> |
|||
<text style="color:#C0C0C0" v-if="item.competeStatus === 0">已结束</text> |
|||
<text style="color:#39B54A" v-else-if="item.competeStatus === 2"> |
|||
正在报名中 |
|||
</text> |
|||
<text style="color:#F0AD4E" v-else>未开始</text> |
|||
</view> |
|||
<view class="item-time"> |
|||
<text :style="{color:item.competeStatus === 2?'#39B54A':'#C0C0C0'}" > |
|||
({{$moment(+item.startTime).format('MM-DD HH:mm:ss')}} - {{$moment(+item.endTime).format('MM-DD HH:mm:ss')}}) |
|||
</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapMutations } from 'vuex'; |
|||
import { competeTimeList } from 'api/competeTimeList' |
|||
export default { |
|||
data() { |
|||
return { |
|||
list: [], |
|||
} |
|||
}, |
|||
created() { |
|||
this.getMatchList() |
|||
}, |
|||
methods: { |
|||
...mapMutations('project',['setCompanyId','setType']), |
|||
async getMatchList() { |
|||
const res = await competeTimeList() |
|||
this.list = res |
|||
}, |
|||
jump(item) { |
|||
console.log(item.competeStatus) |
|||
if(item.competeStatus === 2) { |
|||
this.setCompanyId(item.id) |
|||
this.setType(item.type) |
|||
uni.navigateTo({ |
|||
url:`../First/First` |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.item-box { |
|||
margin-top: 24px; |
|||
height: 80px; |
|||
line-height: 80px; |
|||
font-size: 18px; |
|||
width: 670rpx; |
|||
margin-left: 40rpx; |
|||
padding-left: 56rpx; |
|||
position: relative; |
|||
box-shadow: 0px 2px 5px $grey; |
|||
border-radius: 10px; |
|||
} |
|||
.item-num { |
|||
position: relative; |
|||
width: 40px; |
|||
height: 40px; |
|||
border-radius: 50%; |
|||
top: 20px; |
|||
text-align: center; |
|||
line-height: 40px; |
|||
background-color: #709AFC; |
|||
color: #fff; |
|||
} |
|||
.item-infor { |
|||
position: absolute; |
|||
left: 180rpx; |
|||
font-size: 30rpx; |
|||
color: $gray; |
|||
top: 6px; |
|||
} |
|||
.item-content { |
|||
position: absolute; |
|||
left: 180rpx; |
|||
top: -16px; |
|||
font-size: 16px; |
|||
} |
|||
.item-time { |
|||
font-size: 24rpx; |
|||
position: absolute; |
|||
left: 180rpx; |
|||
top: 26px; |
|||
} |
|||
</style> |
@ -1,5 +1,16 @@ |
|||
const mutations = { |
|||
|
|||
/* |
|||
存取比赛的Id |
|||
*/ |
|||
setCompanyId(state,data) { |
|||
state.companyId = data |
|||
}, |
|||
/* |
|||
存取比赛的Type |
|||
*/ |
|||
setType(state,data) { |
|||
state.type = data |
|||
} |
|||
}; |
|||
|
|||
export default mutations; |
|||
|
Loading…
Reference in new issue