26 changed files with 432 additions and 172 deletions
@ -1,4 +1,5 @@ |
|||
NODE_ENV=production |
|||
VUE_APP_API_SERVER = https://epdc-shibei.elinkservice.cn/api |
|||
VUE_APP_NODE_ENV=shibei_prod |
|||
VUE_APP_PUBLIC_PATH=epmet-oper |
|||
VUE_APP_PUBLIC_PATH=epmet-oper |
|||
VUE_APP_SSO_LOGIN=off |
@ -0,0 +1,52 @@ |
|||
import { clearLoginInfo } from "@/utils"; |
|||
|
|||
export default { |
|||
data() { |
|||
return {}; |
|||
/* eslint-enable */ |
|||
}, |
|||
created() {}, |
|||
activated() {}, |
|||
methods: { |
|||
// 退出
|
|||
logoutHandle() { |
|||
this.$confirm( |
|||
this.$t("prompt.info", { handle: this.$t("logout") }), |
|||
this.$t("prompt.title"), |
|||
{ |
|||
confirmButtonText: this.$t("confirm"), |
|||
cancelButtonText: this.$t("cancel"), |
|||
type: "warning", |
|||
} |
|||
) |
|||
.then(() => { |
|||
//关闭所有标签页
|
|||
// tabs, 关闭全部
|
|||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter( |
|||
(item) => item.name === "home" |
|||
); |
|||
|
|||
this.$http |
|||
.post("/auth/login/logout") |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
//别处登陆时 退出不提示 直接跳登陆页即可
|
|||
if (res.code !== 10007) { |
|||
this.$message.error(res.msg); |
|||
} |
|||
} |
|||
|
|||
clearLoginInfo(); |
|||
this.$router.push({ name: "login" }); |
|||
// if (localStorage.getItem('userType') === 'work') {
|
|||
// this.$router.push({ name: 'loginWork' })
|
|||
// } else {
|
|||
// this.$router.push({ name: 'login' })
|
|||
// }
|
|||
}) |
|||
.catch(() => {}); |
|||
}) |
|||
.catch(() => {}); |
|||
}, |
|||
}, |
|||
}; |
@ -0,0 +1,76 @@ |
|||
<template> |
|||
<div class="g-app"> |
|||
<div class="m-hint">登录中...</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestGet, requestPost } from "@/js/dai/request"; |
|||
import getQueryPara from "dai-js/modules/getQueryPara"; |
|||
|
|||
export default { |
|||
data() { |
|||
return {}; |
|||
}, |
|||
|
|||
components: {}, |
|||
computed: {}, |
|||
|
|||
created() { |
|||
let ticket = getQueryPara("ticket"); |
|||
if (ticket) { |
|||
this.loginByTicket(ticket); |
|||
} else { |
|||
this.getAuthUrl(); |
|||
} |
|||
}, |
|||
mounted() {}, |
|||
|
|||
methods: { |
|||
async getAuthUrl() { |
|||
const url = "/auth/sso/ssoAuthUrl"; |
|||
|
|||
const { data, code, msg } = await requestGet(url, { |
|||
clientLoginUrl: location.href, |
|||
}); |
|||
|
|||
if (code === 0) { |
|||
location.href = data.authUrl + "&mode=ticket"; |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
async loginByTicket(ticket) { |
|||
const url = "/auth/sso/login?ticket=" + ticket; |
|||
|
|||
const { data, code, msg } = await requestPost(url, { |
|||
ticket, |
|||
}); |
|||
|
|||
if (code === 0) { |
|||
localStorage.setItem("token", data.token); |
|||
this.$router.replace({ name: "index" }); |
|||
} else { |
|||
this.$router.replace({ name: "login-sso" }); |
|||
this.getAuthUrl(); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.g-app { |
|||
width: 100vw; |
|||
height: 100vh; |
|||
background-color: #f7f7f7; |
|||
.m-hint { |
|||
text-align: center; |
|||
font-size: 36px; |
|||
line-height: 100vh; |
|||
color: #999999; |
|||
font-weight: bold; |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue