diff --git a/resources/assets/js/components/MicroApps/index.vue b/resources/assets/js/components/MicroApps/index.vue index 25aca435b..049ff342d 100644 --- a/resources/assets/js/components/MicroApps/index.vue +++ b/resources/assets/js/components/MicroApps/index.vue @@ -288,10 +288,10 @@ export default { this.userSelectOptions.value = params.value delete params.value this.userSelectOptions.config = params - return await new Promise(resolve => { + return await new Promise((resolve, reject) => { this.$refs.userSelect.onSelection((res) => { - return resolve(res) - }) + resolve(res) + }, reject) }) }, nextZIndex: () => { diff --git a/resources/assets/js/components/UserSelect.vue b/resources/assets/js/components/UserSelect.vue index a7a7a32f4..5ee561f34 100755 --- a/resources/assets/js/components/UserSelect.vue +++ b/resources/assets/js/components/UserSelect.vue @@ -328,6 +328,7 @@ export default { values: [], selects: [], callback: null, + closeCallback: null, recents: [], contacts: [], @@ -373,6 +374,7 @@ export default { this.upTitleWidth() } else { this.searchKey = "" + this.closeCallback && this.closeCallback() } this.$emit("on-show-change", v) // @@ -764,13 +766,14 @@ export default { }, this.searchCache.length > 0 ? 300 : 0) }, - onSelection(callback = null) { + onSelection(callback = null, closeCallback = null) { if (this.disabled) { return } this.$nextTick(_ => { this.selects = $A.cloneJSON(this.values) this.callback = typeof callback === 'function' ? callback : null + this.closeCallback = typeof closeCallback === 'function' ? closeCallback : null this.showModal = true }) }, diff --git a/resources/assets/js/store/getters.js b/resources/assets/js/store/getters.js index d866e693a..6bf4720eb 100644 --- a/resources/assets/js/store/getters.js +++ b/resources/assets/js/store/getters.js @@ -287,9 +287,6 @@ export default { */ filterMicroAppsMenus: (state) => { return state.microAppsMenus.filter(item => { - if (item.only_admin === true && !state.userIsAdmin) { - return false - } return item.location === 'application' }) }, @@ -303,9 +300,6 @@ export default { */ filterMicroAppsMenusAdmin: (state) => { return state.microAppsMenus.filter(item => { - if (item.only_admin === true && !state.userIsAdmin) { - return false - } return item.location === 'application/admin' }) }, @@ -319,9 +313,6 @@ export default { */ filterMicroAppsMenusMain: (state) => { return state.microAppsMenus.filter(item => { - if (item.only_admin === true && !state.userIsAdmin) { - return false - } return item.location === 'main/menu' }) } diff --git a/resources/assets/js/store/mutations.js b/resources/assets/js/store/mutations.js index cb5f31a29..c0b0532a7 100644 --- a/resources/assets/js/store/mutations.js +++ b/resources/assets/js/store/mutations.js @@ -337,19 +337,20 @@ export default { 'microApps/data': function(state, data) { // 添加应用商店 - data.unshift({ - id: 'appstore', - version: '1.0.0', - menu_items: [{ - location: "application/admin", - label: $A.L("应用商店"), - icon: $A.mainUrl("images/application/appstore.svg"), - url: 'appstore/internal?language={system_lang}&theme={system_theme}', - only_admin: true, - disable_scope_css: true, - auto_dark_theme: false, - }] - }) + if (state.userIsAdmin) { + data.unshift({ + id: 'appstore', + version: '1.0.0', + menu_items: [{ + location: "application/admin", + label: $A.L("应用商店"), + icon: $A.mainUrl("images/application/appstore.svg"), + url: 'appstore/internal?language={system_lang}&theme={system_theme}', + disable_scope_css: true, + auto_dark_theme: false, + }] + }) + } // 找出已卸载的应用和版本更新的应用 const updatedOrUninstalledApps = state.microAppsInstalled .filter((oldApp) => !data.some((newApp) => newApp.id === oldApp.id))