Commit 03def38d authored by 陈冲's avatar 陈冲

commit

parent 2912c668
......@@ -215,6 +215,7 @@ if (wechat) {
}
onMounted(() => {
document.title = '小游戏 - 击鼓齐福'
if (token.value) {
window.addEventListener('beforeunload', confirmRefresh)
}
......
......@@ -74,7 +74,7 @@ onMounted(() => {
.img-score {
position: absolute;
top: 500px;
top: 450px;
left: 50%;
width: 465px;
height: 731px;
......@@ -144,7 +144,7 @@ onMounted(() => {
.btn-group {
position: absolute;
top: 1354px;
top: 1320px;
left: 50%;
display: flex;
gap: 40px;
......
......@@ -17,7 +17,7 @@ type AdminGameSocketOptions = {
onGameStart?: (data: any) => void | Promise<void>
onGameStartRejected?: (data: any) => void
onRoomRank?: (data: any) => void
onEvent?: (evt: string, payload: SocketPayload) => void
onRelogin?: () => void
}
export function useAdminGameSocket(options: AdminGameSocketOptions) {
......@@ -64,6 +64,10 @@ export function useAdminGameSocket(options: AdminGameSocketOptions) {
options.onGameStartRejected?.(data)
return
}
if (evt == 'login_result') {
options.onRelogin?.()
return;
}
alert(msg)
return
}
......@@ -88,8 +92,6 @@ export function useAdminGameSocket(options: AdminGameSocketOptions) {
break
}
}
options.onEvent?.(evt, payload)
})
})
......
......@@ -48,6 +48,7 @@ onMounted(() => {
<template>
<DesignStage>
<form>
<table>
<tbody>
<tr>
......@@ -60,11 +61,12 @@ onMounted(() => {
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Login" @click="loginHandler" />
<input type="button" value="登录" @click="loginHandler" />
</td>
</tr>
</tbody>
</table>
</form>
</DesignStage>
</template>
......
<script setup lang="ts">
import { nextTick, onMounted, onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import Loading from './views/LoadingView.vue'
import Rank1 from './views/Rank1View.vue'
import Rank2 from './views/Rank2View.vue'
import { useAdminGameSocket } from '@/composables/useAdminGameSocket'
import type Player from '@/commons/player.ts'
import { playGame1Music } from '@/commons/music'
import { $remove_socket_storage } from '@/commons/utils.ts'
const router = useRouter()
type GameScreen = 'loading' | 'rank1' | 'rank2'
......@@ -145,6 +149,10 @@ const { startGame, createRoom, backRoom } = useAdminGameSocket({
},
onGameStart: gotoRank1WithIntro,
onRoomRank: updateRankPlayers,
onRelogin: async () => {
$remove_socket_storage();
await router.replace('/')
}
})
const startGameWithMusic = () => {
......
......@@ -28,8 +28,8 @@ function copyImageAssets() {
export default defineConfig(({ command }) => ({
base: command === 'build' ? '/cc/pc/' : '/',
define: {
// __APP_DOMAIN__: JSON.stringify(command === 'build' ? buildDomain : ''),
__APP_DOMAIN__: JSON.stringify(buildDomain),
__APP_DOMAIN__: JSON.stringify(command === 'build' ? buildDomain : ''),
// __APP_DOMAIN__: JSON.stringify(buildDomain),
},
plugins: [
vue(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment