fix: 统一登录跳转逻辑,添加redirectTo参数避免页面栈溢出
1. 为所有登录跳转调用添加redirectTo跳转类型参数 2. 调整部分页面的onShow生命周期执行顺序和定时器包装 3. 补充缺失的ns-login组件引用到两个diy组件中 4. 修复部分页面登录后返回出现循环跳转的问题
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
<view class="fui-cell-remark" style="font-size: 24rpx;">{{ lang == 'en-us' ? 'view' : '查看' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<ns-login ref="login"></ns-login>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<image mode="widthFix" src="{{childitem.imgurl}}" style="{{bannerheight?'height:'+bannerheight+'px':'height:auto'}}"></image>
|
||||
</view> -->
|
||||
</view>
|
||||
<ns-login ref="login"></ns-login>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -262,9 +262,9 @@ export default {
|
||||
return this.whetherCollection;
|
||||
} else {
|
||||
if (this.source_member) {
|
||||
this.$refs.login.open(this.shareUrl + '&source_member=' + this.source_member);
|
||||
this.$refs.login.open(this.shareUrl + '&source_member=' + this.source_member, 'redirectTo');
|
||||
} else {
|
||||
this.$refs.login.open(this.shareUrl);
|
||||
this.$refs.login.open(this.shareUrl, 'redirectTo');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -83,7 +83,7 @@ export default {
|
||||
});
|
||||
},
|
||||
toLogin() {
|
||||
this.$refs.login.open('/pages_goods/category')
|
||||
this.$refs.login.open('/pages_goods/category', 'redirectTo');
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
|
||||
@@ -260,7 +260,7 @@ export default {
|
||||
// 加入购物车
|
||||
joinCart() {
|
||||
if (!this.storeToken && this.preview == 0) {
|
||||
this.$refs.login.open(this.shareUrl);
|
||||
this.$refs.login.open(this.shareUrl, 'redirectTo');
|
||||
return;
|
||||
}
|
||||
if (this.goodsSkuDetail.is_virtual == 1) {
|
||||
@@ -276,7 +276,7 @@ export default {
|
||||
// 立即购买
|
||||
buyNow() {
|
||||
if (!this.storeToken && this.preview == 0) {
|
||||
this.$refs.login.open(this.shareUrl);
|
||||
this.$refs.login.open(this.shareUrl, 'redirectTo');
|
||||
return;
|
||||
}
|
||||
this.$refs.goodsSku.show("buy_now", () => {
|
||||
@@ -352,7 +352,7 @@ export default {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.$refs.login.open(this.shareUrl);
|
||||
this.$refs.login.open(this.shareUrl, 'redirectTo');
|
||||
this.couponBtnSwitch = false;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.loadingCover.hide();
|
||||
this.$refs.login.open(this.$util.getCurrentRoute().path)
|
||||
this.$refs.login.open(this.$util.getCurrentRoute().path, 'redirectTo');
|
||||
})
|
||||
}
|
||||
this.getTransactionAgreement();
|
||||
|
||||
@@ -66,7 +66,7 @@ export default {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/childfenxiao');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/childfenxiao', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
:src="$util.img('public/uniapp/fenxiao/index/commissionFission-level.png')"
|
||||
alt="" class="level-icon">{{ info.level_name }}</p>
|
||||
</view>
|
||||
<view class="recommend">{{ $lang('superiorAgent') }}:{{ info.parent_name ? info.parent_name : $lang('headquarters') }}</view>
|
||||
<view class="recommend">{{ $lang('invitedSuccess', { count: teamNum.num }) }}<text class="iconfont icon-right"
|
||||
<view class="recommend">{{ $lang('superiorAgent') }}:{{ info.parent_name ? info.parent_name : $lang('headquarters') }}</view>
|
||||
<view class="recommend">{{ $lang('invitedSuccess', { count: teamNum.num }) }}<text class="iconfont icon-right"
|
||||
style="font-size: 24rpx;"></text></view>
|
||||
</view>
|
||||
<!-- <view class="promote-rules font-size-tag" @click="$util.redirectTo('/pages_promotion/fenxiao/promote')">
|
||||
@@ -296,7 +296,7 @@ export default {
|
||||
this.checkFenxiaoIsStart();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/index');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/index', 'redirectTo');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ export default {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/order');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/order', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -116,7 +116,7 @@ export default {
|
||||
this.getOrderData();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/order_detail?id=' + this.orderId);
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/order_detail?id=' + this.orderId, 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
this.getFenxiaoDetail();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/promote_code');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/promote_code', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/promote_code');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/promote_code', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/team');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/team', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -79,7 +79,7 @@ export default {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/withdraw_list');
|
||||
this.$refs.login.open('/pages_promotion/fenxiao/withdraw_list', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
},
|
||||
toLogin() {
|
||||
this.$refs.login.open('/pages_goods/category')
|
||||
this.$refs.login.open('/pages_goods/category', 'redirectTo');
|
||||
}
|
||||
},
|
||||
// onPullDownRefresh() {
|
||||
|
||||
@@ -442,7 +442,7 @@ export default {
|
||||
// 立即购买
|
||||
exchange() {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open('/pages_promotion/point/detail?id=' + this.id);
|
||||
this.$refs.login.open('/pages_promotion/point/detail?id=' + this.id, 'redirectTo');
|
||||
return;
|
||||
}
|
||||
this.$refs.goodsSku.show('point');
|
||||
|
||||
@@ -490,7 +490,7 @@ export default {
|
||||
},
|
||||
//跳转至登录页面
|
||||
login() {
|
||||
this.$refs.login.open('/pages_promotion/point/list');
|
||||
this.$refs.login.open('/pages_promotion/point/list', 'redirectTo');
|
||||
},
|
||||
imgError(index) {
|
||||
this.goodsList[index].image = this.$util.getDefaultImage().goods;
|
||||
@@ -521,7 +521,7 @@ export default {
|
||||
*/
|
||||
redirect(url) {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open(url);
|
||||
this.$refs.login.open(url, 'redirectTo');
|
||||
} else {
|
||||
this.$util.redirectTo(url);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ export default {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_promotion/point/order_list');
|
||||
this.$refs.login.open('/pages_promotion/point/order_list', 'redirectTo');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
this.getData();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/form/form?id=' + this.id)
|
||||
this.$refs.login.open('/pages_tool/form/form?id=' + this.id, 'redirectTo');
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -200,7 +200,7 @@ export default {
|
||||
});
|
||||
} else {
|
||||
this.couponBtnSwitch = false;
|
||||
this.$refs.login.open('/pages_tool/goods/coupon');
|
||||
this.$refs.login.open('/pages_tool/goods/coupon', 'redirectTo');
|
||||
}
|
||||
},
|
||||
//获取优惠券列表
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ export default {
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/recharge/order_list');
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$refs.login.open('/pages_tool/recharge/order_list', 'redirectTo');
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
},
|
||||
methods: {
|
||||
getListData(mescroll) {
|
||||
|
||||
Reference in New Issue
Block a user