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

add noMatch

parent 9a582b20
...@@ -4,9 +4,11 @@ module.exports = { ...@@ -4,9 +4,11 @@ module.exports = {
dev: { dev: {
'/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: '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',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*' 'Access-Control-Allow-Origin': '*'
...@@ -17,8 +19,10 @@ module.exports = { ...@@ -17,8 +19,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: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*' 'Access-Control-Allow-Origin': '*'
...@@ -26,6 +30,20 @@ module.exports = { ...@@ -26,6 +30,20 @@ module.exports = {
pathRewrite: { pathRewrite: {
'/cityinterface': '/cityinterface' '/cityinterface': '/cityinterface'
} }
},
'/Publish': {
// 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',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
pathRewrite: {
'/Publish': '/Publish'
}
} }
} }
}; };
\ No newline at end of file
...@@ -2,9 +2,11 @@ module.exports = { ...@@ -2,9 +2,11 @@ module.exports = {
dev: { dev: {
'/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: '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',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
...@@ -15,8 +17,10 @@ module.exports = { ...@@ -15,8 +17,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: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
...@@ -25,5 +29,19 @@ module.exports = { ...@@ -25,5 +29,19 @@ module.exports = {
'/cityinterface': '/cityinterface', '/cityinterface': '/cityinterface',
}, },
}, },
'/Publish': {
// 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',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/Publish': '/Publish',
},
}
}, },
}; };
...@@ -23,8 +23,8 @@ class HttpRequest { ...@@ -23,8 +23,8 @@ class HttpRequest {
// } // }
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
if (!config.ignoreSite && this.getSite()) { if ( (!config.ignoreSite && this.getSite(config)) && (Array.isArray(window.globalConfig.userInfo.Groups) && (Array.isArray(window.globalConfig.userInfo.Industries) && window.globalConfig.userInfo.Industries.length > 0)) ) {
config.headers['civ-site'] = this.getSite(); config.headers['civ-site'] = this.getSite(config);
// config.headers['civ-site'] = "192_168_19_105_site_c8de50fc"; // config.headers['civ-site'] = "192_168_19_105_site_c8de50fc";
} }
this.removePending(config); //在一个ajax发送前执行一下取消操作 this.removePending(config); //在一个ajax发送前执行一下取消操作
...@@ -118,13 +118,8 @@ class HttpRequest { ...@@ -118,13 +118,8 @@ class HttpRequest {
pending.splice(p, 1); //把这条记录从数组中移除 pending.splice(p, 1); //把这条记录从数组中移除
} }
}; };
getSite() { getSite(config) {
return ( return window.globalConfig && window.globalConfig.userInfo && window.globalConfig.userInfo.site && !config.ignoreSite ? window.globalConfig.userInfo.site: ""
(window.globalConfig &&
window.globalConfig.userInfo &&
window.globalConfig.userInfo.site) ||
''
);
} }
get(url, params, config = {}) { get(url, params, config = {}) {
return this.requestApi.get(url, { ...config, params }); return this.requestApi.get(url, { ...config, params });
......
...@@ -26,7 +26,7 @@ import { actionCreators } from './containers/App/store'; ...@@ -26,7 +26,7 @@ import { actionCreators } from './containers/App/store';
import { initMicroApps } from './micro'; import { initMicroApps } from './micro';
import history from './utils/history'; import history from './utils/history';
const namespace = `__PANDA_STORE__${location.hostname}}` const namespace = `__PANDA_STORE__${location.hostname}`
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
window.Http = Http; window.Http = Http;
const initialState = Immutable.Map(); const initialState = Immutable.Map();
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
width: 280px; width: 280px;
min-width: 120px; min-width: 120px;
max-width: 280px; max-width: 280px;
border-radius: 20px;
} }
:global(.anticon-search) { :global(.anticon-search) {
color: #888888; color: #888888;
......
...@@ -13,10 +13,8 @@ import { dyRoutes } from '../../routes/config'; ...@@ -13,10 +13,8 @@ import { dyRoutes } from '../../routes/config';
function App(props) { function App(props) {
return ( return (
<> <>
<Helmet <Helmet title={`${props.global && props.global.title}`}>
titleTemplate={`%s - ${props.global && props.global.title}`} <title>{`${props.global && props.global.title}`}</title>
defaultTitle={`${props.global && props.global.title}`}
>
<link <link
rel="shortcut icon" rel="shortcut icon"
href={`https://panda-water.cn/web4/${props.global && href={`https://panda-water.cn/web4/${props.global &&
......
...@@ -77,7 +77,7 @@ var initMicroApps = function initMicroApps(loader) { ...@@ -77,7 +77,7 @@ var initMicroApps = function initMicroApps(loader) {
scopedCSS: true, scopedCSS: true,
getPublicPath: window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__, getPublicPath: window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__,
excludeAssetFilter: function excludeAssetFilter(url) { excludeAssetFilter: function excludeAssetFilter(url) {
return url.indexOf('webapi.amap.com') !== -1 || url.indexOf('api.map.baidu.com') !== -1 || url.indexOf('map.baidu.com') !== -1 || 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; return url.indexOf('webapi.amap.com') !== -1 || url.indexOf('api.map.baidu.com') !== -1 || url.indexOf('map.baidu.com') !== -1 || 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 || url.indexOf('hm.baidu.com') !== -1 || url.indexOf('https://maponline0.bdimg.com') !== -1 || url.indexOf('https://maponline1.bdimg.com') !== -1 || url.indexOf('https://maponline2.bdimg.com') !== -1 || url.indexOf('https://maponline3.bdimg.com') !== -1 || url.indexOf('https://api.map.baidu.com/getscript') !== -1;
} }
}); });
(0, _qiankun.runAfterFirstMounted)(function () { (0, _qiankun.runAfterFirstMounted)(function () {
...@@ -102,7 +102,7 @@ var defaultApp = function defaultApp() { ...@@ -102,7 +102,7 @@ var defaultApp = function defaultApp() {
if (config && config.token) { if (config && config.token) {
// const startWith = config.homepage ? config.homepage.split('/') : []; // const startWith = config.homepage ? config.homepage.split('/') : [];
var basePath = _constants.FILTER_FOLER_REG.test(config.homepage) ? 'civweb4' : 'civweb'; var basePath = _constants.FILTER_FOLER_REG.test(config.homepage) ? 'civweb4' : 'civweb4';
(0, _qiankun.setDefaultMountApp)("/".concat(_package["default"].name.toLocaleLowerCase(), "/").concat(basePath, "/?client=").concat(config.client) // config.homepage (0, _qiankun.setDefaultMountApp)("/".concat(_package["default"].name.toLocaleLowerCase(), "/").concat(basePath, "/?client=").concat(config.client) // config.homepage
// ? `/${pkg.name.toLocaleLowerCase()}/${basePath}/${config.homepage}` // ? `/${pkg.name.toLocaleLowerCase()}/${basePath}/${config.homepage}`
// : `/${pkg.name.toLocaleLowerCase()}/${basePath}/?client=${ // : `/${pkg.name.toLocaleLowerCase()}/${basePath}/?client=${
......
...@@ -27,8 +27,9 @@ ul, ...@@ -27,8 +27,9 @@ ul,
ol { ol {
list-style: none; list-style: none;
} }
a { body a {
text-decoration: underline; text-decoration: none;
color: inherit;
// color: #fff!important; // color: #fff!important;
} }
......
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
Popover, Popover,
Radio, Radio,
Result, Result,
Spin,
} from 'antd'; } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
...@@ -74,11 +75,12 @@ const menuExtraRender = currentRoutes => { ...@@ -74,11 +75,12 @@ const menuExtraRender = currentRoutes => {
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
overflow: 'hidden', overflow: 'hidden',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
color: 'rgba(255, 255, 255, 0.65)'
}} }}
> >
{currentRoutes && currentRoutes.name} {currentRoutes && currentRoutes.name}
</span> </span>
<MenuFoldOutlined onClick={() => setToggleSystem(!toggleSystem)} /> <MenuFoldOutlined onClick={() => setToggleSystem(!toggleSystem)} style={{color: '#888'}}/>
</a> </a>
); );
} }
...@@ -90,6 +92,9 @@ const menuExtraRender = currentRoutes => { ...@@ -90,6 +92,9 @@ const menuExtraRender = currentRoutes => {
}; };
const HOT = ["HOT", "县", "市", "New"] const HOT = ["HOT", "县", "市", "New"]
const StationsItem = (item, action) => { const StationsItem = (item, action) => {
const changeGroup = (event, data) => {
action.changeGroup && action.changeGroup(event, data)
}
return ( return (
<li key={item.groupID} style={{marginRight: `${item.style.marginRight}px`}}> <li key={item.groupID} style={{marginRight: `${item.style.marginRight}px`}}>
<a className={classNames(styles.city_select, styles.showTip)} <a className={classNames(styles.city_select, styles.showTip)}
...@@ -97,7 +102,7 @@ const StationsItem = (item, action) => { ...@@ -97,7 +102,7 @@ const StationsItem = (item, action) => {
index={item.promoteIndex} index={item.promoteIndex}
data-GroupID={item.groupID} data-GroupID={item.groupID}
data-Site={item.site} data-Site={item.site}
style={{fontSize: '13px'}} onClick={action.changeGroup.bind(action)}> style={{fontSize: '13px'}} onClick={(event) => changeGroup(event, item)}>
{item.groupName} {item.groupName}
{ {
item.promoteTip && HOT.includes(item.promoteTip) && ( item.promoteTip && HOT.includes(item.promoteTip) && (
...@@ -121,7 +126,6 @@ const Stations = props => { ...@@ -121,7 +126,6 @@ const Stations = props => {
const handleClick = (event, link) => { const handleClick = (event, link) => {
event.preventDefault(); event.preventDefault();
console.log(link);
} }
const handleTabChange = (event) => { const handleTabChange = (event) => {
...@@ -143,39 +147,39 @@ const Stations = props => { ...@@ -143,39 +147,39 @@ const Stations = props => {
options={optionsWith} options={optionsWith}
optionType="button" optionType="button"
buttonStyle="solid" size="small" value={defaultTab} onChange={handleTabChange} style={{marginTop: '6px'}}/> buttonStyle="solid" size="small" value={defaultTab} onChange={handleTabChange} style={{marginTop: '6px'}}/>
<div style={{maxWidth: '520px'}}> <div style={{maxWidth: '520px', position: 'relative'}}>
{ {
defaultTab === 'site' ? ( defaultTab === 'site' ? (
<div className={classNames(styles.city_pane, styles.station_container)} ref={cityPane}> <div className={classNames(styles.city_pane, styles.station_container)} ref={cityPane}>
<Anchor affix={false} onClick={handleClick} targetOffset={targetOffset} getContainer={() => cityContent.current}> <Anchor affix={false} onClick={handleClick} targetOffset={targetOffset} getContainer={() => cityContent.current}>
<ul className={styles.py}> <ul className={styles.py}>
{ {
props.data.siteCityList.letters props.data.siteCityList.letters
} }
</ul> </ul>
<div className={styles.cityContent} style={{height: '335px'}} ref={cityContent}> <div className={styles.cityContent} style={{height: '335px'}} ref={cityContent}>
{ {
props.data.siteCityList.content props.data.siteCityList.content
} }
</div> </div>
</Anchor> </Anchor>
</div> </div>
): ( ): (
<div className="city_pane city_container"> <div className="city_pane city_container">
{ {
props.data.citySelector props.data.citySelector
} }
</div> </div>
) )
} }
<Spin spinning={props.loading}></Spin>
</div> </div>
</> </>
) )
} }
const renderTitle = (title, action, data) => { const renderTitle = (title, action, data, loading, setLoading) => {
console.log("renderTitle", data)
return { return {
render: ( render: (
<> <>
...@@ -185,7 +189,7 @@ const renderTitle = (title, action, data) => { ...@@ -185,7 +189,7 @@ const renderTitle = (title, action, data) => {
<div className={styles.cityContent}> <div className={styles.cityContent}>
<Popover placement="bottomLeft" <Popover placement="bottomLeft"
trigger="click" trigger="click"
content={<Stations data={data} action={action}/>} content={<Stations data={data} action={action} loading={loading} setLoading={setLoading}/>}
arrowPointAtCenter arrowPointAtCenter
overlayClassName={styles.stationsWrapper}> overlayClassName={styles.stationsWrapper}>
{ {
...@@ -213,7 +217,6 @@ const renderTitle = (title, action, data) => { ...@@ -213,7 +217,6 @@ const renderTitle = (title, action, data) => {
}; };
}; };
const BasicLayout = props => { const BasicLayout = props => {
console.log("props", props)
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
const { const {
children, children,
...@@ -222,6 +225,7 @@ const BasicLayout = props => { ...@@ -222,6 +225,7 @@ 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);
...@@ -233,6 +237,7 @@ const BasicLayout = props => { ...@@ -233,6 +237,7 @@ const BasicLayout = props => {
const [cityData, setCityData] = useState({}); const [cityData, setCityData] = useState({});
const menuDataRef = useRef([]); const menuDataRef = useRef([]);
const [pageLoading, setPageLoading] = useState(true) const [pageLoading, setPageLoading] = useState(true)
const [siteLoading, setSiteLoading] = useState(false)
const handleMenuCollapse = collapse => { const handleMenuCollapse = collapse => {
setCollapse(collapse); setCollapse(collapse);
}; };
...@@ -240,7 +245,7 @@ const BasicLayout = props => { ...@@ -240,7 +245,7 @@ const BasicLayout = props => {
const isMounted = useMountedState(); const isMounted = useMountedState();
const [siteAction, setSiteAction] = useState(() => { const [siteAction, setSiteAction] = useState(() => {
return new Site(props); return new Site(props, setSiteLoading);
}); });
matchRoutes(props.route.routes, props.location.pathname); matchRoutes(props.route.routes, props.location.pathname);
...@@ -282,12 +287,10 @@ const BasicLayout = props => { ...@@ -282,12 +287,10 @@ const BasicLayout = props => {
}; };
const handleLogo = event => { const handleLogo = event => {
setTimeout(() => { props.global.userInfo.site ? history.replace(`/industry`): null;
history.replace(`/industry`);
}, 300);
}; };
const headerContentRender = renderTitle(props.global.title, siteAction, cityData); const headerContentRender = renderTitle(props.global.title, siteAction, cityData, siteLoading, setSiteLoading);
const others = { const others = {
history: props.history, history: props.history,
location: props.location, location: props.location,
...@@ -299,7 +302,7 @@ const BasicLayout = props => { ...@@ -299,7 +302,7 @@ const BasicLayout = props => {
<ProLayout <ProLayout
logo="http://panda-water.cn/web4/assets/images/logo/单独图案-白色.svg" logo="http://panda-water.cn/web4/assets/images/logo/单独图案-白色.svg"
siderWidth="145px" siderWidth="145px"
title="" title={props.global && props.global.title}
fixSiderbar={true} fixSiderbar={true}
onMenuHeaderClick={event => handleLogo(event)} onMenuHeaderClick={event => handleLogo(event)}
onCollapse={collapse => handleMenuCollapse(collapse)} onCollapse={collapse => handleMenuCollapse(collapse)}
......
...@@ -17,12 +17,13 @@ const { Link } = Anchor; ...@@ -17,12 +17,13 @@ const { Link } = Anchor;
const ERR_OK = '0000' const ERR_OK = '0000'
class Site { class Site {
constructor(props) { constructor(props, callback) {
this.weatherCity = null this.weatherCity = null
this.globalConfig = props.global this.globalConfig = props.global
this.updateConfig = props.updateConfig this.updateConfig = props.updateConfig
this.props = props this.props = props
this.init() this.init()
this.setLoading = callback
} }
init(config) { init(config) {
...@@ -284,7 +285,9 @@ class Site { ...@@ -284,7 +285,9 @@ class Site {
const loginSite = this.getLocalSites() const loginSite = this.getLocalSites()
loginSite[token] = site loginSite[token] = site
localStorage.setItem("loginSite", JSON.stringify(loginSite)); localStorage.setItem("loginSite", JSON.stringify(loginSite));
const self = this;
const login = new Login(this.props, () => { const login = new Login(this.props, () => {
self.setLoading(false)
window.location.reload(); window.location.reload();
}); });
login.init() login.init()
...@@ -296,6 +299,7 @@ class Site { ...@@ -296,6 +299,7 @@ class Site {
event.persist(); event.persist();
const site = item ? item.site : event.target.dataset.site const site = item ? item.site : event.target.dataset.site
const loginName = this.globalConfig.userInfo.loginName const loginName = this.globalConfig.userInfo.loginName
this.setLoading(true)
Http.generateTokenQuick({ Http.generateTokenQuick({
loginName: loginName loginName: loginName
}, { }, {
......
...@@ -190,6 +190,7 @@ ...@@ -190,6 +190,7 @@
} }
} }
} }
} }
.city_pane { .city_pane {
// padding: 10px; // padding: 10px;
...@@ -247,6 +248,7 @@ ...@@ -247,6 +248,7 @@
flex-wrap: wrap; flex-wrap: wrap;
flex: 1; flex: 1;
font-size: 12px; font-size: 12px;
padding: 0!important;
li { li {
margin-right: 8px; margin-right: 8px;
margin-bottom: 6px; margin-bottom: 6px;
...@@ -255,5 +257,15 @@ ...@@ -255,5 +257,15 @@
} }
} }
} }
:global(.ant-spin) {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
} }
\ No newline at end of file :global(.ant-pro-basicLayout .ant-pro-sider-logo h1) {
display: none;
}
\ No newline at end of file
...@@ -113,7 +113,14 @@ export const initMicroApps = loader => { ...@@ -113,7 +113,14 @@ export const initMicroApps = loader => {
url.indexOf('mt0.google.cn') !== -1 || url.indexOf('mt0.google.cn') !== -1 ||
url.indexOf('mt1.google.cn') !== -1 || url.indexOf('mt1.google.cn') !== -1 ||
url.indexOf('mt2.google.cn') !== -1 || url.indexOf('mt2.google.cn') !== -1 ||
url.indexOf('mt3.google.cn') !== -1 url.indexOf('mt3.google.cn') !== -1 ||
url.indexOf('hm.baidu.com') !== -1 ||
url.indexOf('https://maponline0.bdimg.com') !== -1 ||
url.indexOf('https://maponline1.bdimg.com') !== -1 ||
url.indexOf('https://maponline2.bdimg.com') !== -1 ||
url.indexOf('https://maponline3.bdimg.com') !== -1 ||
url.indexOf('https://api.map.baidu.com/getscript') !== -1
); );
}, },
}); });
...@@ -137,7 +144,7 @@ export const defaultApp = () => { ...@@ -137,7 +144,7 @@ export const defaultApp = () => {
// const startWith = config.homepage ? config.homepage.split('/') : []; // const startWith = config.homepage ? config.homepage.split('/') : [];
const basePath = FILTER_FOLER_REG.test(config.homepage) const basePath = FILTER_FOLER_REG.test(config.homepage)
? 'civweb4' ? 'civweb4'
: 'civweb'; : 'civweb4';
setDefaultMountApp( setDefaultMountApp(
`/${pkg.name.toLocaleLowerCase()}/${basePath}/?client=${config.client}`, `/${pkg.name.toLocaleLowerCase()}/${basePath}/?client=${config.client}`,
// config.homepage // config.homepage
......
...@@ -55,11 +55,11 @@ export default { ...@@ -55,11 +55,11 @@ export default {
rules: [ rules: [
{ {
required: true, required: true,
message: 'Please enter mobile number!', message: '请输入手机号码!',
}, },
{ {
pattern: /^1\d{10}$/, pattern: /^1[34578]\d{9}$/,
message: 'Wrong mobile number format!', message: '输入手机号码格式错误!',
}, },
], ],
}, },
...@@ -67,12 +67,12 @@ export default { ...@@ -67,12 +67,12 @@ export default {
props: { props: {
size: 'large', size: 'large',
prefix: <MailTwoTone className={styles.prefixIcon} />, prefix: <MailTwoTone className={styles.prefixIcon} />,
placeholder: 'captcha', placeholder: '请输入短信验证码',
}, },
rules: [ rules: [
{ {
required: true, required: true,
message: 'Please enter Captcha!', message: '请输入短信验证码',
}, },
], ],
}, },
......
import React from 'react';
const WxLogin = props => {
let self_redirect = "default";
props.self_redirect === !0 ? self_redirect= "true": props.self_redirect === !1 && (self_redirect = "false");
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>
}
export default WxLogin;
\ No newline at end of file
This diff is collapsed.
import 'kit_utils/lib/format';
import React, { import React, {
useEffect, useEffect,
useRef, useRef,
...@@ -11,6 +13,7 @@ import { ...@@ -11,6 +13,7 @@ import {
Popover, Popover,
} from 'antd'; } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { encode } from 'js-base64';
import { dom } from 'kit_utils'; import { dom } from 'kit_utils';
import QRCode from 'qrcode.react'; import QRCode from 'qrcode.react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
...@@ -18,11 +21,16 @@ import { withRouter } from 'react-router-dom'; ...@@ -18,11 +21,16 @@ import { withRouter } from 'react-router-dom';
import { actionCreators } from '../../../containers/App/store'; import { actionCreators } from '../../../containers/App/store';
import LoginForm from './components/Login'; import LoginForm from './components/Login';
import WxLogin from './components/WxLogin';
import LoginAction from './login'; import LoginAction from './login';
import styles from './style.less'; import styles from './style.less';
const { UserName, Password, Submit } = LoginForm; const { UserName, Password, Mobile,Captcha, Submit } = LoginForm;
const Display = {
Account: "Account",
WeChart: "WeChart",
Mobile: "Mobile"
}
const LoginMessage = ({ content }) => ( const LoginMessage = ({ content }) => (
<Alert <Alert
style={{ style={{
...@@ -67,6 +75,7 @@ const useRenderQcode = (props) => { ...@@ -67,6 +75,7 @@ const useRenderQcode = (props) => {
</div> </div>
) )
break; break;
case "Android": case "Android":
element.push( element.push(
<div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}> <div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}>
...@@ -82,7 +91,6 @@ const useRenderQcode = (props) => { ...@@ -82,7 +91,6 @@ const useRenderQcode = (props) => {
case "iPhone": case "iPhone":
element.push( element.push(
<div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}> <div className={classNames(styles["quickMark-single"], "miniIOT-single")} key={index}>
{/* <img src="https://panda-water.cn/web4/assets/images/智联小程序二维码.jpg" class="QuickMark-cont"/> */}
<Popover placement="top" content={<QRCode value={firstValue[1].replace(/{ip}/ig, props.ip || window.location.host)}/>}> <Popover placement="top" content={<QRCode value={firstValue[1].replace(/{ip}/ig, props.ip || window.location.host)}/>}>
<div className={styles['icon-Container']}> <div className={styles['icon-Container']}>
<span className={styles.Wechat}></span> <span className={styles.Wechat}></span>
...@@ -112,6 +120,105 @@ const useRenderQcode = (props) => { ...@@ -112,6 +120,105 @@ const useRenderQcode = (props) => {
} }
const Account = props => {
return (
<LoginForm onSubmit={props.onSubmit}>
{props.status === 'error' && props.type === 'account' && !props.submitting && (
<LoginMessage content="账户或密码错误" />
)}
<UserName
name="userName"
placeholder="请输入你的用户名"
rules={[
{
required: true,
message: '请输入用户名!',
},
]}
/>
<Password
name="password"
placeholder="请输入你的密码"
rules={[
{
required: true,
message: '请输入密码!',
},
]}
/>
<div>
<Checkbox
checked={props.autoLogin}
onChange={e => props.setAutoLogin(e.target.checked)}
>
下次自动登录
</Checkbox>
</div>
<Submit loading={props.submitting}>登录</Submit>
</LoginForm>
)
}
const IOTQRCode = () => {
const REDIRECT_URI = "https://panda-water.com/web4/?client=city";
const APPID = "wx8bfa8b02cb95010b"
const [rstate, setRstate] = useState(() => {
return encode("panda_" + Math.round(Math.random() * 10000 + Date.now()).toString(16));
})
const props = Object.assign({}, {
self_redirect: false,
scope: "snsapi_login",
appid: APPID,
state: rstate,
redirect_uri: REDIRECT_URI,
href: "https://panda-water.cn/web4/styles/PandaIOTQrcodeStyle.css"
})
return (
<WxLogin {...props}/>
)
}
const Phone = props => {
return (
<LoginForm 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>
</LoginForm>
)
}
const IotComponent = props => {
const handlerType = (type) => {
props.setType(Display[type])
}
return (
<div className={styles.wechatQRcode}>
{
props.type === Display["Account"] ?
<Account {...props}/> :
props.type === Display["WeChart"] ?
<IOTQRCode {...props}/>: props.type === Display["Mobile"] ? <Phone {...props}/>: <Account {...props}/>
}
<div className={styles.loginDisplay}>
<a onClick={() => handlerType('Account')} style={{display: props.type === Display["Account"] ? 'none': 'block' }}>账号密码登录</a>
<a onClick={() => handlerType('WeChart')} style={{display: props.type === Display["WeChart"] ? 'none': 'block' }}>微信扫码登录</a>
<a onClick={() => handlerType('Mobile')} style={{display: props.type === Display["Mobile"] ? 'none': 'block' }}>手机验证码登录</a>
</div>
</div>
)
}
const Login = props => { const Login = props => {
const videoRef = useRef(); const videoRef = useRef();
...@@ -126,7 +233,7 @@ const Login = props => { ...@@ -126,7 +233,7 @@ const Login = props => {
const [autoLogin, setAutoLogin] = useState(true); const [autoLogin, setAutoLogin] = useState(true);
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');
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [action, setAction] = useState(() => { const [action, setAction] = useState(() => {
return new LoginAction(props, setVisible) return new LoginAction(props, setVisible)
...@@ -169,7 +276,7 @@ const Login = props => { ...@@ -169,7 +276,7 @@ const Login = props => {
setCurrentDate({ setCurrentDate({
time: time, time: time,
dayofweek: weekday[date.getDay()], dayofweek: weekday[date.getDay()],
date: date.pattern('yyyy/mm/dd'), date: date.pattern('yyyy/MM/dd'),
}); });
}, 1000); }, 1000);
return () => { return () => {
...@@ -206,7 +313,6 @@ const Login = props => { ...@@ -206,7 +313,6 @@ const Login = props => {
setSubmitting(false); setSubmitting(false);
}, [visible]) }, [visible])
const renderAddons = useRenderQcode(props.global) const renderAddons = useRenderQcode(props.global)
return ( return (
<div className={styles.main}> <div className={styles.main}>
<video <video
...@@ -271,44 +377,14 @@ const Login = props => { ...@@ -271,44 +377,14 @@ 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']}>
<LoginForm <IotComponent
activeKey={type} type={type}
onTabChange={setType} setType={setType}
onSubmit={handleSubmit} status={status}
> submitting={submitting}
{status === 'error' && type === 'account' && !submitting && ( autoLogin={autoLogin}
<LoginMessage content="账户或密码错误" /> setAutoLogin={setAutoLogin}
)} onSubmit={handleSubmit}/>
<UserName
name="userName"
placeholder="请输入你的用户名"
rules={[
{
required: true,
message: '请输入用户名!',
},
]}
/>
<Password
name="password"
placeholder="请输入你的密码"
rules={[
{
required: true,
message: '请输入密码!',
},
]}
/>
<div>
<Checkbox
checked={autoLogin}
onChange={e => setAutoLogin(e.target.checked)}
>
下次自动登录
</Checkbox>
</div>
<Submit loading={submitting}>登录</Submit>
</LoginForm>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -416,6 +416,7 @@ class Login { ...@@ -416,6 +416,7 @@ 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;
...@@ -432,7 +433,7 @@ class Login { ...@@ -432,7 +433,7 @@ class Login {
if (userInfo) { if (userInfo) {
self.globalConfig.userInfo = { self.globalConfig.userInfo = {
site: userInfo.site ? userInfo.site : null, site: userInfo.site ? userInfo.site : "",
Groups: self.globalConfig.userInfo.Groups, Groups: self.globalConfig.userInfo.Groups,
}; };
_industrySite = userInfo.site ? userInfo.site : null; _industrySite = userInfo.site ? userInfo.site : null;
...@@ -469,10 +470,13 @@ class Login { ...@@ -469,10 +470,13 @@ class Login {
self.globalConfig.userInfo = Object.assign( self.globalConfig.userInfo = Object.assign(
{}, {},
response, response,
this.globalConfig.userInfo, self.globalConfig.userInfo,
{
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)
self.writeLogs(); self.writeLogs();
self.getIndustry(flag, token, industry); self.getIndustry(flag, token, industry);
} else { } else {
......
...@@ -243,5 +243,28 @@ ...@@ -243,5 +243,28 @@
margin-top: 24px; margin-top: 24px;
} }
} }
.wechatQRcode {
width: 250px;
height: 220px;
margin: 0 15px;
}
.loginDisplay {
width: 100%;
display: flex;
justify-content: space-between;
font-size: 12px;
a {
&:hover {
color: @primary-color;
transition: all .3s ease-in-out;
}
}
}
.captcha {
color: @primary-6;
font-weight: 400;
cursor: pointer;
font-size: 12px;
}
} }
"use strict";
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment