Skip to content

Commit b4d69f4

Browse files
committed
fix some bug and add new a function
1 parent 0e7e782 commit b4d69f4

File tree

6 files changed

+137
-144
lines changed

6 files changed

+137
-144
lines changed

src/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const runLcu = async () => {
8585
clearInterval(idSetInterval)
8686
ws.unsubscribe('/lol-champ-select/v1/session')
8787
}else if (data==='InProgress'){
88-
creatMatchAfterStartGame(userHeader) // 游戏对局开始后, 打开查询历史战绩窗口
88+
await creatMatchAfterStartGame(userHeader) // 游戏对局开始后, 打开查询历史战绩窗口
8989
}else if(data ==='PreEndOfGame'){ // PreEndOfGame
9090
if (appConfig.get('isSwitchBlacklist')){assistWindow.show()}
9191
assistWindow.webContents.send('show-other-summoner')

src/render/components/matchHistory/barKDA.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<n-space>
44
<n-card class="boxShadow mainCard">
55
<div>
6-
<v-chart style="margin-top: 10px" class="chart" :key="refresh" :option="
6+
<v-chart style="margin-top: 10px" @click="onClick" class="chart" :key="refresh" :option="
77
{
88
title: {
99
show: true,
@@ -233,7 +233,7 @@ import {
233233
NCard, NSpace, NTag, NIcon, NInput,
234234
NButton, NColorPicker, NPopover, NPopconfirm, NCheckbox, NCheckboxGroup
235235
} from 'naive-ui'
236-
import {onMounted, ref, watch} from "vue"
236+
import {onMounted, ref} from "vue"
237237
import {appConfig} from "@/utils/main/config"
238238
import {ChevronsDownLeft, CircleX, Ballon} from '@vicons/tabler'
239239
import {ipcRenderer} from "electron"
@@ -242,7 +242,7 @@ import {storeToRefs} from "pinia/dist/pinia";
242242
import {sendMessageToChat} from "@/utils/main/lcu";
243243
244244
const store = useStore()
245-
const {echartsData, enemyEchartsData, currentTeam, currentEchartData} = storeToRefs(store)
245+
const {echartsData, enemyEchartsData, currentTeam, currentEchartData,summonerInfo} = storeToRefs(store)
246246
let refresh = ref(1)
247247
let topHorse = ref(appConfig.get("topHorse"))
248248
let midHorse = ref(appConfig.get("midHorse"))
@@ -254,12 +254,10 @@ let midHorseType = ref(horseType.value.mid)
254254
let botHorseType = ref(horseType.value.bot)
255255
let trashHorseType = ref(horseType.value.trash)
256256
const sendPopover = ref(false)
257+
const emits = defineEmits(['summonerId'])
257258
258259
const summonerName = ref([])
259260
260-
watch(currentTeam, () => {
261-
currentEchartData.value = currentTeam.value === 1 ? echartsData.value : enemyEchartsData.value
262-
})
263261
onMounted(() => {
264262
let colorTitle = document.querySelectorAll('.n-color-picker-trigger__value')
265263
for (const colorTitleElement of colorTitle) {
@@ -323,6 +321,11 @@ const changeHorseType = (type, horse) => {
323321
}
324322
}
325323
324+
function onClick() {
325+
const index = arguments[0].dataIndex
326+
emits('summonerId', {summonerId:currentEchartData.value.summonerId[index],
327+
name:currentEchartData.value.name[index]})
328+
}
326329
</script>
327330

328331
<style scoped>

src/render/components/matchHistory/index.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<div style="overflow: hidden;">
33
<n-space>
4-
<left-card @summonerId="getSummonerId($event)"></left-card>
4+
<left-card @summonerId="getSummonerId($event)" @backHome="backHome"></left-card>
55
<n-space>
6-
<bar-k-d-a
6+
<bar-k-d-a @summonerId="getSummonerId($event)"
77
v-if="pageCount==1" class="slide-in-right"></bar-k-d-a>
88
<standing :matchData="matchData"
9-
@changePage="() => {pageCount=1}"
9+
@changePage="backHome"
1010
@toGameDetailsPage="toGameDetailsPage($event)"
1111
v-else-if="pageCount==2" class="slide-in-right"></standing>
1212
<gameDetails v-else-if="pageCount==3" class="slide-in-right"
@@ -46,12 +46,13 @@ const {
4646
const credentials = appConfig.get('credentials')
4747
4848
const getChartsData = (res) => {
49-
echartsData.value = {name: [], data: [], kdaHistory: [], horse: []}
49+
echartsData.value = {name: [], data: [], kdaHistory: [], horse: [],summonerId:[]}
5050
for (const re of res) {
5151
echartsData.value.name.push(re.name)
5252
echartsData.value.data.push(re.score)
5353
echartsData.value.kdaHistory.push(re.kdaHistory)
5454
echartsData.value.horse.push(re.horse)
55+
echartsData.value.summonerId.push(re.summonerId)
5556
}
5657
currentEchartData.value = echartsData.value
5758
}
@@ -85,6 +86,12 @@ const toGameDetailsPage = (gameId) => {
8586
pageCount.value = 3
8687
currentQueryGameId.value = gameId
8788
}
89+
90+
const backHome = () => {
91+
pageCount.value=1
92+
currentSummonerName.value = ''
93+
}
94+
8895
</script>
8996

9097
<style scoped>

src/render/components/matchHistory/leftCard.vue

Lines changed: 111 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,139 @@
11
<template>
22
<div>
3-
<n-card class="mainCard boxShadow">
4-
<n-space v-if="summonerInfo.length !=0">
5-
<n-space vertical style="margin-top: 15px;width: 200px"
6-
:size="[2,34]" v-if="currentTeam ===1">
7-
<n-space v-for="summoner in summonerInfo">
8-
<n-avatar
9-
round
10-
:bordered="false"
11-
:size="50"
12-
:src="`https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/${summoner.iconId}.png`"
13-
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
14-
@click="clickCurrentSummoner($event,summoner.summonerId,summoner.name)"
15-
/>
16-
<n-space vertical :size="[10,4]">
17-
<n-tag type="success" :bordered="false" round size="small" disabled="disabled">{{ summoner.name }}</n-tag>
18-
<n-tag type="success" :bordered="false" v-if="summoner.horse == horseType.top"
19-
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
20-
</n-tag>
21-
<n-tag type="warning" :bordered="false" v-else-if="summoner.horse == horseType.mid"
22-
round size="small">{{ summoner.horse }} {{summoner.rankPoint }}
23-
</n-tag>
24-
<n-tag type="info" :bordered="false" v-else-if="summoner.horse == horseType.bot"
25-
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
26-
</n-tag>
27-
<n-tag type="error" :bordered="false" v-else-if="summoner.horse == horseType.trash"
28-
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
29-
</n-tag>
30-
</n-space>
31-
</n-space>
32-
</n-space>
3+
<n-card class="mainCard boxShadow">
4+
<n-space v-if="summonerInfo.length !=0">
5+
<n-space vertical style="margin-top: 15px;width: 200px"
6+
:size="[2,34]" v-if="currentTeam ===1">
7+
<n-space v-for="summoner in summonerInfo">
8+
<n-avatar
9+
round
10+
:bordered="false"
11+
:size="50"
12+
:src="`https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/${summoner.iconId}.png`"
13+
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
14+
@click="clickCurrentSummoner($event,summoner.summonerId,summoner.name)"
15+
/>
16+
<n-space vertical :size="[10,4]">
17+
<n-tag type="success" :bordered="false"
18+
round size="small" :disabled="currentSummonerName === summoner.name ? false:true">{{ summoner.name }}</n-tag>
3319

34-
<n-space vertical style="margin-top: 15px;width: 200px"
35-
:size="[2,34]" v-else-if="currentTeam===2">
36-
<n-space v-for="summoner in enemySummonerInfo">
37-
<n-avatar
38-
round
39-
:bordered="false"
40-
:size="50"
41-
:src="`https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/${summoner.iconId}.png`"
42-
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
43-
@click="clickCurrentSummoner($event,summoner.summonerId,summoner.name)"
44-
/>
45-
<n-space vertical :size="[10,4]">
46-
<n-tag type="success" :bordered="false" round size="small" disabled="disabled">{{ summoner.name }}</n-tag>
47-
<n-tag type="success" :bordered="false" v-if="summoner.horse == horseType.top"
48-
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
49-
</n-tag>
50-
<n-tag type="warning" :bordered="false" v-else-if="summoner.horse == horseType.mid"
51-
round size="small">{{ summoner.horse }} {{summoner.rankPoint }}
52-
</n-tag>
53-
<n-tag type="info" :bordered="false" v-else-if="summoner.horse == horseType.bot"
54-
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
55-
</n-tag>
56-
<n-tag type="error" :bordered="false" v-else-if="summoner.horse == horseType.trash"
57-
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
58-
</n-tag>
59-
</n-space>
20+
<n-tag type="success" :bordered="false" v-if="summoner.horse == horseType.top"
21+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
22+
</n-tag>
23+
<n-tag type="warning" :bordered="false" v-else-if="summoner.horse == horseType.mid"
24+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
25+
</n-tag>
26+
<n-tag type="info" :bordered="false" v-else-if="summoner.horse == horseType.bot"
27+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
28+
</n-tag>
29+
<n-tag type="error" :bordered="false" v-else-if="summoner.horse == horseType.trash"
30+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
31+
</n-tag>
6032
</n-space>
6133
</n-space>
34+
</n-space>
6235

63-
<n-space style="margin-top: 12px;width: 200px" v-if="enemySummonerInfo.length != 0" justify="space-between">
64-
<n-button size="small" :bordered="currentTeam===1" @click="changeCurrentTeam"
65-
type="success" dashed>我方召唤师</n-button>
66-
<n-button size="small" :bordered="currentTeam===2" @click="changeCurrentTeam"
67-
type="error" dashed>敌方召唤师</n-button>
36+
<n-space vertical style="margin-top: 15px;width: 200px"
37+
:size="[2,34]" v-else-if="currentTeam===2">
38+
<n-space v-for="summoner in enemySummonerInfo">
39+
<n-avatar
40+
round
41+
:bordered="false"
42+
:size="50"
43+
:src="`https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/${summoner.iconId}.png`"
44+
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
45+
@click="clickCurrentSummoner($event,summoner.summonerId,summoner.name)"
46+
/>
47+
<n-space vertical :size="[10,4]">
48+
<n-tag type="success" :bordered="false" round size="small"
49+
:disabled="currentSummonerName === summoner.name ? false:true">{{ summoner.name }}</n-tag>
50+
<n-tag type="success" :bordered="false" v-if="summoner.horse == horseType.top"
51+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
52+
</n-tag>
53+
<n-tag type="warning" :bordered="false" v-else-if="summoner.horse == horseType.mid"
54+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
55+
</n-tag>
56+
<n-tag type="info" :bordered="false" v-else-if="summoner.horse == horseType.bot"
57+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
58+
</n-tag>
59+
<n-tag type="error" :bordered="false" v-else-if="summoner.horse == horseType.trash"
60+
round size="small">{{ summoner.horse }} {{ summoner.rankPoint }}
61+
</n-tag>
62+
</n-space>
6863
</n-space>
64+
</n-space>
6965

70-
<n-space style="margin-top: 12px;width: 200px" v-else-if="summonerInfo !=null && enemySummonerInfo.length === 0">
71-
<n-tag :bordered="false" size="small" class="tipTag">进入游戏后可查看敌方信息</n-tag>
72-
<n-tag :bordered="false" size="small" class="tipTag">点击召唤师的头像查看战绩</n-tag>
73-
</n-space>
66+
<n-space style="margin-top: 12px;width: 200px" v-if="enemySummonerInfo.length != 0" justify="space-between">
67+
<n-button size="small" :bordered="currentTeam===1" @click="changeCurrentTeam"
68+
type="success" dashed>我方召唤师
69+
</n-button>
70+
<n-button size="small" :bordered="currentTeam===2" @click="changeCurrentTeam"
71+
type="error" dashed>敌方召唤师
72+
</n-button>
7473
</n-space>
75-
<n-space v-else style="align-items: center">
76-
<n-spin size="medium" />
77-
<p>数据加载中....</p>
74+
75+
<n-space style="margin-top: 12px;width: 200px"
76+
v-else-if="summonerInfo !=null && enemySummonerInfo.length === 0">
77+
<n-tag :bordered="false" size="small" class="tipTag">进入游戏后可查看敌方信息</n-tag>
78+
<n-tag :bordered="false" size="small" class="tipTag">点击召唤师的头像查看战绩</n-tag>
7879
</n-space>
79-
</n-card>
80+
</n-space>
81+
<n-space v-else style="align-items: center;margin-top: 220px;margin-left: 30px">
82+
<n-spin size="medium"/>
83+
<p>数据加载中....</p>
84+
</n-space>
85+
</n-card>
8086
</div>
8187
</template>
8288

83-
<script>
84-
import {NCard, NAvatar, NSpace, NTag, NButton,NBadge,NSpin} from 'naive-ui'
89+
<script setup>
90+
import {NCard, NAvatar, NSpace, NTag, NButton, NSpin} from 'naive-ui'
8591
import {appConfig} from "@/utils/main/config";
8692
import {queryEnemySummonerId} from "@/utils/render/renderLcu";
8793
import {ref} from "vue";
8894
import {getSummonerNickName} from "@/utils/main/lcu";
8995
import {storeToRefs} from "pinia/dist/pinia";
9096
import {useStore} from "@/render/store";
9197
import {ipcRenderer} from "electron";
98+
const emits = defineEmits(['summonerId','backHome'])
9299
93-
export default {
94-
name: "leftCard",
95-
components: {
96-
NCard, NAvatar, NSpace, NTag, NButton,NBadge,NSpin
97-
},
98-
setup(props,{emit}) {
99-
let clickCount = 0
100-
let clickList = []
101-
const horseType = appConfig.get('horseType')
102-
const enemySummonerInfo = ref([])
103-
const store = useStore()
104-
const {enemyEchartsData,currentTeam,summonerInfo} = storeToRefs(store)
105-
106-
ipcRenderer.on('query-enemy-summoner',() => {
107-
getEnemyInfo()
108-
})
100+
const horseType = appConfig.get('horseType')
101+
const enemySummonerInfo = ref([])
102+
const store = useStore()
103+
const {enemyEchartsData, currentEchartData,echartsData,currentTeam,currentSummonerName, summonerInfo} = storeToRefs(store)
109104
110-
const getEnemyInfo = async () => {
111-
const credentials = appConfig.get('credentials')
112-
const enemyIdList = await queryEnemySummonerId(credentials)
113-
enemySummonerInfo.value = await getSummonerNickName(credentials,enemyIdList)
114-
getEnemyChartsData(enemySummonerInfo.value)
115-
}
116-
117-
const getEnemyChartsData = (res) => {
118-
enemyEchartsData.value = {name:[],data:[],kdaHistory:[],horse:[]}
119-
for (const re of res) {
120-
enemyEchartsData.value.name.push(re.name)
121-
enemyEchartsData.value.data.push(re.score)
122-
enemyEchartsData.value.kdaHistory.push(re.kdaHistory)
123-
enemyEchartsData.value.horse.push(re.horse)
124-
}
125-
}
105+
ipcRenderer.on('query-enemy-summoner', () => {
106+
getEnemyInfo()
107+
})
108+
const getEnemyInfo = async () => {
109+
const credentials = appConfig.get('credentials')
110+
const enemyIdList = await queryEnemySummonerId(credentials)
111+
enemySummonerInfo.value = await getSummonerNickName(credentials, enemyIdList)
112+
getEnemyChartsData(enemySummonerInfo.value)
113+
}
114+
getEnemyInfo()
126115
127-
const changeCurrentTeam = () => {
128-
currentTeam.value = currentTeam.value ===1 ? 2:1
129-
}
116+
const getEnemyChartsData = (res) => {
117+
enemyEchartsData.value = {name: [], data: [], kdaHistory: [], horse: [], summonerId: []}
118+
for (const re of res) {
119+
enemyEchartsData.value.name.push(re.name)
120+
enemyEchartsData.value.data.push(re.score)
121+
enemyEchartsData.value.kdaHistory.push(re.kdaHistory)
122+
enemyEchartsData.value.horse.push(re.horse)
123+
enemyEchartsData.value.summonerId.push(re.summonerId)
124+
}
125+
}
130126
131-
const clickCurrentSummoner = (e,summonerId,name) => {
132-
try {
133-
emit('summonerId', {summonerId, name})
134-
let tar = e.currentTarget.parentElement.parentElement
135-
let nTag = tar.getElementsByClassName('n-tag--disabled')[0]
136-
nTag.classList.remove('n-tag--disabled')
137-
clickCount += 1
138-
clickList.push(nTag)
139-
if (clickCount == 2) {
140-
clickList[0].classList.add('n-tag--disabled')
141-
clickList.splice(0, 1)
142-
clickCount = 1
143-
}
144-
}catch (e){
145-
return e
146-
}
147-
}
127+
const changeCurrentTeam = () => {
128+
currentTeam.value = currentTeam.value === 1 ? 2 : 1
129+
currentEchartData.value = currentTeam.value === 1 ? echartsData.value : enemyEchartsData.value
130+
emits('backHome')
131+
}
148132
149-
return {
150-
horseType,currentTeam,enemySummonerInfo,summonerInfo,
151-
clickCurrentSummoner,changeCurrentTeam
152-
}
153-
}
133+
const clickCurrentSummoner = (e, summonerId, name) => {
134+
emits('summonerId', {summonerId, name})
154135
}
136+
155137
</script>
156138

157139
<style scoped>
@@ -161,6 +143,7 @@ export default {
161143
width: 250px;
162144
height: 556px
163145
}
146+
164147
.tipTag {
165148
width: 200px;
166149
justify-content: center;

0 commit comments

Comments
 (0)