refactor: 统一替换登录跳转逻辑为通用方法
将项目内多处手动调用$refs.login.open的登录跳转逻辑,统一替换为新增的redirectTologin通用方法,简化代码并提升维护性,同时统一处理了延迟和nextTick调用逻辑。
This commit is contained in:
@@ -442,7 +442,7 @@ export default {
|
||||
// 立即购买
|
||||
exchange() {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open('/pages_promotion/point/detail?id=' + this.id, 'redirectTo');
|
||||
this.redirectTologin('/pages_promotion/point/detail?id=' + this.id);
|
||||
return;
|
||||
}
|
||||
this.$refs.goodsSku.show('point');
|
||||
|
||||
@@ -490,7 +490,7 @@ export default {
|
||||
},
|
||||
//跳转至登录页面
|
||||
login() {
|
||||
this.$refs.login.open('/pages_promotion/point/list', 'redirectTo');
|
||||
this.redirectTologin('/pages_promotion/point/list');
|
||||
},
|
||||
imgError(index) {
|
||||
this.goodsList[index].image = this.$util.getDefaultImage().goods;
|
||||
@@ -521,7 +521,8 @@ export default {
|
||||
*/
|
||||
redirect(url) {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open(url, 'redirectTo');
|
||||
this.redirectTologin(url);
|
||||
return;
|
||||
} else {
|
||||
this.$util.redirectTo(url);
|
||||
}
|
||||
|
||||
@@ -124,14 +124,13 @@ export default {
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/point/order_list', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.redirectTologin('/pages_promotion/point/order_list');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user