Browse Source

修改报名方式

master
aBin 5 years ago
parent
commit
99d29203da
  1. 24
      App.vue
  2. 5
      api/delTeam.js
  3. 5
      api/rulePlayer.js
  4. 5
      api/teamProject.js
  5. 6
      manifest.json
  6. 8
      pages.json
  7. 12
      pages/Athletes/AthAdd.vue
  8. 2
      pages/Choice/Choice.vue
  9. 2
      pages/First/First.vue
  10. 9
      pages/Login/Login.vue
  11. 21
      pages/Project/MatchDetail/MatchDetail.vue
  12. 206
      pages/Project/MatchDetail/TeamDetail.vue
  13. 75
      pages/Project/MatchDetail/TeamMatch.vue
  14. 3
      store/modules/project/state.js

24
App.vue

@ -2,8 +2,17 @@
import { mapState, mapMutations, mapActions } from 'vuex'; import { mapState, mapMutations, mapActions } from 'vuex';
export default { export default {
async onLaunch(options) { async onLaunch() {
if (localStorage.getItem('user')) {
var obj = localStorage.getItem('user')
// console.log(JSON.parse(obj))
this.cacheData(obj)
}
if (localStorage.getItem('token')) {
var obj = localStorage.getItem('token')
// console.log(JSON.parse(obj))
this.$store.state.user.token = obj
}
}, },
created () { created () {
//sessionStorage //sessionStorage
@ -14,6 +23,17 @@ export default {
window.addEventListener("beforeunload",()=>{ window.addEventListener("beforeunload",()=>{
sessionStorage.setItem("store",JSON.stringify(this.$store.state)) sessionStorage.setItem("store",JSON.stringify(this.$store.state))
}) })
},
methods:{
...mapMutations('user', ['setToken', 'setUser','setBindMsg']),
// user data
cacheData(data) {
const { token } = data;
this.setToken(token);
this.setUser(data);
// console.log(this.$store.state.user.token)
// console.log(this.$store.state.user.user.wxInfo)
}
} }
}; };
</script> </script>

5
api/delTeam.js

@ -0,0 +1,5 @@
const proxyUrl = '/mt';
import { http } from 'plugins/request/index';
// 删除已经报名的队伍
export const delTeam = params => http.post(`${proxyUrl}/province/del/team`, params);

5
api/rulePlayer.js

@ -0,0 +1,5 @@
const proxyUrl = '/mt';
import { http } from 'plugins/request/index';
// 团体报名查询可以参加和已经参加的选手
export const rulePlayer = params => http.post(`${proxyUrl}/province/rule/player`, params);

5
api/teamProject.js

@ -0,0 +1,5 @@
const proxyUrl = '/mt';
import { http } from 'plugins/request/index';
// 查找团体比赛已报名的选手信息
export const teamProject = params => http.post(`${proxyUrl}/province/teamProject/player`, params);

6
manifest.json

@ -98,12 +98,12 @@
} }
}, },
"https" : false, "https" : false,
"port" : "" "port" : 30022
}, },
"router" : { "router" : {
"base" : "" "base" : "/compete"
}, },
"domain" : "https//:www.tall.wiki", "domain" : "https://test.tall.wiki",
"async" : { "async" : {
//js //js
"loading" : "AsyncLoading", //js使 "loading" : "AsyncLoading", //js使

8
pages.json

@ -27,7 +27,7 @@
,{ ,{
"path" : "pages/Choice/Choice", "path" : "pages/Choice/Choice",
"style" : { "style" : {
"navigationBarTitleText": "教练及领队信息", "navigationBarTitleText": "领队及教练信息",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#f8f8f8" "navigationBarBackgroundColor": "#f8f8f8"
} }
@ -74,11 +74,7 @@
} }
,{ ,{
"path" : "pages/Project/MatchDetail/MatchDetail", "path" : "pages/Project/MatchDetail/MatchDetail",
"style" : { "style" : {}
"navigationBarTitleText": "队员添加",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#f8f8f8"
}
} }
,{ ,{
"path" : "pages/Login/Register", "path" : "pages/Login/Register",

12
pages/Athletes/AthAdd.vue

@ -193,17 +193,17 @@ import { group } from 'api/group'
content: 'insuranceRecord' content: 'insuranceRecord'
}], }],
idCardFront: '', // idCardFront: '', //
idCardFrontId: '', // idCardFrontId: '1326409300276547584', //
idCardBack: '', // idCardBack: '', //
idCardBackId: '', // idCardBackId: '1326409300276547584', //
idPhone: '', // idPhone: '', //
idPhoneId: '', // idPhoneId: '1326409300276547584', //
studentRecord: '', // studentRecord: '', //
studentRecordId: '', // studentRecordId: '1326409300276547584', //
healthRecord: '', // healthRecord: '', //
healthRecordId: '', // healthRecordId: '1326409300276547584', //
insuranceRecord: '', // insuranceRecord: '', //
insuranceRecordId: '', // insuranceRecordId: '1326409300276547584', //
che: 0, che: 0,
isId: 0, isId: 0,
playerId: 0, playerId: 0,

2
pages/Choice/Choice.vue

@ -174,7 +174,7 @@
watch:{ watch:{
'$store.state.project.num'(val) { '$store.state.project.num'(val) {
const that = this const that = this
that.query()() that.query()
} }
} }
} }

2
pages/First/First.vue

@ -30,7 +30,7 @@
import { competeTime } from 'api/competeTime' import { competeTime } from 'api/competeTime'
import { overview } from 'api/overview' import { overview } from 'api/overview'
export default { export default {
onLoad () { created () {
this.query() this.query()
}, },
data() { data() {

9
pages/Login/Login.vue

@ -34,6 +34,14 @@
import { mapState, mapMutations, mapActions } from 'vuex'; import { mapState, mapMutations, mapActions } from 'vuex';
import { login } from 'api/login' import { login } from 'api/login'
export default { export default {
onLoad() {
const that = this
if (that.$store.state.user.token) {
uni.navigateTo({
url:`../First/First`
})
}
},
data() { data() {
return { return {
userphone:'', userphone:'',
@ -93,6 +101,7 @@ import { login } from 'api/login'
type: 3 type: 3
} }
const data = await login(params) const data = await login(params)
localStorage.setItem("token", data.token);
console.log(data) console.log(data)
that.cacheData(data) that.cacheData(data)
uni.navigateTo({ uni.navigateTo({

21
pages/Project/MatchDetail/MatchDetail.vue

@ -1,5 +1,9 @@
<template> <template>
<view> <view>
<view class="match-name">
{{ objdata.name }}
</view>
<view class="match-Name"></view>
<view class="sign-up" v-show="submit === 0" @click="changeSub"> <view class="sign-up" v-show="submit === 0" @click="changeSub">
添加报名 添加报名
</view> </view>
@ -160,6 +164,22 @@ import { join } from 'api/join'
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.match-name {
position: fixed;
text-align: center;
width: 100%;
top: 44px;
height: 40px;
line-height: 40px;
background: $white;
z-index: 10;
font-size: 20px;
font-size: 16px;
font-weight: 600;
}
.match-Name {
height: 40px;
}
.member-box { .member-box {
margin-left: 35rpx; margin-left: 35rpx;
width: 680rpx; width: 680rpx;
@ -202,6 +222,7 @@ import { join } from 'api/join'
.sign-up { .sign-up {
position: absolute; position: absolute;
right: 35rpx; right: 35rpx;
top: 88rpx;
padding: 5px 10px; padding: 5px 10px;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 0 5px $gray; box-shadow: 0 0 5px $gray;

206
pages/Project/MatchDetail/TeamDetail.vue

@ -1,26 +1,34 @@
<template> <template>
<view> <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="value" :list="list"></ms-dropdown-item>
<ms-dropdown-item v-model="value1" :list="list1"></ms-dropdown-item> <ms-dropdown-item v-model="value1" :list="list1"></ms-dropdown-item>
</ms-dropdown-menu> </ms-dropdown-menu>
<!-- <button type="default" @click="btn">123</button> --> <!-- <button type="default" @click="btn">123</button> -->
<view class="player-box"> <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)"> <view class="player" :class="item.joinProject?'player-active':''" v-for="(item,index) in list2" :key="index" @click="choice(index)">
<icon type="icon" :class="item.isjoin?'backactive':''" class="cuIcon-roundcheckfill back"></icon> <icon type="icon" :class="item.joinProject?'backactive':''" class="cuIcon-roundcheckfill back"></icon>
{{ item.name }} {{ item.playerName }}
</view> </view>
</view> </view>
<button class="modify" type="default" @click="editData" :class="edit - 0 === 1?'mit':''"> <button v-show="list2[0]" class="modify mit" type="default" @click="editData">
<text v-if="edit - 0 === 0">编辑</text> <!-- <text v-if="edit - 0 === 0">编辑</text> -->
<text v-else-if="edit - 0 === 1">提交</text> <text>提交</text>
</button> </button>
<view v-show="!list2[0]" class="img-B">
<img src="static/item.png" class="img-box" />
<view>
暂无运动员信息
</view>
</view>
</view> </view>
</template> </template>
<script> <script>
import msDropdownMenu from '@/components/ms-dropdown/dropdown-menu.vue' import msDropdownMenu from '@/components/ms-dropdown/dropdown-menu.vue'
import msDropdownItem from '@/components/ms-dropdown/dropdown-item.vue' import msDropdownItem from '@/components/ms-dropdown/dropdown-item.vue'
import { rulePlayer } from 'api/rulePlayer'
import { join } from 'api/join'
export default { export default {
components: { components: {
msDropdownMenu, msDropdownMenu,
@ -29,10 +37,18 @@
onLoad(option) { onLoad(option) {
const that = this const that = this
that.obj = JSON.parse(option.obj) 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() { data() {
return { return {
showms: 1,
obj:{}, obj:{},
list: [ list: [
{ {
@ -58,11 +74,11 @@
], ],
list1: [ list1: [
{ {
text: '子组', text: '子组',
value: 0 value: 0
}, },
{ {
text: '子组', text: '子组',
value: 1 value: 1
}, },
{ {
@ -70,52 +86,7 @@
value: 2 value: 2
} }
], ],
list2: [ 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
}
],
value: 0, value: 0,
value1: 0, value1: 0,
edit: 0, edit: 0,
@ -133,14 +104,12 @@
close() { close() {
this.$refs.dropdownItem.closePopup() this.$refs.dropdownItem.closePopup()
}, },
editData() { async editData() {
const that = this const that = this
if(that.edit - 0 === 0) { // if(that.edit - 0 === 0) {
that.edit = 1 // that.edit = 1
} else { // } else {
if (that.joinNum - 0 === 0) { if (that.joinNum < that.obj.memberMin && that.joinNum > 0) {
that.edit = 0
} else if (that.joinNum < that.obj.memberMin) {
uni.showToast({ uni.showToast({
title:`小于最少人数${that.obj.memberMin}`, title:`小于最少人数${that.obj.memberMin}`,
icon: 'none', icon: 'none',
@ -153,24 +122,112 @@
duration: 1500 duration: 1500
}) })
} else { } 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) { choice(index) {
const that = this const that = this
that.joinNum = 0 that.joinNum = 0
if(that.list2[`${index}`].isjoin - 0 === 0) { if(that.list2[`${index}`].joinProject - 0 === 0) {
that.list2[`${index}`].isjoin = 1 that.list2[`${index}`].joinProject = 1
} else { } else {
that.list2[`${index}`].isjoin = 0 that.list2[`${index}`].joinProject = 0
} }
for(var i=0; i<that.list2.length;i++) { 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++ 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; background: $blue;
color: $white; color: $white;
} }
.img-box {
width: 70%;
height: 70%;
}
.img-B {
width: 100%;
margin-top: 100px;
height: 450rpx;
text-align: center;
color: #aaa;
}
</style> </style>

75
pages/Project/MatchDetail/TeamMatch.vue

@ -4,19 +4,18 @@
{{ obj.name }} {{ obj.name }}
</view> </view>
<view class="match-Name"></view> <view class="match-Name"></view>
<view v-if="list[0]"> <view v-if="item.playerList[0]" class="match-team" v-for="(item,index) in list" :key="index">
<view class="match-team" v-for="(item,index) in list" :key="index">
<view class="team-name"> <view class="team-name">
{{ item.name }} <text v-if="obj.joinRule - 0 === 0">{{ item.groupName }}</text>
<icon type="icon" class="cuIcon-close icon" @click="del"></icon> <text v-else>不限组别</text>
<icon type="icon" class="cuIcon-close icon" @click="del(item.teamId)"></icon>
</view> </view>
<view class="team-player"> <view class="team-player">
<view class="team-man" v-for="(a,b) in item.player" :key="b"> <view class="team-man" v-for="(a,b) in item.playerList" :key="b">
{{ a }} {{ a.playerName }}
</view> </view>
</view> </view>
<button type="default" class="change" @click="edit">编辑</button> <button type="default" class="change" @click="edit(item.gender,item.groupRemark)">编辑</button>
</view>
</view> </view>
<view class="img-B" v-else> <view class="img-B" v-else>
<img src="static/item.png" class="img-box" /> <img src="static/item.png" class="img-box" />
@ -24,53 +23,58 @@
暂无运动员信息 暂无运动员信息
</view> </view>
</view> </view>
<view class="add" @click="addTeam">添加</view> <view class="add" @click="addTeam">添加</view>
</view> </view>
</template> </template>
<script> <script>
import { delTeam } from 'api/delTeam'
import { teamProject } from 'api/teamProject'
export default { export default {
onLoad(option) { onLoad(option) {
const that = this const that = this
var OBJ = JSON.parse(option.obj) var OBJ = JSON.parse(option.obj)
console.log(option.TypeNum,OBJ) console.log(option.TypeNum,OBJ)
that.obj = OBJ that.obj = OBJ
that.query()
}, },
data() { data() {
return { return {
obj: {}, obj: {},
list: [{ list: []
name:'小学女子组',
player: ['王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺']
},{
name:'小学男子组',
player: ['王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺','王旺旺']
},{
name:'小学混合组',
player: ['王旺旺','王旺旺','王旺旺']
}]
} }
}, },
methods: { methods: {
del() { del(index) {
const that = this
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要删除整组么?', content: '确定要删除整组么?',
success: (res) => { success: async (res) => {
if (res.confirm) { if (res.confirm) {
console.log('确定删除') console.log(index)
const params = {
param: {
teamId: index
}
} }
if (res.cancel) { const data = await delTeam(params)
console.log('取消') that.$store.state.project.Mat++
uni.showToast({
title: '删除成功',
icon: 'success',
duration: 1500
})
} }
} }
}) })
}, },
edit() { edit(gender,groupRemark) {
const that = this const that = this
const obj = that.obj const obj = that.obj
uni.navigateTo({ uni.navigateTo({
url: `./TeamDetail?obj=${JSON.stringify(obj)}` url: `./TeamDetail?obj=${JSON.stringify(obj)}&gender=${gender}&groupRemark=${groupRemark}`
}) })
}, },
addTeam() { addTeam() {
@ -79,6 +83,24 @@
uni.navigateTo({ uni.navigateTo({
url: `./TeamDetail?obj=${JSON.stringify(obj)}` url: `./TeamDetail?obj=${JSON.stringify(obj)}`
}) })
},
async query() {
const that = this
const params = {
param: {
companyId: that.$store.state.project.companyId,
projectId: that.obj.id
}
}
const data = await teamProject(params)
that.list = data
console.log(that.list)
}
},
watch:{
'$store.state.project.Mat'(val) {
const that = this
that.query()
} }
} }
} }
@ -94,7 +116,8 @@
line-height: 40px; line-height: 40px;
background: $white; background: $white;
z-index: 10; z-index: 10;
font-size: 20px; font-size: 16px;
font-weight: 600;
} }
.match-Name { .match-Name {
height: 40px; height: 40px;

3
store/modules/project/state.js

@ -1,7 +1,8 @@
const state = { const state = {
data: null, data: null,
companyId: 0, companyId: 0,
num: 0 num: 0,
Mat: 0
}; };
export default state; export default state;

Loading…
Cancel
Save