fix:删除冗余代码+创建房间表单默认不选择
This commit is contained in:
@@ -17,12 +17,19 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const battleMode = ref(1);
|
||||
const targetMode = ref(1);
|
||||
/** 对战模式:0=未选 1=1v1 2=乱斗 3=2v2 4=3v3 */
|
||||
const battleMode = ref(0);
|
||||
/** 靶纸尺寸:0=未选 1=20cm 2=40cm */
|
||||
const targetMode = ref(0);
|
||||
const loading = ref(false);
|
||||
const roomNumber = ref("");
|
||||
|
||||
const createRoom = debounce(async () => {
|
||||
// 校验必填项:对战模式与靶纸均必须选择
|
||||
if (!battleMode.value || !targetMode.value) {
|
||||
uni.showToast({ title: '请完善创建信息', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (game.value.inBattle) {
|
||||
uni.$showHint(1);
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,6 @@ import ScreenHint from "@/components/ScreenHint.vue";
|
||||
import {
|
||||
getRoomAPI,
|
||||
exitRoomAPI,
|
||||
startRoomAPI,
|
||||
chooseTeamAPI,
|
||||
getReadyAPI,
|
||||
kickPlayerAPI,
|
||||
@@ -208,10 +207,6 @@ const chooseTeam = async (team) => {
|
||||
refreshMembers(result.members);
|
||||
};
|
||||
|
||||
const exitRoom = async () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
/** 待确认踢出的玩家信息 */
|
||||
const playerToKick = ref(null);
|
||||
/** 控制踢出确认弹窗的显示状态 */
|
||||
|
||||
@@ -162,7 +162,8 @@ onLoad(async (options) => {
|
||||
<view v-if="warnning" class="warnning">
|
||||
{{ warnning }}
|
||||
</view>
|
||||
<CreateRoom v-if="!warnning" :onConfirm="() => (showModal = false)" />
|
||||
<!-- showModal 关闭时立即销毁组件,重开时重建,确保选项重置为 0 -->
|
||||
<CreateRoom v-if="!warnning && showModal" :onConfirm="() => (showModal = false)" />
|
||||
</SModal>
|
||||
<Signin :show="showSignin" :onClose="onSignin" />
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user