From de226a5981cbff207a7afcdf8b9f8957fc82352d Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Wed, 28 May 2025 16:41:21 +0800 Subject: [PATCH] 移动端 --- src/mobile/common/CommobileBill.js | 6 +++--- src/routes/mobile/IndexMobile.js | 14 ++++++++++++-- src/routes/mobile/common/commobileBill.js | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/mobile/common/CommobileBill.js b/src/mobile/common/CommobileBill.js index 4df01df..d671aa9 100644 --- a/src/mobile/common/CommobileBill.js +++ b/src/mobile/common/CommobileBill.js @@ -1,13 +1,13 @@ /* eslint-disable */ import React from 'react'; import weixin from 'weixin-js-sdk'; -import { Flex, Button, ListView, Toast } from 'antd-mobile-v2'; +import { Flex, Button, ListView, Toast } from 'antd-mobile'; import { createForm } from 'rc-form'; -import 'antd-mobile-v2/dist/antd-mobile.css'; +import 'antd-mobile/dist/antd-mobile.css'; import CommobileBase from './CommobileBase'; import CommobileBillEvent from './CommobileBillEvent'; import CommobileViewMaster from './CommobileViewMaster'; -import commonConfig from '../../utils/config'; +import * as commonConfig from '../../utils/config'; import * as commonUtils from '../../utils/utils'; import ShowType from './CommobileComponent'; import CommobileToolBar from './CommobileToolBar'; diff --git a/src/routes/mobile/IndexMobile.js b/src/routes/mobile/IndexMobile.js index 87096c2..9894010 100644 --- a/src/routes/mobile/IndexMobile.js +++ b/src/routes/mobile/IndexMobile.js @@ -2,7 +2,7 @@ import React from "react"; import "antd-mobile-v2/dist/antd-mobile.css"; import { Icon, NavBar, TabBar, Modal } from "antd-mobile-v2"; // import { routerRedux } from 'dva/router'; -import { connect, history } from "umi"; +import { connect, history, useLocation } from "umi"; import * as commonUtils from "@/utils/utils"; import styles from "./IndexMobile.less"; @@ -36,6 +36,7 @@ const alert = Modal.alert; class IndexMobile extends React.Component { constructor(props) { super(props); + this.state = { selectedTab: "scene", title: "现场", @@ -47,6 +48,8 @@ class IndexMobile extends React.Component { } componentWillMount() { history.push("/indexMobile"); // 刷新时更新路由,避免底部按钮和返回按钮错乱显示 + console.log("🚀 ~ IndexMobile ~ componentWillMount ~ this.props:", this.props) + if (this.props.routing && this.props.routing) { const { state } = this.props.routing; if (state) { @@ -103,6 +106,9 @@ class IndexMobile extends React.Component { ]); } else { window.history.back(-1); + setTimeout(() => { + this.props.dispatch({ type: "app/refreshPage" }); + }, 100); } } }; @@ -221,6 +227,10 @@ class IndexMobile extends React.Component { onLeftClick={() => { if (TabBarHidden && navbarIconShow) { window.history.back(-1); + setTimeout(() => { + this.props.dispatch({ type: "app/refreshPage" }); + // history.push(location.pathname); + }, 100); } }} className={styles.iconColor} @@ -404,4 +414,4 @@ class IndexMobile extends React.Component { ); } } -export default connect(({ app, routing }) => ({ app, routing }))(IndexMobile); +export default connect(({ app, routing }) => ({ app, routing, ...history }))(IndexMobile); diff --git a/src/routes/mobile/common/commobileBill.js b/src/routes/mobile/common/commobileBill.js index 5bf808c..b2da9fa 100644 --- a/src/routes/mobile/common/commobileBill.js +++ b/src/routes/mobile/common/commobileBill.js @@ -4,7 +4,7 @@ */ import React from 'react'; -import { connect } from 'dva'; +import { connect } from 'umi'; // import CommobileBillComponent from '../../../mobile/common/CommobileTabBill'; import CommobileBillComponent from '../../../mobile/common/CommobileSubBill'; import * as commonUtils from '../../../utils/utils'; -- libgit2 0.22.2