瀏覽代碼

ref:saas登录其他应用后再登录当前应用

liusw 7 年之前
父節點
當前提交
fe7aa68241
共有 1 個文件被更改,包括 23 次插入22 次删除
  1. 23 22
      pages/sassLogin/index.vue

+ 23 - 22
pages/sassLogin/index.vue

@@ -611,30 +611,31 @@
             promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?${a}`))
           }
         }
+
         Promise.all(promises).then(() => {
-          let baseContent = response.data.content.currentUrl
-          let flag = '?'
-          if (baseContent.indexOf('?') !== -1) {
-            flag = '&'
-          }
-          this.$jsonp(`${response.data.content.currentUrl}${flag}${a}`, {
-            name: 'successCallback',
-            timeout: 3000
-          }, (err, data) => {
-            if (err) {
-              this.$message.error('登录超时,请重试')
-              this.isShowLoading = false
-              throw err
-            } else {
-              this.loginIsSuccess = true
-              this.isShowLoading = false
-            }
-          })
-          // crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
+          this.loginCurrent(response, a)
         }).catch(() => {
-          this.loginIsSuccess = true
-          this.isShowLoading = false
-          // crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
+          this.loginCurrent(response, a)
+        })
+      },
+      loginCurrent (response, a) {
+        let baseContent = response.data.content.currentUrl
+        let flag = '?'
+        if (baseContent.indexOf('?') !== -1) {
+          flag = '&'
+        }
+        this.$jsonp(`${response.data.content.currentUrl}${flag}${a}`, {
+          name: 'successCallback',
+          timeout: 3000
+        }, (err, data) => {
+          if (err) {
+            this.$message.error('登录超时,请重试')
+            this.isShowLoading = false
+            throw err
+          } else {
+            this.loginIsSuccess = true
+            this.isShowLoading = false
+          }
         })
       },
       getCheckCode () {