Commit de226a5981cbff207a7afcdf8b9f8957fc82352d

Authored by 陈鑫涛
1 parent b733e5d2

移动端

src/mobile/common/CommobileBill.js
1 /* eslint-disable */ 1 /* eslint-disable */
2 import React from 'react'; 2 import React from 'react';
3 import weixin from 'weixin-js-sdk'; 3 import weixin from 'weixin-js-sdk';
4 -import { Flex, Button, ListView, Toast } from 'antd-mobile-v2'; 4 +import { Flex, Button, ListView, Toast } from 'antd-mobile';
5 import { createForm } from 'rc-form'; 5 import { createForm } from 'rc-form';
6 -import 'antd-mobile-v2/dist/antd-mobile.css'; 6 +import 'antd-mobile/dist/antd-mobile.css';
7 import CommobileBase from './CommobileBase'; 7 import CommobileBase from './CommobileBase';
8 import CommobileBillEvent from './CommobileBillEvent'; 8 import CommobileBillEvent from './CommobileBillEvent';
9 import CommobileViewMaster from './CommobileViewMaster'; 9 import CommobileViewMaster from './CommobileViewMaster';
10 -import commonConfig from '../../utils/config'; 10 +import * as commonConfig from '../../utils/config';
11 import * as commonUtils from '../../utils/utils'; 11 import * as commonUtils from '../../utils/utils';
12 import ShowType from './CommobileComponent'; 12 import ShowType from './CommobileComponent';
13 import CommobileToolBar from './CommobileToolBar'; 13 import CommobileToolBar from './CommobileToolBar';
src/routes/mobile/IndexMobile.js
@@ -2,7 +2,7 @@ import React from "react"; @@ -2,7 +2,7 @@ import React from "react";
2 import "antd-mobile-v2/dist/antd-mobile.css"; 2 import "antd-mobile-v2/dist/antd-mobile.css";
3 import { Icon, NavBar, TabBar, Modal } from "antd-mobile-v2"; 3 import { Icon, NavBar, TabBar, Modal } from "antd-mobile-v2";
4 // import { routerRedux } from 'dva/router'; 4 // import { routerRedux } from 'dva/router';
5 -import { connect, history } from "umi"; 5 +import { connect, history, useLocation } from "umi";
6 6
7 import * as commonUtils from "@/utils/utils"; 7 import * as commonUtils from "@/utils/utils";
8 import styles from "./IndexMobile.less"; 8 import styles from "./IndexMobile.less";
@@ -36,6 +36,7 @@ const alert = Modal.alert; @@ -36,6 +36,7 @@ const alert = Modal.alert;
36 class IndexMobile extends React.Component { 36 class IndexMobile extends React.Component {
37 constructor(props) { 37 constructor(props) {
38 super(props); 38 super(props);
  39 +
39 this.state = { 40 this.state = {
40 selectedTab: "scene", 41 selectedTab: "scene",
41 title: "现场", 42 title: "现场",
@@ -47,6 +48,8 @@ class IndexMobile extends React.Component { @@ -47,6 +48,8 @@ class IndexMobile extends React.Component {
47 } 48 }
48 componentWillMount() { 49 componentWillMount() {
49 history.push("/indexMobile"); // 刷新时更新路由,避免底部按钮和返回按钮错乱显示 50 history.push("/indexMobile"); // 刷新时更新路由,避免底部按钮和返回按钮错乱显示
  51 + console.log("🚀 ~ IndexMobile ~ componentWillMount ~ this.props:", this.props)
  52 +
50 if (this.props.routing && this.props.routing) { 53 if (this.props.routing && this.props.routing) {
51 const { state } = this.props.routing; 54 const { state } = this.props.routing;
52 if (state) { 55 if (state) {
@@ -103,6 +106,9 @@ class IndexMobile extends React.Component { @@ -103,6 +106,9 @@ class IndexMobile extends React.Component {
103 ]); 106 ]);
104 } else { 107 } else {
105 window.history.back(-1); 108 window.history.back(-1);
  109 + setTimeout(() => {
  110 + this.props.dispatch({ type: "app/refreshPage" });
  111 + }, 100);
106 } 112 }
107 } 113 }
108 }; 114 };
@@ -221,6 +227,10 @@ class IndexMobile extends React.Component { @@ -221,6 +227,10 @@ class IndexMobile extends React.Component {
221 onLeftClick={() => { 227 onLeftClick={() => {
222 if (TabBarHidden && navbarIconShow) { 228 if (TabBarHidden && navbarIconShow) {
223 window.history.back(-1); 229 window.history.back(-1);
  230 + setTimeout(() => {
  231 + this.props.dispatch({ type: "app/refreshPage" });
  232 + // history.push(location.pathname);
  233 + }, 100);
224 } 234 }
225 }} 235 }}
226 className={styles.iconColor} 236 className={styles.iconColor}
@@ -404,4 +414,4 @@ class IndexMobile extends React.Component { @@ -404,4 +414,4 @@ class IndexMobile extends React.Component {
404 ); 414 );
405 } 415 }
406 } 416 }
407 -export default connect(({ app, routing }) => ({ app, routing }))(IndexMobile); 417 +export default connect(({ app, routing }) => ({ app, routing, ...history }))(IndexMobile);
src/routes/mobile/common/commobileBill.js
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 */ 4 */
5 5
6 import React from 'react'; 6 import React from 'react';
7 -import { connect } from 'dva'; 7 +import { connect } from 'umi';
8 // import CommobileBillComponent from '../../../mobile/common/CommobileTabBill'; 8 // import CommobileBillComponent from '../../../mobile/common/CommobileTabBill';
9 import CommobileBillComponent from '../../../mobile/common/CommobileSubBill'; 9 import CommobileBillComponent from '../../../mobile/common/CommobileSubBill';
10 import * as commonUtils from '../../../utils/utils'; 10 import * as commonUtils from '../../../utils/utils';