Authored by yoho-js001

Add type for jump url.

export function urlAddParamOfType(url, type='0') {
let strs= new Array();
let dataString = '';
if (url.indexOf('yohobuy=') !== -1) {
strs = url.split("yohobuy=");
if (strs.length == 1) {
dataString = strs[0];
} else {
dataString = strs[1];
}
} else {
strs = url.split("yohobuy=");
if (strs.length == 1) {
dataString = strs[0];
} else {
dataString = strs[1];
}
}
var obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象
obj.params.type = type;
let totalUrlWithType = "yohobuy=" + JSON.stringify(obj);
if (strs.length > 1) {
totalUrlWithType = strs[0] + totalUrlWithType;
}
return totalUrlWithType;
}
... ...
... ... @@ -15,6 +15,7 @@ import ReactNative, {
import HeaderCell from './HeaderCell';
import ListCell from './ListCell';
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
import LoadingIndicator from '../../../common/components/LoadingIndicator';
export default class List extends Component {
... ... @@ -102,6 +103,9 @@ export default class List extends Component {
}
}}
/>
<LoadingIndicator
isVisible={isFetching}
/>
</View>
);
}
... ...
... ... @@ -18,7 +18,7 @@ import {Map} from 'immutable';
import * as detailActions from '../reducers/detail/detailActions';
import Detail from '../components/detail/Detail';
import {urlAddParamOfType} from '../../common/utils/urlHandler';
const actions = [
detailActions,
... ... @@ -109,7 +109,8 @@ class DetailContainer extends Component {
}
_onPressTag(url) {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let taggedUrl = urlAddParamOfType(url, '12')
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(taggedUrl);
}
_onPressMoreLink(url) {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
... ...
... ... @@ -19,7 +19,7 @@ import {Map} from 'immutable';
import * as listActions from '../reducers/list/listActions';
import List from '../components/list/List';
import {urlAddParamOfType} from '../../common/utils/urlHandler';
const actions = [
listActions,
... ... @@ -75,7 +75,8 @@ class ListContainer extends Component {
}
_onPressHeader(url) {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let taggedUrl = urlAddParamOfType(url, '11')
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(taggedUrl);
}
_onRefresh() {
... ... @@ -85,7 +86,6 @@ class ListContainer extends Component {
}
_onPressShare(param) {
console.log(param);
ReactNative.NativeModules.YH_CommonHelper.shareWithParam(param);
}
... ...