|
|
@@ -1,59 +1,68 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div class="match-name">{{matchInfo.name}}</div>
|
|
|
- <div class="game-name">{{matchInfo.gameInfo?matchInfo.gameInfo.name:''}}</div>
|
|
|
+ <div class="game-name">{{matchInfo.gameInfo?matchInfo.gameInfo.name:''}}
|
|
|
+ </div>
|
|
|
<div class="title">报名信息</div>
|
|
|
<div class="cell">
|
|
|
<div class="row">
|
|
|
<span class="label">注册手机号</span>
|
|
|
- <span class="input" style="background: none">{{userInfo.phone}}</span>
|
|
|
+ <span class="input"
|
|
|
+ style="background: none">{{userInfo.phone}}</span>
|
|
|
</div>
|
|
|
<div class="row" v-if="matchInfo.teamMode">
|
|
|
<span class="label">战队名称</span>
|
|
|
<input class="input" v-model="teamName" placeholder="请填写战队名称">
|
|
|
<img v-if="teamName" @click="teamName=''"
|
|
|
- src="../assets/icon_clear_pre.png"
|
|
|
- class="icon-clear">
|
|
|
+ src="../assets/icon_clear_pre.png" class="icon-clear">
|
|
|
</div>
|
|
|
<div class="row" v-else>
|
|
|
<span class="label">游戏ID</span>
|
|
|
- <input @click="$event.target.focus()" class="input" v-model="gameId" placeholder="请填写游戏ID">
|
|
|
- <img v-if="gameId" @click="gameId=''" src="../assets/icon_clear_pre.png" class="icon-clear">
|
|
|
+ <input @click="$event.target.focus()" class="input"
|
|
|
+ v-model="gameId" placeholder="请填写游戏ID">
|
|
|
+ <img v-if="gameId" @click="gameId=''"
|
|
|
+ src="../assets/icon_clear_pre.png" class="icon-clear">
|
|
|
</div>
|
|
|
<div class="row" v-if="!matchInfo.isPublic">
|
|
|
<span class="label">报名密码</span>
|
|
|
- <input @click="$event.target.focus()" class="input" v-model="password" placeholder="请填写报名密码">
|
|
|
+ <input @click="$event.target.focus()" class="input"
|
|
|
+ v-model="password" placeholder="请填写报名密码">
|
|
|
</div>
|
|
|
<div class="row" v-if="matchInfo.requireRealName">
|
|
|
<span class="label">真实姓名</span>
|
|
|
- <input @click="$event.target.focus()"
|
|
|
- class="input" v-model="realName" placeholder="请填写真实姓名">
|
|
|
+ <input @click="$event.target.focus()" class="input"
|
|
|
+ v-model="realName" placeholder="请填写真实姓名">
|
|
|
</div>
|
|
|
<div class="row" v-if="matchInfo.requireId">
|
|
|
<span class="label">身份证</span>
|
|
|
- <input @click="$event.target.focus()" class="input" v-model="idNo" placeholder="请填写身份证号">
|
|
|
+ <input @click="$event.target.focus()" class="input"
|
|
|
+ v-model="idNo" placeholder="请填写身份证号">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="title">联系方式</div>
|
|
|
<div class="cell">
|
|
|
<div class="row">
|
|
|
<span class="label">手机号</span>
|
|
|
- <input @click="$event.target.focus()" class="input" v-model="phone" placeholder="请填写手机号">
|
|
|
+ <input @click="$event.target.focus()" class="input"
|
|
|
+ v-model="phone" placeholder="请填写手机号">
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
<span class="label">QQ</span>
|
|
|
- <input @click="$event.target.focus()" class="input" v-model="qq" placeholder="请填写QQ号">
|
|
|
+ <input @click="$event.target.focus()" class="input" v-model="qq"
|
|
|
+ placeholder="请填写QQ号">
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
<span class="label">微信</span>
|
|
|
- <input @click="$event.target.focus()" class="input" v-model="wx" placeholder="请填写微信号">
|
|
|
+ <input @click="$event.target.focus()" class="input" v-model="wx"
|
|
|
+ placeholder="请填写微信号">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="title" v-if="matchInfo.teamMode">战队信息</div>
|
|
|
<div class="cell" v-if="matchInfo.teamMode">
|
|
|
<div class="row" v-for="item in teamInfo" :key="item.name">
|
|
|
<span class="label">{{item.name}}</span>
|
|
|
- <input class="input" v-model="item.gameId" placeholder="请填写游戏ID">
|
|
|
+ <input class="input" v-model="item.gameId"
|
|
|
+ placeholder="请填写游戏ID">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="btn-wrapper">
|
|
|
@@ -62,127 +71,155 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { mapState } from 'vuex'
|
|
|
+import { mapState } from "vuex";
|
|
|
export default {
|
|
|
created() {
|
|
|
if (this.$route.params.matchInfo && this.$route.params.matchInfo.id) {
|
|
|
- this.matchInfo = this.$route.params.matchInfo
|
|
|
- } else {
|
|
|
- this.$http.get({
|
|
|
- url: 'matchInfo/getMatchInfo',
|
|
|
- data: {
|
|
|
- id: this.$route.query.id
|
|
|
+ this.matchInfo = this.$route.params.matchInfo;
|
|
|
+ if (this.matchInfo.teamMode) {
|
|
|
+ let arr = [];
|
|
|
+ for (let i = 0; i < this.matchInfo.teamSize; i++) {
|
|
|
+ arr[i] = {
|
|
|
+ name: i === 0 ? "队长" : `队员${i}`,
|
|
|
+ gameId: "",
|
|
|
+ leader: i === 0
|
|
|
+ };
|
|
|
+ console.log(111);
|
|
|
}
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.matchInfo = res.data;
|
|
|
- if (this.matchInfo.teamMode) {
|
|
|
- let arr = [];
|
|
|
- for (let i = 0; i < this.matchInfo.teamSize; i++) {
|
|
|
- arr[i] = {
|
|
|
- name: i === 0 ? '队长' : `队员${i}`,
|
|
|
- gameId: '',
|
|
|
- leader: i === 0
|
|
|
+ this.teamInfo = arr;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$http
|
|
|
+ .get({
|
|
|
+ url: "matchInfo/getMatchInfo",
|
|
|
+ data: {
|
|
|
+ id: this.$route.query.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.matchInfo = res.data;
|
|
|
+ console.log(111);
|
|
|
+ if (this.matchInfo.teamMode) {
|
|
|
+ let arr = [];
|
|
|
+ for (let i = 0; i < this.matchInfo.teamSize; i++) {
|
|
|
+ arr[i] = {
|
|
|
+ name: i === 0 ? "队长" : `队员${i}`,
|
|
|
+ gameId: "",
|
|
|
+ leader: i === 0
|
|
|
+ };
|
|
|
+ console.log(111);
|
|
|
}
|
|
|
+ this.teamInfo = arr;
|
|
|
}
|
|
|
- this.teamInfo = arr;
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
matchInfo: {},
|
|
|
- realName: '',
|
|
|
- idNo: '',
|
|
|
- gameId: '',
|
|
|
- phone: '',
|
|
|
- qq: '',
|
|
|
- wx: '',
|
|
|
- remark: '',
|
|
|
- password: '',
|
|
|
- teamName: '',
|
|
|
+ realName: "",
|
|
|
+ idNo: "",
|
|
|
+ gameId: "",
|
|
|
+ phone: "",
|
|
|
+ qq: "",
|
|
|
+ wx: "",
|
|
|
+ remark: "",
|
|
|
+ password: "",
|
|
|
+ teamName: "",
|
|
|
teamInfo: []
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(['userInfo'])
|
|
|
+ ...mapState(["userInfo"])
|
|
|
},
|
|
|
methods: {
|
|
|
setupNavbar() {
|
|
|
- this.$navbar.style = 'dark'
|
|
|
- this.$navbar.title = '报名'
|
|
|
- this.$navbar.background = '#0E1822'
|
|
|
- this.$navbar.showBack = true
|
|
|
- this.$navbar.showRightItem = false
|
|
|
- this.$navbar.hidden = false
|
|
|
+ this.$navbar.style = "dark";
|
|
|
+ this.$navbar.title = "报名";
|
|
|
+ this.$navbar.background = "#0E1822";
|
|
|
+ this.$navbar.showBack = true;
|
|
|
+ this.$navbar.showRightItem = false;
|
|
|
+ this.$navbar.hidden = false;
|
|
|
},
|
|
|
apply() {
|
|
|
if (this.matchInfo.teamMode) {
|
|
|
if (!this.teamName) {
|
|
|
- this.$modal.info('请填写战队名称');
|
|
|
+ this.$modal.info("请填写战队名称");
|
|
|
return;
|
|
|
}
|
|
|
for (let i = 0; i < this.teamInfo.length; i++) {
|
|
|
if (!this.teamInfo[i].gameId) {
|
|
|
- this.$modal.info(`请填写${this.teamInfo[i].name}游戏ID`);
|
|
|
+ this.$modal.info(
|
|
|
+ `请填写${this.teamInfo[i].name}游戏ID`
|
|
|
+ );
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
this.gameId = this.teamName;
|
|
|
}
|
|
|
if (!this.gameId) {
|
|
|
- this.$modal.info('请填写游戏ID');
|
|
|
+ this.$modal.info("请填写游戏ID");
|
|
|
} else if (!this.phone && !this.qq && !this.wx) {
|
|
|
- this.$modal.info('请至少填写一种联系方式');
|
|
|
+ this.$modal.info("请至少填写一种联系方式");
|
|
|
} else if (this.matchInfo.requireRealName && !this.realName) {
|
|
|
- this.$modal.info('请填写真实姓名');
|
|
|
+ this.$modal.info("请填写真实姓名");
|
|
|
} else if (this.matchInfo.requireId && !this.idNo) {
|
|
|
- this.$modal.info('请填写身份证');
|
|
|
- } else if (this.matchInfo.requirePhone && !/^1[3-9]\d{9}$/.test(this.phone)) {
|
|
|
- this.$modal.info('请填写正确的手机号');
|
|
|
- } else if (this.matchInfo.requireQq && !/^\d{5,11}$/.test(this.qq)) {
|
|
|
- this.$modal.info('请填写正确的QQ号');
|
|
|
+ this.$modal.info("请填写身份证");
|
|
|
+ } else if (
|
|
|
+ this.matchInfo.requirePhone &&
|
|
|
+ !/^1[3-9]\d{9}$/.test(this.phone)
|
|
|
+ ) {
|
|
|
+ this.$modal.info("请填写正确的手机号");
|
|
|
+ } else if (
|
|
|
+ this.matchInfo.requireQq &&
|
|
|
+ !/^\d{5,11}$/.test(this.qq)
|
|
|
+ ) {
|
|
|
+ this.$modal.info("请填写正确的QQ号");
|
|
|
} else if (this.matchInfo.requireWx && !this.wx) {
|
|
|
- this.$modal.info('请填写微信号');
|
|
|
+ this.$modal.info("请填写微信号");
|
|
|
} else if (!this.matchInfo.isPublic && !this.password) {
|
|
|
- this.$modal.info('请填写报名密码');
|
|
|
+ this.$modal.info("请填写报名密码");
|
|
|
} else {
|
|
|
- this.$http.post({
|
|
|
- url: 'applyInfo/apply',
|
|
|
- data: {
|
|
|
- matchId: this.matchInfo.id,
|
|
|
- userId: this.userInfo.id,
|
|
|
- nickname: this.userInfo.nickname,
|
|
|
- gameId: this.gameId,
|
|
|
- realName: this.realName,
|
|
|
- idNo: this.idNo,
|
|
|
- phone: this.phone || this.userInfo.phone,
|
|
|
- qq: this.qq,
|
|
|
- wx: this.wx,
|
|
|
- remark: this.remark,
|
|
|
- password: this.matchInfo.isPublic ? '' : this.password,
|
|
|
- teamName: this.teamName,
|
|
|
- teamInfo: JSON.stringify(this.teamInfo)
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.$modal.success('报名成功');
|
|
|
- this.$router.replace({
|
|
|
- path: '/matchInfo',
|
|
|
- query: {
|
|
|
- id: this.matchInfo.id
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$modal.info(res.error);
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$http
|
|
|
+ .post({
|
|
|
+ url: "applyInfo/apply",
|
|
|
+ data: {
|
|
|
+ matchId: this.matchInfo.id,
|
|
|
+ userId: this.userInfo.id,
|
|
|
+ nickname: this.userInfo.nickname,
|
|
|
+ gameId: this.gameId,
|
|
|
+ realName: this.realName,
|
|
|
+ idNo: this.idNo,
|
|
|
+ phone: this.phone || this.userInfo.phone,
|
|
|
+ qq: this.qq,
|
|
|
+ wx: this.wx,
|
|
|
+ remark: this.remark,
|
|
|
+ password: this.matchInfo.isPublic
|
|
|
+ ? ""
|
|
|
+ : this.password,
|
|
|
+ teamName: this.teamName,
|
|
|
+ teamInfo: JSON.stringify(this.teamInfo)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$modal.success("报名成功");
|
|
|
+ this.$router.replace({
|
|
|
+ path: "/matchInfo",
|
|
|
+ query: {
|
|
|
+ id: this.matchInfo.id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$modal.info(res.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
@import "../base.less";
|