Authored by yoho-js001

BLK通用跳转处理url。 reviewed by顺老板。

... ... @@ -125,6 +125,11 @@ class BrandContainer extends Component {
//URL 拼装跳转规则跳转
_onPressSlideItem(url, index=0) {
let newUrl = this._handleBLKBannerURL(url);
if (newUrl.length) {
url = newUrl;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
// // 0-girl 1-boy 2-child 3-lifestyle
... ... @@ -150,6 +155,10 @@ class BrandContainer extends Component {
_onPressRecommendItem(data, index=0) {
let url = data.url;
let newUrl = this._handleBLKBannerURL(url);
if (newUrl.length) {
url = newUrl;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
// let brandId = brandId = data.id ? data.id : '';
... ... @@ -172,6 +181,49 @@ class BrandContainer extends Component {
// NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BR', params);
}
_handleBLKBannerURL(url) {
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];
}
}
try {
var obj = {};
if (dataString.length > 1) {
obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象
}
console.log(obj);
if (obj.action == 'go.brand') {
obj.parames.jumptoshop = 'N';
obj.parames.type = '';
} else if (obj.action == 'go.shop') {
obj.params.is_red_shop = '0';
obj.params.shop_template_type = '1';
}
let totalUrlWithType = "yohobuy=" + JSON.stringify(obj);
if (strs.length > 1) {
totalUrlWithType = strs[0] + totalUrlWithType;
}
return totalUrlWithType;
} catch (e) {
return '';
}
return '';
}
_onPressFilter(value) {
this.props.actions.setBrandFilter(value);
... ...