mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
no message
This commit is contained in:
parent
790b05880a
commit
d93092de99
@ -96,7 +96,7 @@ services:
|
|||||||
appstore:
|
appstore:
|
||||||
container_name: "dootask-appstore-${APP_ID}"
|
container_name: "dootask-appstore-${APP_ID}"
|
||||||
privileged: true
|
privileged: true
|
||||||
image: "dootask/appstore:0.0.2"
|
image: "dootask/appstore:0.0.3"
|
||||||
volumes:
|
volumes:
|
||||||
- shared_data:/usr/share/dootask
|
- shared_data:/usr/share/dootask
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|||||||
@ -7,14 +7,14 @@
|
|||||||
:ref="`ref-${app.name}`"
|
:ref="`ref-${app.name}`"
|
||||||
:size="1200"
|
:size="1200"
|
||||||
:transparent="app.transparent"
|
:transparent="app.transparent"
|
||||||
:autoDarkTheme="app.autoDarkTheme"
|
:autoDarkTheme="app.auto_dark_theme"
|
||||||
:beforeClose="async () => { await onBeforeClose(app.name) }">
|
:beforeClose="async () => { await onBeforeClose(app.name) }">
|
||||||
<micro-app
|
<micro-app
|
||||||
v-if="app.isOpen && app.url"
|
v-if="app.isOpen && app.url"
|
||||||
:name="app.name"
|
:name="app.name"
|
||||||
:url="app.url"
|
:url="app.url"
|
||||||
:keep-alive="app.keepAlive"
|
:keep-alive="app.keep_alive"
|
||||||
:disable-scopecss="app.disableScopecss"
|
:disable-scopecss="app.disable_scope_css"
|
||||||
:data="appData(app.name)"
|
:data="appData(app.name)"
|
||||||
@created="created"
|
@created="created"
|
||||||
@beforemount="beforemount"
|
@beforemount="beforemount"
|
||||||
@ -268,8 +268,10 @@ export default {
|
|||||||
}
|
}
|
||||||
appConfig = Object.assign({}, app)
|
appConfig = Object.assign({}, app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appConfig.url_type = 'inline';
|
||||||
appConfig.transparent = true
|
appConfig.transparent = true
|
||||||
appConfig.keepAlive = false
|
appConfig.keep_alive = false
|
||||||
|
|
||||||
const apps = (await $A.IDBArray("cacheMicroApps")).filter(item => item.name != appConfig.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)
|
||||||
@ -329,6 +331,14 @@ export default {
|
|||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
async observeMicroApp(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);
|
const app = this.apps.find(({name}) => name == config.name);
|
||||||
if (app) {
|
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
|
* @param name
|
||||||
|
|||||||
26
resources/assets/js/store/actions.js
vendored
26
resources/assets/js/store/actions.js
vendored
@ -4648,11 +4648,12 @@ export default {
|
|||||||
* @param data
|
* @param data
|
||||||
* - id 应用ID
|
* - id 应用ID
|
||||||
* - url 应用地址
|
* - url 应用地址
|
||||||
* - props 传递参数
|
* - url_type 地址类型
|
||||||
* - transparent 是否透明模式 (true/false),默认 false
|
* - transparent 是否透明模式 (true/false),默认 false
|
||||||
* - autoDarkTheme 是否自动适配深色主题 (true/false),默认 true
|
* - disable_scope_css 是否禁用样式隔离 (true/false),默认 false
|
||||||
* - keepAlive 是否开启微应用保活 (true/false),默认 true
|
* - auto_dark_theme 是否自动适配深色主题 (true/false),默认 true
|
||||||
* - disableScopecss 是否禁用样式隔离 (true/false),默认 false
|
* - keep_alive 是否开启微应用保活 (true/false),默认 true
|
||||||
|
* - props 传递参数
|
||||||
*/
|
*/
|
||||||
async openMicroApp({state}, data) {
|
async openMicroApp({state}, data) {
|
||||||
if (!data || !$A.isJson(data)) {
|
if (!data || !$A.isJson(data)) {
|
||||||
@ -4664,11 +4665,12 @@ export default {
|
|||||||
const config = {
|
const config = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
url: $A.mainUrl(data.url),
|
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,
|
transparent: typeof data.transparent == 'boolean' ? data.transparent : false,
|
||||||
autoDarkTheme: typeof data.autoDarkTheme == 'boolean' ? data.autoDarkTheme : true,
|
disable_scope_css: typeof data.disable_scope_css == 'boolean' ? data.disable_scope_css : false,
|
||||||
keepAlive: typeof data.keepAlive == 'boolean' ? data.keepAlive : true,
|
auto_dark_theme: typeof data.auto_dark_theme == 'boolean' ? data.auto_dark_theme : true,
|
||||||
disableScopecss: typeof data.disableScopecss == 'boolean' ? data.disableScopecss : false
|
keep_alive: typeof data.keep_alive == 'boolean' ? data.keep_alive : true,
|
||||||
|
props: $A.isJson(data.props) ? data.props : {},
|
||||||
}
|
}
|
||||||
if (!config.id) {
|
if (!config.id) {
|
||||||
return
|
return
|
||||||
@ -4678,6 +4680,14 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
config.name = `${config.id}_${await $A.getSHA256Hash(config.url)}`
|
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);
|
emitter.emit('observeMicroApp:open', config);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
21
resources/assets/js/store/getters.js
vendored
21
resources/assets/js/store/getters.js
vendored
@ -286,7 +286,12 @@ export default {
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
filterMicroAppsMenus: (state) => {
|
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}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
filterMicroAppsMenusAdmin: (state) => {
|
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}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
filterMicroAppsMenusMain: (state) => {
|
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'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
resources/assets/js/store/mutations.js
vendored
4
resources/assets/js/store/mutations.js
vendored
@ -308,8 +308,8 @@ export default {
|
|||||||
label: $A.L("应用商店"),
|
label: $A.L("应用商店"),
|
||||||
icon: $A.mainUrl("images/application/appstore.svg"),
|
icon: $A.mainUrl("images/application/appstore.svg"),
|
||||||
url: 'appstore/internal',
|
url: 'appstore/internal',
|
||||||
disableScopecss: true,
|
disable_scope_css: true,
|
||||||
autoDarkTheme: false,
|
auto_dark_theme: false,
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
const ids = [];
|
const ids = [];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user