|
|
@@ -418,101 +418,62 @@ const getById = (tab) => {
|
|
|
const go = async (item) => {
|
|
|
if (userStore.getUser.username && getAccessToken()) {
|
|
|
if (item.type === "OA") {
|
|
|
- const res = await ssoLogin({
|
|
|
- username: userStore.getUser.username,
|
|
|
- });
|
|
|
- if (res) {
|
|
|
- const ua = window.navigator.userAgent; // const ua = navigator.userAgent;
|
|
|
- const isDesktop =
|
|
|
- ua.includes("DingTalk") &&
|
|
|
- (ua.includes("Windows") || ua.includes("Macintosh"));
|
|
|
-
|
|
|
- let ua2 = navigator.userAgent.toLowerCase();
|
|
|
- let isMobile = ua2.indexOf("dingtalk") > -1;
|
|
|
-
|
|
|
- if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
|
|
|
- if (isMobile && !isDesktop) {
|
|
|
- const targetUrl = item.appUrl;
|
|
|
- if (targetUrl) {
|
|
|
- dd.biz.util.openLink({
|
|
|
- url: targetUrl,
|
|
|
- onSuccess: () => {},
|
|
|
- onFail: (err) => {
|
|
|
- // loading.close();
|
|
|
- ElMessage.error("打开链接失败,请重试");
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- const targetUrl1 = item.indexUrl + "?ssoToken=" + res + "#/main";
|
|
|
- const targetUrl2 = item.flowUrl;
|
|
|
-
|
|
|
- dd.biz.util.openLink({
|
|
|
- url: targetUrl1,
|
|
|
- onSuccess: () => {
|
|
|
- setTimeout(() => {
|
|
|
- dd.biz.util.openLink({
|
|
|
- url: targetUrl2,
|
|
|
- onSuccess: () => {},
|
|
|
- onFail: (err) => {
|
|
|
- ElMessage.error("跳转失败,请重试");
|
|
|
- },
|
|
|
- });
|
|
|
- }, 2000);
|
|
|
- },
|
|
|
- onFail: (err) => {
|
|
|
- ElMessage.error("打开链接失败,请重试");
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } else if (isDesktop) {
|
|
|
- // const newTab = window.open("", "_blank");
|
|
|
- // newTab.location.href =
|
|
|
- // item.indexUrl + "?ssoToken=" + res + "#/main";
|
|
|
-
|
|
|
- // setTimeout(() => {
|
|
|
- // newTab.location.href = item.flowUrl;
|
|
|
- // setTimeout(() => {
|
|
|
- // // loading.close();
|
|
|
- // }, 500);
|
|
|
- // }, 100);
|
|
|
+ const ua = window.navigator.userAgent; // const ua = navigator.userAgent;
|
|
|
+ const isDesktop =
|
|
|
+ ua.includes("DingTalk") &&
|
|
|
+ (ua.includes("Windows") || ua.includes("Macintosh"));
|
|
|
+
|
|
|
+ let ua2 = navigator.userAgent.toLowerCase();
|
|
|
+ let isMobile = ua2.indexOf("dingtalk") > -1;
|
|
|
+
|
|
|
+ if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
|
|
|
+ if (isMobile && !isDesktop) {
|
|
|
+ const targetUrl = item.appUrl;
|
|
|
+ if (targetUrl) {
|
|
|
+ const res = await ssoLogin({
|
|
|
+ workcode: userStore.getUser.username,
|
|
|
+ uri: targetUrl,
|
|
|
+ });
|
|
|
dd.biz.util.openLink({
|
|
|
- url: item.indexUrl + "?ssoToken=" + res + "#/main",
|
|
|
- onSuccess: () => {
|
|
|
- setTimeout(() => {
|
|
|
- dd.biz.util.openLink({
|
|
|
- url: item.flowUrl,
|
|
|
- onSuccess: () => {},
|
|
|
- onFail: (err) => {
|
|
|
- ElMessage.error("跳转失败,请重试");
|
|
|
- },
|
|
|
- });
|
|
|
- }, 2000);
|
|
|
- },
|
|
|
+ url: JSON.parse(res).ssoUrl,
|
|
|
+ onSuccess: () => {},
|
|
|
onFail: (err) => {
|
|
|
+ // loading.close();
|
|
|
ElMessage.error("打开链接失败,请重试");
|
|
|
},
|
|
|
});
|
|
|
} else {
|
|
|
- console.log("❌ 非钉钉环境");
|
|
|
+ const res = await ssoLogin({
|
|
|
+ workcode: userStore.getUser.username,
|
|
|
+ uri: item.flowUrl,
|
|
|
+ });
|
|
|
+
|
|
|
+ dd.biz.util.openLink({
|
|
|
+ url: JSON.parse(res).ssoUrl,
|
|
|
+ onSuccess: () => {},
|
|
|
+ onFail: (err) => {
|
|
|
+ ElMessage.error("打开链接失败,请重试");
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
- } else {
|
|
|
- // 浏览器环境
|
|
|
- const loading = ElLoading.service({
|
|
|
- lock: true,
|
|
|
- text: "正在跳转,请稍候...",
|
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
|
|
+ } else if (isDesktop) {
|
|
|
+ const res = await ssoLogin({
|
|
|
+ workcode: userStore.getUser.username,
|
|
|
+ uri: item.flowUrl,
|
|
|
});
|
|
|
|
|
|
- const newTab = window.open("", "_blank");
|
|
|
- newTab.location.href = item.indexUrl + "?ssoToken=" + res + "#/main";
|
|
|
-
|
|
|
- setTimeout(() => {
|
|
|
- newTab.location.href = item.flowUrl;
|
|
|
- setTimeout(() => {
|
|
|
- loading.close();
|
|
|
- }, 500);
|
|
|
- }, 100);
|
|
|
+ dd.biz.util.openLink({
|
|
|
+ url: JSON.parse(res).ssoUrl, // 先跳你的 SSO 链接
|
|
|
+ onSuccess: () => {},
|
|
|
+ });
|
|
|
}
|
|
|
+ } else {
|
|
|
+ const res = await ssoLogin({
|
|
|
+ workcode: userStore.getUser.username,
|
|
|
+ uri: item.flowUrl,
|
|
|
+ });
|
|
|
+
|
|
|
+ window.open(JSON.parse(res).ssoUrl, "_blank");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -591,7 +552,6 @@ const handleDetailClick = (task, categoryTitle) => {
|
|
|
let isMobile = ua2.indexOf("dingtalk") > -1;
|
|
|
|
|
|
if (isMobile) {
|
|
|
- // 示例:根据类型跳转
|
|
|
if (task.name === "OA" && categoryTitle === "我的待办") {
|
|
|
// router.push({
|
|
|
// path: "/mobile-todo-list",
|