Commit 111412f7 authored by 邓晓峰's avatar 邓晓峰

fix: fix role

parent b9e40121
......@@ -5,10 +5,10 @@ module.exports = {
'/CityInterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
target: 'https://panda-water.com',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*'
......@@ -20,9 +20,9 @@ module.exports = {
'/cityinterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*'
......@@ -33,10 +33,10 @@ module.exports = {
},
'/Publish': {
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// 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.com',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*'
......
......@@ -3,10 +3,10 @@ module.exports = {
'/CityInterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
target: 'https://panda-water.com',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
......@@ -18,9 +18,9 @@ module.exports = {
'/cityinterface': {
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
......@@ -31,10 +31,10 @@ module.exports = {
},
'/Publish': {
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// 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.com',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
......
This diff is collapsed.
......@@ -140,7 +140,7 @@
"@commitlint/config-conventional": "^9.1.2",
"@umijs/hooks": "^1.9.3",
"add-asset-html-webpack-plugin": "3.1.3",
"antd": "^4.5.3",
"antd": "^4.8.5",
"axios": "^0.19.2",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
......@@ -152,6 +152,7 @@
"babel-plugin-styled-components": "1.10.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"bcore": "^0.0.22",
"child_process": "^1.0.2",
"circular-dependency-plugin": "5.0.2",
"classnames": "^2.2.6",
"compare-versions": "3.4.0",
......@@ -178,6 +179,7 @@
"eslint-plugin-redux-saga": "1.0.0",
"express": "^4.17.1",
"file-loader": "3.0.1",
"fs": "0.0.1-security",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^1.0.5",
......
......@@ -12,18 +12,21 @@ const API = {
GET_ALL_GROUPS_INFO_FORUSER:
'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE: 'CityInterface/rest/services/portal.svc/SendMessVerificationCode'
};
export default vm => {
vm.getConfig = (
data = { client: params.getParams('client') || 'city', ts: Date.now() },
config = {}
config = {},
) => vm.get(API.GET_CONFIG, data, config).then(res => Promise.resolve(res));
vm.generateToken = (data = {}, config = {}) =>
vm.get(API.GENERATE_TOKEN, data, config).then(res => Promise.resolve(res));
vm.getWebSiteConfig = (data = {}, config = {}) =>
vm.get(API.GET_WEB_SITE_CONFIG, data, config).then(res => Promise.resolve(res));
vm
.get(API.GET_WEB_SITE_CONFIG, data, config)
.then(res => Promise.resolve(res));
vm.getUserInfo = (data = {}, config = {}) =>
vm.get(API.GET_USER_INFO, data, config).then(res => Promise.resolve(res));
......@@ -46,4 +49,6 @@ export default vm => {
vm.getWeather = (data = {}, config) =>
vm.get(API.GET_WEATHER, data, config).then(res => Promise.resolve(res));
vm.sendMessVerificationCode = (data = {}, config ={}) => vm.get(API.SEND_MESSAGE_CODE, data, config).then(res => Promise.resolve(res));
};
......@@ -17,7 +17,8 @@ var API = {
GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
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_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE: 'CityInterface/rest/services/portal.svc/SendMessVerificationCode'
};
var _default = function _default(vm) {
......@@ -99,6 +100,14 @@ var _default = function _default(vm) {
return Promise.resolve(res);
});
};
vm.sendMessVerificationCode = 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.SEND_MESSAGE_CODE, data, config).then(function (res) {
return Promise.resolve(res);
});
};
};
exports["default"] = _default;
\ No newline at end of file
......@@ -16,7 +16,6 @@ const Authorized = ({
/>
),
}) => {
debugger
const childrenRender = typeof children === 'undefined' ? null : children;
const dom = check(authority, flatMenu, childrenRender, noMatch);
return <>{dom}</>;
......
......@@ -9,7 +9,6 @@ const checkPermissions = (
target,
Exception,
) => {
debugger;
const filterPath = [
{ name: '/', path: '/' },
{ name: 'civbase', path:`/civbase/?client=${window.globalConfig.client}` },
......@@ -38,7 +37,6 @@ const checkPermissions = (
};
function check(authority, flatMenu, target, Exception) {
debugger;
return checkPermissions(
authority,
flatMenu,
......
......@@ -56,7 +56,6 @@ export default class PromiseRender extends React.Component {
}
render() {
debugger
const { } = this.state;
const { ok, error, promise, ...rest } = this.props;
return component ? (
......
......@@ -40,7 +40,6 @@ var checkPermissions = function checkPermissions(authority, flatMenu, currentAut
};
function check(authority, flatMenu, target, Exception) {
debugger;
return checkPermissions(authority, flatMenu, _renderAuthorize.CURRENT, target, Exception);
}
......
......@@ -180,7 +180,7 @@ class CitySelector extends React.Component {
)
}
} else {
debugger
let flg1 = false
for (var k = 0; k < siteOption.length; k++) {
if (siteOption[k].city.indexOf(item.address) > -1) {
......@@ -235,14 +235,13 @@ class CitySelector extends React.Component {
}
handleChangeTab = (activeKey) => {
debugger
this.setState({
activeIndex: activeKey
})
}
selectCityHandle = (event, item, status) => {
debugger
event.persist();
this.setState({
......@@ -252,7 +251,6 @@ class CitySelector extends React.Component {
}
districtHandle = (event, item, status) => {
debugger
event.persist();
this.setState({
districtCurrentItem: item
......
......@@ -46,6 +46,13 @@
color: @primary-color;
vertical-align: top;
background: rgba(255, 255, 255, 0.85);
width: 36px;
height: 36px;
border-radius: 50%;
box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
transition: box-shadow .1s linear,opacity .4s linear;
background-position: center;
overflow: hidden;
}
}
}
......
......@@ -51,7 +51,6 @@ const SearchPanel = props => {
}
const handlerMore = (event) => {
debugger
event.persist && event.persist()
event && event.nativeEvent.stopImmediatePropagation()
setVisible(true)
......
......@@ -243,7 +243,6 @@ function () {
password: password,
onSuccess: this.onMQTTConnect.bind(this),
onFailure: function onFailure(e) {
debugger;
console.log(e);
}
};
......
......@@ -1309,8 +1309,6 @@ function onMessageArrived(message) {
ClientImpl.prototype._on_socket_message = function (event) {
debugger;
this._trace("Client._on_socket_message", event.data);
var messages = this._deframeMessages(event.data);
......
......@@ -179,7 +179,6 @@ class Notifier {
password: password,
onSuccess: this.onMQTTConnect.bind(this),
onFailure: function(e) {
debugger;
console.log(e);
},
};
......
......@@ -1219,7 +1219,6 @@ function onMessageArrived(message) {
* @ignore
*/
ClientImpl.prototype._on_socket_message = function (event) {
debugger
this._trace("Client._on_socket_message", event.data);
var messages = this._deframeMessages(event.data);
for (var i = 0; i < messages.length; i+=1) {
......
......@@ -66,7 +66,7 @@ const menuExtraRender = currentRoutes => {
<a style={{ display: 'flex', alignItems: 'center' }}>
<img
src={`http://panda-water.cn/web4/${currentRoutes &&
currentRoutes.extData.icon}`}
currentRoutes.extData && currentRoutes.extData.icon}`}
style={{ width: '20px', height: '20px' }}
/>
<span
......@@ -225,7 +225,6 @@ const BasicLayout = props => {
pathname: '/',
},
} = props;
document.title= props.global && props.global.title;
const basename = getBaseName();
const history = useHistory();
const [pathname, setPathname] = useState(props.location.pathname);
......@@ -306,7 +305,7 @@ const BasicLayout = props => {
fixSiderbar={true}
onMenuHeaderClick={event => handleLogo(event)}
onCollapse={collapse => handleMenuCollapse(collapse)}
menuExtraRender={extraRender.render}
menuExtraRender={props.menu.length > 0 ? extraRender.render: null}
rightContentRender={() => <RightContent {...props}/>}
headerContentRender={() => headerContentRender.render}
menu={{
......
......@@ -56,7 +56,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;
......@@ -427,7 +426,6 @@ class Site {
}
handEnd = (event, item) => {
debugger
event.persist();
const self = this;
if(item) {
......
import React from 'react';
import React, {
useCallback,
useEffect,
useState,
} from 'react';
import {
Button,
Form,
Input,
} from 'antd';
import omit from 'omit.js';
import styles from './index.less';
import LoginContext from './LoginContext';
import ItemMap from './map';
......@@ -29,6 +36,8 @@ const getFormItemOptions = ({
};
const LoginItem = props => {
const [count, setCount] = useState(props.countDown || 0);
const [timing, setTiming] = useState(false);
const {
onChange,
customProps,
......@@ -36,9 +45,47 @@ const LoginItem = props => {
rules,
name,
type,
getCaptchaButtonText,
getCaptchaSecondText,
updateActive,
tabUtil,
...restProps
} = props;
const onGetCaptcha = useCallback((mobile) => {
Http.sendMessVerificationCode({
phoneNumber: mobile
}, {
ignoreSite: true,
cacheBust: true
}).then(res => {
if(res) {
console.log(res)
setTiming(true);
}
}).catch(error => {
message.error("获取验证码失败")
})
}, []);
useEffect(() => {
let interval = 0;
const { countDown } = props;
if (timing) {
interval = window.setInterval(() => {
setCount((preSecond) => {
if (preSecond <= 1) {
setTiming(false);
clearInterval(interval);
return countDown || 60;
}
return preSecond - 1;
});
}, 1000);
}
return () => clearInterval(interval);
}, [timing]);
if (!name) {
return null;
}
......@@ -46,6 +93,34 @@ const LoginItem = props => {
const options = getFormItemOptions(props);
const otherProps = restProps || {};
if(type === 'Captcha') {
const inputProps = omit(otherProps, ['onGetCaptcha', 'countDown']);
return (
<FormItem shouldUpdate>
{({ getFieldValue, validateFields }) => (
<>
<FormItem name={name} {...options}>
<Input {...customProps} {...inputProps} />
</FormItem>
<Button
disabled={timing}
className={styles.getCaptcha}
size="large"
onClick={() => {
validateFields(['mobile'])
const value = getFieldValue('mobile');
onGetCaptcha(value);
}}
>
{timing ? `${count} 秒` : '获取验证码'}
</Button>
</>
)}
</FormItem>
)
}
return (
<FormItem name={name} {...options}>
<Input {...customProps} {...otherProps} />
......
......@@ -16,16 +16,22 @@
}
}
.getCaptcha {
color: @primary-6;
font-weight: 400;
cursor: pointer;
font-size: 12px;
width: auto;
padding: 0!important;
height: auto!important;
border: none!important;
}
.desc {
width: 88px;
font-size: 20px;
margin-bottom: 15px;
}
.getCaptcha {
display: block;
width: 100%;
}
.icon {
margin-left: 16px;
......
......@@ -51,6 +51,7 @@ export default {
size: 'large',
prefix: <MobileTwoTone className={styles.prefixIcon} />,
placeholder: 'mobile number',
id: 'mobile',
},
rules: [
{
......@@ -58,7 +59,7 @@ export default {
message: '请输入手机号码!',
},
{
pattern: /^1[34578]\d{9}$/,
pattern: /^0?1([38][0-9]|4[5-9]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/,
message: '输入手机号码格式错误!',
},
],
......
......@@ -6,7 +6,7 @@ const WxLogin = props => {
let url = `https://open.weixin.qq.com/connect/qrconnect?appid=${props.appid}&scope=${props.scope}&redirect_uri=${props.redirect_uri}&state=${props.state}&login_type=jssdk&self_redirect=${self_redirect}&styletype=${props.styletype || ''}&sizetype=${props.sizetype || ''}&bgcolor=${props.bgcolor|| ''}&rst=${props.rst || ''}`;
url += props.style ? "&stylle=" + props.style: "";
url += props.href ? "&href=" + props.href: "";
return <iframe frameBorder="0" allowTransparency="true" scrolling="no" width="250px" height="250px" src={url}></iframe>
return <iframe frameBorder="0" scrolling="no" width="250px" height="245px" src={url}></iframe>
}
export default WxLogin;
\ No newline at end of file
This diff is collapsed.
......@@ -9,6 +9,7 @@ import React, {
import {
Alert,
Checkbox,
Form,
Modal,
Popover,
} from 'antd';
......@@ -77,33 +78,39 @@ const useRenderQcode = (props) => {
break;
case "Android":
element.push(
<div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}>
<Popover placement="top" content={<QRCode value={firstValue[1].replace(/{ip}/ig, props.ip || window.location.host)}/>}>
<div className={styles['icon-Container']}>
<span className={styles.Android}></span>
<span className={classNames(styles.iconText, styles.AndroidText)}>Android</span>
</div>
</Popover>
</div>
)
if(firstValue[1] && firstValue[1].replace(/ /g, "").length > 0) {
element.push(
<div className={classNames(styles["quickMark-single"], "Android-single")} key={index}>
<Popover placement="top" content={<QRCode value={firstValue[1].replace(/{ip}/ig, props.ip || window.location.host)}/>}>
<div className={styles['icon-Container']}>
<span className={styles.Android}></span>
<span className={classNames(styles.iconText, styles.AndroidText)}>Android</span>
</div>
</Popover>
</div>
)
}
break;
case "iPhone":
element.push(
<div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}>
<Popover placement="top" content={<QRCode value={firstValue[1].replace(/{ip}/ig, props.ip || window.location.host)}/>}>
<div className={styles['icon-Container']}>
<span className={styles.Wechat}></span>
<span className={classNames(styles.iconText, styles.iphoneText)}>iPhone</span>
</div>
</Popover>
</div>
)
if(firstValue[1] && firstValue[1].replace(/ /g, "").length > 0) {
element.push(
<div className={classNames(styles["quickMark-single"], "iphone-single")} key={index}>
<Popover placement="top" content={<QRCode value={firstValue[1].replace(/{ip}/ig, props.ip || window.location.host)}/>}>
<div className={styles['icon-Container']}>
<span className={styles.Wechat}></span>
<span className={classNames(styles.iconText, styles.iphoneText)}>iPhone</span>
</div>
</Popover>
</div>
)
}
break;
default:
if(item && item.replace(/ /g, "").length > 0) {
const indexIndex = element.findIndex(item => item.props.className.indexOf('Android-single') > -1);
element.splice(indexIndex, 1);
element.push(
<div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}>
<div className={classNames(styles["quickMark-single"], "Android-single")} key={index}>
<Popover placement="top" content={<QRCode value={item.replace(/{ip}/ig, props.ip || window.location.host)}/>}>
<div className={styles['icon-Container']}>
<span className={styles.Android}></span>
......@@ -121,8 +128,9 @@ const useRenderQcode = (props) => {
}
const Account = props => {
return (
<LoginForm onSubmit={props.onSubmit}>
<LoginForm onSubmit={props.onSubmit} ref={props.formRef}>
{props.status === 'error' && props.type === 'account' && !props.submitting && (
<LoginMessage content="账户或密码错误" />
)}
......@@ -180,17 +188,34 @@ const IOTQRCode = () => {
}
const Phone = props => {
const [form] = Form.useForm();
return (
<LoginForm onSubmit={props.onSubmit}>
<LoginForm form={form} onSubmit={props.onSubmit}>
{props.status === 'error' && props.type === 'account' && !props.submitting && (
<LoginMessage content="账户或密码错误" />
)}
<Mobile name="phone" placeholder="请输入手机号码" />
<Captcha name="captcha"/>
<div className={styles.captcha}>
获取短信验证码
</div>
<Submit loading={props.submitting}>登录</Submit>
<Mobile name="mobile"
placeholder="请输入手机号码"
/>
<Captcha
name="captcha"
placeholder="请输入短信验证码"
countDown={60}
getCaptchaButtonText=""
getCaptchaSecondText="秒"
autocomplete="off"
rules={[
{
required: true,
message: '请输入短信验证码!',
},
]}/>
{/* <Button type="text" className={styles.captcha} tabIndex="-1"
onClick={(event) => {
props.action.getCaptcha(event, form)
}}>
获取短信验证码</Button> */}
<Submit loading={props.submitting} style={{marginTop: '0px'}}>登录</Submit>
</LoginForm>
)
}
......@@ -201,7 +226,6 @@ const IotComponent = props => {
const handlerType = (type) => {
props.setType(Display[type])
}
return (
<div className={styles.wechatQRcode}>
{
......@@ -228,9 +252,10 @@ const Login = props => {
const sliVerify = useRef();
const verifyModal = useRef();
const loginFormRef = useRef();
const formRef = useRef(null);
const footerRef = useRef();
const [status, setStatus ] = useState('normal');
const [autoLogin, setAutoLogin] = useState(true);
const [autoLogin, setAutoLogin] = useState(false);
const [submitting, setSubmitting] = useState(false);
const [currentDate, setCurrentDate] = useState({});
const [type, setType] = useState('Account');
......@@ -313,6 +338,30 @@ const Login = props => {
setSubmitting(false);
}, [visible])
const renderAddons = useRenderQcode(props.global)
const renderPlatform = () => {
const template = props.global.loginTemplate;
const params = {
fromRef:formRef,
type:type,
setType:setType,
status:status,
submitting:submitting,
autoLogin:autoLogin,
setAutoLogin:setAutoLogin,
action:action,
onSubmit:handleSubmit,
}
switch(template) {
case "DarkCloud.html":
case "Dark.html":
return <Account {...params}/>
case "Dark - IOTMultiLogin.html":
return <IotComponent {...params}/>
default:
return <Account {...params}/>
break;
}
}
return (
<div className={styles.main}>
<video
......@@ -377,14 +426,9 @@ const Login = props => {
<img src="https://panda-water.cn/web4/assets/images/login/dark/login.png" />
</div>
<div className={styles['login-form']}>
<IotComponent
type={type}
setType={setType}
status={status}
submitting={submitting}
autoLogin={autoLogin}
setAutoLogin={setAutoLogin}
onSubmit={handleSubmit}/>
{
renderPlatform()
}
</div>
</div>
</div>
......
......@@ -416,7 +416,6 @@ class Login {
});
}
getUserInfoAndConfig(failCallback, flag, industry) {
debugger
const token = this.globalConfig.token;
const site = Cookies.get('site');
const self = this;
......@@ -467,14 +466,15 @@ class Login {
.then(response => {
try {
if (response && !response.errMsg) {
self.globalConfig.userInfo = Object.assign(
{},
response,
self.globalConfig.userInfo,
{
site: response.site === "" ? "": self.globalConfig.userInfo.site
}
);
self.globalConfig.userInfo = response
// Object.assign(
// {},
// response,
// self.globalConfig.userInfo,
// {
// site: response.site === "" ? "": self.globalConfig.userInfo.site
// }
// );
// Cookies.set('site', this.globalConfig.userInfo.site);
console.log("self.globalConfig.userInfo", self.globalConfig.userInfo)
self.writeLogs();
......@@ -600,6 +600,35 @@ class Login {
})
}
getCaptcha(event, form) {
event.persist();
event.stopPropagation()
// const reg = /^0?1([38][0-9]|4[5-9]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/.test(phone);
// if(!reg.test(phone)) {
// }
try {
setTimeout(() => {
form.validateFields(['mobile'])
}, 1000)
} catch (errorInfo) {
console.log('Failed:', errorInfo);
}
// Http.sendMessVerificationCode({
// phoneNumber: phoneNumber
// }, {
// ignoreSite: true,
// cacheBust: true
// }).then(res => {
// if(res) {
// console.log(res)
// }
// }).catch(error => {
// message.error("获取验证码失败")
// })
}
}
export default Login;
......@@ -7,7 +7,6 @@ let Authorized = RenderAuthorize(getAuthority());
// Reload the rights component
const reloadAuthorized = () => {
debugger
Authorized = RenderAuthorize(getAuthority());
};
......
......@@ -17,7 +17,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
var Authorized = (0, _Authorized["default"])((0, _authority.getAuthority)()); // Reload the rights component
var reloadAuthorized = function reloadAuthorized() {
debugger;
Authorized = (0, _Authorized["default"])((0, _authority.getAuthority)());
};
......
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