mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-19 16:22:52 +00:00
feat: 添加解析类型的方法,优化微应用配置逻辑
This commit is contained in:
parent
52913abb4f
commit
d94ebfe04c
@ -404,6 +404,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解析 type 字段
|
||||||
|
config.type = this.resolveType(config.type)
|
||||||
|
|
||||||
// 如果是 blank 链接,则在新窗口打开
|
// 如果是 blank 链接,则在新窗口打开
|
||||||
if (/_blank$/i.test(config.type)) {
|
if (/_blank$/i.test(config.type)) {
|
||||||
await this.inlineBlank(config)
|
await this.inlineBlank(config)
|
||||||
@ -769,6 +772,25 @@ export default {
|
|||||||
this.closeMicroApp(app.name, true)
|
this.closeMicroApp(app.name, true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析类型
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
resolveType(type) {
|
||||||
|
if (typeof type === 'string') {
|
||||||
|
return type
|
||||||
|
}
|
||||||
|
if ($A.isJson(type)) {
|
||||||
|
const defaultType = typeof type.default === 'string' ? type.default : 'iframe'
|
||||||
|
const mobileType = typeof type.mobile === 'string'
|
||||||
|
? type.mobile
|
||||||
|
: (typeof type.app === 'string' ? type.app : defaultType)
|
||||||
|
const desktopType = typeof type.desktop === 'string' ? type.desktop : defaultType
|
||||||
|
return $A.platformType() === 'desktop' ? desktopType : mobileType
|
||||||
|
}
|
||||||
|
return 'inline'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
resources/assets/js/store/actions.js
vendored
17
resources/assets/js/store/actions.js
vendored
@ -5095,26 +5095,11 @@ export default {
|
|||||||
})
|
})
|
||||||
.replace(/\{system_base_url}/g, serverLocation.origin)
|
.replace(/\{system_base_url}/g, serverLocation.origin)
|
||||||
|
|
||||||
const resolveType = () => {
|
|
||||||
if (typeof data.type === 'string') {
|
|
||||||
return data.type
|
|
||||||
}
|
|
||||||
if ($A.isJson(data.type)) {
|
|
||||||
const defaultType = typeof data.type.default === 'string' ? data.type.default : 'iframe'
|
|
||||||
const mobileType = typeof data.type.mobile === 'string'
|
|
||||||
? data.type.mobile
|
|
||||||
: (typeof data.type.app === 'string' ? data.type.app : defaultType)
|
|
||||||
const desktopType = typeof data.type.desktop === 'string' ? data.type.desktop : defaultType
|
|
||||||
return $A.platformType() === 'desktop' ? desktopType : mobileType
|
|
||||||
}
|
|
||||||
return 'inline'
|
|
||||||
}
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
url: $A.mainUrl(data.url),
|
url: $A.mainUrl(data.url),
|
||||||
type: resolveType(),
|
type: data.type || data.url_type,
|
||||||
background: data.background || null,
|
background: data.background || null,
|
||||||
capsule: $A.isJson(data.capsule) ? data.capsule : {},
|
capsule: $A.isJson(data.capsule) ? data.capsule : {},
|
||||||
transparent: typeof data.transparent == 'boolean' ? data.transparent : false,
|
transparent: typeof data.transparent == 'boolean' ? data.transparent : false,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user