Skip to content

Commit 1bf32ef

Browse files
committed
fix some bug
1 parent 59ce0c2 commit 1bf32ef

File tree

6 files changed

+48
-94
lines changed

6 files changed

+48
-94
lines changed

scripts/debug.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Object.values(manifest.data.windows).forEach((w) => {
1010
w.debug_url = 'http://localhost:5173';
1111
w.file = w.file.replace('index.html/#/','#/')
1212
});
13+
manifest.meta.name = 'Sample App'
14+
manifest.meta.author = 'Cube'
1315

1416
try {
1517
mkdirSync(path.resolve(__dirname, '../dist/'));

src/pages/main/utils/gameFlow.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import {champSelectSession} from "../lcu/autoBP";
22
import {invokeLcu} from "../lcu";
33

44
export class GameFlow {
5-
6-
public config = JSON.parse(String(localStorage.getItem('config')))
7-
85
// 显示或者隐藏助手窗口
96
public showOrHideAssist = async (isShow: boolean, message: string) => {
107
const assistWin = await cube.windows.getWindowByName('assist')
@@ -17,7 +14,8 @@ export class GameFlow {
1714
}
1815
// 游戏结束后,根据用户设置判断是否弹出拉黑召唤师的抽屉
1916
public isShowBlack = async () => {
20-
if (this.config.isSwitchBlacklist) {
17+
const config = JSON.parse(String(localStorage.getItem('config')))
18+
if (config.isSwitchBlacklist) {
2119
const assistWin = await cube.windows.getWindowByName('assist')
2220
cube.windows.show(assistWin.id)
2321
cube.windows.message.send(assistWin.id, 'show-other-summoner', '')
@@ -36,7 +34,7 @@ export class GameFlow {
3634
cube.windows.close(v.id)
3735
}).catch(() => {})
3836
cube.windows.obtainDeclaredWindow('matchHistory', { gamein: true}).then((v) => {
39-
if (!this.config.isGameInWindow){
37+
if (!JSON.parse(String(localStorage.getItem('config'))).isGameInWindow){
4038
cube.windows.hide(v.id)
4139
}
4240
})
@@ -55,15 +53,17 @@ export class GameFlow {
5553
}
5654
// 自动(禁用)选择英雄
5755
public autoPickBanChamp = () => {
58-
if (this.config.autoPickChampion.isAuto || this.config.autoBanChampion.isAuto) {
56+
const config = JSON.parse(String(localStorage.getItem('config')))
57+
if (config.autoPickChampion.isAuto || config.autoBanChampion.isAuto) {
5958
const idSetInterval = setInterval(async () => {
6059
champSelectSession(idSetInterval)
6160
}, 1000)
6261
}
6362
}
6463
// 自动接收对局
6564
public autoAcceptGame = async () => {
66-
const isAutoAccept = this.config.autoAccept
65+
const config = JSON.parse(String(localStorage.getItem('config')))
66+
const isAutoAccept = config.autoAccept
6767
if (isAutoAccept < 50) {
6868
return
6969
}

src/pages/main/utils/gameScore.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ const queryMatchHistory = async (summonerId: number) => {
3535
let matchCount = 0
3636
for (let i = 0; i < 100; i += 20) {
3737
const matchList = await invokeLcu('get', `/lol-match-history/v3/matchlist/account/${summonerId}`, [i, i + 20])
38-
for (const matchListElement of matchList['games']['games'].reverse()) {
39-
if (matchListElement.queueId === currentGameMode && matchCount < 10) {
40-
matchCount += 1
41-
classicMode.push(matchListElement)
42-
} else if (matchCount === 10) {
43-
return classicMode
38+
try {
39+
for (const matchListElement of matchList['games']['games'].reverse()) {
40+
if (matchListElement.queueId === currentGameMode && matchCount < 10) {
41+
matchCount += 1
42+
classicMode.push(matchListElement)
43+
} else if (matchCount === 10) {
44+
return classicMode
45+
}
4446
}
47+
}catch (e) {
48+
continue
4549
}
4650
}
4751
return classicMode

src/pages/main/view/assist/blacklist.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const addBlacklistActive = ref(false)
137137
const blacklist:Ref<any> = ref([])
138138
const detialsJson = reactive({name:'',date:'',content:'',tag:'',summonerId:''})
139139
const message = useMessage()
140-
let localBlacklist:any = JSON.parse(localStorage.getItem('blacklist'))
140+
let localBlacklist:any = JSON.parse(String(localStorage.getItem('blacklist')))
141141
const store = assistStore()
142142
const {currentBlackList}:any = storeToRefs(store)
143143
@@ -180,7 +180,7 @@ const shiftFirst = (currentSummonerId:number) => {
180180
181181
// 从本地查询黑名单列表
182182
const queryBlacklist = () => {
183-
localBlacklist = JSON.parse(localStorage.getItem('blacklist'))
183+
localBlacklist = JSON.parse(String(localStorage.getItem('blacklist')))
184184
blacklist.value = []
185185
// 获取黑名单数据
186186
for (const black in localBlacklist) {
@@ -236,6 +236,13 @@ const addBlacklistFunc = () => {
236236
queryBlacklist()
237237
addBlacklistActive.value=false
238238
}
239+
// 更新排位日记
240+
cube.windows.message.on('received',(id:any) => {
241+
if (id==='updataBL'){
242+
queryBlacklist()
243+
}
244+
})
245+
239246
</script>
240247

241248
<style scoped>

src/pages/main/view/components/personalGameDetails.vue

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ import {NAvatar, NSpace, NTag,NList,NListItem,NButton,NScrollbar,useMessage} fro
101101
102102
103103
// 从父组件获取的数据
104-
const props = defineProps({
104+
const props:any = defineProps({
105105
personalDetails: {
106106
type: Object,
107107
},
@@ -123,23 +123,28 @@ const queryCurrenDate = () => {
123123
124124
const message = useMessage()
125125
126-
const addBlacklist = () => {
127-
console.log('拉黑到黑名单')
128-
// const currentDate = queryCurrenDate()
129-
// appConfig.set(`blacklist.${props.personalDetails.summonerId}`,{
130-
// nickname:props.personalDetails.name,
131-
// date:currentDate,
132-
// timestamp:Date.now(),
133-
// content:'战绩查询中添加的召唤师',
134-
// tag:'战绩查询',
135-
// })
136-
// message.success(`${props.personalDetails.name} 拉黑成功😡`)
137-
// ipcRenderer.send('setting-page-refresh-assist')
138-
}
126+
const addBlacklist = async () => {
127+
try {
128+
const currentDate = queryCurrenDate()
129+
const localBlacklist:any = JSON.parse(String(localStorage.getItem('blacklist'))) === null ? {}: JSON.parse(String(localStorage.getItem('blacklist')))
130+
localBlacklist[`${props.personalDetails.summonerId}`] = {
131+
nickname:props.personalDetails.name,
132+
date:currentDate,
133+
timestamp:Date.now(),
134+
content:'战绩查询中添加的召唤师',
135+
tag:'战绩查询',
136+
}
137+
localStorage.setItem('blacklist',JSON.stringify(localBlacklist))
138+
message.success(`${props.personalDetails.name} 拉黑成功😡`)
139+
cube.windows.message.send((await cube.windows.getWindowByName('assist')).id,'updataBL','')
140+
}catch (e) {
141+
message.error(`${props.personalDetails.name} 拉黑失败 !`)
142+
}
143+
}
139144
140145
// 获取符文图片地址
141146
const getImaUrl = (imgId:string) => {
142-
return `../../assets/runes/${imgId}.png`
147+
return new URL(`/src/assets/runes/${imgId}.png`, import.meta.url).href
143148
}
144149
</script>
145150

src/pages/main/ws/index.ts

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +0,0 @@
1-
2-
// @ts-ignore
3-
let clients: any = [];
4-
// const wsServer = cube.net.createWebSocketServer({
5-
// cert: `-----BEGIN CERTIFICATE-----
6-
// MIIBujCCAWACCQDjKdAMt3mZhDAKBggqhkjOPQQDAjBkMQswCQYDVQQGEwJJVDEQ
7-
// MA4GA1UECAwHUGVydWdpYTEQMA4GA1UEBwwHRm9saWdubzETMBEGA1UECgwKd2Vi
8-
// c29ja2V0czELMAkGA1UECwwCd3MxDzANBgNVBAMMBnNlcnZlcjAgFw0yMTA1MjYx
9-
// OTEwMjlaGA8yMTIxMDUwMjE5MTAyOVowZDELMAkGA1UEBhMCSVQxEDAOBgNVBAgM
10-
// B1BlcnVnaWExEDAOBgNVBAcMB0ZvbGlnbm8xEzARBgNVBAoMCndlYnNvY2tldHMx
11-
// CzAJBgNVBAsMAndzMQ8wDQYDVQQDDAZzZXJ2ZXIwWTATBgcqhkjOPQIBBggqhkjO
12-
// PQMBBwNCAAQKhyRhdSVOecbJU4O5XkB/iGodbnCOqmchs4TXmE3Prv5SrNDhODDv
13-
// rOWTXwR3/HrrdNfOzPdb54amu8POwpohMAoGCCqGSM49BAMCA0gAMEUCIHMRUSPl
14-
// 8FGkDLl8KF1A+SbT2ds3zUOLdYvj30Z2SKSVAiEA84U/R1ly9wf5Rzv93sTHI99o
15-
// KScsr/PHN8rT2pop5pk=
16-
// -----END CERTIFICATE-----`,
17-
// key: `-----BEGIN EC PRIVATE KEY-----
18-
// MHcCAQEEIIjLz7YEWIrsGem2+YV8eJhHhetsjYIrjuqJLbdG7B3zoAoGCCqGSM49
19-
// AwEHoUQDQgAECockYXUlTnnGyVODuV5Af4hqHW5wjqpnIbOE15hNz67+UqzQ4Tgw
20-
// 76zlk18Ed/x663TXzsz3W+eGprvDzsKaIQ==
21-
// -----END EC PRIVATE KEY-----`,
22-
// });
23-
// wsServer.on('connection', (s) => {
24-
// clients.push(s);
25-
// s.on('pong', (v) => {
26-
// console.log(new TextDecoder().decode(v));
27-
// });
28-
// s.on('ping', (v) => {
29-
// console.log(new TextDecoder().decode(v));
30-
// });
31-
// s.on('message', (v) => {
32-
// console.log(new TextDecoder().decode(v));
33-
// });
34-
// });
35-
// wsServer.on('close', () => {
36-
// console.log('server close');
37-
// });
38-
// wsServer.listen(undefined, () => {
39-
// console.log(wsServer, wsServer.address());
40-
// const ws = cube.net.createWebSocket(`wss://localhost:${wsServer.address()!.port}`, undefined, {
41-
// rejectUnauthorized: false,
42-
// });
43-
// ws.on('ping', () => {});
44-
// ws.on('open', () => {
45-
// ws.ping('abc');
46-
// ws.pong('abc');
47-
// ws.send('hello world');
48-
// });
49-
// ws.on('close', () => {
50-
// console.log('ws closed');
51-
// });
52-
//
53-
// ws.connect();
54-
// });
55-
//
56-
// setTimeout(() => {
57-
// clients.forEach((v: any) => {
58-
// v.close();
59-
// });
60-
// wsServer.close();
61-
// }, 1000);
62-
// export {};
63-
// @ts-ignore
64-
// @ts-ignore

0 commit comments

Comments
 (0)