球星卡微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
744 B

  1. /**
  2. * @description token失效时跳转登录页方法
  3. * @return { Function }
  4. */
  5. export const httpMessage = (function () {
  6. let isTp = true
  7. // 返回一个闭包来保证同时间段的多次请求错误都只弹出一个窗口
  8. return function (msg) {
  9. if (isTp) {
  10. isTp = false
  11. uni.showModal({
  12. title: '提示',
  13. content: msg,
  14. showCancel: false,
  15. confirmText: '确定',
  16. success: (res) =>{
  17. if (res.confirm) {
  18. isTp = true;
  19. let pages = getCurrentPages(); // 设置登录重定向地址,登录完成后跳转回原页面
  20. getApp().globalData.loginRedirectPage = '/'+ pages[pages.length - 1].route;
  21. uni.redirectTo({
  22. url: '/pages/login/login',
  23. })
  24. }
  25. }
  26. })
  27. }
  28. }
  29. })()