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. 77
      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';
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 () {
//sessionStorage
@ -14,6 +23,17 @@ export default {
window.addEventListener("beforeunload",()=>{
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>

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,
"port" : ""
"port" : 30022
},
"router" : {
"base" : ""
"base" : "/compete"
},
"domain" : "https//:www.tall.wiki",
"domain" : "https://test.tall.wiki",
"async" : {
//js
"loading" : "AsyncLoading", //js使

8
pages.json

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

12
pages/Athletes/AthAdd.vue

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

2
pages/Choice/Choice.vue

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

2
pages/First/First.vue

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

9
pages/Login/Login.vue

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

21
pages/Project/MatchDetail/MatchDetail.vue

@ -1,5 +1,9 @@
<template>
<view>
<view class="match-name">
{{ objdata.name }}
</view>
<view class="match-Name"></view>
<view class="sign-up" v-show="submit === 0" @click="changeSub">
添加报名
</view>
@ -160,6 +164,22 @@ import { join } from 'api/join'
</script>
<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 {
margin-left: 35rpx;
width: 680rpx;
@ -202,6 +222,7 @@ import { join } from 'api/join'
.sign-up {
position: absolute;
right: 35rpx;
top: 88rpx;
padding: 5px 10px;
border-radius: 5px;
box-shadow: 0 0 5px $gray;

206
pages/Project/MatchDetail/TeamDetail.vue

@ -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>

77
pages/Project/MatchDetail/TeamMatch.vue

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

3
store/modules/project/state.js

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

Loading…
Cancel
Save