|
|
|
@ -73,11 +73,58 @@ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
onLaunch: function() { |
|
|
|
|
// uni.addInterceptor('request',{ |
|
|
|
|
// invoke(e){ |
|
|
|
|
// console.log(e,"e") |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
/* |
|
|
|
|
路由拦截 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
// const methodToPatch = ['navigateTo', 'redirectTo', 'switchTab', 'navigateBack']; |
|
|
|
|
const methodToPatch = ['navigateTo', 'redirectTo', 'switchTab', ]; |
|
|
|
|
|
|
|
|
|
let arr = [ |
|
|
|
|
"/subPages/recharge-centre/recharge-centre",//话费充值 |
|
|
|
|
"/pages/user/mineCoupons/mineCoupons",//卡券中心 |
|
|
|
|
"/pages/user/myPromotion/myPromotion",//我的推广 |
|
|
|
|
"/subPages/cardsList/cardsList",//卡管理 |
|
|
|
|
"/pages/user/deposit/deposit",//积分充值 |
|
|
|
|
"/physical-merchants/address/address",//我的地址 |
|
|
|
|
"/pages/goods/recording/recording",//积分记录 |
|
|
|
|
"../../../subPages/cardsList/cardsList",//卡管理 |
|
|
|
|
"../../user/order_list/order_list",//我的订单 |
|
|
|
|
"../../user/coupon/coupon",//优惠券 |
|
|
|
|
"/pages/user/payActivity/payActivity",//活动券 |
|
|
|
|
"../../login/updatePas/updatePas",//支付密码 |
|
|
|
|
"/physical-merchants/classify/cart/cart",//我的购物车 |
|
|
|
|
|
|
|
|
|
"../order/confirmation",//兑换 |
|
|
|
|
"../coupon-comfirmation/coupon-comfirmation",//天天好券 |
|
|
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
methodToPatch.map(item => { |
|
|
|
|
uni.addInterceptor(item,{ |
|
|
|
|
invoke(e){ |
|
|
|
|
console.log(e,"e",arr.includes(e.url.split('?')[0])); |
|
|
|
|
if(!uni.getStorageSync('token')&&arr.includes(e.url.split('?')[0])){ |
|
|
|
|
// #ifdef H5 |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/login/register' |
|
|
|
|
}) |
|
|
|
|
// #endif |
|
|
|
|
// #ifdef MP |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
onShow: function() { |
|
|
|
|