Commit 14763990 by 万亚飞

fix

parent f2e070c2
import React, { Component } from 'react'; import React, { Component } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import moment from 'moment'; import moment from 'moment';
import { linkTo } from '@/utils/tools';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
...@@ -41,9 +42,11 @@ class TrainItem extends Component { ...@@ -41,9 +42,11 @@ class TrainItem extends Component {
console.log(this.props.history); console.log(this.props.history);
if (data.auditStatus == 1) return; if (data.auditStatus == 1) return;
if (iType === 3) { if (iType === 3) {
this.props.history.push(`/user/train/${data.id}?modifyId=${data.modifyId}`); linkTo(`/user/train/${data.id}?modifyId=${data.modifyId}`);
// this.props.history.push();
} else { } else {
this.props.history.push(`/user/job/${data.id}?index=${iType}&modifyId=${data.modifyId}`); linkTo(`/user/job/${data.id}?index=${iType}&modifyId=${data.modifyId}`);
// this.props.history.push();
} }
}} }}
className={classNames('o-btn', { disabled: data.auditStatus == 1 })} className={classNames('o-btn', { disabled: data.auditStatus == 1 })}
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Modal, Toast } from 'antd-mobile'; import { Modal, Toast } from 'antd-mobile';
import classNames from 'classnames'; import classNames from 'classnames';
import Layout from '../../Components/static/Layout/Layout'; import { linkTo } from '@/utils/tools';
import TrainItem from '../../Components/page/user/TrainItem'; import TrainItem from '../../Components/page/user/TrainItem';
import TabBar from '../../Components/page/user/TabBar'; import TabBar from '../../Components/page/user/TabBar';
import { MATERIAL_ARR } from '../../static/js/constant'; import { MATERIAL_ARR } from '../../static/js/constant';
...@@ -17,18 +16,28 @@ function AddView(props) { ...@@ -17,18 +16,28 @@ function AddView(props) {
console.log(props); console.log(props);
return ( return (
<div className="bottom-operate"> <div className="bottom-operate">
<Link className="am-button am-button-primary" to={`/user/job/add?index=${props.tabIndex}`}> <a
className="am-button am-button-primary"
onClick={() => {
linkTo(`/user/job/add?index=${props.tabIndex}`);
}}
>
添加{MATERIAL_ARR[props.tabIndex]} 添加{MATERIAL_ARR[props.tabIndex]}
</Link> </a>
</div> </div>
); );
} }
function NoDataView(props) { function NoDataView(props) {
return ( return (
<Link className="add-train" to={`/user/job/add?index=${props.tabIndex}`}> <a
className="add-train"
onClick={() => {
linkTo(`/user/job/add?index=${props.tabIndex}`);
}}
>
<i className="y-icon-add" /> <i className="y-icon-add" />
<span>添加{MATERIAL_ARR[props.tabIndex]}</span> <span>添加{MATERIAL_ARR[props.tabIndex]}</span>
</Link> </a>
); );
} }
function ListItemView(props) { function ListItemView(props) {
...@@ -93,10 +102,8 @@ class JobList extends Component { ...@@ -93,10 +102,8 @@ class JobList extends Component {
tabIndex: index tabIndex: index
}); });
const { history } = this.props; const { history } = this.props;
console.log(this.props); history.replace(`${history.location.pathname}?index=${index}`);
console.log(history.replace(`${history.location.pathname}?index=${index}`));
// location.replace(`?index=${index}`); // location.replace(`?index=${index}`);
console.log(location);
} }
toAddMaterial = () => {}; toAddMaterial = () => {};
delTrain = operate => { delTrain = operate => {
......
...@@ -2,6 +2,7 @@ import React, { Component } from 'react'; ...@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Modal, Toast } from 'antd-mobile'; import { Modal, Toast } from 'antd-mobile';
import { linkTo } from '@/utils/tools';
import Layout from '../../Components/static/Layout/Layout'; import Layout from '../../Components/static/Layout/Layout';
import TrainItem from '../../Components/page/user/TrainItem'; import TrainItem from '../../Components/page/user/TrainItem';
...@@ -75,9 +76,14 @@ class TrainList extends Component { ...@@ -75,9 +76,14 @@ class TrainList extends Component {
</ul> </ul>
<div className="bottom-operate"> <div className="bottom-operate">
<Link to="/user/train/add" className="am-button am-button-primary"> <a
onClick={() => {
linkTo('/user/train/add');
}}
className="am-button am-button-primary"
>
添加受训背景 添加受训背景
</Link> </a>
</div> </div>
<Modal <Modal
...@@ -103,10 +109,15 @@ class TrainList extends Component { ...@@ -103,10 +109,15 @@ class TrainList extends Component {
/> />
</div> </div>
) : ( ) : (
<Link to="/user/train/add" className="add-train"> <a
onClick={() => {
linkTo('/user/train/add');
}}
className="add-train"
>
<i className="y-icon-add" /> <i className="y-icon-add" />
<span>添加受训背景</span> <span>添加受训背景</span>
</Link> </a>
)} )}
</div> </div>
</Layout> </Layout>
......
...@@ -2,7 +2,7 @@ import React, { Component } from 'react'; ...@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Toast, Modal } from 'antd-mobile'; import { Toast, Modal } from 'antd-mobile';
import Layout from '../../Components/static/Layout/Layout'; import Layout from '../../Components/static/Layout/Layout';
import { MATERIAL_ARR } from '../../static/js/constant'; import { MATERIAL_ARR } from '../../static/js/constant';
import { getParam, getImgNaturalDimensions } from '../../utils/tools'; import { getParam, getImgNaturalDimensions, linkTo } from '../../utils/tools';
import UpLoad from '../../Components/common/Upload/Upload'; import UpLoad from '../../Components/common/Upload/Upload';
import { getParameterByName } from '../../utils/common'; import { getParameterByName } from '../../utils/common';
......
...@@ -281,7 +281,7 @@ export default function() { ...@@ -281,7 +281,7 @@ export default function() {
}; };
params.cmd.action_name = 'action_needLoad'; params.cmd.action_name = 'action_needLoad';
params.url = 'ydl_app'; params.url = 'ydl_app';
console.log('notRefresh'); console.log('notRefresh,2.2.50');
sendDataToExp(params); sendDataToExp(params);
}; };
// 跳转到m站 // 跳转到m站
......
import app from '../static/js/native';
export const ENV = process.env.NODE_ENV; export const ENV = process.env.NODE_ENV;
export const isBrowser = process.browser; export const isBrowser = process.browser;
export const UA = isBrowser ? navigator.userAgent : ''; export const UA = isBrowser ? navigator.userAgent : '';
...@@ -5,7 +6,6 @@ export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA.toLowerCase()); ...@@ -5,7 +6,6 @@ export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA.toLowerCase());
export const isAndroid = UA.indexOf('Android') > -1 || UA.indexOf('Adr') > -1; //android终端 export const isAndroid = UA.indexOf('Android') > -1 || UA.indexOf('Adr') > -1; //android终端
export const isWX = /MicroMessenger/.test(UA); export const isWX = /MicroMessenger/.test(UA);
export const TERMINAL = isIOS ? 'IOS' : 'Android'; export const TERMINAL = isIOS ? 'IOS' : 'Android';
console.log(UA);
export function getUrlParam(name, _location) { export function getUrlParam(name, _location) {
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象 let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象
let r; let r;
...@@ -52,3 +52,8 @@ export function getImgNaturalDimensions(imgSrc, callback) { ...@@ -52,3 +52,8 @@ export function getImgNaturalDimensions(imgSrc, callback) {
// } // }
return [nWidth, nHeight]; return [nWidth, nHeight];
} }
export function linkTo(url) {
location.href = url;
// alert(`${location.origin}${url}`);
// app().goPage('壹点零', `${location.origin}${url}`);
}
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