feat: 刷新 Access Token(带并发锁)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
/**
|
||||
* SSE 连接客户端
|
||||
@@ -89,6 +90,7 @@ export class SseClient {
|
||||
return
|
||||
}
|
||||
this.callbacks.onMessage(message.event, message.data)
|
||||
ElMessage.success(message.event)
|
||||
},
|
||||
|
||||
onclose: () => {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import mitt from 'mitt'
|
||||
import type { RoomItem } from '@/api/modules/game'
|
||||
|
||||
/**
|
||||
* SSE 事件定义
|
||||
*/
|
||||
export type SseEvents = {
|
||||
connected: undefined
|
||||
error: { message: string; retryCount: number }
|
||||
@@ -10,6 +13,8 @@ export type SseEvents = {
|
||||
kicked: { roomId: string }
|
||||
game_started: { roomId: string }
|
||||
balance_chg: { balance: number; delta: number }
|
||||
/** 自定义事件类型,用于测试或任意消息推送,数据格式由调用方决定 */
|
||||
custom: unknown
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { RoomItem, RoomPlayer, RoomStatus } from '@/api/modules/game'
|
||||
import type { RoomItem } from '@/api/modules/game'
|
||||
import { getAvatarUrl } from '@/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -109,7 +109,7 @@ const chairPositions = computed(() => {
|
||||
|
||||
positions.push({
|
||||
left: `${left}px`,
|
||||
top: `${top}px`,
|
||||
top: `${top}px`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -164,9 +164,7 @@ function isHost(idx: number): boolean {
|
||||
function chairTooltip(idx: number): string {
|
||||
const player = props.room.players[idx]
|
||||
if (!player) return ''
|
||||
return player.nickname === props.room.creatorName
|
||||
? `${player.nickname}(房主)`
|
||||
: player.nickname
|
||||
return player.nickname === props.room.creatorName ? `${player.nickname}(房主)` : player.nickname
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -350,12 +348,7 @@ function chairTooltip(idx: number): string {
|
||||
height: 76px;
|
||||
border-radius: 50%;
|
||||
/* 木质桌面 */
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
#e8d5b0 0%,
|
||||
#d4a574 40%,
|
||||
#c49060 100%
|
||||
);
|
||||
background: linear-gradient(145deg, #e8d5b0 0%, #d4a574 40%, #c49060 100%);
|
||||
box-shadow:
|
||||
0 3px 12px rgba(0, 0, 0, 0.15),
|
||||
inset 0 1px 2px rgba(255, 255, 255, 0.4);
|
||||
|
||||
@@ -135,7 +135,14 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Setting, EditPen, ArrowRight, Check, DocumentCopy, SwitchButton } from '@element-plus/icons-vue'
|
||||
import {
|
||||
Setting,
|
||||
EditPen,
|
||||
ArrowRight,
|
||||
Check,
|
||||
DocumentCopy,
|
||||
SwitchButton
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useAccountStore } from '@/stores'
|
||||
import { UserStatus, type UserStatusType } from '@/api/modules/user'
|
||||
import { getAvatarUrl } from '@/utils'
|
||||
|
||||
Reference in New Issue
Block a user