Commit d1b94495 by liguokang

feat:

parent 51a9386c
......@@ -2,7 +2,7 @@
* @Author: liguokang
* @Date: 2021-07-15 10:28:10
* @LastEditors: liguokang
* @LastEditTime: 2021-07-15 10:47:25
* @LastEditTime: 2021-07-15 11:32:52
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
......@@ -35,4 +35,4 @@ class LaHeader extends React.Component {
}
// export default withRouter(LaHeader);
const mapStateToProps = ({ city, cityMap }) => ({ city, cityMap });
export default connect(mapStateToProps)(LaHeader);
export default LaHeader;
/*
* @Author: liguokang
* @Date: 2021-07-15 10:28:10
* @LastEditors: liguokang
* @LastEditTime: 2021-07-15 11:35:57
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
import React from 'react';
import Head from 'next/head';
import { changeCity } from '../../redux/action';
......@@ -5,10 +13,7 @@ import { changeCity } from '../../redux/action';
import XMHeader from './XMHeader/laHeader';
import XMFooter from './XMFooter/LaFooter';
import PropTypes from 'prop-types';
import { noXiaoHan } from '@/lib/methods';
import Sidebar from '../base/sidebar';
import { connect } from 'react-redux';
import { getCity } from 'static/js/util';
const Fragment = React.Fragment;
class Layout extends React.Component {
......@@ -28,26 +33,14 @@ class Layout extends React.Component {
componentDidMount() {
if (window.location.pathname !== '/') {
// 关闭个人中心和商标页的小韩
noXiaoHan();
}
getCity(this.props.cityMap, window.location.href).then((res) => {
let cityConfig = res.data;
this.setState({ phone: cityConfig.config.phone });
this.setState({ hostname: cityConfig.hostname });
this.setState({ hmurl: cityConfig.config.hmurl });
this.setState({ cityname: cityConfig.config.city });
sessionStorage.setItem('pgtUrl', cityConfig.config.chatAnchor);
});
}
render() {
let mLink = '';
let hmurl = '';
const { title } = this.props;
let city = '';
if (this.state.cityname) {
city = this.state.cityname;
hmurl = this.state.hmurl;
mLink = this.state.hostname[1];
}
......@@ -57,49 +50,30 @@ class Layout extends React.Component {
<title>{title || `${city} `}</title>
<meta charSet="utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
{/*添加keywords*/}
{this.props.useImgHead && <meta name="referrer" content="no-referrer" />}
<meta name="keywords" content=" " />
<link type="image/x-icon" rel="shortcut icon" href="static/images/favicon.ico" />
<link rel="stylesheet" href="/static/styles/ready.css" />
{/* 部分老页面对antd.css这个文件有依赖,传递useAntd*/}
<meta name="description" content="" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta httpEquiv="mobile-agent" content={'format=xhtml;url=' + mLink} />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link type="image/x-icon" rel="shortcut icon" href="static/images/favicon.ico" />
<link rel="stylesheet" href="/static/styles/ready.css" />
<script async defer src=" " />
<meta httpEquiv="Expires" content="0" />
</Head>
<XMHeader city={this.state.cityname} changeCity={this.props.changeCity} noTop={this.props.noTop} />
{this.props.children}
{this.props.noFooter || (
<Fragment>
<div style={{ width: '100%', height: 258, backgroundColor: '#fff' }}></div>
<footer style={{ position: 'absolute', bottom: 0, width: '100%' }}>
<XMFooter phone={this.state.phone} />
</footer>
</Fragment>
)}
<Sidebar props={{ phone: this.state.phone }} phone={this.state.phone} />
</div>
);
}
}
export default connect(
({ city, cityMap }) => ({ city, cityMap }),
(dispatchEvent) => {
return {
changeCity: (city) => {
dispatchEvent(changeCity(city));
},
};
},
)(Layout);
export default Layout;
......@@ -259,6 +259,11 @@
"resolved": "https://registry.npm.taobao.org/@opentelemetry/context-base/download/@opentelemetry/context-base-0.14.0.tgz",
"integrity": "sha1-xn/CCk2JFEfKGoVdfXD6eaNTMAE="
},
"@types/cookie": {
"version": "0.3.3",
"resolved": "https://registry.nlark.com/@types/cookie/download/@types/cookie-0.3.3.tgz",
"integrity": "sha1-hbx0ungvt6o6UU0RdngysOO8aAM="
},
"@types/hoist-non-react-statics": {
"version": "3.3.1",
"resolved": "https://registry.nlark.com/@types/hoist-non-react-statics/download/@types/hoist-non-react-statics-3.3.1.tgz?cache=0&sync_timestamp=1621241339435&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fhoist-non-react-statics%2Fdownload%2F%40types%2Fhoist-non-react-statics-3.3.1.tgz",
......@@ -273,6 +278,11 @@
"resolved": "https://registry.nlark.com/@types/node/download/@types/node-16.3.2.tgz",
"integrity": "sha1-ZVQygX+DtRrIacLVHdgwX7g0LhY="
},
"@types/object-assign": {
"version": "4.0.30",
"resolved": "https://registry.nlark.com/@types/object-assign/download/@types/object-assign-4.0.30.tgz?cache=0&sync_timestamp=1621242072851&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fobject-assign%2Fdownload%2F%40types%2Fobject-assign-4.0.30.tgz",
"integrity": "sha1-iUk3HVqZ9Dge4PHfCpt6GH4H5lI="
},
"@types/prop-types": {
"version": "15.7.4",
"resolved": "https://registry.nlark.com/@types/prop-types/download/@types/prop-types-15.7.4.tgz",
......@@ -4983,6 +4993,32 @@
"object-assign": "^4.1.1"
}
},
"react-cookie": {
"version": "3.1.2",
"resolved": "https://registry.npm.taobao.org/react-cookie/download/react-cookie-3.1.2.tgz",
"integrity": "sha1-ODXSXTqr+h2rOHmfa95J9QUFgKw=",
"requires": {
"@types/hoist-non-react-statics": "^3.0.1",
"hoist-non-react-statics": "^3.0.0",
"universal-cookie": "^3.1.0"
}
},
"react-cookies": {
"version": "0.1.1",
"resolved": "https://registry.npm.taobao.org/react-cookies/download/react-cookies-0.1.1.tgz",
"integrity": "sha1-KjWAfgT1oT9YzNGp+2ZXRQaHPIg=",
"requires": {
"cookie": "^0.3.1",
"object-assign": "^4.1.1"
},
"dependencies": {
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npm.taobao.org/cookie/download/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
}
}
},
"react-dom": {
"version": "17.0.2",
"resolved": "https://registry.nlark.com/react-dom/download/react-dom-17.0.2.tgz",
......@@ -5995,6 +6031,24 @@
"imurmurhash": "^0.1.4"
}
},
"universal-cookie": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/universal-cookie/download/universal-cookie-3.1.0.tgz",
"integrity": "sha1-oWlkzLFs+PpGO9oevoZIKUUzmtg=",
"requires": {
"@types/cookie": "^0.3.1",
"@types/object-assign": "^4.0.30",
"cookie": "^0.3.1",
"object-assign": "^4.1.0"
},
"dependencies": {
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npm.taobao.org/cookie/download/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
}
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/unpipe/download/unpipe-1.0.0.tgz",
......
......@@ -15,9 +15,11 @@
"next": "10.2.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"lottie-web": "^5.7.1",
"react-cookie": "^3.1.2",
"react-cookies": "^0.1.0",
"react-lazyload": "^2.5.0",
"react-redux": "^7.0.3",
"lottie-web": "^5.7.1",
"redux": "^4.0.1"
},
"devDependencies": {
......
......@@ -2,13 +2,12 @@
* @Author: liguokang
* @Date: 2021-07-15 10:34:53
* @LastEditors: liguokang
* @LastEditTime: 2021-07-15 10:35:22
* @LastEditTime: 2021-07-15 11:32:07
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
import React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
const Fragment = React.Fragment;
export default class MyDocument extends Document {
......
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