|
|
@@ -0,0 +1,555 @@
|
|
|
+<template>
|
|
|
+ <div class="svg-map" ref="svgMap">
|
|
|
+ <svg
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
+ :width="(loserRound + 2) * (width + xGap) / 1.2"
|
|
|
+ :height="(loserRoundParticipantNum[0] / 2 * (height * 2 + yGap) * 3 + 2 * (titleHeight + yGap) + yGap) / 1.2"
|
|
|
+ :viewBox="`0 0 ${(loserRound + 2) * (width + xGap)} ${loserRoundParticipantNum[0] / 2 * (height * 2 + yGap) * 3 + 2 * (titleHeight + yGap) + yGap}`"
|
|
|
+ class="svg-vs-info-double-elimination"
|
|
|
+ >
|
|
|
+ <rect class="title-rect" x="20" y="0" rx="8" ry="8" :height="titleHeight" :width="(loserRound + 2) * (width + xGap) + xGap / 2 - 40"></rect>
|
|
|
+ <text
|
|
|
+ v-for="(n,i) in loserRound"
|
|
|
+ class="round-text"
|
|
|
+ :x="i * (width + xGap) + xGap / 2 + width / 2"
|
|
|
+ :y="titleHeight / 2 + 6"
|
|
|
+ text-anchor="middle"
|
|
|
+ >胜者组第{{n}}轮</text>
|
|
|
+ <text class="round-text" :x="loserRound * (width + xGap) + xGap / 2 + width / 2" :y="titleHeight / 2 + 6" text-anchor="middle">决赛</text>
|
|
|
+ <text class="round-text" :x="(loserRound + 1) * (width + xGap) + xGap / 2 + width / 2" :y="titleHeight / 2 + 6" text-anchor="middle">附加赛</text>
|
|
|
+ <template v-for="(i,r) in round">
|
|
|
+ <vs-pair
|
|
|
+ v-for="(j,g) in roundParticipantNum[r] / 2"
|
|
|
+ :key="`w-${r}-${g}`"
|
|
|
+ type="win"
|
|
|
+ :round="round"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ :xGap="xGap"
|
|
|
+ :yGap="yGap"
|
|
|
+ :titleHeight="titleHeight"
|
|
|
+ :r="r"
|
|
|
+ :g="g"
|
|
|
+ :mode="mode"
|
|
|
+ :allMatchData="matchData"
|
|
|
+ @switchAgainst="switchAgainst"
|
|
|
+ :switchData="switchData"
|
|
|
+ ></vs-pair>
|
|
|
+ </template>
|
|
|
+ <template v-for="(i,r) in round">
|
|
|
+ <image
|
|
|
+ v-for="(j,g) in roundParticipantNum[r] / 2"
|
|
|
+ v-if="showUploadIcon(r,g,'win')"
|
|
|
+ class="upload-icon"
|
|
|
+ :x="uploadIconPosition(r,g,'win').x"
|
|
|
+ :y="uploadIconPosition(r,g,'win').y"
|
|
|
+ :width="28"
|
|
|
+ :height="28"
|
|
|
+ xlink:href="../assets/icon_upload.png"
|
|
|
+ @click="uploadMatchData(r,g,'win')"
|
|
|
+ ></image>
|
|
|
+ </template>
|
|
|
+ <rect
|
|
|
+ class="title-rect"
|
|
|
+ rx="8"
|
|
|
+ ry="8"
|
|
|
+ x="20"
|
|
|
+ :y="roundParticipantNum[0] / 2 * (2 * height + yGap) + titleHeight + yGap"
|
|
|
+ :height="titleHeight"
|
|
|
+ :width="loserRound * (width + xGap) - 40"
|
|
|
+ ></rect>
|
|
|
+ <text
|
|
|
+ v-for="(n,i) in loserRound"
|
|
|
+ class="round-text"
|
|
|
+ :x="i * (width + xGap) + xGap / 2 + width / 2"
|
|
|
+ :y="titleHeight / 2 + 6 + roundParticipantNum[0] / 2 * (2 * height + yGap) + titleHeight + yGap"
|
|
|
+ text-anchor="middle"
|
|
|
+ >败者组第{{n}}轮</text>
|
|
|
+ <template v-for="(i,r) in loserRound">
|
|
|
+ <vs-pair
|
|
|
+ v-for="(j,g) in loserRoundParticipantNum[r] / 2"
|
|
|
+ type="lose"
|
|
|
+ :key="`l-${r}-${g}`"
|
|
|
+ :round="loserRound"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ :xGap="xGap"
|
|
|
+ :yGap="yGap"
|
|
|
+ :titleHeight="titleHeight"
|
|
|
+ :r="r"
|
|
|
+ :g="g"
|
|
|
+ :mode="mode"
|
|
|
+ :participantNum="participantNum"
|
|
|
+ :allMatchData="matchData"
|
|
|
+ @switchAgainst="switchAgainst"
|
|
|
+ :switchData="switchData"
|
|
|
+ ></vs-pair>
|
|
|
+ </template>
|
|
|
+ <template v-for="(i,r) in loserRound">
|
|
|
+ <image
|
|
|
+ v-for="(j,g) in loserRoundParticipantNum[r] / 2"
|
|
|
+ v-if="showUploadIcon(r,g,'lose')"
|
|
|
+ class="upload-icon"
|
|
|
+ :x="uploadIconPosition(r,g,'lose').x"
|
|
|
+ :y="uploadIconPosition(r,g,'lose').y"
|
|
|
+ :width="28"
|
|
|
+ :height="28"
|
|
|
+ xlink:href="../assets/icon_upload.png"
|
|
|
+ @click="uploadMatchData(r,g,'lose')"
|
|
|
+ ></image>
|
|
|
+ </template>
|
|
|
+ <g>
|
|
|
+ <rect
|
|
|
+ :x="finalX"
|
|
|
+ :y="finalY - height"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ class="team-rect"
|
|
|
+ :style="{fill:finalData&&finalData.user1===highlightUser?'#F15436':''}"
|
|
|
+ ></rect>
|
|
|
+ <text :x="finalX + 40" :y="finalY - height + height/2 + 4" class="team-name">{{finalData.applyInfo1 ? finalData.applyInfo1.nickname : '暂无'}}</text>
|
|
|
+ <text
|
|
|
+ :x="finalX + width - 20"
|
|
|
+ :y="finalY - height + height/2 + 4"
|
|
|
+ text-anchor="end"
|
|
|
+ class="team-score"
|
|
|
+ >{{finalData.score1 >= 0 ? finalData.score1 : '-'}}</text>
|
|
|
+ <rect
|
|
|
+ :x="finalX"
|
|
|
+ :y="finalY"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ class="team-rect"
|
|
|
+ :style="{fill:finalData&&finalData.user2===highlightUser?'#F15436':''}"
|
|
|
+ ></rect>
|
|
|
+ <text :x="finalX + 40" :y="finalY + height/2 + 4" class="team-name">{{finalData.applyInfo2 ? finalData.applyInfo2.nickname : '暂无'}}</text>
|
|
|
+ <text
|
|
|
+ :x="finalX + width - 20"
|
|
|
+ :y="finalY + height/2 + 4"
|
|
|
+ text-anchor="end"
|
|
|
+ class="team-score"
|
|
|
+ >{{finalData.score2 >= 0 ? finalData.score2 : '-'}}</text>
|
|
|
+ <text :x="finalX - 10" :y="finalY + 4" text-anchor="end" class="vs-num">{{finalNum}}</text>
|
|
|
+ <polyline :points="getPath(0)" class="line"></polyline>
|
|
|
+ <polyline :points="getPath(1)" class="line"></polyline>
|
|
|
+ <image
|
|
|
+ :x="finalX + 5"
|
|
|
+ :y="finalY - height + (height - 20) / 2"
|
|
|
+ :width="30"
|
|
|
+ :height="20"
|
|
|
+ xlink:href="http://djq-img.oss-cn-hangzhou.aliyuncs.com/country/0.jpg"
|
|
|
+ ></image>
|
|
|
+ <image
|
|
|
+ :x="finalX + 5"
|
|
|
+ :y="finalY + (height - 20) / 2"
|
|
|
+ :width="30"
|
|
|
+ :height="20"
|
|
|
+ xlink:href="http://djq-img.oss-cn-hangzhou.aliyuncs.com/country/0.jpg"
|
|
|
+ ></image>
|
|
|
+ <rect
|
|
|
+ :x="finalX"
|
|
|
+ :y="finalY - height"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ style="fill: rgba(0,0,0,0)"
|
|
|
+ @mouseover="mouseover(0,1)"
|
|
|
+ @mouseout="mouseleave"
|
|
|
+ ></rect>
|
|
|
+ <rect :x="finalX" :y="finalY" :width="width" :height="height" style="fill: rgba(0,0,0,0)" @mouseover="mouseover(0,2)" @mouseout="mouseleave"></rect>
|
|
|
+ </g>
|
|
|
+ <g>
|
|
|
+ <rect
|
|
|
+ :x="finalX + width + xGap"
|
|
|
+ :y="finalY - height"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ :style="{fill:extraData&&extraData.user1===highlightUser?'#F15436':''}"
|
|
|
+ class="team-rect"
|
|
|
+ ></rect>
|
|
|
+ <text
|
|
|
+ :x="finalX + width + xGap + 40"
|
|
|
+ :y="finalY - height + height/2 + 4"
|
|
|
+ class="team-name"
|
|
|
+ >{{extraData.applyInfo1 ? extraData.applyInfo1.nickname : '暂无'}}</text>
|
|
|
+ <text
|
|
|
+ :x="finalX + width + xGap + width - 20"
|
|
|
+ :y="finalY - height + height/2 + 4"
|
|
|
+ text-anchor="end"
|
|
|
+ class="team-score"
|
|
|
+ >{{extraData.score1 >= 0 ? extraData.score1 : '-'}}</text>
|
|
|
+ <rect
|
|
|
+ :x="finalX + width + xGap"
|
|
|
+ :y="finalY"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ :style="{fill:extraData&&extraData.user2===highlightUser?'#F15436':''}"
|
|
|
+ class="team-rect"
|
|
|
+ ></rect>
|
|
|
+ <text
|
|
|
+ :x="finalX + width + xGap + 40"
|
|
|
+ :y="finalY + height/2 + 4"
|
|
|
+ class="team-name"
|
|
|
+ >{{extraData.applyInfo2 ? extraData.applyInfo2.nickname : '暂无'}}</text>
|
|
|
+ <text
|
|
|
+ :x="finalX + width + xGap + width - 20"
|
|
|
+ :y="finalY + height/2 + 4"
|
|
|
+ text-anchor="end"
|
|
|
+ class="team-score"
|
|
|
+ >{{extraData.score2 >= 0 ? extraData.score2 : '-'}}</text>
|
|
|
+ <text :x="finalX + width + xGap - 10" :y="finalY + 4" text-anchor="end" class="vs-num">{{finalNum + 1}}</text>
|
|
|
+ <polyline :points="`${finalX + width} ${finalY}, ${finalX + width + xGap - 40} ${finalY}`" class="line"></polyline>
|
|
|
+ <image
|
|
|
+ :x="finalX + width + xGap + 5"
|
|
|
+ :y="finalY - height + (height - 20) / 2"
|
|
|
+ :width="30"
|
|
|
+ :height="20"
|
|
|
+ xlink:href="http://djq-img.oss-cn-hangzhou.aliyuncs.com/country/0.jpg"
|
|
|
+ ></image>
|
|
|
+ <image
|
|
|
+ :x="finalX + width + xGap + 5"
|
|
|
+ :y="finalY + (height - 20) / 2"
|
|
|
+ :width="30"
|
|
|
+ :height="20"
|
|
|
+ xlink:href="http://djq-img.oss-cn-hangzhou.aliyuncs.com/country/0.jpg"
|
|
|
+ ></image>
|
|
|
+ <rect
|
|
|
+ :x="finalX + width + xGap"
|
|
|
+ :y="finalY - height"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ style="fill: rgba(0,0,0,0)"
|
|
|
+ @mouseover="mouseover(1,1)"
|
|
|
+ @mouseout="mouseleave"
|
|
|
+ ></rect>
|
|
|
+ <rect
|
|
|
+ :x="finalX + width + xGap"
|
|
|
+ :y="finalY"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ style="fill: rgba(0,0,0,0)"
|
|
|
+ @mouseover="mouseover(1,2)"
|
|
|
+ @mouseout="mouseleave"
|
|
|
+ ></rect>
|
|
|
+ </g>
|
|
|
+ <image
|
|
|
+ v-if="showUploadIcon(null,null,null,finalNum)"
|
|
|
+ class="upload-icon"
|
|
|
+ :x="finalX + width - 14"
|
|
|
+ :y="finalY - 14"
|
|
|
+ :width="28"
|
|
|
+ :height="28"
|
|
|
+ xlink:href="../assets/icon_upload.png"
|
|
|
+ @click="uploadMatchData(null,null,null,finalNum)"
|
|
|
+ ></image>
|
|
|
+ <image
|
|
|
+ v-if="showUploadIcon(null,null,null,finalNum+1)"
|
|
|
+ class="upload-icon"
|
|
|
+ :x="finalX + width + xGap + width - 14"
|
|
|
+ :y="finalY - 14"
|
|
|
+ :width="28"
|
|
|
+ :height="28"
|
|
|
+ xlink:href="../assets/icon_upload.png"
|
|
|
+ @click="uploadMatchData(null,null,null,finalNum+1)"
|
|
|
+ ></image>
|
|
|
+ </svg>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import VsPair from './VsPair'
|
|
|
+import { mapState } from 'vuex'
|
|
|
+
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ mode: String,
|
|
|
+ matchData: {
|
|
|
+ default() {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ participantNum: {
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ admin: {}
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ width: 200,
|
|
|
+ height: 30,
|
|
|
+ xGap: 100,
|
|
|
+ yGap: 20,
|
|
|
+ titleHeight: 44,
|
|
|
+ switchData: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['userInfo', 'highlightUser']),
|
|
|
+ finalData() {
|
|
|
+ return this.matchData.find(i => {
|
|
|
+ return i.round === this.finalNum;
|
|
|
+ }) || {}
|
|
|
+ },
|
|
|
+ extraData() {
|
|
|
+ return this.matchData.find(i => {
|
|
|
+ return i.round === this.finalNum + 1;
|
|
|
+ }) || {}
|
|
|
+ },
|
|
|
+ finalX() {
|
|
|
+ return this.xGap / 2 + (this.xGap + this.width) * this.loserRound;
|
|
|
+ },
|
|
|
+ finalY() {
|
|
|
+ return ((this.height * 2 * Math.pow(2, Math.floor((this.loserRound - 1) / 2))
|
|
|
+ + this.yGap * (Math.pow(2, Math.floor((this.loserRound - 1) / 2)) - 1) - this.height * 2) / 2
|
|
|
+ + this.yGap + (this.titleHeight + this.yGap) * 2 - Math.ceil((this.loserRound - 1) / 2) * this.height
|
|
|
+ + this.height + Math.pow(2, this.loserRound / 2) * (2 * this.height + this.yGap)
|
|
|
+ + (this.height * 2 * Math.pow(2, (this.round - 1)) + this.yGap * (Math.pow(2, (this.round - 1)) - 1) - this.height * 2) / 2
|
|
|
+ + this.yGap + this.titleHeight + this.yGap) / 2;
|
|
|
+ },
|
|
|
+ finalNum() {
|
|
|
+ return this.participantNum * 2 - 2;
|
|
|
+ },
|
|
|
+ round() {
|
|
|
+ let round = 0;
|
|
|
+ let temp = this.participantNum;
|
|
|
+ while (temp > 1) {
|
|
|
+ temp /= 2;
|
|
|
+ round++;
|
|
|
+ }
|
|
|
+ return round;
|
|
|
+ },
|
|
|
+ loserRound() {
|
|
|
+ let round = 0;
|
|
|
+ let temp = this.participantNum / 2;
|
|
|
+ while (temp > 1) {
|
|
|
+ temp /= 2;
|
|
|
+ round++;
|
|
|
+ }
|
|
|
+ return round * 2;
|
|
|
+ },
|
|
|
+ roundParticipantNum() {
|
|
|
+ let roundParticipantNum = [];
|
|
|
+ for (let i = 0; i < this.round; i++) {
|
|
|
+ roundParticipantNum.push(Math.pow(2, this.round - i))
|
|
|
+ }
|
|
|
+ return roundParticipantNum;
|
|
|
+ },
|
|
|
+ loserRoundParticipantNum() {
|
|
|
+ let roundParticipantNum = [];
|
|
|
+ for (let i = 0; i < this.loserRound / 2; i++) {
|
|
|
+ roundParticipantNum.push(Math.pow(2, this.loserRound / 2 - i));
|
|
|
+ roundParticipantNum.push(Math.pow(2, this.loserRound / 2 - i));
|
|
|
+ }
|
|
|
+ return roundParticipantNum;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getPath(i) {
|
|
|
+ if (i === 0) {
|
|
|
+ let y0 = (this.height * 2 * Math.pow(2, this.round - 1) + this.yGap * (Math.pow(2, this.round - 1) - 1) - this.height * 2) / 2
|
|
|
+ + this.titleHeight + this.yGap + this.height;
|
|
|
+ let y1 = this.finalY - this.height + 5;
|
|
|
+ let x0 = this.finalX - this.xGap;
|
|
|
+ let x1 = this.finalX - 15;
|
|
|
+ return `${x0} ${y0}, ${x1} ${y0}, ${x1} ${y1}`
|
|
|
+ } else {
|
|
|
+ let y0 = (this.height * 2 * Math.pow(2, Math.floor((this.loserRound - 1) / 2)) + this.yGap * (Math.pow(2, Math.floor((this.loserRound - 1) / 2)) - 1) - this.height * 2) / 2
|
|
|
+ + (this.titleHeight + this.yGap) * 2 - Math.ceil((this.loserRound - 1) / 2) * this.height + this.height
|
|
|
+ + Math.pow(2, this.loserRound / 2) * (2 * this.height + this.yGap) + this.height;
|
|
|
+ let y1 = this.finalY + this.height - 5;
|
|
|
+ let x0 = this.finalX - this.xGap;
|
|
|
+ let x1 = this.finalX - 15;
|
|
|
+ return `${x0} ${y0}, ${x1} ${y0}, ${x1} ${y1}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadIconPosition(r, g, type) {
|
|
|
+ let x, y;
|
|
|
+ if (type === 'lose') {
|
|
|
+ x = (this.xGap + this.width) * r + this.xGap / 2;
|
|
|
+ } else {
|
|
|
+ x = (this.xGap + this.width) * r + (r > 1 ? (this.width + this.xGap) * (r - 1) : 0) + this.xGap / 2;
|
|
|
+ }
|
|
|
+ x = x + this.width - 14;
|
|
|
+
|
|
|
+ let i = 0;
|
|
|
+ let groupGap;
|
|
|
+ let yOffset;
|
|
|
+ if (type === 'lose') {
|
|
|
+ groupGap = (this.height * 2 + this.yGap) * Math.pow(2, Math.floor(r / 2));
|
|
|
+ if (r === 0) {
|
|
|
+ yOffset = 0;
|
|
|
+ } else {
|
|
|
+ yOffset = (this.height * 2 * Math.pow(2, Math.floor(r / 2)) + this.yGap * (Math.pow(2, Math.floor(r / 2)) - 1) - this.height * 2) / 2
|
|
|
+ }
|
|
|
+ y = yOffset + g * groupGap + this.yGap * i + (this.titleHeight + this.yGap) * 2 - Math.ceil(r / 2) * this.height + this.height
|
|
|
+ + Math.pow(2, this.loserRound / 2) * (2 * this.height + this.yGap) + this.height - 14;
|
|
|
+ } else {
|
|
|
+ groupGap = (this.height * 2 + this.yGap) * Math.pow(2, r);
|
|
|
+ if (r === 0) {
|
|
|
+ yOffset = 0;
|
|
|
+ } else {
|
|
|
+ yOffset = (this.height * 2 * Math.pow(2, r) + this.yGap * (Math.pow(2, r) - 1) - this.height * 2) / 2
|
|
|
+ }
|
|
|
+ y = yOffset + g * groupGap + this.yGap * i + this.titleHeight + this.yGap + this.height - 14;
|
|
|
+ }
|
|
|
+ return { x, y }
|
|
|
+ },
|
|
|
+ switchAgainst(userId, matchDataId) {
|
|
|
+ let find = this.switchData.findIndex(i => {
|
|
|
+ return i.userId === userId
|
|
|
+ });
|
|
|
+ if (find > -1) {
|
|
|
+ this.switchData.splice(find, 1);
|
|
|
+ } else {
|
|
|
+ this.switchData.push({ userId: userId, matchDataId: matchDataId })
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.switchData.length === 2) {
|
|
|
+ this.$http.get({
|
|
|
+ url: '/against/switchAgainst',
|
|
|
+ data: {
|
|
|
+ type: 1,
|
|
|
+ matchDataId1: this.switchData[0].matchDataId,
|
|
|
+ userId1: this.switchData[0].userId,
|
|
|
+ matchDataId2: this.switchData[1].matchDataId,
|
|
|
+ userId2: this.switchData[1].userId,
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$emit('switchComplete');
|
|
|
+ this.switchData = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getNum(r, g, type) {
|
|
|
+ let num = 0;
|
|
|
+ if (type === 'win') {
|
|
|
+ if (r === 0) {
|
|
|
+ num = g + 1;
|
|
|
+ } else {
|
|
|
+ num = 0;
|
|
|
+ for (let i = 0; i < r; i++) {
|
|
|
+ num += Math.pow(2, this.round - i - 1);
|
|
|
+ }
|
|
|
+ num = num + g + 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (r === 0) {
|
|
|
+ num = this.participantNum + g;
|
|
|
+ } else {
|
|
|
+ num = 0;
|
|
|
+ for (let i = 0; i < Math.floor(r / 2); i++) {
|
|
|
+ num += Math.pow(2, this.loserRound / 2 - i - 1) * 2;
|
|
|
+ }
|
|
|
+ num = this.participantNum + num + g + Math.pow(2, this.loserRound / 2 - Math.floor(r / 2) - 1) * (r % 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ },
|
|
|
+ showUploadIcon(r, g, type, num) {
|
|
|
+ if (!num) {
|
|
|
+ num = this.getNum(r, g, type);
|
|
|
+ }
|
|
|
+ let matchData = this.matchData.find(i => {
|
|
|
+ return i.round === num;
|
|
|
+ });
|
|
|
+ if (this.mode === 'upload' && matchData && this.userInfo) {
|
|
|
+ if (matchData.user1 && matchData.user2) {
|
|
|
+ if (matchData.state === 0) {
|
|
|
+ if (this.admin) {
|
|
|
+ return true
|
|
|
+ } else if (matchData.user1 === this.userInfo.id || matchData.user2 === this.userInfo.id) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // return this.mode === 'upload' && matchData && matchData.user1 && matchData.user2 && matchData.state !== 2;
|
|
|
+ },
|
|
|
+ uploadMatchData(r, g, type, num) {
|
|
|
+ if (!num) {
|
|
|
+ num = this.getNum(r, g, type);
|
|
|
+ }
|
|
|
+ this.$emit('uploadMatchData', this.matchData.find(i => {
|
|
|
+ return i.round === num;
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ onMouseDown(e) {
|
|
|
+ this.move = true
|
|
|
+ },
|
|
|
+ onMouseMove(e) {
|
|
|
+ if (this.move) {
|
|
|
+ this.$refs.svgMap.scrollLeft -= e.movementX || 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTouchMove(e) {
|
|
|
+ },
|
|
|
+ onMouseUp(e) {
|
|
|
+ this.move = false
|
|
|
+ },
|
|
|
+ mouseover(i, j) {
|
|
|
+ if (i === 0) {
|
|
|
+ if (this.finalData && this.finalData[`user${j}`]) {
|
|
|
+ this.$store.commit('updateHighlightUser', this.finalData[`user${j}`])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.extraData && this.extraData[`user${j}`]) {
|
|
|
+ this.$store.commit('updateHighlightUser', this.extraData[`user${j}`])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mouseleave() {
|
|
|
+ this.$store.commit('updateHighlightUser', null)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ participantNum() {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ VsPair
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="less">
|
|
|
+.svg-map {
|
|
|
+ width: 1220px;
|
|
|
+ overflow-x: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.svg-vs-info-double-elimination {
|
|
|
+ cursor: default;
|
|
|
+ user-select: none;
|
|
|
+ .title-rect {
|
|
|
+ fill: #192836;
|
|
|
+ }
|
|
|
+ .round-text {
|
|
|
+ font-size: 13px;
|
|
|
+ fill: #f2f3f4;
|
|
|
+ }
|
|
|
+ .team-rect {
|
|
|
+ fill: #192836;
|
|
|
+ }
|
|
|
+ .team-name {
|
|
|
+ font-size: 13px;
|
|
|
+ fill: #f2f3f4;
|
|
|
+ }
|
|
|
+ .team-score {
|
|
|
+ font-size: 13px;
|
|
|
+ fill: #f2f3f4;
|
|
|
+ }
|
|
|
+ .vs-num {
|
|
|
+ fill: #f2f3f4;
|
|
|
+ }
|
|
|
+ .line {
|
|
|
+ fill: none;
|
|
|
+ stroke: rgba(255, 255, 255, 0.5);
|
|
|
+ stroke-width: 1px;
|
|
|
+ fill-opacity: 0;
|
|
|
+ }
|
|
|
+ .upload-icon,
|
|
|
+ .switch-icon {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|