wlzboy
9 小时以前 5f2ee03958a1a16dc27195c76ea7cffb422c95d1
app/App.vue
@@ -68,7 +68,7 @@
        this.updateUnreadMessageBadge()
        // 重新启动轮询(如果之前已停止)
        if (!this.messagePollingTimer) {
          this.startMessagePolling()
          // this.startMessagePolling()
        }
      }
    },
@@ -99,6 +99,28 @@
        try {
          if (!getToken()) {
            console.log('用户未登录,准备跳转到登录页面')
            // 保存目标页面用于登录后跳转
            if (options && options.path &&
                options.path !== 'pages/login' &&
                options.path !== 'pages/qylogin') {
              // 构造完整的路径和查询参数
              let fullPath = '/' + options.path;
              if (options.query) {
                const queryString = Object.keys(options.query).map(key =>
                  `${key}=${encodeURIComponent(options.query[key])}`).join('&');
                if (queryString) {
                  fullPath += '?' + queryString;
                }
              }
              // 保存目标URL到本地存储
              try {
                uni.setStorageSync('targetUrl', fullPath);
              } catch (e) {
                console.error('保存目标URL失败:', e);
              }
            }
            // 使用工具类根据环境自动跳转到合适的登录页面
            redirectToLoginByEnvironment(options, this.$tab);
          } else {