feat:多应用配置

This commit is contained in:
weifashi 2023-07-12 14:58:52 +08:00
parent 10d68790e7
commit fead758660
4 changed files with 40 additions and 28 deletions

View File

@ -573,7 +573,6 @@ export default {
{path: 'personal', name: '个人设置', divided: true},
{path: 'approve', name: '审批中心'},
{path: 'okrManage', name: 'OkR管理'},
{path: 'okrAnalyze', name: 'OkR结果分析'},
{path: 'version', name: '更新版本', divided: true, visible: !!this.clientNewVersion},
{path: 'workReport', name: '工作报告', divided: true},
@ -782,8 +781,10 @@ export default {
return;
case 'okrManage':
case 'okrAnalyze':
if (this.menu.findIndex((m) => m.path == path) > -1) {
this.goForward({path: '/manage/microapp/'});
if(path=='okrManage'){
this.goForward({path: '/manage/microapp/' });
}else{
this.goForward({path: '/manage/microapp/#/main' });
}
return;
case 'logout':

View File

@ -713,7 +713,6 @@ export default {
this.quill.on('text-change', _ => {
this.textTimer && clearTimeout(this.textTimer)
this.textTimer = setTimeout(_ => {
console.log(11);
if (this.maxlength > 0 && this.quill.getLength() > this.maxlength) {
this.quill.deleteText(this.maxlength, this.quill.getLength());
}

View File

@ -540,7 +540,7 @@ export default {
props: {
dialogId: {
type: Number,
default: 1
default: 0
},
msgId: {
type: Number,
@ -559,9 +559,6 @@ export default {
data() {
return {
dialogId:1,
msgItem: DialogItem,
msgText: '',
msgNew: 0,

View File

@ -5,13 +5,11 @@
<Loading/>
</div>
</transition>
<!-- <div class="messenger-msg" style="width: 500px;position: relative;height: 100%;">
<DialogWrapper :dialogId="1" is-messenger/>
</div> -->
<micro-app name='micro-app' v-if="microAppUrl && !loading"
:url='microAppUrl'
baseRoute="/"
baseRoute="/main"
inline
destroy
disableSandbox
:data='microAppData'
@created='handleCreate'
@ -26,23 +24,18 @@
<script>
import Vue from 'vue'
import store from '../../store/index'
import {mapState} from "vuex";
import { EventCenterForMicroApp } from '@micro-zoe/micro-app'
import ProjectDialog from "./components/ProjectDialog.vue";
import DialogWrapper from "./components/DialogWrapper.vue";
window.DialogWrapper = DialogWrapper;
// Vue.component('MyComponent', {
// // ...
// })
window.Vue = Vue;
import DialogWrapper from './components/DialogWrapper'
import {languageList, languageType} from "../../language";
export default {
components: { ProjectDialog, DialogWrapper },
data() {
return {
loading: false,
microAppUrl: 'http://localhost:5567/',
microAppData: { }
microAppUrl: 'http://localhost:5567/manage/microapp/#/main',
microAppData: {}
}
},
@ -54,14 +47,24 @@ export default {
'$route': {
handler(to) {
if( to.name == 'manage-microapp' ){
this.loading = false;
window.eventCenterForAppNameVite = new EventCenterForMicroApp("micro-app")
this.loading = true;
this.$nextTick(()=>{
this.loading = false;
window.eventCenterForAppNameVite = new EventCenterForMicroApp("micro-app")
})
}
},
immediate: true,
},
},
computed: {
...mapState([
'userInfo',
'themeMode',
])
},
methods: {
handleCreate(e) {
console.log("子应用创建了",e)
@ -70,9 +73,21 @@ export default {
console.log("子应用即将被渲染",e)
},
handleMount(e) {
console.log("子应用已经渲染完成",e)
this.microAppData = {
msg: '来自基座的数据'
this.microAppData = {
type: 'init',
vues:{
Vue,
store,
components:{
DialogWrapper
}
},
theme: this.themeMode,
languages: {
languageList,
languageType,
},
userInfo: this.userInfo,
}
},
handleUnmount(e) {