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