|
|
@@ -5,7 +5,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="back">
|
|
|
- <img src="@assets/back.png" alt="" />
|
|
|
+ <img src="@assets/back.png" @click="back" alt="" />
|
|
|
</div>
|
|
|
|
|
|
<div class="content">
|
|
|
@@ -37,28 +37,68 @@
|
|
|
/>
|
|
|
<div class="name">{{ host.nickname }}</div>
|
|
|
</div>
|
|
|
- <div class="list" v-else></div>
|
|
|
+ <div class="list" v-else>
|
|
|
+ <div class="person" v-for="(item, index) in hosts" :key="index">
|
|
|
+ <van-image
|
|
|
+ width="24"
|
|
|
+ height="24"
|
|
|
+ radius="4"
|
|
|
+ :src="item.avatar || require('@assets/img_default_photo.png')"
|
|
|
+ fit="cover"
|
|
|
+ />
|
|
|
+ <div class="name">{{ item.nickname }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="player-item">
|
|
|
<div class="title">客队</div>
|
|
|
- <div class="list1 not" v-if="info.maxPlayerNum === 2">
|
|
|
- <van-image
|
|
|
- width="58"
|
|
|
- height="58"
|
|
|
- radius="4"
|
|
|
- :src="require('@assets/png-pipeizhong.png')"
|
|
|
- fit="cover"
|
|
|
- />
|
|
|
- <div class="name">匹配中…</div>
|
|
|
+ <template v-if="info.maxPlayerNum === 2">
|
|
|
+ <div
|
|
|
+ class="list1 not"
|
|
|
+ @click="choosePerson(item)"
|
|
|
+ v-for="(item, index) in guests"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <van-image
|
|
|
+ width="58"
|
|
|
+ height="58"
|
|
|
+ radius="4"
|
|
|
+ :src="item.avatar || require('@assets/img_default_photo.png')"
|
|
|
+ fit="cover"
|
|
|
+ />
|
|
|
+ <div class="name">{{ item.nickname }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <div class="list" v-else>
|
|
|
+ <div
|
|
|
+ class="person"
|
|
|
+ @click="choosePerson(item)"
|
|
|
+ v-for="(item, index) in guests"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <van-image
|
|
|
+ width="24"
|
|
|
+ height="24"
|
|
|
+ radius="4"
|
|
|
+ :src="item.avatar || require('@assets/img_default_photo.png')"
|
|
|
+ fit="cover"
|
|
|
+ />
|
|
|
+ <div class="name">{{ item.nickname }}</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="list" v-else></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="bg-icon">
|
|
|
-
|
|
|
- <img src="@assets/png-1v1-bg.png" class="img1" alt="" />
|
|
|
+ <img src="@assets/png-1v1-bg.png" v-if="info.maxPlayerNum === 2" class="img1" alt="" />
|
|
|
+ <img
|
|
|
+ src="@assets/png-2v2~5v5-bg.png"
|
|
|
+ :style="{ height: teamHeight + 'px' }"
|
|
|
+ v-else
|
|
|
+ class="img3"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
<img src="@assets/png-vs.png" alt="" class="img2" />
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -71,8 +111,8 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="bottom">
|
|
|
- <div class="btn" @click="changeUrl">
|
|
|
+ <div class="bottom" v-if="isJoin">
|
|
|
+ <div class="btn" @click="changeUrl" v-if="isHost">
|
|
|
<img src="@assets/png-xiugaidizhi.png" alt="" />
|
|
|
<span>修改地址</span>
|
|
|
</div>
|
|
|
@@ -89,6 +129,7 @@
|
|
|
<join-room ref="join" :roomInfo="info" @update="getInfo"></join-room>
|
|
|
<description ref="description"></description>
|
|
|
<failed ref="failed"></failed>
|
|
|
+ <player-info ref="player" :roomInfo="info"></player-info>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -98,6 +139,7 @@ import changeUrl from '../components/room/changeUrl.vue';
|
|
|
import joinRoom from '../components/room/joinRoom.vue';
|
|
|
import description from '../components/room/description.vue';
|
|
|
import failed from '../components/room/failed.vue';
|
|
|
+import playerInfo from '../components/room/playerInfo.vue';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -114,10 +156,58 @@ export default {
|
|
|
},
|
|
|
host() {
|
|
|
return this.info.host || {};
|
|
|
+ },
|
|
|
+ players() {
|
|
|
+ return this.info.players || [];
|
|
|
+ },
|
|
|
+ hosts() {
|
|
|
+ let list = [...this.players].filter(item => {
|
|
|
+ return item.team === 'host' && !item.host;
|
|
|
+ });
|
|
|
+
|
|
|
+ list.splice(0, 0, this.host);
|
|
|
+
|
|
|
+ for (let i = list.length; i < this.info.maxPlayerNum / 2; i++) {
|
|
|
+ list.push({
|
|
|
+ nickname: '匹配中...',
|
|
|
+ avatar: require('@assets/png-pipeizhong.png')
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ },
|
|
|
+ guests() {
|
|
|
+ let list = [...this.players].filter(item => {
|
|
|
+ return item.team === 'guest';
|
|
|
+ });
|
|
|
+ for (let i = list.length; i < this.info.maxPlayerNum / 2; i++) {
|
|
|
+ list.push({
|
|
|
+ nickname: '匹配中...',
|
|
|
+ avatar: require('@assets/png-pipeizhong.png')
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ },
|
|
|
+ isHost() {
|
|
|
+ return this.host.id === this.$store.state.userInfo.id;
|
|
|
+ },
|
|
|
+ isJoin() {
|
|
|
+ if (this.isHost) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ let info = [...this.players].find(item => {
|
|
|
+ return item.userId === this.$store.state.userInfo.id;
|
|
|
+ });
|
|
|
+ return !!info;
|
|
|
+ },
|
|
|
+ isFull() {
|
|
|
+ return this.players.length === this.info.maxPlayerNum;
|
|
|
+ },
|
|
|
+ teamHeight() {
|
|
|
+ return (this.info.maxPlayerNum / 2) * 43 + 12;
|
|
|
}
|
|
|
},
|
|
|
mixins: [room],
|
|
|
- components: { changeUrl, joinRoom, description, failed },
|
|
|
+ components: { changeUrl, joinRoom, description, failed, playerInfo },
|
|
|
mounted() {
|
|
|
if (this.$route.query.id) {
|
|
|
this.roomId = this.$route.query.id;
|
|
|
@@ -133,11 +223,19 @@ export default {
|
|
|
this.$http.get('/room/detail/' + this.roomId).then(res => {
|
|
|
this.$toast.clear();
|
|
|
this.info = res;
|
|
|
- // this.$refs.join.init();
|
|
|
+ if (!this.isFull && !this.isJoin && res.status === 'WAITING') {
|
|
|
+ this.$refs.join.init();
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
changeUrl() {
|
|
|
this.$refs.url.init(this.info.url);
|
|
|
+ },
|
|
|
+ back() {
|
|
|
+ this.$router.back();
|
|
|
+ },
|
|
|
+ choosePerson(info) {
|
|
|
+ console.log(info);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -237,7 +335,7 @@ export default {
|
|
|
.content-box {
|
|
|
.flex-col();
|
|
|
position: relative;
|
|
|
- padding: 16px;
|
|
|
+ padding: 16px 10px;
|
|
|
flex-grow: 1;
|
|
|
background: linear-gradient(180deg, #6310b0 0%, #09005c 100%);
|
|
|
.tabs {
|
|
|
@@ -284,6 +382,12 @@ export default {
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
}
|
|
|
+ .img3 {
|
|
|
+ width: 100%;
|
|
|
+ display: block;
|
|
|
+ top: -26px;
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.player-content {
|
|
|
@@ -389,4 +493,30 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.person {
|
|
|
+ .flex();
|
|
|
+ padding: 10px 0;
|
|
|
+ overflow: hidden;
|
|
|
+ .van-image {
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+ .name {
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 24px;
|
|
|
+ margin-left: 6px;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+ &:first-child {
|
|
|
+ padding-top: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:last-child {
|
|
|
+ padding-bottom: 16px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|