feat:更改路由

This commit is contained in:
weifashi 2023-07-24 13:58:06 +08:00
parent 69fd97485d
commit dd7e24850d
4 changed files with 23 additions and 24 deletions

View File

@ -185,12 +185,10 @@ server {
} }
# OKR # OKR
location /manage/microapp/okr/ { location /apps/okr/ {
proxy_pass http://192.168.100.90:5566/; proxy_pass http://192.168.100.88:5566/apps/okr/;
}
location /microapp/okr/api/ {
proxy_pass http://192.168.100.90:5566/microapp/okr/api/;
} }
} }
include /etc/nginx/conf.d/conf.d/*.conf; include /etc/nginx/conf.d/conf.d/*.conf;

View File

@ -781,11 +781,11 @@ export default {
return; return;
case 'okrManage': case 'okrManage':
case 'okrAnalyze': case 'okrAnalyze':
let query = { url: import.meta.env.VITE_OKR_WEB_URL || "/manage/microapp/okr/" } let query = { url: import.meta.env.VITE_OKR_WEB_URL || "/apps/okr/" }
if(path=='okrManage'){ if(path=='okrManage'){
this.goForward({ path: '/manage/microapp/', query }); this.goForward({ path: '/manage/apps/', query });
}else{ }else{
this.goForward({ path: '/manage/microapp/#/analysis', query }); this.goForward({ path: '/manage/apps/#/analysis', query });
} }
return; return;
case 'logout': case 'logout':

View File

@ -5,11 +5,12 @@
<Loading/> <Loading/>
</div> </div>
</transition> </transition>
<micro-app name='micro-app' v-if="microAppUrl && !loading" <micro-app name='micro-app' v-if="appUrl && !loading"
:url='microAppUrl' :url='appUrl'
inline inline
destroy destroy
:data='microAppData' disableSandbox
:data='appData'
@created='handleCreate' @created='handleCreate'
@beforemount='handleBeforeMount' @beforemount='handleBeforeMount'
@mounted='handleMount' @mounted='handleMount'
@ -32,8 +33,8 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
microAppUrl: '', appUrl: '',
microAppData: {} appData: {}
} }
}, },
@ -44,7 +45,7 @@ export default {
watch: { watch: {
'$route': { '$route': {
handler(to) { handler(to) {
if( to.name == 'manage-microapp' ){ if( to.name == 'manage-apps' ){
this.loading = true; this.loading = true;
this.$nextTick(()=>{ this.$nextTick(()=>{
this.loading = false; this.loading = false;
@ -52,7 +53,7 @@ export default {
if( url.indexOf('http') == -1 ){ if( url.indexOf('http') == -1 ){
url = window.location.origin + url url = window.location.origin + url
} }
this.microAppUrl =url this.appUrl = url
window.eventCenterForAppNameVite = new EventCenterForMicroApp("micro-app") window.eventCenterForAppNameVite = new EventCenterForMicroApp("micro-app")
}) })
} }
@ -70,13 +71,13 @@ export default {
methods: { methods: {
handleCreate(e) { handleCreate(e) {
console.log("子应用创建了",e) // console.log("",e)
}, },
handleBeforeMount(e) { handleBeforeMount(e) {
console.log("子应用即将被渲染",e) // console.log("",e)
}, },
handleMount(e) { handleMount(e) {
this.microAppData = { this.appData = {
type: 'init', type: 'init',
vues:{ vues:{
Vue, Vue,
@ -95,13 +96,13 @@ export default {
}, },
handleUnmount(e) { handleUnmount(e) {
this.loading = true; this.loading = true;
console.log("子应用卸载了",e) // console.log("",e)
}, },
handleError(e) { handleError(e) {
console.log("子应用加载出错了",e.detail.error) // console.log("",e.detail.error)
}, },
handleDataChange(e) { handleDataChange(e) {
console.log('来自子应用 child-vite 的数据:', e.detail.data) // console.log(' child-vite :', e.detail.data)
} }
} }
} }

View File

@ -40,9 +40,9 @@ export default [
component: () => import('./pages/manage/approve/details.vue'), component: () => import('./pages/manage/approve/details.vue'),
}, },
{ {
name: 'manage-microapp', name: 'manage-apps',
path: 'microapp/*', path: 'apps/*',
component: () => import('./pages/manage/microapp.vue') component: () => import('./pages/manage/apps.vue')
}, },
{ {
name: 'manage-setting', name: 'manage-setting',