|
|
@@ -330,19 +330,20 @@
|
|
|
for (let n in param) {
|
|
|
a += (n + '=' + param[n] + '&')
|
|
|
}
|
|
|
- let countLink = 0
|
|
|
+ const crossAfter = this.crossAfter
|
|
|
+ let promises = []
|
|
|
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 ((++countLink) === response.data.content.loginUrls.length) {
|
|
|
- window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
|
|
|
- }
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
+ 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')
|
|
|
+ }).catch(() => {
|
|
|
+ crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com')
|
|
|
+ })
|
|
|
this.isShowLoading = true
|
|
|
- setTimeout(function () {
|
|
|
- window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
|
|
|
- }, 3000)
|
|
|
+// setTimeout(function () {
|
|
|
+// window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
|
|
|
+// }, 3000)
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.error(response.data)
|
|
|
@@ -378,6 +379,28 @@
|
|
|
this.login.spaceUU = spaceUU
|
|
|
this.dialogVisible = false
|
|
|
this.isLogin(flag)
|
|
|
+ },
|
|
|
+ getJsonp: function (url) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$jsonp(url, {
|
|
|
+ name: 'successCallback',
|
|
|
+ timeout: 200
|
|
|
+ }, function (err, data) {
|
|
|
+ if (err) {
|
|
|
+ reject(err)
|
|
|
+ throw err
|
|
|
+ } else {
|
|
|
+ resolve(data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ crossAfter (url) {
|
|
|
+ try {
|
|
|
+ window.location.href = url
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|