fix:比赛页面新增设备已离线弹窗提示
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
import { ref, onMounted, onBeforeUnmount, watch } from "vue";
|
||||||
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
|
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import BowTarget from "@/components/BowTarget.vue";
|
import BowTarget from "@/components/BowTarget.vue";
|
||||||
@@ -10,13 +10,14 @@ import SButton from "@/components/SButton.vue";
|
|||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
import ScreenHint from "@/components/ScreenHint.vue";
|
import ScreenHint from "@/components/ScreenHint.vue";
|
||||||
import TestDistance from "@/components/TestDistance.vue";
|
import TestDistance from "@/components/TestDistance.vue";
|
||||||
|
import SModal from "@/components/SModal.vue";
|
||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
import { getBattleAPI, laserCloseAPI } from "@/apis";
|
import { getBattleAPI, laserCloseAPI } from "@/apis";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { user } = storeToRefs(store);
|
const { user, online } = storeToRefs(store);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
const start = ref(null);
|
const start = ref(null);
|
||||||
const battleId = ref("");
|
const battleId = ref("");
|
||||||
@@ -29,6 +30,17 @@ const playersSorted = ref([]);
|
|||||||
const playersScores = ref([]);
|
const playersScores = ref([]);
|
||||||
const halfTimeTip = ref(false);
|
const halfTimeTip = ref(false);
|
||||||
const halfRest = 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 } = {}) {
|
function recoverData(battleInfo, { force = false } = {}) {
|
||||||
if (!battleInfo) return;
|
if (!battleInfo) return;
|
||||||
@@ -208,6 +220,19 @@ onShow(async () => {
|
|||||||
<text>20秒后开始下半场</text>
|
<text>20秒后开始下半场</text>
|
||||||
</view>
|
</view>
|
||||||
</ScreenHint>
|
</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>
|
</view>
|
||||||
</Container>
|
</Container>
|
||||||
</template>
|
</template>
|
||||||
@@ -217,4 +242,25 @@ onShow(async () => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 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>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {ref, onMounted, onBeforeUnmount, nextTick} from "vue";
|
import {ref, onMounted, onBeforeUnmount, nextTick, watch} from "vue";
|
||||||
import {onLoad, onShow, onHide} from "@dcloudio/uni-app";
|
import {onLoad, onShow, onHide} from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import BattleHeader from "@/components/BattleHeader.vue";
|
import BattleHeader from "@/components/BattleHeader.vue";
|
||||||
@@ -11,6 +11,7 @@ import RoundEndTip from "@/components/RoundEndTip.vue";
|
|||||||
import TestDistance from "@/components/TestDistance.vue";
|
import TestDistance from "@/components/TestDistance.vue";
|
||||||
import TeamAvatars from "@/components/TeamAvatars.vue";
|
import TeamAvatars from "@/components/TeamAvatars.vue";
|
||||||
import ShootProgress2 from "@/components/ShootProgress2.vue";
|
import ShootProgress2 from "@/components/ShootProgress2.vue";
|
||||||
|
import SModal from "@/components/SModal.vue";
|
||||||
import {laserCloseAPI, getBattleAPI} from "@/apis";
|
import {laserCloseAPI, getBattleAPI} from "@/apis";
|
||||||
import {MESSAGETYPESV2} from "@/constants";
|
import {MESSAGETYPESV2} from "@/constants";
|
||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
@@ -18,7 +19,7 @@ import useStore from "@/store";
|
|||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const {user} = storeToRefs(store);
|
const {user, online} = storeToRefs(store);
|
||||||
const start = ref(null);
|
const start = ref(null);
|
||||||
const tips = ref("");
|
const tips = ref("");
|
||||||
const battleId = ref("");
|
const battleId = ref("");
|
||||||
@@ -44,6 +45,17 @@ const updateRemainSecond = ref(0);
|
|||||||
const battleWay = ref(0);
|
const battleWay = ref(0);
|
||||||
/** 上一次处理的 ToSomeoneShoot 关键字段,用于去重过滤重复消息 */
|
/** 上一次处理的 ToSomeoneShoot 关键字段,用于去重过滤重复消息 */
|
||||||
const lastToSomeoneShootKey = ref("");
|
const lastToSomeoneShootKey = ref("");
|
||||||
|
/** 控制设备离线提示弹窗的显示状态 */
|
||||||
|
const showOfflineModal = ref(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听设备在线状态,比赛进行中设备离线时弹窗提示用户
|
||||||
|
*/
|
||||||
|
watch(online, (newVal, oldVal) => {
|
||||||
|
if (!newVal && oldVal && start.value === true) {
|
||||||
|
showOfflineModal.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
|
const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => {
|
||||||
try {
|
try {
|
||||||
@@ -314,6 +326,19 @@ onShow(async () => {
|
|||||||
:onAutoClose="()=>{ showRoundTip = false}"
|
:onAutoClose="()=>{ showRoundTip = false}"
|
||||||
/>
|
/>
|
||||||
</ScreenHint>
|
</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>
|
</view>
|
||||||
</Container>
|
</Container>
|
||||||
</template>
|
</template>
|
||||||
@@ -331,4 +356,25 @@ onShow(async () => {
|
|||||||
margin-top: -2%;
|
margin-top: -2%;
|
||||||
margin-bottom: 6%;
|
margin-bottom: 6%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user