Răsfoiți Sursa

经营驾驶舱、生产移动端

yanghao 1 lună în urmă
părinte
comite
8ded817ee1
1 a modificat fișierele cu 43 adăugiri și 2 ștergeri
  1. 43 2
      src/views/drive/index.vue

+ 43 - 2
src/views/drive/index.vue

@@ -66,7 +66,7 @@
 import Header from "@components/home/header.vue";
 import Footer from "@components/home/Footer.vue";
 import { ref, computed, watch } from "vue";
-
+import * as dd from "dingtalk-jsapi";
 import { getMCSsoToken } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
 import { useThemeStore } from "@/stores/useThemeStore";
@@ -125,6 +125,7 @@ type DriveCard = {
   title: string;
   description: string;
   url: string;
+  mobileUrl?: string;
   bgColor: string;
   pcBg: string;
   mobileBg: string;
@@ -140,6 +141,8 @@ watch(
           title: "经营驾驶舱",
           description: "查看经营分析、经营指标与执行情况。",
           url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/9fb42908-894a-4373-a6be-ce046a42851d?preview=true&page_number=1",
+          mobileUrl:
+            "https://report.deepoil.cc:/webroot/decision/view/duchamp?viewlet=%25E7%25BB%258F%25E8%2590%25A5%25E9%25A9%25BE%25E9%25A9%25B6%25E8%2588%25B1%25EF%25BC%2588%25E7%25A7%25BB%25E5%258A%25A8%25E7%25AB%25AF%25EF%25BC%2589.fvs",
           bgColor: "#3876e0",
           pcBg: drivePc1_white,
           mobileBg: driveMobile1_white,
@@ -149,6 +152,7 @@ watch(
           title: "生产驾驶舱",
           description: "查看生产运营态势、核心指标与执行情况。",
           url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/dbc9cf73-81ce-43f1-9923-45cdfa5d5d3a?preview=true&page_number=1",
+          mobileUrl: "",
           bgColor: "#0f766e",
           pcBg: drivePc2_white,
           mobileBg: driveMobile2_white,
@@ -158,6 +162,7 @@ watch(
           title: "财务驾驶舱",
           description: "查看财务分析、预算执行与经营数据表现。",
           url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/e836fb5b-092c-4d64-a324-3beeb4fac0cc?preview=true&page_number=1",
+          mobileUrl: "",
           bgColor: "#ca8a04",
           pcBg: drivePc3_white,
           mobileBg: driveMobile3_white,
@@ -167,6 +172,7 @@ watch(
           title: "供应链驾驶舱",
           description: "查看供应链分析、物料需求与执行。",
           url: "#",
+          mobileUrl: "",
           bgColor: "#7c3aed",
           pcBg: drivePc4_white,
           mobileBg: driveMobile4_white,
@@ -176,6 +182,7 @@ watch(
           title: "市场驾驶舱",
           description: "查看市场分析、销售数据与执行情况。",
           url: "#",
+          mobileUrl: "",
           bgColor: "#16a34a",
           pcBg: drivePc5_white,
           mobileBg: driveMobile5_white,
@@ -185,6 +192,7 @@ watch(
           title: "QHSE驾驶舱",
           description: "查看安全、健康、环境与质量数据。",
           url: `${import.meta.env.VITE_PMS_URL}/portalLogin?username=${userStore.getUser.username}&source=qhse`,
+          mobileUrl: "",
           bgColor: "#dc2626",
           pcBg: drivePc6_white,
           mobileBg: driveMobile6_white,
@@ -197,6 +205,8 @@ watch(
           title: "经营驾驶舱",
           description: "查看经营分析、经营指标与执行情况。",
           url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/9fb42908-894a-4373-a6be-ce046a42851d?preview=true&page_number=1",
+          mobileUrl:
+            "https://report.deepoil.cc:/webroot/decision/view/duchamp?viewlet=%25E7%25BB%258F%25E8%2590%25A5%25E9%25A9%25BE%25E9%25A9%25B6%25E8%2588%25B1%25EF%25BC%2588%25E7%25A7%25BB%25E5%258A%25A8%25E7%25AB%25AF%25EF%25BC%2589.fvs",
           bgColor: "#3876e0",
           pcBg: drivePc1,
           mobileBg: driveMobile1,
@@ -206,6 +216,8 @@ watch(
           title: "生产驾驶舱",
           description: "查看生产运营态势、核心指标与执行情况。",
           url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/dbc9cf73-81ce-43f1-9923-45cdfa5d5d3a?preview=true&page_number=1",
+          mobileUrl:
+            "https://report.deepoil.cc:/webroot/decision/view/duchamp?viewlet=%25E7%2594%259F%25E4%25BA%25A7%25E6%2580%25BB%25E8%25A7%2588%25E9%25A9%25BE%25E9%25A9%25B6%25E8%2588%25B1%25EF%25BC%2588%25E7%25A7%25BB%25E5%258A%25A8%25E7%25AB%25AF%25EF%25BC%2589.fvs",
           bgColor: "#0f766e",
           pcBg: drivePc2,
           mobileBg: driveMobile2,
@@ -215,6 +227,7 @@ watch(
           title: "财务驾驶舱",
           description: "查看财务分析、预算执行与经营数据表现。",
           url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/e836fb5b-092c-4d64-a324-3beeb4fac0cc?preview=true&page_number=1",
+          mobileUrl: "",
           bgColor: "#ca8a04",
           pcBg: drivePc3,
           mobileBg: driveMobile3,
@@ -224,6 +237,7 @@ watch(
           title: "供应链驾驶舱",
           description: "查看供应链分析、物料需求与执行。",
           url: "#",
+          mobileUrl: "",
           bgColor: "#7c3aed",
           pcBg: drivePc4,
           mobileBg: driveMobile4,
@@ -233,6 +247,7 @@ watch(
           title: "市场驾驶舱",
           description: "查看市场分析、销售数据与执行情况。",
           url: "#",
+          mobileUrl: "",
           bgColor: "#16a34a",
           pcBg: drivePc5,
           mobileBg: driveMobile5,
@@ -242,6 +257,7 @@ watch(
           title: "QHSE驾驶舱",
           description: "查看安全、健康、环境与质量数据。",
           url: `${import.meta.env.VITE_PMS_URL}/portalLogin?username=${userStore.getUser.username}&source=qhse`,
+          mobileUrl: "",
           bgColor: "#dc2626",
           pcBg: drivePc6,
           mobileBg: driveMobile6,
@@ -257,6 +273,8 @@ const driveCards = ref([
     title: "经营驾驶舱",
     description: "查看经营分析、经营指标与执行情况。",
     url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/9fb42908-894a-4373-a6be-ce046a42851d?preview=true&page_number=1",
+    mobileUrl:
+      "https://report.deepoil.cc:/webroot/decision/view/duchamp?viewlet=%25E7%25BB%258F%25E8%2590%25A5%25E9%25A9%25BE%25E9%25A9%25B6%25E8%2588%25B1%25EF%25BC%2588%25E7%25A7%25BB%25E5%258A%25A8%25E7%25AB%25AF%25EF%25BC%2589.fvs",
     bgColor: "#3876e0",
     pcBg: themeStore.theme === "light" ? drivePc1_white : drivePc1,
     mobileBg: themeStore.theme === "light" ? driveMobile1_white : driveMobile1,
@@ -266,6 +284,8 @@ const driveCards = ref([
     title: "生产驾驶舱",
     description: "查看生产运营态势、核心指标与执行情况。",
     url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/dbc9cf73-81ce-43f1-9923-45cdfa5d5d3a?preview=true&page_number=1",
+    mobileUrl:
+      "https://report.deepoil.cc:/webroot/decision/view/duchamp?viewlet=%25E7%2594%259F%25E4%25BA%25A7%25E6%2580%25BB%25E8%25A7%2588%25E9%25A9%25BE%25E9%25A9%25B6%25E8%2588%25B1%25EF%25BC%2588%25E7%25A7%25BB%25E5%258A%25A8%25E7%25AB%25AF%25EF%25BC%2589.fvs",
     bgColor: "#0f766e",
     pcBg: themeStore.theme === "light" ? drivePc2_white : drivePc2,
     mobileBg: themeStore.theme === "light" ? driveMobile2_white : driveMobile2,
@@ -275,6 +295,7 @@ const driveCards = ref([
     title: "财务驾驶舱",
     description: "查看财务分析、预算执行与经营数据表现。",
     url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/e836fb5b-092c-4d64-a324-3beeb4fac0cc?preview=true&page_number=1",
+    mobileUrl: "",
     bgColor: "#ca8a04",
     pcBg: themeStore.theme === "light" ? drivePc3_white : drivePc3,
     mobileBg: themeStore.theme === "light" ? driveMobile3_white : driveMobile3,
@@ -284,6 +305,7 @@ const driveCards = ref([
     title: "供应链驾驶舱",
     description: "查看供应链分析、物料需求与执行。",
     url: "#",
+    mobileUrl: "",
     bgColor: "#7c3aed",
     pcBg: themeStore.theme === "light" ? drivePc4_white : drivePc4,
     mobileBg: themeStore.theme === "light" ? driveMobile4_white : driveMobile4,
@@ -293,6 +315,7 @@ const driveCards = ref([
     title: "市场驾驶舱",
     description: "查看市场分析、销售数据与执行情况。",
     url: "#",
+    mobileUrl: "",
     bgColor: "#16a34a",
     pcBg: themeStore.theme === "light" ? drivePc5_white : drivePc5,
     mobileBg: themeStore.theme === "light" ? driveMobile5_white : driveMobile5,
@@ -302,6 +325,7 @@ const driveCards = ref([
     title: "QHSE驾驶舱",
     description: "查看安全、健康、环境与质量数据。",
     url: `${import.meta.env.VITE_PMS_URL}/portalLogin?username=${userStore.getUser.username}&source=qhse`,
+    mobileUrl: "",
     bgColor: "#dc2626",
     pcBg: themeStore.theme === "light" ? drivePc6_white : drivePc6,
     mobileBg: themeStore.theme === "light" ? driveMobile6_white : driveMobile6,
@@ -317,10 +341,27 @@ const filteredCards = computed(() => {
 });
 
 const openDrive = async (option: DriveCard) => {
+  let ua2 = navigator.userAgent.toLowerCase();
+  let isMobile = ua2.indexOf("dingtalk") > -1;
   if (userStore.getUser.username && getAccessToken()) {
     const res = await getMCSsoToken();
     if (res) {
-      window.open(`${option.url}&ssoToken=${res}`, "_blank");
+      if (isMobile) {
+        if (option.title === "经营驾驶舱" || option.title === "生产驾驶舱") {
+          dd.biz.util.openLink({
+            url: `${option.mobileUrl}&ssoToken=${res}`,
+            onSuccess: () => {},
+          });
+        } else {
+          dd.biz.util.openLink({
+            url: `${option.url}&ssoToken=${res}`,
+            onSuccess: () => {},
+          });
+          // window.open(`${option.url}&ssoToken=${res}`, "_blank");
+        }
+      } else {
+        window.open(`${option.url}&ssoToken=${res}`, "_blank");
+      }
     }
   }
 };