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

fix: fix role

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