no message

This commit is contained in:
kuaifan 2025-05-26 15:55:42 +08:00
parent d93092de99
commit c178e36f9b

View File

@ -252,38 +252,13 @@ export default {
}) })
}) })
}, },
popoutWindow: async (config) => { popoutWindow: async (windowConfig = null) => {
let appConfig = {}
if (config.url) {
appConfig = {
name: `url-${await $A.getSHA256Hash(config.url)}`,
url: config.url,
}
delete config.url
} else {
const app = this.apps.find(item => item.name == name); const app = this.apps.find(item => item.name == name);
if (!app) { if (!app) {
$A.modalError("应用不存在"); $A.modalError("应用不存在");
return return
} }
appConfig = Object.assign({}, app) await this.inlineBlank(app, windowConfig)
}
appConfig.url_type = 'inline';
appConfig.transparent = true
appConfig.keep_alive = false
const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != appConfig.name);
apps.length > 50 && apps.splice(0, 10)
apps.push(appConfig)
await $A.IDBSet("cacheMicroApps", apps);
await this.$store.dispatch('openChildWindow', {
name: `single-apps-${$A.randomString(6)}`,
path: `/single/apps/${appConfig.name}`,
force: false,
config
});
}, },
openWindow: (params) => { openWindow: (params) => {
if (!$A.isJson(params)) { if (!$A.isJson(params)) {
@ -360,18 +335,21 @@ export default {
/** /**
* 内联链接在新窗口打开 * 内联链接在新窗口打开
* @param config * @param config
* @param windowConfig
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async inlineBlank(config) { async inlineBlank(config, windowConfig = null) {
// const appConfig = {
config.url_type = 'inline'; ...config,
config.transparent = true url_type: 'inline',
config.keep_alive = false transparent: true,
keep_alive: false,
};
// //
const path = `/single/apps/${config.name}` const path = `/single/apps/${appConfig.name}`
const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != config.name); const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != appConfig.name);
apps.length > 50 && apps.splice(0, 10) apps.length > 50 && apps.splice(0, 10)
apps.push(config) apps.push(appConfig)
await $A.IDBSet("cacheMicroApps", apps); await $A.IDBSet("cacheMicroApps", apps);
if (this.$Electron) { if (this.$Electron) {
@ -379,12 +357,12 @@ export default {
name: `single-apps-${$A.randomString(6)}`, name: `single-apps-${$A.randomString(6)}`,
path: path, path: path,
force: false, force: false,
config: { config: Object.assign({
title: ' ', title: ' ',
parent: null, parent: null,
width: Math.min(window.screen.availWidth, 1440), width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900), height: Math.min(window.screen.availHeight, 900),
}, }, $A.isJson(windowConfig) ? windowConfig : {}),
}); });
} else if (this.$isEEUIApp) { } else if (this.$isEEUIApp) {
await this.$store.dispatch('openAppChildPage', { await this.$store.dispatch('openAppChildPage', {
@ -402,14 +380,14 @@ export default {
/** /**
* 外部链接在新窗口打开 * 外部链接在新窗口打开
* @param url * @param config
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async externalWindow({url}) { async externalWindow(config) {
if (this.$Electron) { if (this.$Electron) {
await this.$store.dispatch('openChildWindow', { await this.$store.dispatch('openChildWindow', {
name: `external-apps-${$A.randomString(6)}`, name: `external-apps-${$A.randomString(6)}`,
path: url, path: config.url,
force: false, force: false,
config: { config: {
title: ' ', title: ' ',
@ -423,10 +401,12 @@ export default {
pageType: 'app', pageType: 'app',
pageTitle: ' ', pageTitle: ' ',
url: 'web.js', url: 'web.js',
params: {url}, params: {
url: config.url
},
}); });
} else { } else {
window.open(url) window.open(config.url)
} }
}, },