|
|
@ -1,26 +1,34 @@ |
|
|
|
<template> |
|
|
|
<view> |
|
|
|
<ms-dropdown-menu class="select"> |
|
|
|
<ms-dropdown-menu v-show="showms - 0 === 0" class="select"> |
|
|
|
<ms-dropdown-item v-model="value" :list="list"></ms-dropdown-item> |
|
|
|
<ms-dropdown-item v-model="value1" :list="list1"></ms-dropdown-item> |
|
|
|
</ms-dropdown-menu> |
|
|
|
<!-- <button type="default" @click="btn">123</button> --> |
|
|
|
<view class="player-box"> |
|
|
|
<view class="player" :class="item.isjoin?'player-active':''" v-show="item.isjoin || edit - 0 === 1" v-for="(item,index) in list2" :key="index" @click="choice(index)"> |
|
|
|
<icon type="icon" :class="item.isjoin?'backactive':''" class="cuIcon-roundcheckfill back"></icon> |
|
|
|
{{ item.name }} |
|
|
|
<view class="player" :class="item.joinProject?'player-active':''" v-for="(item,index) in list2" :key="index" @click="choice(index)"> |
|
|
|
<icon type="icon" :class="item.joinProject?'backactive':''" class="cuIcon-roundcheckfill back"></icon> |
|
|
|
{{ item.playerName }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<button class="modify" type="default" @click="editData" :class="edit - 0 === 1?'mit':''"> |
|
|
|
<text v-if="edit - 0 === 0">编辑</text> |
|
|
|
<text v-else-if="edit - 0 === 1">提交</text> |
|
|
|
<button v-show="list2[0]" class="modify mit" type="default" @click="editData"> |
|
|
|
<!-- <text v-if="edit - 0 === 0">编辑</text> --> |
|
|
|
<text>提交</text> |
|
|
|
</button> |
|
|
|
<view v-show="!list2[0]" class="img-B"> |
|
|
|
<img src="static/item.png" class="img-box" /> |
|
|
|
<view> |
|
|
|
暂无运动员信息 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import msDropdownMenu from '@/components/ms-dropdown/dropdown-menu.vue' |
|
|
|
import msDropdownItem from '@/components/ms-dropdown/dropdown-item.vue' |
|
|
|
import { rulePlayer } from 'api/rulePlayer' |
|
|
|
import { join } from 'api/join' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
msDropdownMenu, |
|
|
@ -29,10 +37,18 @@ |
|
|
|
onLoad(option) { |
|
|
|
const that = this |
|
|
|
that.obj = JSON.parse(option.obj) |
|
|
|
console.log(that.obj) |
|
|
|
that.showms = that.obj.joinRule |
|
|
|
if (option.groupRemark - 0) { |
|
|
|
that.value = option.groupRemark - 0 - 1 |
|
|
|
that.value1 = option.gender - 0 |
|
|
|
} else { |
|
|
|
that.query() |
|
|
|
} |
|
|
|
// console.log(that.obj,option) |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
showms: 1, |
|
|
|
obj:{}, |
|
|
|
list: [ |
|
|
|
{ |
|
|
@ -58,11 +74,11 @@ |
|
|
|
], |
|
|
|
list1: [ |
|
|
|
{ |
|
|
|
text: '男子组', |
|
|
|
text: '女子组', |
|
|
|
value: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: '女子组', |
|
|
|
text: '男子组', |
|
|
|
value: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
@ -70,52 +86,7 @@ |
|
|
|
value: 2 |
|
|
|
} |
|
|
|
], |
|
|
|
list2: [ |
|
|
|
{ |
|
|
|
name: '男子组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '女子组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '混合组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '女子组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '混合组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '女子组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '混合组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '女子组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '混合组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '女子组', |
|
|
|
isjoin: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '混合组', |
|
|
|
isjoin: 0 |
|
|
|
} |
|
|
|
], |
|
|
|
list2: [], |
|
|
|
value: 0, |
|
|
|
value1: 0, |
|
|
|
edit: 0, |
|
|
@ -133,14 +104,12 @@ |
|
|
|
close() { |
|
|
|
this.$refs.dropdownItem.closePopup() |
|
|
|
}, |
|
|
|
editData() { |
|
|
|
async editData() { |
|
|
|
const that = this |
|
|
|
if(that.edit - 0 === 0) { |
|
|
|
that.edit = 1 |
|
|
|
} else { |
|
|
|
if (that.joinNum - 0 === 0) { |
|
|
|
that.edit = 0 |
|
|
|
} else if (that.joinNum < that.obj.memberMin) { |
|
|
|
// if(that.edit - 0 === 0) { |
|
|
|
// that.edit = 1 |
|
|
|
// } else { |
|
|
|
if (that.joinNum < that.obj.memberMin && that.joinNum > 0) { |
|
|
|
uni.showToast({ |
|
|
|
title:`小于最少人数${that.obj.memberMin}人`, |
|
|
|
icon: 'none', |
|
|
@ -153,24 +122,112 @@ |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
} else { |
|
|
|
that.edit = 0 |
|
|
|
try{ |
|
|
|
var params = {} |
|
|
|
if(that.obj.joinRule - 0 === 0) { |
|
|
|
params = { |
|
|
|
param:{ |
|
|
|
companyId: that.$store.state.project.companyId, |
|
|
|
competeTimeId: that.$store.state.project.data.id, |
|
|
|
gender: that.value1, |
|
|
|
groupRemark: that.value - 0 + 1, |
|
|
|
projectId: that.obj.id, |
|
|
|
players: that.list2 |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
params = { |
|
|
|
param:{ |
|
|
|
companyId: that.$store.state.project.companyId, |
|
|
|
competeTimeId: that.$store.state.project.data.id, |
|
|
|
projectId: that.obj.id, |
|
|
|
players: that.list2 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const data = await join(params) |
|
|
|
if (that.joinNum - 0 === 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: '取消成功', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: '报名成功', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
} |
|
|
|
that.$store.state.project.Mat++ |
|
|
|
setTimeout(function(){ |
|
|
|
uni.navigateBack() |
|
|
|
},1000) |
|
|
|
// console.log(that.$store.state) |
|
|
|
}catch(e){ |
|
|
|
//TODO handle the exception |
|
|
|
uni.showToast({ |
|
|
|
title: e, |
|
|
|
icon: 'none', |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// } |
|
|
|
}, |
|
|
|
choice(index) { |
|
|
|
const that = this |
|
|
|
that.joinNum = 0 |
|
|
|
if(that.list2[`${index}`].isjoin - 0 === 0) { |
|
|
|
that.list2[`${index}`].isjoin = 1 |
|
|
|
if(that.list2[`${index}`].joinProject - 0 === 0) { |
|
|
|
that.list2[`${index}`].joinProject = 1 |
|
|
|
} else { |
|
|
|
that.list2[`${index}`].isjoin = 0 |
|
|
|
that.list2[`${index}`].joinProject = 0 |
|
|
|
} |
|
|
|
for(var i=0; i<that.list2.length;i++) { |
|
|
|
if(that.list2[i].isjoin - 0 === 1) { |
|
|
|
if(that.list2[i].joinProject - 0 === 1) { |
|
|
|
that.joinNum++ |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(that.joinNum) |
|
|
|
// console.log(that.joinNum) |
|
|
|
}, |
|
|
|
async query() { |
|
|
|
const that = this |
|
|
|
try{ |
|
|
|
const params = { |
|
|
|
param: { |
|
|
|
companyId: that.$store.state.project.companyId, |
|
|
|
gender: that.value1, |
|
|
|
groupRemark: that.value - 0 + 1, |
|
|
|
projectId: that.obj.id |
|
|
|
} |
|
|
|
} |
|
|
|
that.list2 = [] |
|
|
|
const data = await rulePlayer(params) |
|
|
|
if (that.obj.joinRule - 0 === 0 && that.value1 - 0 !== 2) { |
|
|
|
that.list2 = data[0].playerList |
|
|
|
} else { |
|
|
|
console.log(data) |
|
|
|
for (var i=0;i<data.length;i++) { |
|
|
|
that.list2 = that.list2.concat(data[i].playerList) |
|
|
|
} |
|
|
|
} |
|
|
|
// console.log(that.list2) |
|
|
|
}catch(e){ |
|
|
|
//TODO handle the exception |
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
value(val){ |
|
|
|
const that = this |
|
|
|
that.list2 = [] |
|
|
|
that.query() |
|
|
|
}, |
|
|
|
value1(val){ |
|
|
|
const that = this |
|
|
|
that.list2 = [] |
|
|
|
that.query() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -222,4 +279,15 @@ |
|
|
|
background: $blue; |
|
|
|
color: $white; |
|
|
|
} |
|
|
|
.img-box { |
|
|
|
width: 70%; |
|
|
|
height: 70%; |
|
|
|
} |
|
|
|
.img-B { |
|
|
|
width: 100%; |
|
|
|
margin-top: 100px; |
|
|
|
height: 450rpx; |
|
|
|
text-align: center; |
|
|
|
color: #aaa; |
|
|
|
} |
|
|
|
</style> |
|
|
|