fix:比赛页面新增设备已离线弹窗提示
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import { ref, onMounted, onBeforeUnmount, watch } from "vue";
|
||||
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import BowTarget from "@/components/BowTarget.vue";
|
||||
@@ -10,13 +10,14 @@ import SButton from "@/components/SButton.vue";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import ScreenHint from "@/components/ScreenHint.vue";
|
||||
import TestDistance from "@/components/TestDistance.vue";
|
||||
import SModal from "@/components/SModal.vue";
|
||||
import audioManager from "@/audioManager";
|
||||
import { getBattleAPI, laserCloseAPI } from "@/apis";
|
||||
import { MESSAGETYPESV2 } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
const { user, online } = storeToRefs(store);
|
||||
const title = ref("");
|
||||
const start = ref(null);
|
||||
const battleId = ref("");
|
||||
@@ -29,6 +30,17 @@ const playersSorted = ref([]);
|
||||
const playersScores = ref([]);
|
||||
const halfTimeTip = ref(false);
|
||||
const halfRest = ref(false);
|
||||
/** 控制设备离线提示弹窗的显示状态 */
|
||||
const showOfflineModal = ref(false);
|
||||
|
||||
/**
|
||||
* 监听设备在线状态,大乱斗比赛进行中设备离线时弹窗提示用户
|
||||
*/
|
||||
watch(online, (newVal, oldVal) => {
|
||||
if (!newVal && oldVal && start.value === true) {
|
||||
showOfflineModal.value = true;
|
||||
}
|
||||
});
|
||||
|
||||
function recoverData(battleInfo, { force = false } = {}) {
|
||||
if (!battleInfo) return;
|
||||
@@ -208,6 +220,19 @@ onShow(async () => {
|
||||
<text>20秒后开始下半场</text>
|
||||
</view>
|
||||
</ScreenHint>
|
||||
<!-- 设备离线提示弹窗 -->
|
||||
<SModal
|
||||
:show="showOfflineModal"
|
||||
:noBg="true"
|
||||
height="360rpx"
|
||||
:onClose="() => (showOfflineModal = false)"
|
||||
>
|
||||
<view class="offline-modal">
|
||||
<text class="offline-title">设备已离线</text>
|
||||
<text class="offline-desc">检测到设备已断开连接,请检查设备后继续比赛</text>
|
||||
<SButton @click="showOfflineModal = false">我知道了</SButton>
|
||||
</view>
|
||||
</SModal>
|
||||
</view>
|
||||
</Container>
|
||||
</template>
|
||||
@@ -217,4 +242,25 @@ onShow(async () => {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.offline-modal {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 60rpx 40rpx 40rpx;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.offline-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #FED847;
|
||||
}
|
||||
|
||||
.offline-desc {
|
||||
font-size: 28rpx;
|
||||
color: #CCCCCC;
|
||||
text-align: center;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user