Authored by yyq
Committed by lea guo

fix URLSearchParams

import {get} from 'lodash';
import Vue from 'vue';
import queryString from 'querystring';
function getJumpUrl(qs = {}) {
return `//m.yohobuy.com/?${queryString.stringify(qs)}`;
}
export default function() {
return {
... ... @@ -39,17 +44,13 @@ export default function() {
if(item.linkType === 'h5'){
item.isShow = true;
item.url = item.link;
}else {
let hostUrl ='http://m.yohobuy.com/';
let params = new URLSearchParams();
params.append('pagename', 'productList');
params.append('title', item.name);
params.append(`${item.linkType}`, item.link);
} else {
item.isShow = false;
let url = `${hostUrl}?${params}`
item.url = url
item.url = getJumpUrl({
pagename: 'productList',
title: item.name,
[item.linkType]: item.link
});
}
})
... ... @@ -58,16 +59,6 @@ export default function() {
state.categorySubList = data.category;
}
},
getUrl(item){
let hostUrl ='http://m.yohobuy.com/';
let params = new URLSearchParams();
params.append('pagename', 'productList');
params.append('title', item.name);
params.append(`${item.linkType}`, item.link);
return `${hostUrl}?${params}`
},
addBrandList(state, {data}){
if(data && data.brand_list){
let sub = [];
... ... @@ -75,15 +66,8 @@ export default function() {
data.brand_list.forEach((val, index) => {
val.isSelect = false;
let hostUrl ='http://m.yohobuy.com/';
let params = new URLSearchParams();
params.append('pagename', 'productList');
params.append('title', val.brand_name);
params.append('brand', val.id);
let isShowBottomBordor = (size - index) > 3;
let url = `${hostUrl}?${params}`
let right = index % 3 !== 2 ? '-right' : '';
let bottom = isShowBottomBordor ? '-bottom' : '';
let subItem = {
... ... @@ -92,7 +76,11 @@ export default function() {
image: val.brand_logo,
linkType: 'brand',
link: val.id,
url: url,
url: getJumpUrl({
pagename: 'productList',
title: val.brand_name,
brand: val.id,
}),
isShow: false,
}
... ...