From e362c887376c4f95930bbcd8f4bdf7c04b181a51 Mon Sep 17 00:00:00 2001 From: barney <15270405776@163.com> Date: Sun, 11 Sep 2022 18:32:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF(1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/MatchGround.vue | 37 +- web/src/components/NavBar.vue | 2 +- web/src/components/ResultBoard.vue | 1 + web/src/store/pk.js | 6 +- web/src/views/pk/PkIndexView.vue | 6 +- web/src/views/ranklist/RanklistIndexView.vue | 10 +- web/src/views/record/RecordIndexView.vue | 14 +- .../user/account/UserAcWingCodeIndex.vue | 2 +- web/src/views/user/bot/UserBotIndexView.vue | 634 +++++++++++------- 9 files changed, 451 insertions(+), 261 deletions(-) diff --git a/web/src/components/MatchGround.vue b/web/src/components/MatchGround.vue index 39765ed..4922631 100644 --- a/web/src/components/MatchGround.vue +++ b/web/src/components/MatchGround.vue @@ -28,7 +28,17 @@ {{ $store.state.pk.opponent_username }} -
+ +
+ 正在匹配中  + +
+ + + +
@@ -62,7 +72,6 @@ export default { })); }else { - match_btn_info.value = "开始匹配"; is_matched.value = true; store.state.pk.socket.send(JSON.stringify({ @@ -100,8 +109,8 @@ export default { \ No newline at end of file diff --git a/web/src/components/NavBar.vue b/web/src/components/NavBar.vue index db3aeba..bf9716a 100644 --- a/web/src/components/NavBar.vue +++ b/web/src/components/NavBar.vue @@ -27,7 +27,7 @@ 我的Bot
  • -
  • 退出
  • +
  • 退出
  • diff --git a/web/src/components/ResultBoard.vue b/web/src/components/ResultBoard.vue index 0929fd4..ee065b7 100644 --- a/web/src/components/ResultBoard.vue +++ b/web/src/components/ResultBoard.vue @@ -31,6 +31,7 @@ export default { const store = useStore(); const reset = () => { + store.commit("updateLoading",true); store.commit("updateStatus","matching"); store.commit("updateLoser","none"); store.commit("updateOpponent", { diff --git a/web/src/store/pk.js b/web/src/store/pk.js index c48b847..84224e7 100644 --- a/web/src/store/pk.js +++ b/web/src/store/pk.js @@ -12,7 +12,8 @@ export default { b_sx: 0, b_sy: 0, gameObject: null, - loser: "none" //"none","all","A","B" none表示还没有结果 + loser: "none", //"none","all","A","B" none表示还没有结果 + loading: true, // 显示正在加载中 }, getters: { }, @@ -27,6 +28,9 @@ export default { updateStatus(state, status) { state.status = status; }, + updateLoading(state, loading) { + state.loading = loading; + }, updateGame(state, game) { state.gamemap = game.map; state.a_id = game.a_id; diff --git a/web/src/views/pk/PkIndexView.vue b/web/src/views/pk/PkIndexView.vue index 38977b0..a293b8f 100644 --- a/web/src/views/pk/PkIndexView.vue +++ b/web/src/views/pk/PkIndexView.vue @@ -57,9 +57,12 @@ export default { photo: data.opponent_photo, }); + // 更新loading,显示匹配成功 + store.commit("updateLoading",false); + setTimeout(() => { store.commit("updateStatus", "playing"); - }, 200); // 0.2秒后更新地图(修复穿墙bug) + },0.2); // 0.2秒后更新地图 // 更新游戏信息(包括地图、玩家坐标和id) store.commit("updateGame", data.game); @@ -89,6 +92,7 @@ export default { }); // 切换其他页面或者关闭pk页面时调用 onUnmounted(() => { + store.commit("updateLoading",true); socket.close(); }); }, diff --git a/web/src/views/ranklist/RanklistIndexView.vue b/web/src/views/ranklist/RanklistIndexView.vue index 38a0695..f9eeef1 100644 --- a/web/src/views/ranklist/RanklistIndexView.vue +++ b/web/src/views/ranklist/RanklistIndexView.vue @@ -22,16 +22,16 @@ -