no message

This commit is contained in:
kuaifan 2025-05-06 22:12:38 +08:00
parent cb4b9a361f
commit 82778014b8
6 changed files with 62 additions and 63 deletions

View File

@ -32,7 +32,7 @@
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"dexie": "^3.2.3", "dexie": "^3.2.3",
"echarts": "^5.2.2", "echarts": "^5.2.2",
"element-sea": "^2.15.10-8", "element-sea": "^2.15.10-9",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"inquirer": "^8.2.0", "inquirer": "^8.2.0",

View File

@ -8,12 +8,13 @@
:footer-hide="true" :footer-hide="true"
:transition-names="[$A.isAndroid() ? '' : `drawer-slide-${transitionName}`, '']" :transition-names="[$A.isAndroid() ? '' : `drawer-slide-${transitionName}`, '']"
:beforeClose="beforeClose" :beforeClose="beforeClose"
fullscreen :class-name="className"
:class-name="className"> fullscreen>
<div v-if="isFullscreen" class="overlay-body"> <div v-if="isFullscreen" class="overlay-body">
<slot/> <slot/>
</div> </div>
<DrawerOverlayView v-else <DrawerOverlayView
v-else
:placement="transitionName" :placement="transitionName"
:size="size" :size="size"
:minSize="minSize" :minSize="minSize"
@ -49,6 +50,10 @@ export default {
}, },
default: 'bottom' default: 'bottom'
}, },
forceFullscreen: {
type: Boolean,
default: false
},
size: { size: {
type: [Number, String], type: [Number, String],
default: "100%" default: "100%"
@ -72,7 +77,6 @@ export default {
data() { data() {
return { return {
show: this.value, show: this.value,
isFullscreen: false
} }
}, },
watch: { watch: {
@ -82,11 +86,11 @@ export default {
show(v) { show(v) {
this.value !== v && this.$emit("input", v) this.value !== v && this.$emit("input", v)
}, },
windowWidth(val){
this.isFullscreen = val < 500 && this.placement != 'bottom'
}
}, },
computed: { computed: {
isFullscreen() {
return this.forceFullscreen || (this.windowWidth < 500 && this.placement != 'bottom')
},
transitionName() { transitionName() {
return this.isFullscreen ? 'bottom' : this.placement return this.isFullscreen ? 'bottom' : this.placement
}, },
@ -107,9 +111,6 @@ export default {
return array.join(" "); return array.join(" ");
}, },
}, },
mounted() {
this.isFullscreen = this.windowWidth < 500 && this.placement != 'bottom'
},
methods: { methods: {
onClose() { onClose() {
this.$refs.modal.close(); this.$refs.modal.close();

View File

@ -1,34 +1,24 @@
<template> <template>
<micro-app
v-if="appConfig.displayMode=='page'"
v-show="appConfig.isVisible"
:name="appConfig.appName"
:url="appConfig.appUrl"
:data="appData"
@created="created"
@beforemount="beforemount"
@mounted="mounted"
@unmount="unmount"
@error="error"/>
<DrawerOverlay <DrawerOverlay
v-else-if="appConfig.displayMode=='drawer'"
v-model="appConfig.isVisible"
ref="drawer" ref="drawer"
v-model="appConfig.isOpen"
placement="right" placement="right"
modal-class="micro-apps-modal" modal-class="micro-app-modal"
drawer-class="micro-apps-drawer" drawer-class="micro-app-drawer"
:force-fullscreen="appConfig.forceFullscreen"
:size="1200"> :size="1200">
<div v-if="appConfig.isVisible" class="page-microapp"> <div v-if="appConfig.isOpen" class="micro-app-wrapper">
<micro-app <micro-app
:name="appConfig.appName" :name="appConfig.appName"
:url="appConfig.appUrl" :url="appConfig.appUrl"
:keep-alive="appConfig.keepAlive"
:data="appData" :data="appData"
@created="created" @created="created"
@beforemount="beforemount" @beforemount="beforemount"
@mounted="mounted" @mounted="mounted"
@unmount="unmount" @unmount="unmount"
@error="error"/> @error="error"/>
<div v-if="loadIng > 0" class="microapp-load"> <div v-if="loadIng > 0" class="micro-app-load">
<Loading/> <Loading/>
</div> </div>
</div> </div>
@ -36,17 +26,30 @@
</template> </template>
<style lang="scss"> <style lang="scss">
.micro-apps-modal { .micro-app-modal {
.ivu-modal-close { .ivu-modal-close {
display: none; display: none;
} }
} }
.micro-apps-drawer { .micro-app-drawer {
.overlay-content { .overlay-content {
overflow: hidden; overflow: hidden;
} }
} }
.micro-app-wrapper {
.micro-app-load {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
align-items: center;
display: flex;
justify-content: center;
}
}
</style> </style>
<script> <script>
@ -77,7 +80,6 @@ export default {
mounted() { mounted() {
microApp.start({ microApp.start({
'iframe': true, 'iframe': true,
'keep-alive': true, //
'router-mode': 'state', // state 'router-mode': 'state', // state
}) })
@ -103,7 +105,7 @@ export default {
]), ]),
appData() { appData() {
const {initialData} = this.appConfig; const {initialData, appName} = this.appConfig;
return { return {
instance: { instance: {
@ -123,24 +125,30 @@ export default {
...initialData, ...initialData,
systemInfo: window.systemInfo, systemInfo: window.systemInfo,
baseUrl: $A.mainUrl(),
isEEUIApp: $A.isEEUIApp, isEEUIApp: $A.isEEUIApp,
isElectron: $A.isElectron, isElectron: $A.isElectron,
isMainElectron: $A.isMainElectron, isMainElectron: $A.isMainElectron,
isSubElectron: $A.isSubElectron, isSubElectron: $A.isSubElectron,
themeName: this.themeName,
languages: { languages: {
languageList, languageList,
languageName, languageName,
}, },
themeName: this.themeName,
userInfo: this.userInfo, userInfo: this.userInfo,
userToken: this.userToken, userToken: this.userToken,
}, },
handleClose: () => { handleClose: (destroy = false) => {
this.$refs.drawer?.onClose(); this.$refs.drawer.onClose();
if (destroy) {
setTimeout(_ => {
microApp.unmountApp(appName, {destroy: true})
}, 301)
}
}, },
nextModalIndex: () => { nextModalIndex: () => {
@ -201,17 +209,19 @@ export default {
// //
config = Object.assign({ config = Object.assign({
appName: 'micro-app', // appName: 'micro-app', //
displayMode: 'drawer', // : 'page'-, 'drawer'-
isVisible: true, // (true/false)
appUrl: null, // URL appUrl: null, // URL
initialData: {}, // initialData: {}, //
forceFullscreen: false, // (true/false)
keepAlive: true, // (true/false)
isLoading: true, // (true/false) isLoading: true, // (true/false)
isOpen: false, // (true/false)
}, config); }, config);
// //
const item = appMaps.get(config.appName) const lastApp = appMaps.get(config.appName)
if (item) { if (lastApp) {
if (item.displayMode != config.displayMode || item.appUrl != config.appUrl) { if (lastApp.displayMode != config.displayMode || lastApp.appUrl != config.appUrl) {
microApp.unmountApp(config.appName, {destroy: true}) microApp.unmountApp(config.appName, {destroy: true})
} else { } else {
config.isLoading = false; config.isLoading = false;
@ -220,6 +230,11 @@ export default {
// //
appMaps.set(config.appName, this.appConfig = config); appMaps.set(config.appName, this.appConfig = config);
//
this.$nextTick(_ => {
this.appConfig.isOpen = true
})
} }
} }
} }

View File

@ -4671,28 +4671,20 @@ export default {
// 打开详情页 // 打开详情页
emitter.emit('openMicroApp', { emitter.emit('openMicroApp', {
appName: 'okr-details', appName: 'okr-details',
displayMode: 'page', appUrl: `http://127.0.0.1:5567/apps/okr/`,
isVisible: false, // appUrl: $A.mainUrl('apps/okr/'),
appUrl: $A.mainUrl(`apps/okr/`),
initialData: { initialData: {
empty: true,
type: 'details', type: 'details',
id: value, id: value,
}, },
forceFullscreen: true,
}); });
} else { } else {
// 打开列表、统计 // 打开列表、统计
emitter.emit('openMicroApp', { emitter.emit('openMicroApp', {
appName: `okr-${value}`, appName: `okr-${value}`,
displayMode: 'drawer',
isVisible: true,
appUrl: `http://127.0.0.1:5567/apps/okr/${value}`, appUrl: `http://127.0.0.1:5567/apps/okr/${value}`,
// appUrl: $A.mainUrl(`apps/okr/${value}`), // appUrl: $A.mainUrl(`apps/okr/${value}`),
initialData: {
url: $A.mainUrl()
},
}); });
} }
}, },

View File

@ -8,6 +8,5 @@
@import "page-project"; @import "page-project";
@import "page-setting"; @import "page-setting";
@import "page-approve"; @import "page-approve";
@import "page-microapp";
@import "page-apply"; @import "page-apply";
@import "components/_"; @import "components/_";

View File

@ -1,8 +0,0 @@
.page-microapp {
.microapp-load {
align-items: center;
display: flex;
justify-content: center;
height: 100vh;
}
}