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

View File

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

View File

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

View File

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