Add type for jump url.
Showing
4 changed files
with
37 additions
and
5 deletions
js/common/utils/urlHandler.js
0 → 100644
1 | + | ||
2 | +export function urlAddParamOfType(url, type='0') { | ||
3 | + let strs= new Array(); | ||
4 | + let dataString = ''; | ||
5 | + if (url.indexOf('yohobuy=') !== -1) { | ||
6 | + strs = url.split("yohobuy="); | ||
7 | + if (strs.length == 1) { | ||
8 | + dataString = strs[0]; | ||
9 | + } else { | ||
10 | + dataString = strs[1]; | ||
11 | + } | ||
12 | + } else { | ||
13 | + strs = url.split("yohobuy="); | ||
14 | + if (strs.length == 1) { | ||
15 | + dataString = strs[0]; | ||
16 | + } else { | ||
17 | + dataString = strs[1]; | ||
18 | + } | ||
19 | + } | ||
20 | + var obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象 | ||
21 | + obj.params.type = type; | ||
22 | + let totalUrlWithType = "yohobuy=" + JSON.stringify(obj); | ||
23 | + if (strs.length > 1) { | ||
24 | + totalUrlWithType = strs[0] + totalUrlWithType; | ||
25 | + } | ||
26 | + return totalUrlWithType; | ||
27 | +} |
@@ -15,6 +15,7 @@ import ReactNative, { | @@ -15,6 +15,7 @@ import ReactNative, { | ||
15 | import HeaderCell from './HeaderCell'; | 15 | import HeaderCell from './HeaderCell'; |
16 | import ListCell from './ListCell'; | 16 | import ListCell from './ListCell'; |
17 | import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator'; | 17 | import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator'; |
18 | +import LoadingIndicator from '../../../common/components/LoadingIndicator'; | ||
18 | 19 | ||
19 | 20 | ||
20 | export default class List extends Component { | 21 | export default class List extends Component { |
@@ -102,6 +103,9 @@ export default class List extends Component { | @@ -102,6 +103,9 @@ export default class List extends Component { | ||
102 | } | 103 | } |
103 | }} | 104 | }} |
104 | /> | 105 | /> |
106 | + <LoadingIndicator | ||
107 | + isVisible={isFetching} | ||
108 | + /> | ||
105 | </View> | 109 | </View> |
106 | ); | 110 | ); |
107 | } | 111 | } |
@@ -18,7 +18,7 @@ import {Map} from 'immutable'; | @@ -18,7 +18,7 @@ import {Map} from 'immutable'; | ||
18 | import * as detailActions from '../reducers/detail/detailActions'; | 18 | import * as detailActions from '../reducers/detail/detailActions'; |
19 | 19 | ||
20 | import Detail from '../components/detail/Detail'; | 20 | import Detail from '../components/detail/Detail'; |
21 | - | 21 | +import {urlAddParamOfType} from '../../common/utils/urlHandler'; |
22 | 22 | ||
23 | const actions = [ | 23 | const actions = [ |
24 | detailActions, | 24 | detailActions, |
@@ -109,7 +109,8 @@ class DetailContainer extends Component { | @@ -109,7 +109,8 @@ class DetailContainer extends Component { | ||
109 | } | 109 | } |
110 | 110 | ||
111 | _onPressTag(url) { | 111 | _onPressTag(url) { |
112 | - ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 112 | + let taggedUrl = urlAddParamOfType(url, '12') |
113 | + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(taggedUrl); | ||
113 | } | 114 | } |
114 | _onPressMoreLink(url) { | 115 | _onPressMoreLink(url) { |
115 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 116 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
@@ -19,7 +19,7 @@ import {Map} from 'immutable'; | @@ -19,7 +19,7 @@ import {Map} from 'immutable'; | ||
19 | import * as listActions from '../reducers/list/listActions'; | 19 | import * as listActions from '../reducers/list/listActions'; |
20 | 20 | ||
21 | import List from '../components/list/List'; | 21 | import List from '../components/list/List'; |
22 | - | 22 | +import {urlAddParamOfType} from '../../common/utils/urlHandler'; |
23 | 23 | ||
24 | const actions = [ | 24 | const actions = [ |
25 | listActions, | 25 | listActions, |
@@ -75,7 +75,8 @@ class ListContainer extends Component { | @@ -75,7 +75,8 @@ class ListContainer extends Component { | ||
75 | } | 75 | } |
76 | 76 | ||
77 | _onPressHeader(url) { | 77 | _onPressHeader(url) { |
78 | - ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 78 | + let taggedUrl = urlAddParamOfType(url, '11') |
79 | + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(taggedUrl); | ||
79 | } | 80 | } |
80 | 81 | ||
81 | _onRefresh() { | 82 | _onRefresh() { |
@@ -85,7 +86,6 @@ class ListContainer extends Component { | @@ -85,7 +86,6 @@ class ListContainer extends Component { | ||
85 | } | 86 | } |
86 | 87 | ||
87 | _onPressShare(param) { | 88 | _onPressShare(param) { |
88 | - console.log(param); | ||
89 | ReactNative.NativeModules.YH_CommonHelper.shareWithParam(param); | 89 | ReactNative.NativeModules.YH_CommonHelper.shareWithParam(param); |
90 | } | 90 | } |
91 | 91 |
-
Please register or login to post a comment