fix: 统一登录跳转逻辑,添加redirectTo参数避免页面栈溢出
1. 为所有登录跳转调用添加redirectTo跳转类型参数 2. 调整部分页面的onShow生命周期执行顺序和定时器包装 3. 补充缺失的ns-login组件引用到两个diy组件中 4. 修复部分页面登录后返回出现循环跳转的问题
This commit is contained in:
@@ -83,14 +83,14 @@ export default {
|
||||
if (option.redirect) this.redirect = option.redirect;
|
||||
},
|
||||
onShow() {
|
||||
if (this.storeToken) {
|
||||
this.getTransferType();
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/account');
|
||||
});
|
||||
if (!this.storeToken) {
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/account', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
this.getTransferType();
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
},
|
||||
methods: {
|
||||
// 编辑提现账户信息
|
||||
|
||||
@@ -133,9 +133,10 @@ export default {
|
||||
if (this.storeToken) {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/address');
|
||||
});
|
||||
// 使用redirectTo模式:当前页被登录页替换,返回时直接回到上一页,不会产生循环
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/address', 'redirectTo');
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -86,15 +86,15 @@ export default {
|
||||
};
|
||||
},
|
||||
async onShow() {
|
||||
if (!this.storeToken) {
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/balance', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
this.getWithdrawConfig();
|
||||
this.getMemberrechargeConfig();
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/balance');
|
||||
});
|
||||
} else {
|
||||
this.getUserInfo();
|
||||
}
|
||||
this.getUserInfo();
|
||||
},
|
||||
onLoad() {
|
||||
// #ifdef MP
|
||||
|
||||
@@ -95,9 +95,10 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/balance');
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/balance_detail', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -80,9 +80,10 @@
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/index');
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/bind_mobile', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
|
||||
@@ -142,7 +142,7 @@ export default {
|
||||
//会员卡
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/card');
|
||||
this.$refs.login.open('/pages_tool/member/card', 'redirectTo');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ export default {
|
||||
this.getCardList();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/card_buy');
|
||||
this.$refs.login.open('/pages_tool/member/card_buy', 'redirectTo');
|
||||
});
|
||||
}
|
||||
this.getAgreement();
|
||||
|
||||
@@ -84,7 +84,7 @@ export default {
|
||||
onLoad() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/card_log');
|
||||
this.$refs.login.open('/pages_tool/member/card_log', 'redirectTo');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,13 +101,13 @@ export default {
|
||||
this.isIphoneX = this.$util.uniappIsIPhoneX();
|
||||
},
|
||||
onShow() {
|
||||
if (this.storeToken) {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/coupon');
|
||||
});
|
||||
if (!this.storeToken) {
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/coupon', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
},
|
||||
methods: {
|
||||
//切换状态
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
this.getList();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/invite_friends');
|
||||
this.$refs.login.open('/pages_tool/member/invite_friends', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
this.getLevelRule();
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/level');
|
||||
this.$refs.login.open('/pages_tool/member/level', 'redirectTo');
|
||||
});
|
||||
} else {
|
||||
this.getLevelList();
|
||||
|
||||
@@ -90,12 +90,12 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/point');
|
||||
});
|
||||
} else {
|
||||
this.getMemberPoint();
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/point', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
this.getMemberPoint();
|
||||
},
|
||||
onLoad() {
|
||||
// #ifdef MP
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
toLogin(url) {
|
||||
const currentRoute = this.$util.getCurrentRoute();
|
||||
const backUrl = url ?? (currentRoute && currentRoute.path ? currentRoute.path : '');
|
||||
this.$refs.login.open(backUrl);
|
||||
this.$refs.login.open(backUrl, 'redirectTo');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,12 +88,13 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/info');
|
||||
});
|
||||
} else {
|
||||
this.getInfo();
|
||||
// 使用redirectTo模式:当前页被登录页替换,返回时直接回到上一页,不会产生循环
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/member/info', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
this.getInfo();
|
||||
},
|
||||
onHide() {
|
||||
this.seconds = 120;
|
||||
|
||||
@@ -46,7 +46,7 @@ export default {
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/signin');
|
||||
this.$refs.login.open('/pages_tool/member/signin', 'redirectTo');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user