...
|
...
|
@@ -8,6 +8,7 @@ |
|
|
|
|
|
import ReactNative from 'react-native';
|
|
|
import {Actions} from 'react-native-router-flux';
|
|
|
import Immutable, {Map} from 'immutable';
|
|
|
import AppService from '../../services/AppService';
|
|
|
import RouterService from '../../services/RouterService';
|
|
|
import {goToSection, goToPost} from '../home/homeActions';
|
...
|
...
|
@@ -42,43 +43,41 @@ export function setChannel(channel) { |
|
|
|
|
|
export function goAction(inputUrl) {
|
|
|
return (dispatch, getState) => {
|
|
|
return new RouterService().parseUrl(inputUrl)
|
|
|
.then((json) => {
|
|
|
let {action, params} = json;
|
|
|
let {param, share, shareparam, title, url} = params;
|
|
|
let json = new RouterService().parseUrl(inputUrl);
|
|
|
let {action, params} = json;
|
|
|
let {param, share, shareparam, title, url} = params;
|
|
|
|
|
|
if (action == 'go.comm.forum') {
|
|
|
let id = params && params.forumid ? params.forumid : 0;
|
|
|
let name = '';
|
|
|
if (id != 0) {
|
|
|
dispatch(goToSection({id, name}));
|
|
|
}
|
|
|
if (action == 'go.comm.forum') {
|
|
|
let id = params && params.forumid ? params.forumid : 0;
|
|
|
let name = '';
|
|
|
if (id != 0) {
|
|
|
dispatch(goToSection({id, name}));
|
|
|
}
|
|
|
|
|
|
} else if (action == 'go.comm.postdetail') {
|
|
|
let id = params && params.postid ? params.postid : 0;
|
|
|
if (id != 0) {
|
|
|
dispatch(goToPost(id));
|
|
|
}
|
|
|
} else if (action == 'go.comm.postdetail') {
|
|
|
let id = params && params.postid ? params.postid : 0;
|
|
|
if (id == 0) {
|
|
|
id = params && params.postId ? params.postId : 0;
|
|
|
}
|
|
|
if (id != 0) {
|
|
|
dispatch(goToPost(id));
|
|
|
}
|
|
|
|
|
|
} else if (action == 'go.comm.h5') {
|
|
|
let title = params.title ? params.title : '';
|
|
|
let url = params.url ? params.url : '';
|
|
|
if (!url || url.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommunityHelper.displayH5({url, title});
|
|
|
} else if (action == 'go.comm.productDetail') {
|
|
|
let productSkn = params.product_skn ? params.product_skn : '';
|
|
|
productSkn = productSkn + '';
|
|
|
let tag = params.tag ? params.tag : '';
|
|
|
if (!productSkn || productSkn.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommunityHelper.displayProductDetail({productSkn, tag});
|
|
|
}
|
|
|
})
|
|
|
.catch(error => {
|
|
|
__DEV__ && console.log(error);
|
|
|
});
|
|
|
} else if (action == 'go.comm.h5') {
|
|
|
let title = params.title ? params.title : '';
|
|
|
let url = params.url ? params.url : '';
|
|
|
if (!url || url.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommunityHelper.displayH5({url, title});
|
|
|
} else if (action == 'go.comm.productDetail') {
|
|
|
let productSkn = params.product_skn ? params.product_skn : '';
|
|
|
productSkn = productSkn + '';
|
|
|
let tag = params.tag ? params.tag : '';
|
|
|
if (!productSkn || productSkn.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommunityHelper.displayProductDetail({productSkn, tag});
|
|
|
}
|
|
|
};
|
|
|
} |
...
|
...
|
|