对接登录
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user