Commit 6978b1fa authored by 邓晓峰's avatar 邓晓峰

fix: basicLayout bug

parents bd100559 ab27a766
export default {
mode: 'site',
title: '运维管理中台系统',
title: '集中式基座',
dynamicImport: {},
manifest: {},
hash: true,
......
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default = {
navTheme: 'dark',
layout: 'side',
contentWidth: 'Fluid',
fixedHeader: false,
fixSiderbar: false,
menu: {
locale: true
},
headerHeight: 48,
title: '熊猫智慧城市监控管理解决方案',
iconfontUrl: '',
primaryColor: '#1890ff'
};
exports["default"] = _default;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
function genActiveRule(routerPrefix) {
return function (location) {
return location.pathname.startsWith(routerPrefix);
};
}
var _default = {
dev: [{
name: 'web4_console',
entry: "//".concat(window.location.hostname, ":3020/civweb4"),
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb4'),
props: {}
}, {
name: 'civweb5',
entry: "//".concat(window.location.hostname, ":3008/civbase/civweb5"),
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb5')
}],
prod: [{
name: 'web4_console',
entry: "//".concat(window.location.host, "/civweb4"),
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb4'),
props: {}
}, {
name: 'civweb5',
entry: "//".concat(window.location.host, "/civweb5"),
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb5')
}]
};
exports["default"] = _default;
\ No newline at end of file
......@@ -4,8 +4,10 @@ module.exports = {
dev: {
'/CityInterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
target: 'https://panda-water.com',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
......@@ -18,9 +20,10 @@ module.exports = {
}
},
'/cityinterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
......@@ -35,8 +38,10 @@ module.exports = {
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
target: 'https://panda-water.com',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*'
......
......@@ -10,12 +10,12 @@ export default {
activeRule: genActiveRule('/civbase/civweb4'),
props: {},
},
{
name: 'civweb5',
entry: `//${window.location.hostname}:3008/civbase/civweb5`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb5'),
},
// {
// name: 'civweb5',
// entry: `//${window.location.hostname}:3008/civbase/civweb5`,
// container: '#micro-container',
// activeRule: genActiveRule('/civbase/civweb5'),
// },
],
prod: [
{
......@@ -25,11 +25,11 @@ export default {
activeRule: genActiveRule('/civbase/civweb4'),
props: {},
},
{
name: 'civweb5',
entry: `//${window.location.host}/civweb5`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civweb5'),
},
// {
// name: 'civweb5',
// entry: `//${window.location.host}/civweb5`,
// container: '#micro-container',
// activeRule: genActiveRule('/civbase/civweb5'),
// },
],
};
......@@ -2,8 +2,11 @@ module.exports = {
dev: {
'/CityInterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
target: 'https://panda-water.com',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
......@@ -16,9 +19,10 @@ module.exports = {
},
},
'/cityinterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
......@@ -33,8 +37,10 @@ module.exports = {
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
target: 'https://panda-water.com',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
......
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var getNotices = function getNotices(req, res) {
res.json([{
id: '000000001',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '你收到了 14 份新周报',
datetime: '2017-08-09',
type: 'notification'
}, {
id: '000000002',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
title: '你推荐的 曲妮妮 已通过第三轮面试',
datetime: '2017-08-08',
type: 'notification'
}, {
id: '000000003',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
title: '这种模板可以区分多种通知类型',
datetime: '2017-08-07',
read: true,
type: 'notification'
}, {
id: '000000004',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
title: '左侧图标用于区分不同的类型',
datetime: '2017-08-07',
type: 'notification'
}, {
id: '000000005',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '内容不要超过两行字,超出时自动截断',
datetime: '2017-08-07',
type: 'notification'
}, {
id: '000000006',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '曲丽丽 评论了你',
description: '描述信息描述信息描述信息',
datetime: '2017-08-07',
type: 'message',
clickClose: true
}, {
id: '000000007',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '朱偏右 回复了你',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: 'message',
clickClose: true
}, {
id: '000000008',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '标题',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: 'message',
clickClose: true
}, {
id: '000000009',
title: '任务名称',
description: '任务需要在 2017-01-12 20:00 前启动',
extra: '未开始',
status: 'todo',
type: 'event'
}, {
id: '000000010',
title: '第三方紧急代码变更',
description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '马上到期',
status: 'urgent',
type: 'event'
}, {
id: '000000011',
title: '信息安全考试',
description: '指派竹尔于 2017-01-09 前完成更新并发布',
extra: '已耗时 8 天',
status: 'doing',
type: 'event'
}, {
id: '000000012',
title: 'ABCD 版本发布',
description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '进行中',
status: 'processing',
type: 'event'
}]);
};
var _default = {
'GET /api/notices': getNotices
};
exports["default"] = _default;
\ No newline at end of file
This diff is collapsed.
......@@ -97,7 +97,8 @@
"ip": "1.1.5",
"js-base64": "^3.5.2",
"js-cookie": "^2.2.1",
"kit_global_config": "^1.0.7",
"kit_global_config": "^1.0.9",
"kit_logger": "^1.0.1",
"kit_utils": "^1.3.6",
"lodash": "4.17.11",
"minimist": "1.2.0",
......@@ -123,9 +124,10 @@
},
"devDependencies": {
"@ant-design/icons": "^4.0.0",
"@ant-design/pro-layout": "^6.5.16",
"@ant-design/pro-layout": "^6.6.1",
"@ant-design/pro-skeleton": "^1.0.0-beta.2",
"@ant-design/pro-table": "^2.5.3",
"@ant-design/pro-utils": "^1.4.0",
"@babel/cli": "7.4.3",
"@babel/core": "7.4.3",
"@babel/plugin-proposal-class-properties": "7.4.0",
......@@ -140,7 +142,7 @@
"@commitlint/config-conventional": "^9.1.2",
"@umijs/hooks": "^1.9.3",
"add-asset-html-webpack-plugin": "3.1.3",
"antd": "^4.8.6",
"antd": "^4.9.1",
"axios": "^0.19.2",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
......@@ -162,7 +164,7 @@
"copy-webpack-plugin": "^5.0.4",
"core-js": "^3.6.5",
"coveralls": "3.0.3",
"cross-env": "^5.2.0",
"cross-env": "^5.2.1",
"css-loader": "^4.2.1",
"cz-customizable": "^6.3.0",
"dumi": "^1.0.13",
......
"use strict";
/* eslint consistent-return:0 import/order:0 */
var express = require('express');
var logger = require('./logger');
var argv = require('./argv');
var port = require('./port');
var setup = require('./middlewares/frontendMiddleware');
var isDev = process.env.NODE_ENV !== 'production';
var pkg = require('../package.json');
var ngrok = isDev && process.env.ENABLE_TUNNEL || argv.tunnel ? require('ngrok') : false;
var _require = require('path'),
resolve = _require.resolve;
var app = express();
setup(app, {
outputPath: resolve(process.cwd(), pkg.name.toLocaleLowerCase()),
publicPath: "/".concat(pkg.name.toLocaleLowerCase())
});
var customHost = argv.host || process.env.HOST;
var host = customHost || null;
var prettyHost = customHost || 'localhost'; // use the gzipped bundle
app.get('*.js', function (req, res, next) {
req.url = req.url + '.gz'; // eslint-disable-line
res.set('Content-Encoding', 'gzip');
next();
}); // Start your app.
app.listen(port, host, function _callee(err) {
var url;
return regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!err) {
_context.next = 2;
break;
}
return _context.abrupt("return", logger.error(err.message));
case 2:
if (!ngrok) {
_context.next = 15;
break;
}
_context.prev = 3;
_context.next = 6;
return regeneratorRuntime.awrap(ngrok.connect(port));
case 6:
url = _context.sent;
_context.next = 12;
break;
case 9:
_context.prev = 9;
_context.t0 = _context["catch"](3);
return _context.abrupt("return", logger.error(_context.t0));
case 12:
logger.appStarted(port, prettyHost, url);
_context.next = 16;
break;
case 15:
logger.appStarted(port, prettyHost);
case 16:
case "end":
return _context.stop();
}
}
}, null, null, [[3, 9]]);
});
\ No newline at end of file
"use strict";
/* eslint-disable no-console */
var chalk = require('chalk');
var ip = require('ip');
var pkg = require('../package.json');
var divider = chalk.gray('\n-----------------------------------');
/**
* Logger middleware, you can customize it to make messages more personal
*/
var logger = {
// Called whenever there's an error on the server we want to print
error: function error(err) {
console.error(chalk.red(err));
},
// Called when express.js app starts on given port w/o errors
appStarted: function appStarted(port, host, tunnelStarted) {
console.log("Server started ! ".concat(chalk.green('✓'))); // If the tunnel started, log that and the URL it's available at
if (tunnelStarted) {
console.log("Tunnel initialised ".concat(chalk.green('✓')));
}
console.log("\n".concat(chalk.bold('Access URLs:')).concat(divider, "\nLocalhost: ").concat(chalk.magenta("http://".concat(host, ":").concat(port, "/").concat(pkg.name.toLocaleLowerCase())), "\n LAN: ").concat(chalk.magenta("http://".concat(ip.address(), ":").concat(port, "/").concat(pkg.name.toLocaleLowerCase())) + (tunnelStarted ? "\n Proxy: ".concat(chalk.magenta(tunnelStarted)) : '')).concat(divider, "\n").concat(chalk.blue("Press ".concat(chalk.italic('CTRL-C'), " to stop")), "\n "));
}
};
module.exports = logger;
\ No newline at end of file
"use strict";
var argv = require('./argv');
module.exports = parseInt(argv.port || process.env.PORT || '3005', 10);
\ No newline at end of file
......@@ -16,6 +16,7 @@ export const API = {
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE: 'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
CHANGE_PASSWORD: 'cityinterface/rest/services.svc/changepassword',
IOT_CHANGE_PASSWORD: 'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK',
FILE_DOWNLOAD: '"/cityinterface/rest/services/filedownload.svc/download'
};
export default vm => {
......@@ -57,5 +58,5 @@ export default vm => {
vm.sendMessVerificationCode = (data = {}, config ={}) => vm.get(API.SEND_MESSAGE_CODE, data, config).then(res => Promise.resolve(res));
vm.changePassword = (data = {}, config = {}) => vm.get(API.CHANGE_PASSWORD, data, config).then(res => Promise.resolve(res));
vm.changePassword = (data = {}, config = {}) => vm.get(window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' ? API.IOT_CHANGE_PASSWORD: API.CHANGE_PASSWORD, data, config).then(res => Promise.resolve(res));
};
......@@ -22,6 +22,7 @@ var API = {
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE: 'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
CHANGE_PASSWORD: 'cityinterface/rest/services.svc/changepassword',
IOT_CHANGE_PASSWORD: 'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK',
FILE_DOWNLOAD: '"/cityinterface/rest/services/filedownload.svc/download'
};
exports.API = API;
......@@ -125,7 +126,7 @@ var _default = function _default(vm) {
vm.changePassword = function () {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return vm.get(API.CHANGE_PASSWORD, data, config).then(function (res) {
return vm.get(window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' ? API.IOT_CHANGE_PASSWORD : API.CHANGE_PASSWORD, data, config).then(function (res) {
return Promise.resolve(res);
});
};
......
......@@ -51,6 +51,7 @@ const initLocale = () => {
};
const initGlobalConfig = () => {
let authValidate = false;
const config = createStoreage.get('globalConfig') || {};
if (config.title == null) {
createStoreage.remove(namespace);
......@@ -80,15 +81,25 @@ const initGlobalConfig = () => {
}
if (config.token) {
initMicroApps();
initMicroApps(loader);
}
};
window.share &&
window.share.event &&
window.share.event && (
window.share.event.on('triggerMicro', () => {
initMicroApps(loader);
});
})
)
// window.share.event.on('listenerRemoveSigleTab', (url) => {
// console.log(url);
// window.location.href = url
// window.share.event.removeAllListeners('listenerRemoveSigleTab')
// });
//listenerRemoveTab
initGlobalConfig();
initLocale();
......@@ -8,6 +8,8 @@ const Authorized = ({
children,
authority,
flatMenu,
updateAuthValidate,
global,
noMatch = (
<Result
status="403"
......@@ -16,9 +18,15 @@ const Authorized = ({
/>
),
}) => {
debugger
const childrenRender = typeof children === 'undefined' ? null : children;
const dom = useMemo( () => check(authority, flatMenu, childrenRender, noMatch), []);
return <>{dom}</>;
const auth = useMemo( () => check(authority, flatMenu, childrenRender, noMatch), []);
// 目前写死
// const basePath = 'civweb4';
updateAuthValidate && updateAuthValidate(auth.validate);
return <>{auth.target}</>;
};
export default Authorized;
\ No newline at end of file
......@@ -18,9 +18,7 @@ const AuthorizedRoute = ({
authority={authority}
noMatch={<Route {...rest} render={() => <Redirect to={{ pathname: redirectPath }} />} />}
>
<Route
{...rest}
render={(props) => (Component ? <Component {...props} /> : render(props))}
<Route {...rest} render={(props) => (Component ? <Component {...props} /> : render(props))}
/>
</Authorized>
);
......
......@@ -9,10 +9,11 @@ const checkPermissions = (
) => {
const filterPath = [
{ name: '/', path: '/' },
{ name: 'civbase', path:`/civbase/?client=${window.globalConfig.client}` },
{ name: '/', path: `/?client=${window.globalConfig.client || 'city'}` },
{ name: 'civbase', path:`/civbase/?client=${window.globalConfig.client || 'city'}` },
{ name: 'industry', path: '/industry' },
{ name: 'civweb4', path: `/civweb4/` },
{ name: 'civweb4', path: `/civweb4/?client=${window.globalConfig.client}` },
{ name: 'civweb4', path: `/civweb4/?client=${window.globalConfig.client || 'city'}` },
{ name: '404', path: '/404' },
{ name: '403', path: '/403' },
{ name: '500', path: '/500' },
......@@ -21,16 +22,27 @@ const checkPermissions = (
if (!authority) {
return target;
}
if (Array.isArray(flatMenu)) {
debugger
const data = flatMenu.concat(filterPath);
const findIndex = data.findIndex(item => item.path === authority);
if(/web_console/.test(authority.path)) {
return {
target: target,
validate: true
}
}
const findIndex = data.findIndex(item => item.path === authority.path);
if (findIndex > -1) {
return target;
return {
target: target,
validate: true
};
}
return Exception;
return {
target: Exception,
validate: false
};
}
throw new Error('unsupported parameters');
};
......
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var AuthorizedRoute = function AuthorizedRoute(_ref) {
var component = _ref.component,
render = _ref.render,
authority = _ref.authority,
redirectPath = _ref.redirectPath,
rest = _objectWithoutProperties(_ref, ["component", "render", "authority", "redirectPath"]);
};
var _default = AuthorizedRoute;
exports["default"] = _default;
\ No newline at end of file
......@@ -11,9 +11,12 @@ var checkPermissions = function checkPermissions(authority, flatMenu, currentAut
var filterPath = [{
name: '/',
path: '/'
}, {
name: '/',
path: "/?client=".concat(window.globalConfig.client || 'city')
}, {
name: 'civbase',
path: "/civbase/?client=".concat(window.globalConfig.client)
path: "/civbase/?client=".concat(window.globalConfig.client || 'city')
}, {
name: 'industry',
path: '/industry'
......@@ -22,7 +25,7 @@ var checkPermissions = function checkPermissions(authority, flatMenu, currentAut
path: "/civweb4/"
}, {
name: 'civweb4',
path: "/civweb4/?client=".concat(window.globalConfig.client)
path: "/civweb4/?client=".concat(window.globalConfig.client || 'city')
}, {
name: '404',
path: '/404'
......@@ -39,17 +42,30 @@ var checkPermissions = function checkPermissions(authority, flatMenu, currentAut
}
if (Array.isArray(flatMenu)) {
debugger;
var data = flatMenu.concat(filterPath);
if (/web_console/.test(authority.path)) {
return {
target: target,
validate: true
};
}
var findIndex = data.findIndex(function (item) {
return item.path === authority;
return item.path === authority.path;
});
if (findIndex > -1) {
return target;
return {
target: target,
validate: true
};
}
return Exception;
return {
target: Exception,
validate: false
};
}
throw new Error('unsupported parameters');
......
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _Authorized = _interopRequireDefault(require("./Authorized"));
var _CheckPermissions = _interopRequireDefault(require("./CheckPermissions"));
var _renderAuthorize = _interopRequireDefault(require("./renderAuthorize"));
var _Secured = _interopRequireDefault(require("./Secured"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
_Authorized["default"].Secured = _Secured["default"];
_Authorized["default"].check = _CheckPermissions["default"];
var RenderAuthorize = (0, _renderAuthorize["default"])(_Authorized["default"]);
var _default = RenderAuthorize;
exports["default"] = _default;
\ No newline at end of file
......@@ -21,6 +21,9 @@ const formItemLayout = {
sm: { span: 4 },
}
};
const getIOT = () => {
return window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html'
}
class AvatarDropdown extends React.Component {
/* eslint-disable no-unused-vars */
loginout = event => {
......@@ -72,11 +75,15 @@ class AvatarDropdown extends React.Component {
handleOk = (event, form) => {
event.stopPropagation()
form.validateFields().then(res => {
Http.changePassword({
const params = getIOT() ? {
newPassword: res.newPwd,
phone: window.globalConfig.userInfo.Phone
}: {
password: res.oldPwd,
newpassword: res.newPwd,
token: window.globalConfig.token
}).then(res => {
}
Http.changePassword(params).then(res => {
if(res.success) {
message.success("修改密码成功");
setTimeout(() => {
......@@ -214,6 +221,8 @@ class AvatarDropdown extends React.Component {
onOk={(event) => this.handleOk(event, this.form)}
onCancel={(event) => this.handleCancel(event, this.form)} zIndex={2000}>
<Form labelAlign="right" {...formItemLayout} ref={f => this.form = f}>
{
!getIOT() && (
<Form.Item
name="oldPwd"
label="原密码"
......@@ -226,6 +235,8 @@ class AvatarDropdown extends React.Component {
hasFeedback>
<Input.Password />
</Form.Item>
)
}
<Form.Item
name="newPwd"
label="新密码"
......
import React, { Component } from 'react';
import { Modal } from 'antd';
import { connect } from 'react-redux';
import isProd from '../../utils/env';
import NoticeIcon from '../NoticeIcon';
import Notifier from '../Notifier';
import { NEW_MESSAGE } from '../Notifier/constants';
import styles from './index.less';
import Notifier, {NEW_MESSAGE} from '../Notifier';
class NoticeIconView extends Component {
constructor(props) {
......@@ -10,8 +15,14 @@ class NoticeIconView extends Component {
this.state = {
count: 0,
noticeData: [],
platformVisible: true,
videoVisible: false,
noticeVisible: false,
renderVideo: null,
initVisible: false
};
this.notifier = new Notifier(this.props.global.userInfo);
//this.renderPlatform
this.notifier = new Notifier(this.props.global.userInfo, this.renderVideo, this.renderPlatform);
}
async componentDidMount() {
......@@ -20,18 +31,133 @@ class NoticeIconView extends Component {
}
componentWillUnmount(){
try {
this.notifier && this.notifier.stop();
}catch(error) {
console.log(error);
}finally{
}
}
onNewMessage = messages => {
this.setState({
count:messages.totalCount,
noticeData:messages.messages
})
});
console.log("newMessages", messages)
};
modalVisible = () => {
const data = this.state.noticeData.filter(item => item.infoLevel === "4");
return data.length > 0 ? true: false;
}
handleCloseVideo = () => {
this.setState({videoVisible: false})
this.notifier.destoryVideo()
}
handleClosePlatform = (event) => {
this.setState({platformVisible: false})
this.notifier.destoryPlatform()
}
renderPlatform = (message) => {
this.setState({
platformVisible: true
})
return (
<Modal title="报警消息"
visible={this.state.platformVisible}
zIndex={5000}
className={styles.platformModal}
footer={null}
onCancel={() => this.handleClosePlatform()}
centered>
<div className={styles.alarmContent}>
<img src="https://panda-water.com/web4/assets/images/message/报警图标.svg"/>
<div className={styles.content}>
<div className={styles['content-top']}>
<a onClick={() => this.handlerMointer(message, true)}>{message.infoContent.alarmDevice}</a>
<span title="点击标为已读" onClick={() => this.handlerMointer(message, false)}></span>
</div>
<div className={styles['content-mid']}>
<b>{message.infoContent.alarmType}</b>
{
'|' + message.infoContent.alarmContent
}
</div>
<div className={styles['content-bottom']}>
<p>
<b>{message.infoContent.alarmValue}/</b>
{message.infoContent.alarmThreshold}
</p>
<span>{message.time}</span>
</div>
</div>
</div>
</Modal>
)
}
renderVideo = (message) => {
this.setState({
videoVisible: true
});
const props = this.props;
const data = message && message.messContent && message.messContent.split('\\n') || [];
const id = data[3];
const name = data[0];
const baseURI = isProd ? window.location.origin : `http://${window.location.hostname}:3020`;
const url = `${baseURI}/civweb4/video/indexAll.html?ID=${id}&name=${name}&site=${props.global.userInfo.site}`;
return (
<Modal visible={this.state.videoVisible}
title={name}
footer={null}
centered width="50%"
zIndex={1500}
ref={videoRef => this.videoRef = videoRef}
className={styles.videoPopup}
onCancel={() => this.handleCloseVideo() }>
<div className="web4_console_component">
<iframe id="videoIframe" style={{width: '100%', height: '100%'}} frameBorder="0" src={url}></iframe>
</div>
</Modal>
);
}
handlerMointer = (item, detail) => {
this.notifier.confirmRead(false, [item.id]);
if(detail) {
const widgetID = "widget_city_综合运营_管网监控_实时监控_报警监控";
const webPath = item.webPath || "product/scada/AlertMonitoring/AlertMonitoring";
window.share.event.emit("listenerMointer", {
widgetId: widgetID,
label: '报警监控',
url: webPath
});
}
this.setState({
platformVisible: false
})
}
handlePopupVisibleChange = (bool) => {
this.setState({
noticeVisible: bool
})
}
render() {
return (
<>
<NoticeIcon
className={styles.action}
count={this.state.count}
......@@ -46,6 +172,66 @@ class NoticeIconView extends Component {
hasMore = {this.notifier.hasMore}
/>
</NoticeIcon>
{/* {
this.state.platformVisible ? <Modal title="未读消息"
visible={this.state.platformVisible}
zIndex={5000}
className={styles.platformModal}
footer={null}
centered
maskClosable={false}
onCancel={(event) => this.handleClosePlatform(event)}>
<List
itemLayout="vertical"
dataSource={this.state.noticeData.filter(item => item.infoLevel === "4")}
pagination={{
size:"small",
onChange: page => {
console.log(page);
},
pageSize: 1,
}}
renderItem={
item => (
<List.Item
key={item.id}
extra={<img width={16} alt="点击标为已读" src="https://panda-water.com/web4/assets/images/message/%E5%B7%B2%E8%AF%BB-%E9%BB%98%E8%AE%A4.svg" onClick={() => this.handlerMointer(item, false)}/>}>
<List.Item.Meta
avatar={<img size="63" src="https://panda-water.com/web4/assets/images/message/%E6%8A%A5%E8%AD%A6%E5%9B%BE%E6%A0%87.svg" />}
title={<a onClick={() => this.handlerMointer(item, true)}>{item.infoContent.alarmDevice}</a>}
description={
<>
<div className={styles.content}>
<b>{item.infoContent.alarmType}</b>
{
'|' + item.infoContent.alarmContent
}
</div>
<div>
<span>
<b>{item.infoContent.alarmValue}/</b>
{item.infoContent.alarmThreshold}
</span>
<span>{item.time}</span>
</div>
</>
}
/>
</List.Item>
)
}>
</List>
</Modal>: null
} */}
{
this.state.platformVisible ? this.notifier.renderPlatformElement: null
// this.renderPlatform()
}
{
this.state.videoVisible ? this.notifier.renderVideoElement: null
}
</>
);
}
}
......
......@@ -46,20 +46,20 @@ const OrderIcon = props => <Icon component={orderSvg} {...props} />;
const HomeIcon = props => <Icon component={homeSvg} {...props}/>
const MESSAGE_BOX_URL = 'product/maintenance/CaseManage/CaseDoingBox/StardCaseDoingBoxView|isDelay=1'
const getConfig = (widgets, url) => {
export const getConfig = (widgets, url, key) => {
let widgetconfig = {};
if(!widgets) {
return
} else {
if(widgets) {
for(let i = 0; i< widgets.length; i++) {
const widget = widgets[i];
if(widget && widget.url) widget.url = widget.url.replace(/\\/g,'/');
if (widget.url && url.toLowerCase() == widget.url.toLowerCase()) {
if(widget && widget[key]) widget[key] = widget[key].replace(/\\/g,'/').trim();
if (widget[key] && url.toLowerCase() == widget[key].toLowerCase()) {
widgetconfig = widget;
break;
} else {
if (widget.widgets) {
widgetconfig = getConfig(url, widget.widgets);
const children = widget.widgets ? widget.widgets: widget.routes;
if (children) {
widgetconfig = getConfig(children, url, key);
if (widgetconfig) {
break;
}
......@@ -114,7 +114,9 @@ const GlobalHeaderRight = props => {
const handleOrder = (event) => {
event.stopPropagation()
if(getConfig(props.global.widgets.concat(props.global.uiwidgets), MESSAGE_BOX_URL)) {
const widgetConfig = getConfig(props.global.widgets.concat(props.global.uiwidgets), MESSAGE_BOX_URL, 'url');
if(Object.keys(widgetConfig).length > 0) {
props.history.push(`/civweb4/${MESSAGE_BOX_URL}`)
} else {
message.warning('对不起,您没有菜单权限!')
......
......@@ -55,6 +55,8 @@
overflow: hidden;
}
}
}
.dark {
......@@ -167,6 +169,163 @@
}
}
}
.platformModal {
//
border-radius: 30px;
:global {
.ant-modal-header {
background: linear-gradient(90deg, rgba(255, 71, 93, 1) 0%, rgba(255, 104, 93, 1) 100%);
padding: 8px 24px;
.ant-modal-title {
color: #fff;
}
}
.ant-modal-close {
color: #fff;
.ant-modal-close-x {
width: 30px;
height: 30px;
line-height: 30px;
font-size: 14px;
}
}
.ant-list-items {
.ant-list-item-meta-description {
div {
b {
color: rgba(255, 36, 36, 1);
}
&:first-child {
color: #616F88;
}
&:last-child {
display: flex;
justify-content: space-between;
margin-top: 10px;
span {
&:last-child {
font-weight: bold;
color: rgba(51, 62, 81, 1);
}
}
}
}
}
.ant-avatar-image {
top: 10px;
width: 63px;
height: 63px;
line-height: 63px;
}
.ant-list-item-extra {
cursor: pointer;
}
}
.ant-list-vertical {
.ant-list-pagination {
.mini {
.ant-pagination-prev, .ant-pagination-next{
line-height: 5px;
}
}
}
}
}
.alarmContent {
display: flex;
flex-direction: row;
flex: 1;
padding: 10px;
width: 100%;
img {
width: 63px;
height: 63px;
margin: 20px 20px 20px 0;
}
.content {
display: flex;
flex-direction: column;
flex: 1;
&-top {
font-size: 20px;
font-family: Source Han Sans CN;
font-weight: 500;
color: rgba(51, 62, 81, 1);
line-height: 32px;
display: flex;
flex-direction: row;
white-space: nowrap;
justify-content: space-between;
align-items: center;
a {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 60%;
}
span {
width: 18px;
height: 14px;
margin: 17px 0;
background: url(https://panda-water.com/web4/assets/images/message/已读-默认.svg) no-repeat center;
background-size: 100% 100%;
cursor: pointer;
}
}
&-mid {
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #616F88;
line-height: 32px;
b {
color: rgba(255, 36, 36, 1);
}
}
&-bottom {
display: flex;
flex-direction: row;
justify-content: space-between;
line-height: 32px;
p {
b {
color: #FF2929;
}
}
span {
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: bold;
color: rgba(51, 62, 81, 1);
}
}
}
}
}
.videoPopup {
:global(.ant-modal-content) {
height: 520px;
}
:global(.ant-modal-header) {
padding: 8px 24px;
}
:global(.ant-modal-close-x) {
width: 36px;
height: 36px;
line-height: 36px;
}
:global(.ant-modal-body) {
padding: 0;
height: 100%;
width:100%;
}
}
:global(.ant-pro-global-header) {
......
......@@ -93,7 +93,7 @@ const HeaderSearch = props => {
}
window.addEventListener('resize', () => {
setTargetOffset(wrapperRef.current.offsetLeft)
wrapperRef.current && setTargetOffset(wrapperRef.current.offsetLeft)
})
return () => {
window.removeEventListener('resize', () => setTargetOffset(wrapperRef.current.offsetLeft))
......@@ -119,10 +119,6 @@ const HeaderSearch = props => {
inputRef.current.blur();
setFocus(false)
}
return (
<div
className={classNames(className, styles.headerSearch)}
......
......@@ -29,17 +29,24 @@ class NoticeList extends React.Component {
this.state = {
isLoading: false,
};
this.mounted=false;
this.handleScrollCallback=this.throttle(this.handleScroll.bind(this), 30).bind(this);
}
componentDidMount() {
this.mounted=true;
if (this.container.current) {
this.container.current.addEventListener(
'scroll',
this.throttle(this.handleScroll.bind(this), 30),
this.handleScrollCallback,
);
}
}
componentWillUnmount(){
this.mounted=false;
}
throttle(fn, wait) {
var pre = Date.now();
return function() {
......@@ -55,6 +62,7 @@ class NoticeList extends React.Component {
handleScroll(e) {
e.stopPropagation();
if(!this.mounted) return;
if (!this.container.current) return;
let current = this.container.current;
if (
......@@ -75,11 +83,10 @@ class NoticeList extends React.Component {
() => {
if (!this.loadMore) return;
this.loadMore().then(data => {
if(!this.mounted) return;
this.setState({
isLoading: false,
});
this.forceUpdate();
console.log("开始更新了。。。。。",data);
});
},
);
......
import React from 'react';
import styles from './index.less';
import commonStyles from '../common.less';
import classNames from 'classnames';
import { useHistory } from 'react-router-dom';
import commonStyles from '../common.less';
import styles from './index.less';
export class AlarmContent {
constructor({
......@@ -26,14 +27,17 @@ export class AlarmContent {
const Alarm = ({ message, confirmRead }) => {
let alarmContent = message.infoContent;
const history = useHistory();
const goPath = item => {
confirmRead(false, [message.id]);
let path = item.webPath
? `/civweb4/${item.webPath}`
: `/civweb4/product/scada/AlertMonitoring/AlertMonitoring`;
history.push(path);
const widgetID = "widget_city_综合运营_管网监控_实时监控_报警监控";
const webPath = item.webPath || "product/scada/AlertMonitoring/AlertMonitoring";
window.share.event.emit("listenerMointer", {
widgetId: widgetID,
label: '报警监控',
url: webPath,
});
};
const alarmValue = alarmContent && alarmContent.alarmValue && alarmContent.alarmValue.split(' ');
return (
<div
className={classNames(styles.scada, commonStyles.messageContainer)}
......@@ -60,9 +64,10 @@ const Alarm = ({ message, confirmRead }) => {
<p>{alarmContent.alarmContent}</p>
<p>
<font style={{ color: '#ff0000' }} title="点击查看详情">
{alarmContent.alarmValue.split(' ')[0]}
{ alarmValue.length > 0 && alarmValue[0]!== 'undefined' && alarmValue[0] || ''}
</font>
{alarmContent.alarmValue.split(' ')[1] +
{
( alarmValue.length > 0 && alarmValue[1]!== 'undefined' && alarmValue[1] || '') +
' / ' +
alarmContent.alarmThreshold.split(' ').join('')}
</p>
......
import React from 'react';
import styles from './index.less';
import commonStyles from '../common.less';
import classNames from 'classnames';
import { useHistory } from 'react-router-dom';
import commonStyles from '../common.less';
import styles from './index.less';
//"caseType":"待办工单","flowName":"维修处理流程","nodeName":"审核关单","content":"请迅速到现场处理","time":"2020-11-03 09:11:12"
export class CaseContent {
......@@ -24,11 +24,31 @@ export class CaseContent {
const Case = ({ message, confirmRead }) => {
let caseContent = message.infoContent;
const history = useHistory();
const goPath = (item) => {
confirmRead(false,[message.id]);
let path= item.webPath ? `/civweb4/${item.webPath}` : `/civweb4/product/maintenance/CaseManage/CaseDoingBox/StardCaseDoingBoxView|isDelay=1`
history.push(path);
const messageType = item.messType;
let label = '', widgetID = '';
switch(messageType) {
case "任务派发":
label = "任务派发";
widgetID = "widget_city_综合运营_二供管理_维修管理_工单办理";
break;
case "任务驳回":
label = "任务驳回";
widgetID = "widget_city_综合运营_二供管理_维修管理_工单办理";
_tab = "任务驳回";
break;
default:
label = "工单办理";
widgetID = "widget_city_综合运营_二供管理_维修管理_工单办理";
break;
}
const webPath = item.webPath || "product/maintenance/CaseManage/CaseDoingBox/StardCaseDoingBoxView|isDelay=1";
window.share.event.emit("listenerMointer", {
widgetId: widgetID,
label: label,
url: webPath,
});
}
return (
<div className={classNames(styles.case,commonStyles.messageContainer)} title="点击查看详情" onClick={()=> goPath(message)}>
......
import React from 'react';
import styles from './index.less';
import commonStyles from '../common.less';
import classNames from 'classnames';
import { useHistory } from 'react-router-dom';
import commonStyles from '../common.less';
import styles from './index.less';
//'平台公告','{"noticeTitle":"光谷智慧园停水","noticeType":"停水公告","noticeContent":"从今天中午20点开始停水,停三个小时!","time":"2020-11-03 09:11:12"
export class NoticeContent {
constructor({
noticeTitle,
......@@ -22,11 +21,14 @@ export class NoticeContent {
const Notice = ({ message, confirmRead }) => {
let noticeContent = message.infoContent;
const history = useHistory();
const goPath = (item) => {
confirmRead(false,[message.id]);
let path= item.webPath ? `/civweb4/${item.webPath}` : `/civweb4/product/notification/HistoryNotice/HistoryNotice`
history.push(path);
let webPath = item.webPath || "product/notification/HistoryNotice/HistoryNotice";
window.share.event.emit("listenerMointer", {
widgetId: widgetID,
label: '系统公告',
url: webPath,
});
}
return (
<div className={classNames(styles.notice,commonStyles.messageContainer)} title="点击查看详情" onClick={()=> goPath(message)}>
......
import React from 'react';
import styles from './index.less';
import commonStyles from '../common.less';
import classNames from 'classnames';
import commonStyles from '../common.less';
import styles from './index.less';
const Unknown = ({ message, confirmRead }) => {
let alarmContent = message.infoContent;
let content = '';
try {
let type = typeof message.infoContent;
switch (type) {
case 'object':
content = JSON.stringify(message.infoContent);
break;
case 'string':
content = message.infoContent;
break;
default:
break;
}
} catch (e) {
console.log;
}
return (
<div className={classNames(styles.unknown,commonStyles.messageContainer) } title="点击查看详情">
<div
className={classNames(styles.unknown, commonStyles.messageContainer)}
title="点击查看详情"
>
<div className={commonStyles.title}>
<span>消息</span>
<img
className={commonStyles.confirm}
title="点击标为已读"
onClick={() => {
confirmRead(false,[message.id]);
confirmRead(false, [message.id]);
}}
src="https://panda-water.cn/Web4/assets/images/message/%E5%8B%BE%E6%B5%85.png"
/>
</div>
<div className={commonStyles.content}>
<p>{message.infoContent}</p>
<p>{content}</p>
<p className={commonStyles.messageTime}>{message.time}</p>
</div>
</div>
......
......@@ -43,6 +43,7 @@ const messageSvg = () => (
);
const BellOutlined = props => <Icon component={messageSvg} {...props} />;
const NoticeIcon = props => {
console.log(props);
const getNotificationBox = () => {
const {
children,
......@@ -95,9 +96,10 @@ const NoticeIcon = props => {
<Badge
count={props.count}
overflowCount={99}
offset={[-8, 8]}
offset={[-4, 8]}
style={{ boxShadow: 'none' }}
className={styles.badge}
title=""
className={classNames(styles.badge, props.count > 0 ? styles.fountMessage: '')}
>
{NoticeBellIcon}
</Badge>
......@@ -108,6 +110,7 @@ const NoticeIcon = props => {
}
return (
<>
<HeaderDropdown
placement="bottomRight"
overlay={notificationBox}
......@@ -115,9 +118,11 @@ const NoticeIcon = props => {
trigger={['click']}
visible={visible}
onVisibleChange={setVisible}
>
{trigger}
</HeaderDropdown>
</>
);
};
......
@import '~antd/es/style/themes/default.less';
.popover {
position: relative;
position: absolute;
width: 336px;
z-index: 1100;
}
.noticeButton {
......@@ -13,10 +14,23 @@
.icon {
padding: 4px;
vertical-align: middle;
}
.badge {
font-size: 16px;
:global {
.ant-badge-multiple-words {
padding: 0 4px;
}
}
&.fountMessage {
.icon {
animation: bellshake 2s ease-out infinite;
}
}
}
.tabs {
......@@ -53,3 +67,39 @@
}
}
}
@keyframes bellshake {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
3.75% {
-webkit-transform: rotate(25deg);
transform: rotate(25deg);
}
15% {
-webkit-transform: rotate(-25deg);
transform: rotate(-25deg);
}
22.5% {
-webkit-transform: rotate(15deg);
transform: rotate(15deg);
}
29% {
-webkit-transform: rotate(-10deg);
transform: rotate(-10deg);
}
35% {
-webkit-transform: rotate(5deg);
transform: rotate(5deg);
}
43% {
-webkit-transform: rotate(-2deg);
transform: rotate(-2deg);
}
50%,
to {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
}
\ No newline at end of file
export const REQUEST_SERVICE = {
EIMTopic: '/EIM/info',
SaveWaTopic: '/saveWater/info',
SystemTopic: '/system/info',
WorkerOrderTopic: '/workerOrder/info',
ScadaTopic: '/scada/alarm',
UserTopic: '/Message/',
};
export const MESSAGE_TYPE = {
SCADA_TYPE: 'scadaType',
CASE_TYPE: 'caseType',
SYS_TYPE: 'sysType',
SAVE_WA_TYPE: 'saveWaType',
EIMT_TYPE: 'EIMType',
MESSAGE_ALERT: 'remindType',
UNKNOWN: 'unknown',
};
export const NEW_MESSAGE = 'NEW_MESSAGE';
export const MESSAGE_TEXT_TYPE= {
PROJECT_FLOW: '工单流程',
SYS_MESSAGE: '系统消息',
SYS_NOTICE: '系统通知',
SAWATER: '节水通知',
EMTT: '信息化',
MESSAGE_ALERT: '消息提醒',
SCADA_ALARM: 'SCADA报警'
}
export const USERNAME = 'mao2080';
export const PASSWORD = '123';
export const PLATFORM_LEVEL = '4';
export const VIDEO_LEVEL = '5';
export const ERR_OK = '0000';
export const DEFAULT_TCP_PORT = 443;
export const DEFAULT_TCP_IP ='emqttd.panda-water.cn';
export const DEFAULT_MQTT_PATH = '/mqtt';
export const DEFAULT_KEEPLIVE = 60;
export const DEFAULT_TIMEOUT = 50;
export const DEFAULT_PARSE_LEVEL = '1.0'
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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