|
|
@@ -75,42 +75,29 @@
|
|
|
for (let n in param) {
|
|
|
a += (n + '=' + param[n] + '&')
|
|
|
}
|
|
|
- this.$jsonp(`${response.data.content.currentUrl}?${a.substr(0, a.length - 1)}`, {
|
|
|
- name: 'successCallback',
|
|
|
- timeout: 5000
|
|
|
- }, (err, data) => {
|
|
|
- const crossAfter = this.crossAfter
|
|
|
- if (err) {
|
|
|
- this.$indicator.close()
|
|
|
- this.$toast({
|
|
|
- message: '登录超时,即将跳转...',
|
|
|
- iconClass: 'el-icon-error'
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com')
|
|
|
- }, 1000)
|
|
|
- throw err
|
|
|
- } else {
|
|
|
- let promises = []
|
|
|
- for (let i in response.data.content.loginUrls) {
|
|
|
- promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1)))
|
|
|
+ if (response.data.content.currentUrl) {
|
|
|
+ this.$jsonp(`${response.data.content.currentUrl}?${a.substr(0, a.length - 1)}`, {
|
|
|
+ name: 'successCallback',
|
|
|
+ timeout: 5000
|
|
|
+ }, (err, data) => {
|
|
|
+ const crossAfter = this.crossAfter
|
|
|
+ if (err) {
|
|
|
+ this.$indicator.close()
|
|
|
+ this.$toast({
|
|
|
+ message: '登录超时,即将跳转...',
|
|
|
+ iconClass: 'el-icon-error'
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com')
|
|
|
+ }, 1000)
|
|
|
+ throw err
|
|
|
+ } else {
|
|
|
+ this.loginOther(response, a)
|
|
|
}
|
|
|
- Promise.all(promises).then(() => {
|
|
|
- crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com')
|
|
|
- }).catch(() => {
|
|
|
- crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com')
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- // for (let i in response.data.content.loginUrls) {
|
|
|
- // this.$jsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1), function (err, data) {
|
|
|
- // if (err) throw err
|
|
|
- // console.log(data)
|
|
|
- // })
|
|
|
- // }
|
|
|
- // setTimeout(function () {
|
|
|
- // window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
|
|
|
- // }, 3000)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.loginOther(response, a, 3000)
|
|
|
+ }
|
|
|
} else {
|
|
|
window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
|
|
|
}
|
|
|
@@ -121,11 +108,11 @@
|
|
|
this.$message.error(err.errMsg)
|
|
|
})
|
|
|
},
|
|
|
- getJsonp: function (url) {
|
|
|
+ getJsonp: function (url, timeout = 500) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$jsonp(url, {
|
|
|
name: 'successCallback',
|
|
|
- timeout: 500
|
|
|
+ timeout: timeout
|
|
|
}, function (err, data) {
|
|
|
if (err) {
|
|
|
reject(err)
|
|
|
@@ -142,6 +129,18 @@
|
|
|
} catch (err) {
|
|
|
console.log(err)
|
|
|
}
|
|
|
+ },
|
|
|
+ loginOther (response, a, timeout) {
|
|
|
+ const crossAfter = this.crossAfter
|
|
|
+ let promises = []
|
|
|
+ for (let i in response.data.content.loginUrls) {
|
|
|
+ promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1)))
|
|
|
+ }
|
|
|
+ Promise.all(promises).then(() => {
|
|
|
+ crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
|
|
|
+ }).catch(() => {
|
|
|
+ crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|