mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 12:42:51 +00:00
no message
This commit is contained in:
parent
ca353d747b
commit
2af1dba8dc
@ -309,33 +309,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成微应用名称
|
|
||||||
* @param config
|
|
||||||
* @returns {Promise<string>}
|
|
||||||
*/
|
|
||||||
async generateAppName(config) {
|
|
||||||
let name = config.id || 'micro-app'
|
|
||||||
if (!this.apps.find(item => item.name == name)) {
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
const additional = `${config.url}`
|
|
||||||
.replace(/^https?:\/\//, '')
|
|
||||||
.replace(/[^a-zA-Z0-9]/g, '_')
|
|
||||||
name = `${config.id}_${additional.substring(0, 8)}`
|
|
||||||
if (!this.apps.find(item => item.name == name)) {
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
return `${config.id}_${additional}`
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 观察打开微应用
|
* 观察打开微应用
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
async observeMicroApp(config) {
|
async observeMicroApp(config) {
|
||||||
config.name = await this.generateAppName(config)
|
|
||||||
|
|
||||||
if (config.url_type === 'inline_blank') {
|
if (config.url_type === 'inline_blank') {
|
||||||
await this.inlineBlank(config)
|
await this.inlineBlank(config)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -2627,7 +2627,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$store.dispatch("openMicroApp", {
|
this.$store.dispatch("openMicroApp", {
|
||||||
id: 'okr',
|
id: 'okr',
|
||||||
key: 'details',
|
name: 'okr_details',
|
||||||
url: 'apps/okr/#details',
|
url: 'apps/okr/#details',
|
||||||
props: {type: 'details', id},
|
props: {type: 'details', id},
|
||||||
transparent: true,
|
transparent: true,
|
||||||
|
|||||||
11
resources/assets/js/store/actions.js
vendored
11
resources/assets/js/store/actions.js
vendored
@ -4653,8 +4653,9 @@ export default {
|
|||||||
* 打开微应用
|
* 打开微应用
|
||||||
* @param state
|
* @param state
|
||||||
* @param data
|
* @param data
|
||||||
* - id 应用ID
|
* - id 应用ID(必须)
|
||||||
* - url 应用地址
|
* - name 应用名称(必须)
|
||||||
|
* - url 应用地址(必须)
|
||||||
* - url_type 地址类型
|
* - url_type 地址类型
|
||||||
* - transparent 是否透明模式 (true/false),默认 false
|
* - transparent 是否透明模式 (true/false),默认 false
|
||||||
* - disable_scope_css 是否禁用样式隔离 (true/false),默认 false
|
* - disable_scope_css 是否禁用样式隔离 (true/false),默认 false
|
||||||
@ -4666,11 +4667,12 @@ export default {
|
|||||||
if (!data || !$A.isJson(data)) {
|
if (!data || !$A.isJson(data)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!data.url) {
|
if (!data.id || !data.name || !data.url) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const config = {
|
const config = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
|
name: data.name,
|
||||||
url: $A.mainUrl(data.url),
|
url: $A.mainUrl(data.url),
|
||||||
url_type: data.url_type || 'inline',
|
url_type: data.url_type || 'inline',
|
||||||
transparent: typeof data.transparent == 'boolean' ? data.transparent : false,
|
transparent: typeof data.transparent == 'boolean' ? data.transparent : false,
|
||||||
@ -4679,9 +4681,6 @@ export default {
|
|||||||
keep_alive: typeof data.keep_alive == 'boolean' ? data.keep_alive : true,
|
keep_alive: typeof data.keep_alive == 'boolean' ? data.keep_alive : true,
|
||||||
props: $A.isJson(data.props) ? data.props : {},
|
props: $A.isJson(data.props) ? data.props : {},
|
||||||
}
|
}
|
||||||
if (!config.id) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!state.microAppsIds.includes(config.id)) {
|
if (!state.microAppsIds.includes(config.id)) {
|
||||||
$A.modalWarning(`应用「${config.id}」未安装`);
|
$A.modalWarning(`应用「${config.id}」未安装`);
|
||||||
return;
|
return;
|
||||||
|
|||||||
10
resources/assets/js/store/mutations.js
vendored
10
resources/assets/js/store/mutations.js
vendored
@ -320,6 +320,16 @@ export default {
|
|||||||
menus.push(...item.menu_items.map(m => Object.assign(m, {id: item.id})));
|
menus.push(...item.menu_items.map(m => Object.assign(m, {id: item.id})));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
menus.forEach(item => {
|
||||||
|
let name = item.id
|
||||||
|
if (menus.filter(m => m.id === item.id).length > 1) {
|
||||||
|
name += "_" + `${item.url}`.replace(/^https?:\/\/.*?\//, '').replace(/[^a-zA-Z0-9]/g, '_');
|
||||||
|
}
|
||||||
|
if (menus.find(m => m.name === name)) {
|
||||||
|
name += "_" + $A.randomString(8)
|
||||||
|
}
|
||||||
|
item.name = name;
|
||||||
|
})
|
||||||
$A.IDBSave("microAppsIds", state.microAppsIds = ids);
|
$A.IDBSave("microAppsIds", state.microAppsIds = ids);
|
||||||
$A.IDBSave("microAppsMenus", state.microAppsMenus = menus);
|
$A.IDBSave("microAppsMenus", state.microAppsMenus = menus);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user