flat: tiket
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import website from '@/config/website';
|
import website from '@/config/website';
|
||||||
import request from '@/router/axios';
|
import request from '@/router/axios';
|
||||||
|
|
||||||
export const loginByUsername = (username, password, type, key, code, loginType) =>
|
export const loginByUsername = (username, password, type, key, code, loginType, ticket) =>
|
||||||
request({
|
request({
|
||||||
url: '/api/jobslink-auth/oauth/token',
|
url: '/api/jobslink-auth/oauth/token',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -15,7 +15,8 @@ export const loginByUsername = (username, password, type, key, code, loginType)
|
|||||||
password,
|
password,
|
||||||
grant_type: (website.captchaMode ? 'captcha' : 'password'),
|
grant_type: (website.captchaMode ? 'captcha' : 'password'),
|
||||||
scope: 'all',
|
scope: 'all',
|
||||||
type
|
type,
|
||||||
|
ticket
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import { mapGetters } from "vuex";
|
|||||||
import topLang from "@/page/index/top/top-lang";
|
import topLang from "@/page/index/top/top-lang";
|
||||||
// import { info } from "@/api/system/tenant";
|
// import { info } from "@/api/system/tenant";
|
||||||
import { getCaptcha } from "@/api/user";
|
import { getCaptcha } from "@/api/user";
|
||||||
if (/(\/login\b)(\?.*)(\&.*)/ig.test(location.href)) {
|
if (/(\/login\?)(.*)/ig.test(location.href)) {
|
||||||
const obj = {}
|
const obj = {}
|
||||||
const query = location.href.split('?')[1].replace(/\?/, '').split('&')
|
const query = location.href.split('?')[1].replace(/\?/, '').split('&')
|
||||||
query.forEach((item) => { const a = item.split('='); obj[a[0]] = a[1]})
|
query.forEach((item) => { const a = item.split('='); obj[a[0]] = a[1]})
|
||||||
@@ -100,6 +100,7 @@ export default {
|
|||||||
passwordType: "password",
|
passwordType: "password",
|
||||||
proLoading: false,
|
proLoading: false,
|
||||||
loading: null,
|
loading: null,
|
||||||
|
ticket: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -107,12 +108,12 @@ export default {
|
|||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
// this.getTenant();
|
// this.getTenant();
|
||||||
const { username, password } = JSON.parse(window.sessionStorage.getItem('query_session') || "{}")
|
const { ticket } = JSON.parse(window.sessionStorage.getItem('query_session') || "{}")
|
||||||
window.sessionStorage.removeItem('query_session')
|
window.sessionStorage.removeItem('query_session')
|
||||||
if(username && password) {
|
console.log(ticket)
|
||||||
|
if(ticket) {
|
||||||
this.proLoading = true
|
this.proLoading = true
|
||||||
this.loginForm.username = username
|
this.ticket = ticket
|
||||||
this.loginForm.password = password
|
|
||||||
this.handleLogin()
|
this.handleLogin()
|
||||||
} else {
|
} else {
|
||||||
console.log('刷新1')
|
console.log('刷新1')
|
||||||
@@ -143,7 +144,13 @@ export default {
|
|||||||
},
|
},
|
||||||
handleLogin () {
|
handleLogin () {
|
||||||
if(this.proLoading) {
|
if(this.proLoading) {
|
||||||
this.ByUsernameCallback()
|
let params = {
|
||||||
|
...this.loginForm,
|
||||||
|
username: "admin",
|
||||||
|
password: "admin",
|
||||||
|
ticket: this.ticket
|
||||||
|
}
|
||||||
|
this.ByUsernameCallback(params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$refs.loginForm.validate(valid => {
|
this.$refs.loginForm.validate(valid => {
|
||||||
@@ -152,13 +159,17 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
ByUsernameCallback() {
|
ByUsernameCallback(params) {
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '登录中,请稍后。。。',
|
text: '登录中,请稍后。。。',
|
||||||
spinner: "el-icon-loading"
|
spinner: "el-icon-loading"
|
||||||
});
|
});
|
||||||
this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
|
let obj = this.loginForm
|
||||||
|
if(params) {
|
||||||
|
obj = params
|
||||||
|
}
|
||||||
|
this.$store.dispatch("LoginByUsername", obj).then(() => {
|
||||||
this.$store.dispatch('jlHelpShow', false)
|
this.$store.dispatch('jlHelpShow', false)
|
||||||
this.$router.push({ path: this.tagWel.value });
|
this.$router.push({ path: this.tagWel.value });
|
||||||
loading.close();
|
loading.close();
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ const user = {
|
|||||||
userInfo.type,
|
userInfo.type,
|
||||||
userInfo.key,
|
userInfo.key,
|
||||||
userInfo.code,
|
userInfo.code,
|
||||||
userInfo.loginType
|
userInfo.loginType,
|
||||||
|
userInfo.ticket
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ module.exports = {
|
|||||||
port: 1888,
|
port: 1888,
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: 'http://localhost:8000',
|
target: 'http://10.165.0.173:8000',
|
||||||
ws: true,
|
ws: true,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
|
|||||||
Reference in New Issue
Block a user