mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-23 23:45:08 +08:00
完整完成钉钉的三方接入
This commit is contained in:
@ -45,7 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg,thirdLoginRedirect } from "@/api/login";
|
||||
import { getCodeImg,socialLoginRedirect } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
|
||||
@ -143,11 +143,11 @@ export default {
|
||||
// 设置登陆中
|
||||
this.loading = true;
|
||||
// 计算 redirectUri
|
||||
// const redirectUri = location.origin + '/third-login';
|
||||
const redirectUri = location.origin + '/social-login';
|
||||
// const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback';
|
||||
const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
|
||||
// const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
|
||||
// 进行跳转
|
||||
thirdLoginRedirect(provider.type, redirectUri).then((res) => {
|
||||
socialLoginRedirect(provider.type, redirectUri).then((res) => {
|
||||
// console.log(res.url);
|
||||
window.location.href = res.data;
|
||||
});
|
||||
|
@ -28,7 +28,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { thirdLogin } from "@/api/login";
|
||||
import { socialLogin } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
|
||||
@ -39,7 +39,7 @@ export default {
|
||||
loginForm: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
rememberMe: false, // TODO 芋艿:后面看情况,去掉这块
|
||||
},
|
||||
loginRules: {
|
||||
username: [
|
||||
@ -68,11 +68,17 @@ export default {
|
||||
created() {
|
||||
this.getCookie();
|
||||
// 三方登陆相关
|
||||
this.type = 10;
|
||||
this.type = 20;
|
||||
this.code = this.$route.query.code;
|
||||
this.state = this.$route.query.state;
|
||||
thirdLogin(this.type, this.code, this.state).then(res => {
|
||||
debugger
|
||||
this.$store.dispatch("SocialLogin", {
|
||||
code: this.code,
|
||||
state: this.state,
|
||||
type: this.type
|
||||
}).then(() => {
|
||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@ -97,7 +103,13 @@ export default {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
}
|
||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||
this.$store.dispatch("SocialLogin2", {
|
||||
code: this.code,
|
||||
state: this.state,
|
||||
type: this.type,
|
||||
username: this.loginForm.username,
|
||||
password: this.loginForm.password
|
||||
}).then(() => {
|
||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
Reference in New Issue
Block a user