Commit bc013802 authored by 邓晓峰's avatar 邓晓峰

fix: micro config

parents b5299731 51664ab6
Pipeline #27198 skipped with stages
This diff was suppressed by a .gitattributes entry.
......@@ -3,7 +3,7 @@ const proxy = require('./proxy');
const slash = require('slash2');
const defaultSetting = require('./defaultSetting');
function resolve (dir) {
return join(__dirname, '../', dir)
return join(__dirname, '../', dir)
}
const { REACT_APP_ENV } = process.env;
module.exports = {
......
export function genActiveRule(routerPrefix) {
debugger
return location => location.pathname.startsWith(routerPrefix);
debugger
return location => location.pathname.startsWith(routerPrefix);
}
export default {
dev: [
{
name: 'web4_console',
entry: `//${window.location.hostname}:3020/civweb4`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb4'),
props: {},
},
{
name: 'civ_monitor',
entry: `//${window.location.hostname}:8081/civ_monitor`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civ_monitor'),
},
{
name: 'civweb5',
entry: `//172.16.10.54:3008/civweb5`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb5'),
},
],
prod: [
{
name: 'web4_console',
entry: `//${window.location.host}/civweb4`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb4'),
props: {},
},
],
};
dev: [{
name: 'civ_monitor',
entry: `//${window.location.hostname}:8081/civ_monitor`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civ_monitor'),
},
{
name: 'civweb4',
entry: `//${window.location.hostname}:3020/civweb4`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb4'),
},
],
prod: [{
name: 'web4_console',
entry: `//${window.location.host}/civweb4`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb4'),
props: {},
}, ],
};
\ No newline at end of file
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
<<<<<<< HEAD
const proxyURL = 'http://192.168.10.150:8777';
=======
const proxyURL = 'http://172.16.10.176:8080';
>>>>>>> 51664ab62eb0b419b6ad8715b64ad948c34dc4d5
module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: {
......
......@@ -23089,9 +23089,9 @@
"dev": true
},
"kit_global_config": {
"version": "1.0.24",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.24.tgz",
"integrity": "sha512-W7V7E3odjQeJTORONyNG93V834GOz3vAZxK7Of9/db0AstVtPiBWMKgptqUPibgKa7iFztqqugI9R0H3yrBCTQ==",
"version": "1.0.26",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.26.tgz",
"integrity": "sha512-uLrOcaYyKHM0T2Di9iIkzkgIpGex4tFNy3c34x4WkcLL3QaivVKpqE5OZ0hU8BxOPsLDjCqTXR/CcMLNMcT4Yg==",
"requires": {
"@babel/runtime": "^7.10.5",
"js-base64": "^3.5.2",
......@@ -29125,14 +29125,14 @@
"dev": true
},
"qiankun": {
"version": "2.2.5",
"resolved": "https://g.civnet.cn:4873/qiankun/-/qiankun-2.2.5.tgz",
"integrity": "sha512-tRVMnza2bXMkJsfPFsgLqvd2RHwWe8tMIdoSMf89fYolt1vlSsgzDgwcyquRF8sOhQAY6QCkn+I5C3DAJxOacg==",
"version": "2.4.8",
"resolved": "https://g.civnet.cn:4873/qiankun/-/qiankun-2.4.8.tgz",
"integrity": "sha512-JVznyuB7lPB/6mEvINCbUr79reeJ2SHzA0ziORWjrQz+C0/4E2jtdJN/f49uGY1p3zd6vHNNXFucjpjqpKQUMw==",
"requires": {
"@babel/runtime": "^7.10.5",
"import-html-entry": "^1.9.0",
"lodash": "^4.17.11",
"single-spa": "5.8.1",
"single-spa": "^5.9.2",
"tslib": "^1.10.0"
},
"dependencies": {
......@@ -31972,9 +31972,9 @@
}
},
"single-spa": {
"version": "5.8.1",
"resolved": "https://g.civnet.cn:4873/single-spa/-/single-spa-5.8.1.tgz",
"integrity": "sha1-hsJXXil+MdjwaUWUTsl+MYUaWa4="
"version": "5.9.2",
"resolved": "https://g.civnet.cn:4873/single-spa/-/single-spa-5.9.2.tgz",
"integrity": "sha1-S7mm62yQ4xmLFUnYzesDJBQBsVs="
},
"sisteransi": {
"version": "1.0.5",
......@@ -112,7 +112,7 @@
"immutable": "^4.0.0-rc.12",
"js-base64": "^3.5.2",
"js-cookie": "^2.2.1",
"kit_global_config": "^1.0.24",
"kit_global_config": "^1.0.26",
"kit_logger": "^1.0.2",
"kit_utils": "^1.3.11",
"lodash": "4.17.11",
......@@ -122,7 +122,7 @@
"pinyin-match": "^1.1.1",
"promise.prototype.finally": "^3.1.2",
"prop-types": "15.7.2",
"qiankun": "^2.2.5",
"qiankun": "^2.4.8",
"qrcode.react": "^1.0.0",
"react": "16.12.0",
"react-dom": "16.12.0",
......
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 获取是否启用网关配置 GET /GateWayConfig */
export async function GateWayConfig(options) {
return request('/GateWayConfig', {
method: 'GET',
...(options || {}),
});
}
/** 根据配置项名称查询配置_系统信息数据 GET /SysConfiguration */
export async function SysConfiguration(params, options) {
return request('/SysConfiguration', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 数据库测试连接 GET /DBManager/ConnectionTest */
export async function ConnectionTest(params, options) {
return request('/DBManager/ConnectionTest', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 删除数据库连接 GET /DBManager/DeleteConnection */
export async function DeleteConnection(params, options) {
return request('/DBManager/DeleteConnection', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 修改数据库连接描述信息 GET /DBManager/UpdateConnDesc */
export async function UpdateConnDesc(params, options) {
return request('/DBManager/UpdateConnDesc', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 保存数据库连接 GET /DBManager/SaveConnection */
export async function SaveConnection(params, options) {
return request('/DBManager/SaveConnection', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 获取数据库连接记录 GET /DBManager/GetConnRecord */
export async function GetConnRecord(options) {
return request('/DBManager/GetConnRecord', {
method: 'GET',
...(options || {}),
});
}
/** 获取数据库配置 GET /DBManager/GetDataBaseConfig */
export async function GetDataBaseConfig(options) {
return request('/DBManager/GetDataBaseConfig', {
method: 'GET',
...(options || {}),
});
}
/** 获取数据库列表 GET /DBManager/GetDataBaseList */
export async function GetDataBaseList(params, options) {
return request('/DBManager/GetDataBaseList', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 单文件上传 POST /FileCenter/UploadSingleFile */
export async function UploadSingleFile(body, options) {
const formData = new FormData();
Object.keys(body).forEach(ele => {
const item = body[ele];
if (item !== undefined && item !== null) {
form.append(ele, typeof item === 'object' ? JSON.stringify(item) : item);
}
});
return request('/FileCenter/UploadSingleFile', {
method: 'POST',
data: formData,
...(options || {}),
});
}
/** 获取文件路径 moduleName 可选 CityTemp\icon\androidMenu\menuNew\logo\menu 支持多选用逗号隔开 GET /FileCenter/GetFileUrls */
export async function GetFileUrls(params, options) {
return request('/FileCenter/GetFileUrls', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 保存小程序apk文件 POST /FileCenter/SaveMobileApk */
export async function SaveMobileApk(body, options) {
const formData = new FormData();
Object.keys(body).forEach(ele => {
const item = body[ele];
if (item !== undefined && item !== null) {
form.append(ele, typeof item === 'object' ? JSON.stringify(item) : item);
}
});
return request('/FileCenter/SaveMobileApk', {
method: 'POST',
data: formData,
...(options || {}),
});
}
/** 获取移动应用上传apk信息 GET /FileCenter/GetMobileFiles */
export async function GetMobileFiles(params, options) {
return request('/FileCenter/GetMobileFiles', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 获取服务调用日志明细 POST /LogCenter/GetOMSLog */
export async function GetOMSLog(body, options) {
return request('/LogCenter/GetOMSLog', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 平均耗时排名统计 POST /LogCenter/TopConsumeList */
export async function TopConsumeList(body, options) {
return request('/LogCenter/TopConsumeList', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 调用频次排名统计 POST /LogCenter/TopCountList */
export async function TopCountList(body, options) {
return request('/LogCenter/TopCountList', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 服务访问量统计 按每分/每5分/每小时/每天 POST /LogCenter/TrafficStatistics */
export async function TrafficStatistics(body, options) {
return request('/LogCenter/TrafficStatistics', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 获取运维登录日志 POST /LogCenter/GetLoginLog */
export async function GetLoginLog(body, options) {
return request('/LogCenter/GetLoginLog', {
method: 'POST',
data: body,
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 登录 POST /OMSLogin */
export async function OMSLogin(body, options) {
const formData = new FormData();
Object.keys(body).forEach(ele => {
const item = body[ele];
if (item !== undefined && item !== null) {
form.append(ele, typeof item === 'object' ? JSON.stringify(item) : item);
}
});
return request('/OMSLogin', {
method: 'POST',
data: formData,
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 获取小程序配置,网站配置和菜单树 userMode 必填 super 或 admin 或common GET /PlatformCenter/MiniAppModuleTree */
export async function MiniAppModuleTree(params, options) {
return request('/PlatformCenter/MiniAppModuleTree', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** web配置 userMode 必填 super 或 admin 或common GET /PlatformCenter/WebModuleTree */
export async function WebModuleTree(params, options) {
return request('/PlatformCenter/WebModuleTree', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 获取手持菜单配置 userMode 必填 super 或 admin 或common GET /PlatformCenter/MobileModuleTree */
export async function MobileModuleTree(params, options) {
return request('/PlatformCenter/MobileModuleTree', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 角色管理获取应用类别 GET /PlatformCenter/GetWebConfigTypes */
export async function GetWebConfigTypes(options) {
return request('/PlatformCenter/GetWebConfigTypes', {
method: 'GET',
...(options || {}),
});
}
/** 删除小程序菜单和角色 GET /PlatformCenter/DeleteMiniMenu */
export async function DeleteMiniMenu(params, options) {
return request('/PlatformCenter/DeleteMiniMenu', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 获取网站配置信息 GET /PlatformCenter/GetWebSiteConfig */
export async function GetWebSiteConfig(params, options) {
return request('/PlatformCenter/GetWebSiteConfig', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 获取当前解决方案名称 GET /PlatformCenter/GetSolutionList */
export async function GetSolutionList(options) {
return request('/PlatformCenter/GetSolutionList', {
method: 'GET',
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 根据机构id获取子机构及所有机构下用户 GET /UserCenter/GroupUserList */
export async function GroupUserList(params, options) {
return request('/UserCenter/GroupUserList', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 角色列表按产品分组 GET /UserCenter/RoleGroupList */
export async function RoleGroupList(params, options) {
return request('/UserCenter/RoleGroupList', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 修改用户密码 POST /UserCenter/UpdateUserPassword */
export async function UpdateUserPassword(body, options) {
return request('/UserCenter/UpdateUserPassword', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 批量删除用户 GET /UserCenter/DeleteUsers */
export async function DeleteUsers(params, options) {
return request('/UserCenter/DeleteUsers', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 批量设置设置用户角色关联关系 GET /UserCenter/SetUserRoleMap */
export async function SetUserRoleMap(params, options) {
return request('/UserCenter/SetUserRoleMap', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 用户批量更改机构 GET /UserCenter/ModifyUserRole */
export async function ModifyUserRole(params, options) {
return request('/UserCenter/ModifyUserRole', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 分页获取机构列表及用户信息 POST /UserCenter/GroupUserPagingList */
export async function GroupUserPagingList(body, options) {
return request('/UserCenter/GroupUserPagingList', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 获取所有机构列表 GET /UserCenter/GetAllGroup */
export async function GetAllGroup(options) {
return request('/UserCenter/GetAllGroup', {
method: 'GET',
...(options || {}),
});
}
/** 获取某个机构下所有用户列表 GET /UserCenter/GetStationUserList */
export async function GetStationUserList(params, options) {
return request('/UserCenter/GetStationUserList', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 获取产品列表 POST /UserCenter/ProductList */
export async function ProductList(body, options) {
return request('/UserCenter/ProductList', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 修改单个产品 POST /UserCenter/ModifyProduct */
export async function ModifyProduct(body, options) {
return request('/UserCenter/ModifyProduct', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 删除单个产品 GET /UserCenter/DelProduct */
export async function DelProduct(params, options) {
return request('/UserCenter/DelProduct', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
import { request } from '@wisdom-utils/utils';
/** 根据title获取网站配置 GET /WebSite/GetWebsite */
export async function GetWebsite(params, options) {
return request('/WebSite/GetWebsite', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 添加网站配置 POST /WebSite/AddWebsite */
export async function AddWebsite(body, options) {
return request('/WebSite/AddWebsite', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 修改网站配置 POST /WebSite/EditWebsite */
export async function EditWebsite(body, options) {
return request('/WebSite/EditWebsite', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** 删除网站配置 GET /WebSite/DeleteWebsite */
export async function DeleteWebsite(params, options) {
return request('/WebSite/DeleteWebsite', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 根据client获取网站配置 GET /WebSite/GetConfig */
export async function GetConfig(params, options) {
return request('/WebSite/GetConfig', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as ConfigCenter from './ConfigCenter';
import * as DBManager from './DBManager';
import * as FileCenter from './FileCenter';
import * as LogCenter from './LogCenter';
import * as Login from './Login';
import * as PlatformCenter from './PlatformCenter';
import * as UserCenter from './UserCenter';
import * as WebSite from './WebSite';
export default {
ConfigCenter,
DBManager,
FileCenter,
LogCenter,
Login,
PlatformCenter,
UserCenter,
WebSite,
};
......@@ -638,6 +638,8 @@ const BasicLayout = props => {
}
};
const title = getPageTitle({
title: (props.global && props.global.get('title')) || defaultSetting.title,
});
......@@ -730,6 +732,12 @@ const BasicLayout = props => {
}
};
const handleUpdateCurrentIndex = index => {
debugger
props.updateCurrentIndex(index);
window.share && window.share.event.emit('trigger:updateMenuIndex', index);
}
const renderSiderMenu = (menuItemProps, defaultDom) => {
if (collapse) {
return (
......@@ -850,7 +858,7 @@ const BasicLayout = props => {
const { openKeys } = props;
// const filterMenu = props.menu.filter(item => !item.hideInMenu)
return (
<SecurityLayout loading updateCurrentIndex={props.updateCurrentIndex}>
<SecurityLayout loading updateCurrentIndex={handleUpdateCurrentIndex}>
{collapse && props.global.loginTemplate === '新春 - 智联.html' ? null : (
props.global.loginTemplate === '新春 - 智联.html' && (
<img
......@@ -946,7 +954,7 @@ const BasicLayout = props => {
menuProps={{
forceSubMenuRender: false,
onClick: ({ item, key, keyPath, domEvent }) => {
debugger
domEvent.persist();
const keyField = key.indexOf('/') > -1 ? 'path' : 'key';
const config = findPathByLeafId(
......@@ -961,6 +969,7 @@ const BasicLayout = props => {
props.updateComplexConfig(config);
props.updateComplexPathName(config.routes[0].path);
history.push(config.routes[0].path);
}
props.updateSelectedKeys(key);
props.updatePathname(key);
......@@ -993,7 +1002,7 @@ const BasicLayout = props => {
onClose={extraRender.onClose}
data={props.route.routes || []}
currentMenuIndex={props.currentMenuIndex}
onChange={index => props.updateCurrentIndex(index)}
onChange={index => handleUpdateCurrentIndex(index)}
onSelect={item => handleSelectedKey(item)}
/>
{/*{*/}
......
......@@ -33,25 +33,29 @@ const MICRO_STATUS = {
export const initMicroApps = (loader, store) => {
/* eslint-disable */
debugger
const config = createStoreage.get('globalConfig');
const application = config.products || [];
let products = [];
application && Array.isArray(application) && application.length > 0 && application.map(item => {
products.push({
name: item.PackageName,
entry: item.RouteUrl.replace(
// eslint-disable-next-line no-template-curly-in-string
'localhost:${port}',
window.location.host,
) + (item.PackageName.indexOf('civweb4') > -1 ? `/${item.PackageName}` : `/civbase/${item.PackageName}`),
container: '#micro-container',
activeRule: genActiveRule(`/civbase/${item.PackageName}`),
props: item.DefaultSetting
})
});
// console.log(products);
const entrys =
process.env.NODE_ENV !== 'production'
? micorConfig.dev
: application && Array.isArray(application) && application.length > 0
? application.map(item => {
item.name = item.PackageName;
item.entry = item.RouteUrl.replace(
// eslint-disable-next-line no-template-curly-in-string
'localhost:${port}',
window.location.host,
);
item.container = '#micro-container';
item.activeRule = genActiveRule(`/civbase/${item.PackageName}`);
item.props = JSON.parse(item.DefaultSetting);
return item;
}) || micorConfig.prod
: micorConfig.prod;
: products;
registerMicroApps(
entrys.map(item => {
......@@ -93,9 +97,11 @@ export const initMicroApps = (loader, store) => {
afterUnmount: [app => {}],
},
);
const globalStore = store.getState().toJS();
const { setGlobalState } = initGlobalState({
// eslint-disable-next-line no-undef
globalConfig: createStoreage.get('globalConfig'),
global: globalStore.global
});
setGlobalState({
// eslint-disable-next-line no-undef
......@@ -145,7 +151,9 @@ export const initMicroApps = (loader, store) => {
// eslint-disable-next-line no-use-before-define
defaultApp();
addGlobalUncaughtErrorHandler(event => {
const { error } = event;
console.log(event);
const reson = 'Failed to fetch';
if (
error &&
......@@ -161,6 +169,7 @@ export const defaultApp = () => {
// eslint-disable-next-line no-undef
const config = createStoreage.get('globalConfig');
if (config && config.token) {
debugger
// const startWith = config.homepage ? config.homepage.split('/') : [];
// console.log(findPathByLeafId(config.homepage, '', 'url'))
const basePath =
......@@ -170,7 +179,7 @@ export const defaultApp = () => {
const defaultURL =
config.homepage === ''
? `/${pkg.name.toLocaleLowerCase()}/${basePath}?client=${config.client}`
: `${basePath}/${config.homepage}`;
: `/${pkg.name.toLocaleLowerCase()}/${basePath}/${config.homepage}`;
setDefaultMountApp(defaultURL);
}
};
......@@ -208,7 +217,7 @@ window.app = {
}
},
init: function(namespace, reducers) {
[namespace] = reducers;
}
};
// window.app.define('city-data', require.context('./components/CitySelector', true, /^.\/(CitySelector\/)?[^\/]+\.js$/), 'city-data.js')
......
import React from 'react';
function Comopenents() {
return (
<div>
Comopenents
</div>
);
}
export default Comopenents;
import React from 'react';
function Test() {
return (
<div>
Test
</div>
);
}
export default Test;
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function registerGlobal(root, deps) {
Object.keys(deps).forEach((key) => {
root[key] = deps[key];
});
};
registerGlobal(window, {
// 在这里注册暴露给子工程的全局变量
React,
ReactDOM,
});
export default registerGlobal;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment