mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
no message
This commit is contained in:
parent
897fc51ce3
commit
f42408a363
28
electron/electron.js
vendored
28
electron/electron.js
vendored
@ -24,6 +24,7 @@ let enablePlugins = false;
|
||||
let mainWindow = null,
|
||||
mainTray = null,
|
||||
subWindow = [],
|
||||
storageBrowser = null,
|
||||
isReady = false,
|
||||
willQuitApp = false,
|
||||
devloadUrl = "",
|
||||
@ -491,6 +492,33 @@ ipcMain.on('windowMax', (event) => {
|
||||
event.returnValue = "ok"
|
||||
})
|
||||
|
||||
/**
|
||||
* 创建子窗口存储浏览器
|
||||
* @param args {url}
|
||||
*/
|
||||
ipcMain.on('storageBrowser', (event, args) => {
|
||||
if (utils.isJson(args) && allowedUrls.test(args.url)) {
|
||||
if (storageBrowser === null) {
|
||||
storageBrowser = new BrowserWindow({
|
||||
show: false,
|
||||
frame: false,
|
||||
transparent: true,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'electron-preload.js'),
|
||||
webSecurity: true,
|
||||
nodeIntegration: true,
|
||||
contextIsolation: true,
|
||||
nativeWindowOpen: true
|
||||
},
|
||||
})
|
||||
}
|
||||
storageBrowser.loadURL(args.url).then(_ => {
|
||||
|
||||
})
|
||||
}
|
||||
event.returnValue = "ok"
|
||||
})
|
||||
|
||||
/**
|
||||
* 给主窗口发送信息
|
||||
* @param args {channel, data}
|
||||
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
//
|
||||
window.localStorage.setItem("__system:userId__", this.userId)
|
||||
window.localStorage.setItem("__system:userToken__", this.userToken)
|
||||
$A.storageBySubWeb({
|
||||
$A.storageByBrowser({
|
||||
userId: this.userId,
|
||||
userToken: this.userToken,
|
||||
})
|
||||
|
||||
19
resources/assets/js/functions/web.js
vendored
19
resources/assets/js/functions/web.js
vendored
@ -920,31 +920,32 @@ import {MarkdownPreview} from "../store/markdown";
|
||||
* 通过结果存储同步本地数据
|
||||
* @param json
|
||||
*/
|
||||
storageBySubWeb(json) {
|
||||
storageByBrowser(json) {
|
||||
if ($A.isSoftware) {
|
||||
json = Object.assign({}, this.__storageBySubWeb, json)
|
||||
json = Object.assign({}, this.__storageByBrowser, json)
|
||||
const obj = {}
|
||||
Object.keys(json).sort().map(item => {
|
||||
obj[item] = json[item]
|
||||
})
|
||||
if (JSON.stringify(obj) == JSON.stringify(this.__storageBySubWeb)) {
|
||||
if (JSON.stringify(obj) == JSON.stringify(this.__storageByBrowser)) {
|
||||
return
|
||||
}
|
||||
this.__storageBySubWeb = obj
|
||||
const value = encodeURIComponent(JSON.stringify(this.__storageBySubWeb))
|
||||
this.__storageByBrowser = obj
|
||||
const value = encodeURIComponent(JSON.stringify(this.__storageByBrowser))
|
||||
const url = $A.apiUrl(`../storage/synch?value=${value}`)
|
||||
console.log(url);
|
||||
if ($A.isEEUiApp) {
|
||||
$A.eeuiAppSendMessage({
|
||||
action: 'subWeb',
|
||||
action: 'storageBrowser',
|
||||
url,
|
||||
});
|
||||
} else {
|
||||
$A.loadIframe(url, 15000).catch(_ => {})
|
||||
$A.Electron.sendMessage('storageBrowser', {
|
||||
url
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
__storageBySubWeb: {}
|
||||
__storageByBrowser: {}
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
4
resources/assets/js/store/actions.js
vendored
4
resources/assets/js/store/actions.js
vendored
@ -85,7 +85,7 @@ export default {
|
||||
`language/web/key.js`,
|
||||
`language/web/${languageName}.js`,
|
||||
])
|
||||
$A.storageBySubWeb({languageName})
|
||||
$A.storageByBrowser({languageName})
|
||||
|
||||
resolve(action)
|
||||
})
|
||||
@ -522,7 +522,7 @@ export default {
|
||||
themeName: state.themeName,
|
||||
});
|
||||
}
|
||||
$A.storageBySubWeb({themeConf: state.themeConf})
|
||||
$A.storageByBrowser({themeConf: state.themeConf})
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 771933b49d280bc4ada4c16fd9d36a4aef115634
|
||||
Subproject commit bf09ca1248d05de4af09c96d8d27ee77e553028d
|
||||
Loading…
x
Reference in New Issue
Block a user