对接登录

This commit is contained in:
1147680382@qq.com
2025-05-20 17:58:31 +08:00
parent 4bd7c4de67
commit cd90af7c05
4 changed files with 47 additions and 11 deletions
+4 -2
View File
@@ -23,7 +23,7 @@
import { useRouter } from "vue-router";
import { ref } from "vue";
// import { login, obtainUserInformationApi } from "../../api/modules/index";
import { login } from "../../api/modules/index";
import { login, obtainUserInformationApi } from "../../api/modules/index";
import { ElMessage } from "element-plus";
import dd from "dingtalk-jsapi";
const router = useRouter();
@@ -31,6 +31,7 @@ const router = useRouter();
// 登录
const loginIn = async (code) => {
let res = await login(code);
console.log(res);
sessionStorage.setItem("token", res.result.token);
ElMessage({
message: "授权成功",
@@ -58,7 +59,7 @@ if (token) {
dd.runtime.permission.requestAuthCode({
corpId: "ding03f8e88dde9b426835c2f4657eb6378f", //企业id
onSuccess: function (info) {
console.log(info);
console.log(info.code, "code");
loginIn(info.code);
},
});
@@ -71,6 +72,7 @@ if (token) {
const obInformation = async () => {
let res = await obtainUserInformationApi();
const userInfo = res.result;
console.log(userInfo, "userInfo");
ElMessage({
message: "获取个人信息成功",
type: "success",