Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 12, 2024
1 parent 29bc009 commit a06a409
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions resources/assets/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ export default {
return;
}
window.__onBeforeUnload = () => {
this.$store.dispatch("onBeforeUnload");
if (this.$Modal.removeLast()) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/components/TagInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
if (this.max > 0 && this.disSource.length >= this.max) {
this.content = '';
this.tis = '最多只能添加' + this.max + '';
clearInterval(this.tisTimeout);
clearTimeout(this.tisTimeout);
this.tisTimeout = setTimeout(() => { this.tis = ''; }, 2000);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export default {
//
if (this.$isSubElectron) {
window.__onBeforeUnload = () => {
this.$store.dispatch("onBeforeUnload");
if (!this.equalContent) {
$A.modalConfirm({
content: '修改的内容尚未保存,确定要放弃修改吗?',
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/pages/single/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default {
//
if (this.$isSubElectron) {
window.__onBeforeUnload = () => {
this.$store.dispatch("onBeforeUnload");
if (this.$refs.taskDetail.checkUpdate()) {
this.canUpdateBlur = false;
$A.modalConfirm({
Expand Down
17 changes: 16 additions & 1 deletion resources/assets/js/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,17 @@ export default {
})
},

/**
* Electron 页面卸载触发
* @param dispatch
*/
onBeforeUnload({dispatch}) {
if ($A.isSubElectron && $A.isJson(window.__dialogDraft)) {
dispatch("saveDialog", window.__dialogDraft)
window.__dialogDraft = null;
}
},

/** *****************************************************************************************/
/** *************************************** 新窗口打开 ****************************************/
/** *****************************************************************************************/
Expand Down Expand Up @@ -3065,7 +3076,11 @@ export default {
*/
saveDialogDraft({state, dispatch}, data) {
data.extra_draft_content = $A.filterInvalidLine(data.extra_draft_content)
state.dialogDraftTimer[data.id] && clearInterval(state.dialogDraftTimer[data.id])
if ($A.isSubElectron) {
window.__dialogDraft = data
return
}
state.dialogDraftTimer[data.id] && clearTimeout(state.dialogDraftTimer[data.id])
state.dialogDraftTimer[data.id] = setTimeout(_ => {
if (state.dialogId != data.id) {
data.extra_draft_has = data.extra_draft_content ? 1 : 0
Expand Down

0 comments on commit a06a409

Please sign in to comment.