Commit f581cd49 authored by 叶飞's avatar 叶飞

feat: message

parent 3084af57
......@@ -67,7 +67,7 @@ module.exports = {
'newline-per-chained-call': 0,
'no-confusing-arrow': 0,
'no-console': 1,
'no-unused-vars': 2,
'no-unused-vars': 0,
'no-use-before-define': 0,
'prefer-template': 2,
'react/jsx-wrap-multilines': 0,
......@@ -96,6 +96,7 @@ module.exports = {
'redux-saga/no-yield-in-race': 2,
'redux-saga/yield-effects': 2,
'require-yield': 0,
},
settings: {
'import/resolver': {
......
......@@ -23,7 +23,8 @@ class HttpRequest {
// }
// ------------------------------------------------------------------------------------
if (!config.ignoreSite && this.getSite()) {
config.headers['civ-site'] = this.getSite();
// config.headers['civ-site'] = this.getSite();
config.headers['civ-site'] = "192_168_19_105_site_c8de50fc";
}
this.removePending(config); //在一个ajax发送前执行一下取消操作
config.cancelToken = new cancelToken(c => {
......
......@@ -8,11 +8,12 @@ const API = {
GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo',
GET_OA: '/CityInterface/rest/services/OA.svc/getLoginInfo',
GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
GET_INFORMATION:
'/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo',
GET_INFORMATION:'/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo',
GET_MQTT_SITE_CODE:'/CityInterface/rest/services/CountyProduct.svc/SCADAOper/getMqttSitecode',
GET_CITY: 'https://pv.sohu.com/cityjson?ie=utf-8',
GET_ALL_GROUPS_INFO_FORUSER: 'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather'
GET_ALL_GROUPS_INFO_FORUSER:
'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
};
export default vm => {
vm.getConfig = (
......@@ -37,11 +38,19 @@ export default vm => {
vm.getInformationInfo = (data = {}) =>
vm.get(API.GET_INFORMATION, data).then(res => Promise.resolve(res));
vm.getCity = () => vm.get(API.GET_CITY).then(res => Promise.resolve(res))
vm.getMqttSiteCode = (data = {}) =>
vm.get(API.GET_MQTT_SITE_CODE, data).then(res => Promise.resolve(res));
vm.generateTokenQuick = (data={}) => vm.get(API.GENERATE_TOKEN_CHANGE, data).then(res => Promise.resolve(res))
vm.getCity = () => vm.get(API.GET_CITY).then(res => Promise.resolve(res));
vm.getAllGroupsInfoForUser = (data = {}, config) => vm.get(API.GET_ALL_GROUPS_INFO_FORUSER, data, config).then(res => Promise.resolve(res))
vm.generateTokenQuick = (data = {}) =>
vm.get(API.GENERATE_TOKEN_CHANGE, data).then(res => Promise.resolve(res));
vm.getWeather = (data={}) => vm.get(API.GET_WEATHER, data).then(res => Promise.resolve(res))
vm.getAllGroupsInfoForUser = (data = {}, config) =>
vm
.get(API.GET_ALL_GROUPS_INFO_FORUSER, data, config)
.then(res => Promise.resolve(res));
vm.getWeather = (data = {}) =>
vm.get(API.GET_WEATHER, data).then(res => Promise.resolve(res));
};
......@@ -12,10 +12,7 @@ import ReactDOM from 'react-dom';
import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable';
import {
params,
Storeage,
} from 'kit_utils';
import { params, Storeage } from 'kit_utils';
import { Provider } from 'react-redux';
import Http from './api';
......@@ -29,7 +26,6 @@ window.createStoreage = new Storeage('PANDA_STORE');
window.Http = Http;
const initialState = Immutable.Map();
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');
const render = () => {
ReactDOM.render(
......@@ -80,6 +76,7 @@ const initGlobalConfig = () => {
initMicroApps();
}
};
window.share &&
window.share.event &&
window.share.event.on('triggerMicro', () => {
......
......@@ -44,6 +44,7 @@ class AvatarDropdown extends React.Component {
'Serati Ma',
},
} = this.props;
const menuHeaderDropdown = (
<div className={styles.userInfo}>
<div className={styles.header}>
......
import React, { Component } from 'react';
import {
message,
Tag,
} from 'antd';
import { message, Tag, notification } from 'antd';
import moment from 'moment';
import { connect } from 'react-redux';
import NoticeIcon from '../NoticeIcon';
import styles from './index.less';
import Notifier, {NEW_MESSAGE} from '../Notifier';
class NoticeIconView extends Component {
state = {
count: 0,
noticeData: [],
};
componentDidMount() {
// Http.getInformationInfo({
// userID: this.props.global.userInfo.OID,
// pageIndex: 1,
// pageSize: 10,
// 'request.preventCache': Date.now(),
// }).then(res => {
// this.setState({
// count: res.totalRcdNum,
// noticeData: res.getMe,
// });
// });
async componentDidMount() {
let notifier = new Notifier(this.props.global.userInfo);
notifier.subscribe("NEW_MESSAGE",this.onNewMessage.bind(this));
notifier.start();
}
onNewMessage = messages => {
debugger;
this.setState({
count:messages.totalCount,
noticeData:messages.messages
})
};
/* eslint-disable no-unused-vars */
changeReadState = clickedItem => {};
/* eslint-disable no-unused-vars */
handleNoticeClear = (title, key) => {};
getNoticeData = () => {
......@@ -86,7 +84,7 @@ class NoticeIconView extends Component {
return (
<NoticeIcon
className={styles.action}
count={this.state.count}
count={this.state.count > 99 ? 99 : this.state.count}
onItemClick={item => {
this.changeReadState(item);
}}
......
This diff is collapsed.
This diff is collapsed.
{
"currentPageIndex": 1,
"getMe": [
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3676,
"ID": 4341,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3677,
"ID": 4342,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3678,
"ID": 4343,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3679,
"ID": 4344,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3680,
"ID": 4345,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3681,
"ID": 4346,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3682,
"ID": 4347,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3683,
"ID": 4348,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
},
{
"CreateTime": "2020/7/29 0:00:00",
"HisCreateTime": "2020/7/29 9:44:00",
"HisID": 3684,
"ID": 4349,
"InfoContent": "【阈值报警】8-B-AE1\\n累计电量过高\\n报警实时值:3130.5",
"InfoDist": "平台弹框,公众号推送",
"InfoLevel": "1",
"InfoType": "SCADA报警",
"IsRead": "",
"MessType": "通用报警",
"Tousers": "5",
"UserID": 5,
"app_config": "",
"app_path": "",
"web_config": "",
"web_path": "product/scada/AlertMonitoring/AlertMonitoring"
}
],
"say": {
"errMsg": "",
"info": "",
"statusCode": "0000"
},
"totalRcdNum": 22
}
This diff is collapsed.
......@@ -27,7 +27,6 @@ function () {
_createClass(SlideVerify, [{
key: "init",
value: function init() {
debugger;
this.initDOM();
this.initImg();
this.bindEvents();
......
......@@ -5,7 +5,6 @@ import styles from './index.less';
class SlideVerify {
init() {
debugger
this.initDOM()
this.initImg()
this.bindEvents()
......
......@@ -7,7 +7,6 @@ import styles from './index.less';
const Categories = (props) => {
const [currentIndex, setCurrentIndex] = useState(0)
const selectCategories = (event, index) => {
debugger
event.preventDefault();
event.stopPropagation();
event.nativeEvent.stopImmediatePropagation()
......
......@@ -3,10 +3,7 @@ import React from 'react';
import { Helmet } from 'react-helmet';
import { connect } from 'react-redux';
import { renderRoutes } from 'react-router-config';
import {
BrowserRouter as Router,
Switch,
} from 'react-router-dom';
import { BrowserRouter as Router, Switch } from 'react-router-dom';
import { dyRoutes } from '../../routes/config';
......@@ -34,12 +31,10 @@ function App(props) {
);
}
const mapStateToProps = state => {
return {
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
menu: state.getIn(['global', 'menu']),
};
};
});
export default connect(
mapStateToProps,
null,
......
import React, {
useEffect,
useRef,
useState,
} from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { Popover } from 'antd';
import { connect } from 'react-redux';
import {
matchRoutes,
renderRoutes,
} from 'react-router-config';
import { matchRoutes, renderRoutes } from 'react-router-config';
import { useHistory } from 'react-router-dom';
import { MenuFoldOutlined } from '@ant-design/icons';
......@@ -62,26 +55,30 @@ const menuExtraRender = currentRoutes => {
toggleSystem,
onClose: () => setToggleSystem(!toggleSystem),
};
return;
};
const renderTitle = (title, action) => {
console.log(styles);
const getCityStationsForUser = action && action.getCityStationsForUser();
console.log(getCityStationsForUser)
console.log(getCityStationsForUser);
return (
<>
<span className={styles['header-title']}>
{title}
</span>
<span className={styles['header-title']}>{title}</span>
<div className={styles.cityContent}>
<Popover placement="bottom">
<span className={styles.siteName}>
<img src="https://panda-water.cn/web4/assets/images/depart.svg"/>
<img
src="https://panda-water.cn/web4/assets/images/depart.svg"
alt="city"
/>
<span>GCK演示</span>
</span>
</Popover>
<span className={styles.weatcher}>
<img src="https://panda-water.cn/web4/assets/images/weather2/0.svg"/>
<span className={styles.weather}>
<img
src="https://panda-water.cn/web4/assets/images/weather2/0.svg"
alt="weather"
/>
<span> -1/17</span>
</span>
</div>
......@@ -90,9 +87,13 @@ const renderTitle = (title, action) => {
};
const BasicLayout = props => {
/* eslint-disable no-unused-vars */
const {children, settings, location = {
const {
children,
settings,
location = {
pathname: '/',
},} = props
},
} = props;
const basename = getBaseName();
const history = useHistory();
const [pathname, setPathname] = useState(props.location.pathname);
......@@ -108,8 +109,8 @@ const BasicLayout = props => {
};
const [siteAction, setSiteAction] = useState(() => {
return new Site(props)
})
return new Site(props);
});
matchRoutes(props.route.routes, props.location.pathname);
const extraRender = menuExtraRender(currentRoutes);
......@@ -147,7 +148,6 @@ const BasicLayout = props => {
siderWidth="145px"
title=""
fixSiderbar={true}
onMenuHeaderClick={event => handleLogo(event)}
onCollapse={collapse => handleMenuCollapse(collapse)}
menuExtraRender={extraRender.render}
......
......@@ -31,7 +31,6 @@ class Site {
}
getCityStationsForUser() {
debugger
const loginName = this.globalConfig.userInfo.loginName;
const self = this;
Http.getAllGroupsInfoForUser({
......@@ -40,7 +39,6 @@ class Site {
}, {
ignoreSite: true
}).then(res => {
debugger
if(res && res.say.errMsg === '' && res.say.statusCode === ERR_OK) {
const result = res.getMe;
let city = self.weatherCity;
......@@ -64,7 +62,6 @@ class Site {
let allStation = [];
let projectStation = [];
debugger
if (self.globalConfig.Industry) {
allStation = result.filter((item) => {
......
......@@ -84,7 +84,9 @@
// padding-left: 80px;
letter-spacing: 2px;
}
.cityContent {
.siteName {
padding-right: 5px;
display: inline;
......@@ -108,7 +110,8 @@
margin: 0!important;
}
}
.weatcher {
.weather {
border-left: 1px solid rgb(170, 170, 170);
text-shadow: none;
color: #777;
......
......@@ -60,7 +60,6 @@ function () {
value: function getCityStationsForUser() {
var _this2 = this;
debugger;
var loginName = this.globalConfig.userInfo.loginName;
var self = this;
Http.getAllGroupsInfoForUser({
......@@ -69,7 +68,6 @@ function () {
}, {
ignoreSite: true
}).then(function (res) {
debugger;
if (res && res.say.errMsg === '' && res.say.statusCode === ERR_OK) {
var result = res.getMe;
......@@ -97,7 +95,6 @@ function () {
var allStation = [];
var projectStation = [];
debugger;
if (self.globalConfig.Industry) {
allStation = result.filter(function (item) {
......
......@@ -113,6 +113,8 @@ export const initMicroApps = loader => {
url.indexOf('pv.sohu.com') !== -1 ||
url.indexOf('mt0.google.cn') !== -1 ||
url.indexOf('mt1.google.cn') !== -1
// url.indexOf('mt2.google.cn') !== -1 ||
// url.indexOf('mt3.google.cn') !== -1
);
},
});
......
import React, {
useCallback,
useState,
} from 'react';
import React, { useCallback, useState } from 'react';
import {
Space,
Spin,
} from 'antd';
import { Space, Spin } from 'antd';
import classNames from 'classnames';
import { connect } from 'react-redux';
......@@ -40,16 +34,16 @@ const BootPage = props => {
const [loadding, setLoadding] = useState(false);
const handlePage = useCallback((event, type) => {
event.persist();
setLoadding(true)
setLoadding(true);
const config = props.global;
let loginAction = new LoginAction(props);
console.log(loginAction)
console.log(loginAction);
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
props.instance && props.instance.updateConfig(config);
// props.instance && props.instance.getUserInfoAndConfig('', true, type);
loginAction.getUserInfoAndConfig('', true, type)
loginAction.getUserInfoAndConfig('', true, type);
loginAction.events.on('toggleIndustry', event => {
setLoadding(false);
......@@ -63,9 +57,7 @@ const BootPage = props => {
<div className={styles.bootPage}>
<div className={styles.bootPageMain}>
<header className={styles.bootPageHead}>
<img
src={`https://panda-water.cn/web4/assets/images/bootPage/熊猫图标.png`}
/>
<img src="https://panda-water.cn/web4/assets/images/bootPage/熊猫图标.png" />
<div className={styles.bootPageTitle}>
<span className={styles.bootPageZh}>
熊猫智慧城市监控管理解决方案
......@@ -95,20 +87,17 @@ const BootPage = props => {
</ul>
</section>
<Space className={styles.abs}>
<Spin spinning={loadding} size="large"/>
<Spin spinning={loadding} size="large" />
</Space>
</div>
</div>
</SecurityLayout>
);
};
const mapStateToProps = state => {
return {
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
instance: state.getIn(['global', 'instance']),
};
};
});
const mapDispatchToProps = dispatch => {
return {
updateConfig(config) {
......
......@@ -122,7 +122,6 @@ function () {
token: token,
'request.preventCache': Date.now()
}).then(function (response) {
debugger;
if (response && response.length > 0) {
_this4.globalConfig = Object.assign(_this4.globalConfig, response.shift(), {
......@@ -154,7 +153,6 @@ function () {
token: token,
'request.preventCache': Date.now()
}).then(function (response) {
debugger;
if (response && response.length > 0) {
var mainConf = response.shift();
......@@ -275,7 +273,6 @@ function () {
}, {
key: "goLogin",
value: function goLogin() {
debugger;
if (this.globalConfig.style === 'ios' && this.globalConfig.loginTemplate === 'IOSCloud.html') {
window.location.href = window.location.origin + '/#login';
......@@ -571,8 +568,6 @@ function () {
value: function loginHandler(user, pwd, userPhone, isRememberPWD, ref) {
var _this9 = this;
debugger;
if (user && pwd) {
if (this.loginFailed && this.captchaObj) {
this.captchaObj.verify();
......
......@@ -110,7 +110,6 @@ class Login {
'request.preventCache': Date.now(),
})
.then(response => {
debugger;
if (response && response.length > 0) {
this.globalConfig = Object.assign(
this.globalConfig,
......@@ -148,7 +147,6 @@ class Login {
token: token,
'request.preventCache': Date.now(),
}).then(response => {
debugger;
if (response && response.length > 0) {
var mainConf = response.shift();
if (mainConf.homepage)
......@@ -273,7 +271,6 @@ class Login {
}
goLogin() {
debugger;
if (
this.globalConfig.style === 'ios' &&
this.globalConfig.loginTemplate === 'IOSCloud.html'
......@@ -550,7 +547,6 @@ class Login {
}
loginHandler(user, pwd, userPhone, isRememberPWD, ref) {
debugger
if(user && pwd ) {
if(this.loginFailed && this.captchaObj) {
this.captchaObj.verify()
......
......@@ -33,7 +33,6 @@ var getPageQuery = function getPageQuery() {
exports.getPageQuery = getPageQuery;
var getAuthorityFromRouter = function getAuthorityFromRouter(router, pathname) {
debugger;
var authority = router.find(function (_ref) {
var routes = _ref.routes,
_ref$path = _ref.path,
......@@ -49,7 +48,6 @@ var getAuthorityFromRouter = function getAuthorityFromRouter(router, pathname) {
exports.getAuthorityFromRouter = getAuthorityFromRouter;
var getRouteAuthority = function getRouteAuthority(path, routeData) {
debugger;
var authorities;
routeData.forEach(function (route) {
if ((0, _pathToRegexp["default"])("".concat(route.path, "/(.*)")).test("".concat(path, "/"))) {
......
......@@ -11,7 +11,6 @@ export const isUrl = path => reg.test(path);
export const getPageQuery = () => parse(window.location.href.split('?')[1]);
export const getAuthorityFromRouter = (router, pathname) => {
debugger;
const authority = router.find(
({ routes, path = '/', target = '_self' }) =>
(path && target !== '_blank' && pathRegexp(path).exec(pathname)) ||
......@@ -22,7 +21,6 @@ export const getAuthorityFromRouter = (router, pathname) => {
};
export const getRouteAuthority = (path, routeData) => {
debugger;
let authorities;
routeData.forEach(route => {
if (pathRegexp(`${route.path}/(.*)`).test(`${path}/`)) {
......
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