Skip to content

Commit

Permalink
fix 修复崩溃错误
Browse files Browse the repository at this point in the history
  • Loading branch information
liuqi committed Jul 17, 2022
1 parent 330c9d8 commit 3ff7d5e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/inject/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class UploadPreload {
for (let index = 0; index < data.length; index++) {
str += this.createItemTemplate(data[index]);
}
ul.innerHTML = str;
ul.innerHTML += str;
}

// 创建模版
Expand Down
18 changes: 15 additions & 3 deletions src/windows/controller/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class LoginWindow {

// 发送配置到前端
sendLoginType() {
this.loginWindow.webContents.send('login-type', Config.getLoginType());
try {
this.loginWindow.webContents.send('login-type', Config.getLoginType());
} catch (error) {
Logger.def(error);
}
}

// 更换登录类型
Expand Down Expand Up @@ -131,11 +135,19 @@ class LoginWindow {
}

sendUpdateQrCode(data) {
this.loginWindow.webContents.send('update-qr-code', data);
try {
this.loginWindow.webContents.send('update-qr-code', data);
} catch (error) {
Logger.def(err);
}
}

sendUpdateScanState(data) {
this.loginWindow.webContents.send('update-scan-state', data);
try {
this.loginWindow.webContents.send('update-scan-state', data);
} catch (error) {
Logger.def(error);
}
}

async generateQrCode() {
Expand Down
30 changes: 25 additions & 5 deletions src/windows/controller/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,47 @@ class UploaderWindow {

// 发送上传列表到前端
sendReceiveUploadList(data = []) {
this.uploaderWindow.webContents.send('display-upload-list', data);
try {
this.uploaderWindow.webContents.send('display-upload-list', data);
} catch (error) {
Logger.def(error);
}
}

// 发送上传成功消息到前端
sendUploadItemSuccess(data = {}) {
this.uploaderWindow.webContents.send('upload-item-success', data);
try {
this.uploaderWindow.webContents.send('upload-item-success', data);
} catch (error) {
Logger.def(error);
}
}

// 发送签到成功消息到前端
sendSignInSuccess(data) {
this.uploaderWindow.webContents.send('sign-in-success', !!data);
try {
this.uploaderWindow.webContents.send('sign-in-success', !!data);
} catch (error) {
Logger.def(error);
}
}

// 发送刷歌成功消息到前端
sendListenFinished(data) {
this.uploaderWindow.webContents.send('listen-finished', !!data);
try {
this.uploaderWindow.webContents.send('listen-finished', !!data);
} catch (error) {
Logger.def(error);
}
}

// 发送配置到前端
sendConfig() {
this.uploaderWindow.webContents.send('config-info', Config.info());
try {
this.uploaderWindow.webContents.send('config-info', Config.info());
} catch (error) {
Logger.def(error);
}
}

// 监测粘贴事件
Expand Down

0 comments on commit 3ff7d5e

Please sign in to comment.