no message

This commit is contained in:
kuaifan 2025-05-26 15:45:37 +08:00
parent 790b05880a
commit d93092de99
5 changed files with 126 additions and 18 deletions

View File

@ -96,7 +96,7 @@ services:
appstore:
container_name: "dootask-appstore-${APP_ID}"
privileged: true
image: "dootask/appstore:0.0.2"
image: "dootask/appstore:0.0.3"
volumes:
- shared_data:/usr/share/dootask
- /var/run/docker.sock:/var/run/docker.sock

View File

@ -7,14 +7,14 @@
:ref="`ref-${app.name}`"
:size="1200"
:transparent="app.transparent"
:autoDarkTheme="app.autoDarkTheme"
:autoDarkTheme="app.auto_dark_theme"
:beforeClose="async () => { await onBeforeClose(app.name) }">
<micro-app
v-if="app.isOpen && app.url"
:name="app.name"
:url="app.url"
:keep-alive="app.keepAlive"
:disable-scopecss="app.disableScopecss"
:keep-alive="app.keep_alive"
:disable-scopecss="app.disable_scope_css"
:data="appData(app.name)"
@created="created"
@beforemount="beforemount"
@ -268,8 +268,10 @@ export default {
}
appConfig = Object.assign({}, app)
}
appConfig.url_type = 'inline';
appConfig.transparent = true
appConfig.keepAlive = false
appConfig.keep_alive = false
const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != appConfig.name);
apps.length > 50 && apps.splice(0, 10)
@ -329,6 +331,14 @@ export default {
* @param config
*/
async observeMicroApp(config) {
if (config.url_type === 'inline_blank') {
await this.inlineBlank(config)
return
}
if (config.url_type === 'external') {
await this.externalWindow(config)
return
}
const app = this.apps.find(({name}) => name == config.name);
if (app) {
//
@ -347,6 +357,79 @@ export default {
}
},
/**
* 内联链接在新窗口打开
* @param config
* @returns {Promise<void>}
*/
async inlineBlank(config) {
//
config.url_type = 'inline';
config.transparent = true
config.keep_alive = false
//
const path = `/single/apps/${config.name}`
const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != config.name);
apps.length > 50 && apps.splice(0, 10)
apps.push(config)
await $A.IDBSet("cacheMicroApps", apps);
if (this.$Electron) {
await this.$store.dispatch('openChildWindow', {
name: `single-apps-${$A.randomString(6)}`,
path: path,
force: false,
config: {
title: ' ',
parent: null,
width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900),
},
});
} else if (this.$isEEUIApp) {
await this.$store.dispatch('openAppChildPage', {
pageType: 'app',
pageTitle: ' ',
url: 'web.js',
params: {
url: $A.urlReplaceHash(path)
},
})
} else {
window.open($A.mainUrl(path.substring(1)))
}
},
/**
* 外部链接在新窗口打开
* @param url
* @returns {Promise<void>}
*/
async externalWindow({url}) {
if (this.$Electron) {
await this.$store.dispatch('openChildWindow', {
name: `external-apps-${$A.randomString(6)}`,
path: url,
force: false,
config: {
title: ' ',
parent: null,
width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900),
},
});
} else if (this.$isEEUIApp) {
await this.$store.dispatch('openAppChildPage', {
pageType: 'app',
pageTitle: ' ',
url: 'web.js',
params: {url},
});
} else {
window.open(url)
}
},
/**
* 通过名称关闭微应用
* @param name

View File

@ -4648,11 +4648,12 @@ export default {
* @param data
* - id 应用ID
* - url 应用地址
* - props 传递参数
* - url_type 地址类型
* - transparent 是否透明模式 (true/false)默认 false
* - autoDarkTheme 是否自动适配深色主题 (true/false)默认 true
* - keepAlive 是否开启微应用保活 (true/false)默认 true
* - disableScopecss 是否禁用样式隔离 (true/false)默认 false
* - disable_scope_css 是否禁用样式隔离 (true/false)默认 false
* - auto_dark_theme 是否自动适配深色主题 (true/false)默认 true
* - keep_alive 是否开启微应用保活 (true/false)默认 true
* - props 传递参数
*/
async openMicroApp({state}, data) {
if (!data || !$A.isJson(data)) {
@ -4664,11 +4665,12 @@ export default {
const config = {
id: data.id,
url: $A.mainUrl(data.url),
props: $A.isJson(data.props) ? data.props : {},
url_type: data.url_type || 'inline',
transparent: typeof data.transparent == 'boolean' ? data.transparent : false,
autoDarkTheme: typeof data.autoDarkTheme == 'boolean' ? data.autoDarkTheme : true,
keepAlive: typeof data.keepAlive == 'boolean' ? data.keepAlive : true,
disableScopecss: typeof data.disableScopecss == 'boolean' ? data.disableScopecss : false
disable_scope_css: typeof data.disable_scope_css == 'boolean' ? data.disable_scope_css : false,
auto_dark_theme: typeof data.auto_dark_theme == 'boolean' ? data.auto_dark_theme : true,
keep_alive: typeof data.keep_alive == 'boolean' ? data.keep_alive : true,
props: $A.isJson(data.props) ? data.props : {},
}
if (!config.id) {
return
@ -4678,6 +4680,14 @@ export default {
return;
}
config.name = `${config.id}_${await $A.getSHA256Hash(config.url)}`
config.url = config.url.replace(/\{user_id}/g, state.userId)
.replace(/\{user_nickname}/g, encodeURIComponent(state.userInfo.nickname))
.replace(/\{user_email}/g, encodeURIComponent(state.userInfo.email))
.replace(/\{user_avatar}/g, encodeURIComponent(state.userInfo.userimg))
.replace(/\{user_token}/g, encodeURIComponent(state.userToken))
.replace(/\{system_theme}/g, state.systemConfig.themeName)
.replace(/\{system_lang}/g, languageName)
.replace(/\{system_base_url}/g, $A.mainUrl('').replace(/\/$/, ''));
emitter.emit('observeMicroApp:open', config);
},

View File

@ -286,7 +286,12 @@ export default {
* @returns {Array}
*/
filterMicroAppsMenus: (state) => {
return state.microAppsMenus.filter(item => item.location === 'application')
return state.microAppsMenus.filter(item => {
if (item.only_admin === true && !state.userIsAdmin) {
return false
}
return item.location === 'application'
})
},
/**
@ -297,7 +302,12 @@ export default {
* @returns {Array}
*/
filterMicroAppsMenusAdmin: (state) => {
return state.microAppsMenus.filter(item => item.location === 'application/admin')
return state.microAppsMenus.filter(item => {
if (item.only_admin === true && !state.userIsAdmin) {
return false
}
return item.location === 'application/admin'
})
},
/**
@ -308,6 +318,11 @@ export default {
* @returns {Array}
*/
filterMicroAppsMenusMain: (state) => {
return state.microAppsMenus.filter(item => item.location === 'main/menu')
return state.microAppsMenus.filter(item => {
if (item.only_admin === true && !state.userIsAdmin) {
return false
}
return item.location === 'main/menu'
})
}
}

View File

@ -308,8 +308,8 @@ export default {
label: $A.L("应用商店"),
icon: $A.mainUrl("images/application/appstore.svg"),
url: 'appstore/internal',
disableScopecss: true,
autoDarkTheme: false,
disable_scope_css: true,
auto_dark_theme: false,
}]
})
const ids = [];