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'
8591import {appConfig } from " @/utils/main/config" ;
8692import {queryEnemySummonerId } from " @/utils/render/renderLcu" ;
8793import {ref } from " vue" ;
8894import {getSummonerNickName } from " @/utils/main/lcu" ;
8995import {storeToRefs } from " pinia/dist/pinia" ;
9096import {useStore } from " @/render/store" ;
9197import {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