parent
8c143f35f8
commit
f8c7ddd223
@ -1,3 +1,6 @@
|
||||
NODE_ENV=production
|
||||
VUE_APP_PLATFORM_NAME=JeecgBoot 企业级低代码平台
|
||||
VUE_APP_SSO=false
|
||||
# 开启单点登录
|
||||
VUE_APP_SSO=false
|
||||
# 开启微应用模式
|
||||
VUE_APP_QIANKUN=false
|
||||
|
@ -1,4 +1,7 @@
|
||||
NODE_ENV=development
|
||||
VUE_APP_API_BASE_URL=http://localhost:8080/jeecg-boot
|
||||
VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
|
||||
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
|
||||
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
|
||||
|
||||
# 微应用列表必须VUE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
|
||||
VUE_APP_SUB_jeecg-app-1 = '//localhost:8092'
|
||||
|
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 存放配置常量(当值不为空时会覆盖env配置)
|
||||
*/
|
||||
window._CONFIG = {
|
||||
//接口父路径
|
||||
VUE_APP_API_BASE_URL: '',
|
||||
//单点登录地址
|
||||
VUE_APP_CAS_BASE_URL: '',
|
||||
//文件预览路径
|
||||
VUE_APP_ONLINE_BASE_URL: ''
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
@active-color: #11da75;
|
||||
ul {
|
||||
max-height: 700px;
|
||||
overflow-y: auto;
|
||||
padding-left: .5rem;
|
||||
img {
|
||||
width:64px;
|
||||
height:64px;
|
||||
padding: .2rem;
|
||||
margin: .3rem;
|
||||
cursor: pointer;
|
||||
&.active, &:hover {
|
||||
border: 1px solid @active-color;
|
||||
border-radius: 2px;
|
||||
color: #fff;
|
||||
transition: all .3s;
|
||||
}
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
float: left;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #555;
|
||||
transition: color .3s ease-in-out,background-color .3s ease-in-out;
|
||||
position: relative;
|
||||
margin: 3px 0;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
padding: 10px 0 0;
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
/** init domain config */
|
||||
import Vue from 'vue'
|
||||
//设置全局API_BASE_URL
|
||||
Vue.prototype.API_BASE_URL = process.env.VUE_APP_API_BASE_URL
|
||||
Vue.prototype.API_BASE_URL = window._CONFIG.VUE_APP_API_BASE_URL?window._CONFIG.VUE_APP_API_BASE_URL:process.env.VUE_APP_API_BASE_URL
|
||||
window._CONFIG['domianURL'] = Vue.prototype.API_BASE_URL
|
||||
//单点登录地址
|
||||
window._CONFIG['casPrefixUrl'] = process.env.VUE_APP_CAS_BASE_URL
|
||||
window._CONFIG['onlinePreviewDomainURL'] = process.env.VUE_APP_ONLINE_BASE_URL
|
||||
window._CONFIG['casPrefixUrl'] = window._CONFIG.VUE_APP_CAS_BASE_URL?window._CONFIG.VUE_APP_CAS_BASE_URL:process.env.VUE_APP_CAS_BASE_URL
|
||||
window._CONFIG['onlinePreviewDomainURL'] = window._CONFIG.VUE_APP_ONLINE_BASE_URL?window._CONFIG.VUE_APP_ONLINE_BASE_URL:process.env.VUE_APP_ONLINE_BASE_URL
|
||||
window._CONFIG['staticDomainURL'] = Vue.prototype.API_BASE_URL + '/sys/common/static'
|
||||
window._CONFIG['pdfDomainURL'] = Vue.prototype.API_BASE_URL+ '/sys/common/pdf/pdfPreviewIframe'
|
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* qiankun配置
|
||||
*/
|
||||
import {registerMicroApps, setDefaultMountApp, start, runAfterFirstMounted, addGlobalUncaughtErrorHandler} from 'qiankun';
|
||||
import {apps} from './apps';
|
||||
import {getProps, initGlState} from './state';
|
||||
/**
|
||||
* 重构apps
|
||||
*/
|
||||
function filterApps() {
|
||||
apps.forEach((item) => {
|
||||
//主应用需要传递给微应用的数据。
|
||||
item.props = getProps();
|
||||
//微应用触发的路由规则
|
||||
item.activeRule = genActiveRule('/' + item.activeRule);
|
||||
});
|
||||
return apps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 路由监听
|
||||
* @param {*} routerPrefix 前缀
|
||||
*/
|
||||
function genActiveRule(routerPrefix) {
|
||||
return location => location.pathname.startsWith(routerPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微应用注册
|
||||
*/
|
||||
function registerApps() {
|
||||
const _apps = filterApps();
|
||||
registerMicroApps(_apps,
|
||||
{
|
||||
beforeLoad: [
|
||||
loadApp => {
|
||||
console.log('before load', loadApp);
|
||||
}
|
||||
],
|
||||
beforeMount: [
|
||||
mountApp => {
|
||||
console.log('before mount', mountApp);
|
||||
}
|
||||
],
|
||||
afterMount: [
|
||||
mountApp => {
|
||||
console.log('before mount', mountApp);
|
||||
}
|
||||
],
|
||||
afterUnmount: [
|
||||
unloadApp => {
|
||||
console.log('after unload', unloadApp);
|
||||
}
|
||||
]
|
||||
});
|
||||
// 设置默认子应用,与 genActiveRule中的参数保持一致
|
||||
// setDefaultMountApp();
|
||||
// 第一个微应用 mount 后需要调用的方法,比如开启一些监控或者埋点脚本。
|
||||
runAfterFirstMounted(() => console.log('开启监控'));
|
||||
// 添加全局的未捕获异常处理器。
|
||||
addGlobalUncaughtErrorHandler(event => console.log(event));
|
||||
// 定义全局状态
|
||||
initGlState();
|
||||
//启动qiankun
|
||||
start({});
|
||||
}
|
||||
|
||||
export default registerApps;
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue