Authored by yoho-js001

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

@@ -125,6 +125,11 @@ class BrandContainer extends Component { @@ -125,6 +125,11 @@ class BrandContainer extends Component {
125 125
126 //URL 拼装跳转规则跳转 126 //URL 拼装跳转规则跳转
127 _onPressSlideItem(url, index=0) { 127 _onPressSlideItem(url, index=0) {
  128 +
  129 + let newUrl = this._handleBLKBannerURL(url);
  130 + if (newUrl.length) {
  131 + url = newUrl;
  132 + }
128 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 133 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
129 134
130 // // 0-girl 1-boy 2-child 3-lifestyle 135 // // 0-girl 1-boy 2-child 3-lifestyle
@@ -150,6 +155,10 @@ class BrandContainer extends Component { @@ -150,6 +155,10 @@ class BrandContainer extends Component {
150 155
151 _onPressRecommendItem(data, index=0) { 156 _onPressRecommendItem(data, index=0) {
152 let url = data.url; 157 let url = data.url;
  158 + let newUrl = this._handleBLKBannerURL(url);
  159 + if (newUrl.length) {
  160 + url = newUrl;
  161 + }
153 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 162 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
154 163
155 // let brandId = brandId = data.id ? data.id : ''; 164 // let brandId = brandId = data.id ? data.id : '';
@@ -172,6 +181,49 @@ class BrandContainer extends Component { @@ -172,6 +181,49 @@ class BrandContainer extends Component {
172 // NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BR', params); 181 // NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BR', params);
173 } 182 }
174 183
  184 + _handleBLKBannerURL(url) {
  185 + let strs= new Array();
  186 + let dataString = '';
  187 + if (url.indexOf('yohobuy=') !== -1) {
  188 + strs = url.split("yohobuy=");
  189 + if (strs.length == 1) {
  190 + dataString = strs[0];
  191 + } else {
  192 + dataString = strs[1];
  193 + }
  194 + } else {
  195 + strs = url.split("yohobuy=");
  196 + if (strs.length == 1) {
  197 + dataString = strs[0];
  198 + } else {
  199 + dataString = strs[1];
  200 + }
  201 + }
  202 + try {
  203 + var obj = {};
  204 + if (dataString.length > 1) {
  205 + obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象
  206 + }
  207 + console.log(obj);
  208 + if (obj.action == 'go.brand') {
  209 + obj.parames.jumptoshop = 'N';
  210 + obj.parames.type = '';
  211 + } else if (obj.action == 'go.shop') {
  212 + obj.params.is_red_shop = '0';
  213 + obj.params.shop_template_type = '1';
  214 + }
  215 + let totalUrlWithType = "yohobuy=" + JSON.stringify(obj);
  216 + if (strs.length > 1) {
  217 + totalUrlWithType = strs[0] + totalUrlWithType;
  218 + }
  219 +
  220 + return totalUrlWithType;
  221 + } catch (e) {
  222 + return '';
  223 + }
  224 + return '';
  225 + }
  226 +
175 _onPressFilter(value) { 227 _onPressFilter(value) {
176 this.props.actions.setBrandFilter(value); 228 this.props.actions.setBrandFilter(value);
177 229