64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
// import config from '../config.js'
|
|
// 导入路由模块
|
|
import { navigateTo as routerNavigateTo } from '@/common/router.js';
|
|
|
|
/*导航菜单白名单*/
|
|
const tabBarLinks = [
|
|
'/pages/index/index',
|
|
'/pages/product/category',
|
|
'/pages/cart/cart',
|
|
'/pages/user/index/index',
|
|
'/pages/shop/index'
|
|
];
|
|
|
|
/*分享页面白名单*/
|
|
const shareLinks = [
|
|
'/pages/plus/assemble/fight-group-detail/fight-group-detail',
|
|
'/pages/plus/bargain/haggle/haggle',
|
|
'/pages/user/invite/invite',
|
|
'/pages/product/detail/detail',
|
|
'/pages/plus/seckill/detail/detail',
|
|
'/pages/plus/assemble/detail/detail',
|
|
'/pages/plus/bargain/detail/detail',
|
|
'/pages/plus/points/detail/detail'
|
|
]
|
|
|
|
/*
|
|
* 跳转页面
|
|
*/
|
|
export const gotopage = (url, type) => {
|
|
if (!url || url.length == 0) {
|
|
return false;
|
|
}
|
|
|
|
// 从URL中提取路径和参数
|
|
let path = url;
|
|
let params = {};
|
|
|
|
if (url.includes('?')) {
|
|
const [basePath, queryString] = url.split('?');
|
|
path = basePath;
|
|
|
|
// 解析参数
|
|
queryString.split('&').forEach(param => {
|
|
const [key, value] = param.split('=');
|
|
if (key && value) {
|
|
params[key] = decodeURIComponent(value);
|
|
}
|
|
});
|
|
}
|
|
|
|
// 使用新的路由方法进行导航
|
|
let navigationType = 'navigateTo';
|
|
if (type === 'switch') {
|
|
navigationType = 'reLaunch';
|
|
} else if (type === 'redirect') {
|
|
navigationType = 'redirectTo';
|
|
} else if (type === 'reLaunch') {
|
|
navigationType = 'reLaunch';
|
|
}
|
|
|
|
// 使用导入的路由方法
|
|
return routerNavigateTo(path, params, navigationType);
|
|
}
|