Skip to content

Commit

Permalink
修复一些问题
Browse files Browse the repository at this point in the history
  • Loading branch information
cunoe committed May 14, 2024
1 parent e6d941c commit 11370df
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/player/EnemyCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getClanColorFromUtil(clanType: number) {
return getClanColor(clanType)
}
function getClan(){
if (props.battleData.clan === null) return ""
if (props.battleData.clan === null || props.battleData.clan === '') return ""
return `[${props.battleData.clan}]`
}
</script>
Expand Down
7 changes: 6 additions & 1 deletion components/player/PlayerHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ onMounted(async () => {
isReady.value = true
let battleType = 'pvp'
if (gameData.matchGroup.toUpperCase() === 'RANKED') {
battleType = 'rank'
}
let params: BattleDataRequest = {
battle_id: "",
battle_type: "pvp",
battle_type: battleType,
teammate_server: battleHistory.value.teammate_server,
teammates: teammates.value.map(item => {
return {
Expand Down
7 changes: 6 additions & 1 deletion components/player/Players.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ useIntervalFn(async () => {
gameInfo.value = gameData
battleHistory.value = result
let battleType = 'pvp'
if (gameData.matchGroup.toUpperCase() === 'RANKED') {
battleType = 'rank'
}
let params: BattleDataRequest = {
battle_id: "",
battle_type: "pvp",
battle_type: battleType,
teammate_server: battleHistory.value.teammate_server,
teammates: teammates.value.map(item => {
return {
Expand Down
2 changes: 1 addition & 1 deletion components/player/TeammateCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function getFRColorFromUtil(fr: number) {
function getClan(){
if (props.battleData.clan === null) return ""
if (props.battleData.clan === null || props.battleData.clan === '') return ""
return `[${props.battleData.clan}]`
}
function getClanColorFromUtil(clanType: number) {
Expand Down
13 changes: 12 additions & 1 deletion composables/requests/kokomi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,23 @@ function getHeaders(): Headers {
return headers;
}

// 删除机器人用户 一般是以 : 开头的用户
function filterBotUser(data: BattleDataRequest): BattleDataRequest{
const teammates = data.teammates.filter(teammate => !teammate.name.startsWith(':'));
const enemies = data.enemies.filter(enemy => !enemy.name.startsWith(':'));
return {
...data,
teammates,
enemies
}
}

export async function fetchBattleData(data: BattleDataRequest): Promise<BattleDataResponse> {
const url = 'http://www.wows-coral.com:8000/w/brief/';
const response = await fetch(url, {
method: 'POST',
headers: getHeaders(),
body: JSON.stringify(data)
body: JSON.stringify(filterBotUser(data))
});

if (response.status === 200) {
Expand Down

0 comments on commit 11370df

Please sign in to comment.