@@ -13,6 +13,7 @@ import { AngleLeft, AngleRight } from "@vicons/fa";
1313import EpicLoading from " @/components/EpicLoading.vue" ;
1414import { PlayerNote } from " @@/types/type" ;
1515import playerNotesApi from " @/api/playerNotesApi" ;
16+ import { getNameAndTagLine } from " @/utils/util" ;
1617
1718interface SummonerGameHistoryResult {
1819 summonerInfo: SummonerInfo ;
@@ -136,17 +137,23 @@ const fetchData = async ({
136137 console .log (" fetchData" , { summonerName , puuid });
137138 summonerQueryLoading .value = true ;
138139 try {
140+ let summoner: SummonerInfo ;
141+ // 如果只通过名称查询,就先通过名称判断是否有该召唤师
142+ if (summonerName && ! puuid ) {
143+ try {
144+ summoner = await lcuApi .getSummonerByName (summonerName ! );
145+ puuid = summoner .puuid ;
146+ } catch (e ) {
147+ console .log (e );
148+ return ;
149+ }
150+ }
139151 // 判断是否已存在tab
140- const existIndex = summonerQueryList .value .findIndex (
141- (s ) => s .summonerInfo .displayName === summonerName || s .summonerInfo .puuid === puuid
142- );
152+ const existIndex = summonerQueryList .value .findIndex ((s ) => s .summonerInfo .puuid === puuid );
143153 // 不存在就查询
144154 if (existIndex === - 1 ) {
145- let summoner: SummonerInfo ;
146155 if (! puuid && ! summonerName ) {
147156 summoner = await lcuStore .getCurrentSummoner ();
148- } else if (summonerName ) {
149- summoner = await lcuApi .getSummonerByName (summonerName ! );
150157 } else {
151158 summoner = await lcuApi .getSummonerByPuuid (puuid ! );
152159 }
@@ -240,7 +247,7 @@ watch(
240247const handleNameOptionsSelect = (key : string ) => {
241248 switch (key ) {
242249 case " copyName" :
243- copy (currentTabSummoner .value ?. displayName , " 昵称" );
250+ copy (getNameAndTagLine ( currentTabSummoner .value ) , " 昵称" );
244251 break ;
245252 case " copyPuuid" :
246253 copy (currentTabSummoner .value ?.puuid , " puuid" );
@@ -286,14 +293,14 @@ const handleNameOptionsSelect = (key: string) => {
286293 <div class =" flex flex-row flex-nowrap items-center gap-[10px] min-h-[50px]" >
287294 <div class =" flex flex-row items-center" v-if =" currentTabSummoner?.displayName" >
288295 <div v-if =" summonerQueryList[tabIndex]?.playerNote?.tags" >
289- <n-ellipsis style =" max-width : 200px " :tooltip =" {width:400}" >
296+ <n-ellipsis style =" max-width : 200px " :tooltip =" { width: 400 }" >
290297 <n-tag
291298 :bordered =" false"
292299 type =" warning"
293300 v-for =" tag in summonerQueryList[tabIndex]?.playerNote?.tags"
294301 class =" m-1"
295- >{{ tag }}</ n-tag
296- >
302+ >{{ tag }}
303+ </ n-tag >
297304 </n-ellipsis >
298305 </div >
299306
@@ -302,7 +309,7 @@ const handleNameOptionsSelect = (key: string) => {
302309 </n-tag >
303310 <profile-img round class =" m-2 shrink-0" :profile-icon-id =" currentTabSummoner.profileIconId" ></profile-img >
304311 <n-dropdown trigger =" click" :options =" playerDropDownOptions" @select =" handleNameOptionsSelect" >
305- <n-button text class =" truncate cursor-pointer" :title =" currentTabSummoner.displayName " >
312+ <n-button text class =" truncate cursor-pointer" :title =" getNameAndTagLine( currentTabSummoner) " >
306313 {{ currentTabSummoner?.displayName }}
307314 </n-button >
308315 </n-dropdown >
0 commit comments