flat: zanc
This commit is contained in:
4
App.vue
4
App.vue
@@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function(options) {
|
onLaunch: function(options) {
|
||||||
if (options.query.token) {
|
if (options.query.ticket) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/login/blank?token=' + options.query.token
|
url: '/pages/login/blank?ticket=' + options.query.ticket
|
||||||
})
|
})
|
||||||
} else if (this.$store.state.user.token) {
|
} else if (this.$store.state.user.token) {
|
||||||
this.$store.dispatch('startRefreshTokenTimer')
|
this.$store.dispatch('startRefreshTokenTimer')
|
||||||
|
|||||||
90
api/user.js
90
api/user.js
@@ -1,70 +1,70 @@
|
|||||||
import {
|
import {
|
||||||
request
|
request
|
||||||
} from '@/untils/AxiosUtils.js';
|
} from '@/untils/AxiosUtils.js';
|
||||||
import {
|
import {
|
||||||
getStore
|
getStore
|
||||||
} from '@/untils/store.js'
|
} from '@/untils/store.js'
|
||||||
import website from "@/config/website";
|
import website from "@/config/website";
|
||||||
|
|
||||||
export const loginByUsername = (tenantId, username, password, type, key, code, token) => request({
|
export const loginByUsername = (tenantId, username, password, type, key, code, ticket) => request({
|
||||||
url: '/api/jobslink-auth/oauth/token',
|
url: '/api/jobslink-auth/oauth/token',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'Login-Type': 'Type-U',
|
'Login-Type': 'Type-U',
|
||||||
'Captcha-Key': key,
|
'Captcha-Key': key,
|
||||||
'Captcha-Code': code,
|
'Captcha-Code': code,
|
||||||
'Platform-Id': getStore({
|
'Platform-Id': getStore({
|
||||||
name: 'platformId'
|
name: 'platformId'
|
||||||
}) || ''
|
}) || ''
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
tenantId,
|
tenantId,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
grant_type: (website.captchaMode ? "captcha" : "password"),
|
grant_type: (website.captchaMode ? "captcha" : "password"),
|
||||||
scope: "all",
|
scope: "all",
|
||||||
type,
|
type,
|
||||||
token
|
ticket
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const refreshToken = (refresh_token, tenantId) => request({
|
export const refreshToken = (refresh_token, tenantId) => request({
|
||||||
url: '/api/jobslink-auth/oauth/token',
|
url: '/api/jobslink-auth/oauth/token',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'Tenant-Id': tenantId,
|
'Tenant-Id': tenantId,
|
||||||
'Login-Type': 'Type-U',
|
'Login-Type': 'Type-U',
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
tenantId,
|
tenantId,
|
||||||
refresh_token,
|
refresh_token,
|
||||||
grant_type: "refresh_token",
|
grant_type: "refresh_token",
|
||||||
scope: "all",
|
scope: "all",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getCaptcha = () => request({
|
export const getCaptcha = () => request({
|
||||||
url: '/api/jobslink-auth/oauth/captcha',
|
url: '/api/jobslink-auth/oauth/captcha',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const logout = () => request({
|
export const logout = () => request({
|
||||||
url: '/api/jobslink-auth/oauth/logout',
|
url: '/api/jobslink-auth/oauth/logout',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getUserInfo = () => request({
|
export const getUserInfo = () => request({
|
||||||
url: '/api/jobslink-auth/oauth/user-info',
|
url: '/api/jobslink-auth/oauth/user-info',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const sendLogs = (list) => request({
|
export const sendLogs = (list) => request({
|
||||||
url: '/api/jobslink-auth/oauth/logout',
|
url: '/api/jobslink-auth/oauth/logout',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: list
|
data: list
|
||||||
});
|
});
|
||||||
|
|
||||||
export const clearCache = () => request({
|
export const clearCache = () => request({
|
||||||
url: '/api/jobslink-auth/oauth/clear-cache',
|
url: '/api/jobslink-auth/oauth/clear-cache',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
mapGetters
|
mapGetters
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
import website from '@/config/website.js'
|
import website from '@/config/website.js'
|
||||||
export default {
|
export default {
|
||||||
@@ -13,45 +13,45 @@
|
|||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['auth']),
|
...mapGetters(['auth']),
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: ''
|
title: ''
|
||||||
})
|
})
|
||||||
if(options.token) {
|
if (options.ticket) {
|
||||||
const that = this
|
const that = this
|
||||||
console.log(options)
|
console.log(options)
|
||||||
this.$store.dispatch("LoginByUsername", {
|
this.$store.dispatch("LoginByUsername", {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: "admin",
|
password: "admin",
|
||||||
key: '',
|
key: '',
|
||||||
code: '1111',
|
code: '1111',
|
||||||
type: "account",
|
type: "account",
|
||||||
token: options.token,
|
ticket: options.ticket,
|
||||||
tenantId: website.tenantId
|
tenantId: website.tenantId
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
console.log('123', resp)
|
console.log('123', resp)
|
||||||
this.$store.dispatch('refreshAuthState').then(() => {
|
this.$store.dispatch('refreshAuthState').then(() => {
|
||||||
that.loading = false
|
that.loading = false
|
||||||
var auth = this.auth
|
var auth = this.auth
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (!auth.bankCardState) {
|
if (!auth.bankCardState) {
|
||||||
that.goSign(0)
|
that.goSign(0)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
// this.$refs.code.refushCode()
|
// this.$refs.code.refushCode()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -64,7 +64,5 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container{
|
.app-container {}
|
||||||
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -80,7 +80,7 @@ const user = {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type,
|
loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type,
|
||||||
userInfo.key,
|
userInfo.key,
|
||||||
userInfo.code, userInfo.token).then(res => {
|
userInfo.code, userInfo.ticket).then(res => {
|
||||||
|
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
if (data.error_description) {
|
if (data.error_description) {
|
||||||
|
|||||||
Reference in New Issue
Block a user