接入 dingtalk 钉钉的三方登陆,流程未接入

This commit is contained in:
YunaiV
2021-10-02 18:31:05 +08:00
parent a56b4a7c9c
commit e05d90590e
15 changed files with 342 additions and 102 deletions

View File

@ -45,7 +45,7 @@
</template>
<script>
import { getCodeImg,oAuthLogin } from "@/api/login";
import { getCodeImg,thirdLoginRedirect } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
@ -54,7 +54,6 @@ export default {
data() {
return {
codeUrl: "",
cookiePassword: "",
loginForm: {
username: "admin",
password: "admin123",
@ -68,13 +67,10 @@ export default {
source: "gitee",
type: 10
}, {
img: "https://cdn.jsdelivr.net/gh/justauth/justauth-oauth-logo@1.2/wechat.png",
title: "微信",
source: "weixin"
}, {
img: "https://cdn.jsdelivr.net/gh/justauth/justauth-oauth-logo@1.2/qq.png",
title: "QQ",
source: "qq"
img: "https://cdn.jsdelivr.net/gh/justauth/justauth-oauth-logo@1.2/dingtalk.png",
title: "钉钉",
source: "dingtalk",
type: 20
}
],
loginRules: {
@ -147,9 +143,11 @@ export default {
// 设置登陆中
this.loading = true;
// 计算 redirectUri
const redirectUri = location.origin + '/third-login';
// const redirectUri = location.origin + '/third-login';
// const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback';
const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
// 进行跳转
oAuthLogin(provider.type, redirectUri).then((res) => {
thirdLoginRedirect(provider.type, redirectUri).then((res) => {
// console.log(res.url);
window.location.href = res.data;
});