Commit cf203c9b authored by GuanHua's avatar GuanHua

fix:商城顶部搜索找不到classList报错问题

parent 0fe96d9d
......@@ -6,6 +6,7 @@
:global(.anticon) {
margin-right: 8px;
}
:global(.ant-dropdown-menu-item) {
min-width: 160px;
}
......@@ -17,6 +18,8 @@
height: @layout-header-height;
margin-left: auto;
overflow: hidden;
font-size: 12px;
.action {
display: flex;
align-items: center;
......@@ -24,26 +27,32 @@
padding: 0 12px;
cursor: pointer;
transition: all 0.3s;
> span {
>span {
color: @text-color;
vertical-align: middle;
}
&:hover {
background: @pro-header-hover-bg;
}
&:global(.opened) {
background: @pro-header-hover-bg;
}
}
.search {
padding: 0 12px;
&:hover {
background: transparent;
}
}
.account {
.avatar {
margin: ~'calc((@{layout-header-height} - 24px) / 2)' 0;
margin:~'calc((@{layout-header-height} - 24px) / 2)'0;
margin-right: 8px;
color: @primary-color;
vertical-align: top;
......@@ -55,9 +64,11 @@
.dark {
.action {
color: rgba(255, 255, 255, 0.85);
> span {
>span {
color: rgba(255, 255, 255, 0.85);
}
&:hover,
&:global(.opened) {
background: @primary-color;
......@@ -69,12 +80,15 @@
.dark {
.action {
color: @text-color;
> span {
>span {
color: @text-color;
}
&:hover {
color: rgba(255, 255, 255, 0.85);
> span {
>span {
color: rgba(255, 255, 255, 0.85);
}
}
......@@ -86,20 +100,24 @@
:global(.ant-divider-vertical) {
vertical-align: unset;
}
.name {
display: none;
}
.right {
position: absolute;
top: 0;
right: 12px;
.account {
.avatar {
margin-right: 0;
}
}
.search {
display: none;
}
}
}
}
\ No newline at end of file
......@@ -22,13 +22,15 @@ const Header: React.FC<HeaderPropsType> = (props) => {
let handleScroll = () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const floatSearch = document.getElementById("floatSearch")
if (scrollTop > 500) {
if (!hasClass(floatSearch.classList, 'show')) {
floatSearch.classList.add(styles.show)
}
} else {
if (hasClass(floatSearch.classList, 'show')) {
floatSearch.classList.remove(styles.show)
if (floatSearch) {
if (scrollTop > 500) {
if (!hasClass(floatSearch.classList, 'show')) {
floatSearch.classList.add(styles.show)
}
} else {
if (hasClass(floatSearch.classList, 'show')) {
floatSearch.classList.remove(styles.show)
}
}
}
}
......
......@@ -2,6 +2,7 @@ import React from 'react'
import { EnvironmentOutlined, CaretDownOutlined } from '@ant-design/icons'
import { inject, observer } from 'mobx-react'
import cx from 'classnames'
import { Link } from 'umi'
import ImageBox from '@/components/ImageBox'
import defaultAvatar from './imgs/default_avatar.png'
import AccountSafeIcon from './imgs/account_safe_icon.png'
......@@ -107,7 +108,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => {
)
}
<li className={styles.topbar_menu_item}>
<a href="/memberCenter/home">会员中心</a>
<Link to="/memberCenter/home">会员中心</Link>
</li>
<li className={styles.topbar_menu_item}>我的消息</li>
<li className={styles.topbar_menu_item}>
......
......@@ -55,9 +55,11 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
}
useEffect(() => {
let body = document.getElementsByTagName('body')[0];
if (!isEmpty(mallTemplateInfo)) {
let body = document.getElementsByTagName('body')[0];
body.className = mallTemplateInfo.fileName ? `theme-mall-${mallTemplateInfo.fileName}` : templateName;
} else {
body.className = templateName
}
}, [mallTemplateInfo])
......
......@@ -170,6 +170,11 @@ const PurchaseOnline: React.FC<PurchaseOnlinePropsType> = (props) => {
}
}
const handlePageChange = (page) => {
setCurrent(page)
fetchCommodityList(page)
}
return (
<div className={styles.purchaseOnline}>
<div className={styles.mall_container}>
......@@ -225,7 +230,7 @@ const PurchaseOnline: React.FC<PurchaseOnlinePropsType> = (props) => {
<>
<CommodityList showType={showType} commodityList={commodityList} layoutType={layoutType} />
<div className={styles.pagination_wrap}>
<Pagination showQuickJumper showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} />
<Pagination showQuickJumper showSizeChanger={false} onChange={handlePageChange} current={current} total={totalCount} pageSize={pageSize} />
</div>
</>
)
......
......@@ -13,8 +13,10 @@ const LoginWrap: React.FC = () => {
const { redirect } = history.location.query
const [validFrame, setValidFrame] = useState(false)
const [validButton, setValidButton] = useState(false)
const [loginLoading, setLoginLoading] = useState<boolean>(false)
const finish = (value: any) => {
setLoginLoading(true)
PublicApi.postMemberLogin(value).then(res => {
const { data, code } = res
if (code === 1000) {
......@@ -28,7 +30,11 @@ const LoginWrap: React.FC = () => {
} else {
window.location.replace('/memberCenter/home')
}
} else {
setLoginLoading(false)
}
}).catch(() => {
setLoginLoading(false)
})
}
......@@ -89,7 +95,7 @@ const LoginWrap: React.FC = () => {
</Form.Item>)
}
<Form.Item>
<Button type='primary' size='large' htmlType='submit' block>登录</Button>
<Button type='primary' loading={loginLoading} size='large' htmlType='submit' block>登录</Button>
</Form.Item>
</Form>
}
......
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