fix(TabBar): 从商品分类TabBar项点击进入的都算商品分类
This commit is contained in:
@@ -61,6 +61,35 @@ export const adaptSubpackageUrl = (url) => {
|
||||
return replacePrefix(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查tabBar是否激活
|
||||
* @param {string} linkUrl 链接路径 /pages/goods/category
|
||||
* @param {string} currentPageRoute 当前页面路径 /pages_goods/category
|
||||
* @returns {boolean} 是否激活
|
||||
*/
|
||||
export const checkTabBarActive = (linkUrl, currentPageRoute) => {
|
||||
const linkUrlParts = adaptSubpackageUrl(linkUrl).split('/');
|
||||
const currentPageRouteParts = currentPageRoute.split('/');
|
||||
|
||||
console.log('diy-bottom-nav verify:', { linkUrlParts, currentPageRouteParts});
|
||||
|
||||
try {
|
||||
// 二级页面
|
||||
if (linkUrlParts[2] === currentPageRouteParts[2]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 一级页面,限定只能是goods相关
|
||||
if (linkUrlParts[1] === currentPageRouteParts[1] && linkUrlParts[1] === 'pages_goods') {
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('diy-bottom-nav verify error:', error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 页面跳转
|
||||
@@ -91,7 +120,7 @@ export default {
|
||||
const tabBarUrl = systemTabBarList[i];
|
||||
if (url.indexOf(tabBarUrl) == 0) {
|
||||
// 首页特殊处理,采用switchTab, 其他页面采用redirectTo, 不能返回,不能退回
|
||||
(tabBarUrl == INDEX_PAGE_URL ? uni.switchTab : uni.redirectTo)({url});
|
||||
(tabBarUrl == INDEX_PAGE_URL ? uni.switchTab : uni.redirectTo)({ url });
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -130,8 +159,6 @@ export default {
|
||||
* @param {Object} params 参数,针对商品、相册里面的图片区分大中小,size: big、mid、small
|
||||
*/
|
||||
img(img_path, params) {
|
||||
|
||||
|
||||
var path = "";
|
||||
if (img_path != undefined && img_path != "") {
|
||||
if (img_path.split(',').length > 1) {
|
||||
|
||||
Reference in New Issue
Block a user