|
@@ -13,7 +13,8 @@
|
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
|
title: 'loading'
|
|
title: 'loading'
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+ sessionStorage.setItem('option', option)
|
|
|
|
|
+
|
|
|
// 授权调用
|
|
// 授权调用
|
|
|
if(typeof(option.code) != 'undefined' && option.code){
|
|
if(typeof(option.code) != 'undefined' && option.code){
|
|
|
this.userAuth(option.code);
|
|
this.userAuth(option.code);
|
|
@@ -26,7 +27,7 @@
|
|
|
methods: {
|
|
methods: {
|
|
|
// 获取授权地址
|
|
// 获取授权地址
|
|
|
getAuthUrl() {
|
|
getAuthUrl() {
|
|
|
- this.$request.api('/api/auth/url', {url: document.location.protocol+'://'+document.domain+'/page/entry/auth'}).then(res => {
|
|
|
|
|
|
|
+ this.$request.api('/api/auth/url', {url: document.location.protocol+'//'+document.location.host+'/pages/entry/auth'}).then(res => {
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
if(res.success == true){
|
|
if(res.success == true){
|
|
|
location.href = res.data
|
|
location.href = res.data
|
|
@@ -44,14 +45,15 @@
|
|
|
userAuth(code) {
|
|
userAuth(code) {
|
|
|
let _uni = this
|
|
let _uni = this
|
|
|
let redirceUrl = sessionStorage.getItem('redirceUrl')
|
|
let redirceUrl = sessionStorage.getItem('redirceUrl')
|
|
|
- redirceUrl = typeof(redirceUrl)!= 'undefined'? redirceUrl : location.domain+'/pages/index/index';
|
|
|
|
|
|
|
+ redirceUrl = typeof(redirceUrl)!= 'undefined' && redirceUrl != 'undefined'? redirceUrl : document.location.host+'/pages/index/index';
|
|
|
|
|
+
|
|
|
this.$request.api('/api/auth', {code: code}).then(res => {
|
|
this.$request.api('/api/auth', {code: code}).then(res => {
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
let accessToken = typeof(res.access_token)!= 'undefined'? res.access_token : ''
|
|
let accessToken = typeof(res.access_token)!= 'undefined'? res.access_token : ''
|
|
|
if(res.success == true && accessToken){
|
|
if(res.success == true && accessToken){
|
|
|
_uni.$store.commit('setToken', res);
|
|
_uni.$store.commit('setToken', res);
|
|
|
- location.href = redirceUrl
|
|
|
|
|
|
|
+ //location.href = redirceUrl
|
|
|
}else{
|
|
}else{
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: '错误提示',
|
|
title: '错误提示',
|