Răsfoiți Sursa

Merge branch 'fix_env' of ruiqigogs/yf-portal-vue into master

yanghao 2 luni în urmă
părinte
comite
48b56e647f
8 a modificat fișierele cu 129 adăugiri și 91 ștergeri
  1. 0 2
      .env
  2. 2 1
      .env.dev
  3. 2 0
      .env.prod
  4. 0 0
      .env.stage
  5. 0 0
      .env.test
  6. 5 1
      package.json
  7. 37 54
      src/components/home/CardItem.vue
  8. 83 33
      vite.config.ts

+ 0 - 2
.env

@@ -2,5 +2,3 @@ VITE_APP_TITLE='科瑞石油技术门户网站'
 
 VITE_DINGTALK_APP_ID='dingmr9ez0ecgbmscfeb'
 VITE_DINGTALK_REDIRECT_URI='http://iot.deepoil.cc:5172/login?loginType=dingding&type=20'
-
-VITE_BASE_URL='http://iot.deepoil.cc:5172'

+ 2 - 1
.env.dev

@@ -1 +1,2 @@
-VITE_BASE_URL='https://iot.deepoil.cc/admin-api'
+VITE_BASE_URL='http://iot.deepoil.cc:5172'
+VITE_PMS_URL='https://iot.deepoil.cc'

+ 2 - 0
.env.prod

@@ -0,0 +1,2 @@
+VITE_BASE_URL='https://portal.deepoil.cc'
+VITE_PMS_URL='https://aims.deepoil.cc'

+ 0 - 0
.env.stage


+ 0 - 0
.env.test


+ 5 - 1
package.json

@@ -8,7 +8,11 @@
   },
   "scripts": {
     "dev": "vite",
-    "build": "run-p type-check \"build-only {@}\" --",
+    "build:local": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build",
+    "build:dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode dev",
+    "build:test": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode test",
+    "build:stage": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode stage",
+    "build:prod": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode prod",
     "preview": "vite preview",
     "build-only": "vite build",
     "type-check": "vue-tsc --build"

+ 37 - 54
src/components/home/CardItem.vue

@@ -130,27 +130,27 @@ const props = defineProps<{
 
 // 创建图标映射表
 const iconMap: Record<string, string> = {
-  "OA办公系统": oaimage,
-  "经营驾驶舱": driveimage,
-  "战略解码与执行": zhanlueimage,
+  OA办公系统: oaimage,
+  经营驾驶舱: driveimage,
+  战略解码与执行: zhanlueimage,
   "财务管理(收入、成本、应收账款)": erpimage,
-  "技术研发管理": jishuimage,
+  技术研发管理: jishuimage,
   "客户管理(CRM)": crmimage,
   "人力资源(EHR)": ehrimage,
   "供应链管理(SCM)": scmimage,
-  "组织资产管理": zuzhiimage,
+  组织资产管理: zuzhiimage,
   "风控、合规管理": safeimage,
-  "中航北斗智慧管理系统": zhonghangimage,
-  "智能钻井系统": zuanjingimage,
-  "智能压裂系统": yalieimage,
-  "智能注气系统": zhuqiimage,
-  "智能连油系统": lianyouimage,
+  中航北斗智慧管理系统: zhonghangimage,
+  智能钻井系统: zuanjingimage,
+  智能压裂系统: yalieimage,
+  智能注气系统: zhuqiimage,
+  智能连油系统: lianyouimage,
   "QHSE (安全监控、应急指挥)": qhseimage,
   "设备管理系统 (PMS)": pmsimage,
   "项目管理 (PM)": pmimage,
   "全局数据治理 (数据中台)": dataimage,
-  "智能决策": thinkimage,
-  "行业AI大模型": aiimage,
+  智能决策: thinkimage,
+  行业AI大模型: aiimage,
   "AI智能体 (智能交互)": agentimage,
 };
 const isSpecialSystem = (label: string) => {
@@ -178,45 +178,12 @@ const goDetail = () => {
   }
 };
 
-// 根据标签获取系统描述
-const getDescriptionByLabel = (label: string): string => {
-  const descriptions: Record<string, string> = {
-    // 经营管理平台
-    "OA办公系统": "集成日常办公自动化功能,提高工作效率",
-    "经营驾驶舱": "实时展示企业运营数据,辅助管理层决策",
-    "战略解码与执行": "将企业战略转化为具体行动计划并跟踪执行",
-    "财务管理(收入、成本、应收账款)": "全面管理企业财务状况,控制成本和风险",
-    "技术研发管理": "管理企业研发项目和技术资产",
-    "客户管理(CRM)": "管理客户关系,提升销售业绩",
-    "人力资源(EHR)": "企业人力资源全生命周期管理",
-    "供应链管理(SCM)": "优化供应链运作,降低采购成本",
-    "组织资产管理": "管理企业组织架构和各类资产",
-    "风控、合规管理": "识别并控制企业运营风险,确保合规运营",
-
-    // 生产指挥平台
-    "中航北斗智慧管理系统": "利用北斗定位技术实现精准生产管理",
-    "智能钻井系统": "智能化钻井作业管理,提高钻井效率",
-    "智能压裂系统": "自动化压裂作业控制系统",
-    "智能注气系统": "智能化气体注入管理",
-    "智能连油系统": "连续油管作业智能管理",
-    "QHSE (安全监控、应急指挥)": "质量、健康、安全和环境综合管理",
-    "设备管理系统 (PMS)": "生产设备维护和管理",
-    "项目管理 (PM)": "工程项目全周期管理",
-
-    // Chat BI平台
-    "全局数据治理 (数据中台)": "建立统一的数据治理体系和数据中台",
-    "智能决策": "基于数据分析的智能决策支持",
-    "行业AI大模型": "针对石油行业的专业人工智能模型",
-    "AI智能体 (智能交互)": "智能对话和交互式数据分析工具",
-  };
-
-  return descriptions[label] || "该系统的详细功能描述";
-};
-
 // 处理查看按钮点击事件
 const handleView = async (item: Item) => {
   console.log("查看", item);
 
+  console.log("*************************", userStore.getUser.username);
+
   if (item.label === "OA办公系统") {
     if (userStore.getUser.username && getAccessToken()) {
       const res = await ssoLogin({
@@ -226,23 +193,31 @@ const handleView = async (item: Item) => {
       if (res) {
         window.open(
           "https://yfoa.keruioil.com/wui/index.html?ssoToken=" + res + "#/main",
-          "_blank"
+          "_blank",
         );
       }
     } else {
+      console.log("未登录》》》》》》》》》》》");
       window.open("https://yfoa.keruioil.com", "_blank");
     }
   }
 
   if (item.label === "设备管理系统 (PMS)") {
     if (userStore.getUser.username && getAccessToken()) {
+      // window.open(
+      //   "https://iot.deepoil.cc/portalLogin?username=" +
+      //     userStore.getUser.username,
+      //   "_blank"
+      // );
       window.open(
-        "https://iot.deepoil.cc/portalLogin?username=" +
+        import.meta.env.VITE_PMS_URL +
+          "/portalLogin?username=" +
           userStore.getUser.username,
-        "_blank"
+        "_blank",
       );
     } else {
-      window.open("https://iot.deepoil.cc", "_blank");
+      console.log("未登录");
+      window.open(import.meta.env.VITE_PMS_URL, "_blank");
     }
   }
 
@@ -257,15 +232,23 @@ const handleView = async (item: Item) => {
   if (item.label === "智能连油系统") {
     const extraParam = "source=zhly";
     if (userStore.getUser.username && getAccessToken()) {
+      // window.open(
+      //   "https://iot.deepoil.cc/portalLogin?username=" +
+      //     userStore.getUser.username +
+      //     "&" +
+      //     extraParam,
+      //   "_blank",
+      // );
       window.open(
-        "https://iot.deepoil.cc/portalLogin?username=" +
+        import.meta.env.VITE_PMS_URL +
+          "/portalLogin?username=" +
           userStore.getUser.username +
           "&" +
           extraParam,
-        "_blank"
+        "_blank",
       );
     } else {
-      window.open("https://iot.deepoil.cc?" + extraParam, "_blank");
+      window.open(import.meta.env.VITE_PMS_URL + "?" + extraParam, "_blank");
     }
   }
 };

+ 83 - 33
vite.config.ts

@@ -1,45 +1,95 @@
 import { fileURLToPath, URL } from "node:url";
 
-import { defineConfig } from "vite";
 import vue from "@vitejs/plugin-vue";
 import vueDevTools from "vite-plugin-vue-devtools";
 import tailwindcss from "@tailwindcss/vite";
+import type { ConfigEnv, UserConfig } from "vite";
+import { loadEnv } from "vite";
 
 import AutoImport from "unplugin-auto-import/vite";
 import Components from "unplugin-vue-components/vite";
 import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
 import MotionResolver from "motion-v/resolver";
 
-export default defineConfig({
-  server: {
-    host: "0.0.0.0", // 监听所有网络接口
-    port: 5173, // 可选:指定端口
-  },
-  base: "./",
-  plugins: [
-    vue(),
-    vueDevTools(),
-    tailwindcss(),
-    AutoImport({
-      resolvers: [ElementPlusResolver()],
-    }),
-    Components({
-      dts: true,
-      resolvers: [ElementPlusResolver(), MotionResolver()],
-    }),
-  ],
-  resolve: {
-    alias: {
-      "@": fileURLToPath(new URL("./src", import.meta.url)),
-      "@components": fileURLToPath(
-        new URL("./src/components", import.meta.url)
-      ),
-      "@assets": fileURLToPath(new URL("./src/assets", import.meta.url)),
-      "@api": fileURLToPath(new URL("./src/api", import.meta.url)),
-      "@utils": fileURLToPath(new URL("./src/utils", import.meta.url)),
-      "@types": fileURLToPath(new URL("./src/types", import.meta.url)),
-      "@stores": fileURLToPath(new URL("./src/stores", import.meta.url)),
-      "@hooks": fileURLToPath(new URL("./src/hooks", import.meta.url)),
+const root = process.cwd();
+
+// export default defineConfig({
+//   server: {
+//     host: "0.0.0.0", // 监听所有网络接口
+//     port: 5173, // 可选:指定端口
+//   },
+//   base: "./",
+//   plugins: [
+//     vue(),
+//     vueDevTools(),
+//     tailwindcss(),
+//     AutoImport({
+//       resolvers: [ElementPlusResolver()],
+//     }),
+//     Components({
+//       dts: true,
+//       resolvers: [ElementPlusResolver(), MotionResolver()],
+//     }),
+//   ],
+//   resolve: {
+//     alias: {
+//       "@": fileURLToPath(new URL("./src", import.meta.url)),
+//       "@components": fileURLToPath(
+//         new URL("./src/components", import.meta.url)
+//       ),
+//       "@assets": fileURLToPath(new URL("./src/assets", import.meta.url)),
+//       "@api": fileURLToPath(new URL("./src/api", import.meta.url)),
+//       "@utils": fileURLToPath(new URL("./src/utils", import.meta.url)),
+//       "@types": fileURLToPath(new URL("./src/types", import.meta.url)),
+//       "@stores": fileURLToPath(new URL("./src/stores", import.meta.url)),
+//       "@hooks": fileURLToPath(new URL("./src/hooks", import.meta.url)),
+//     },
+//   },
+// });
+
+export default ({ command, mode }: ConfigEnv): UserConfig => {
+  let env = {} as any;
+  const isBuild = command === "build";
+  if (!isBuild) {
+    env = loadEnv(
+      process.argv[3] === "--mode" ? process.argv[4] : process.argv[3],
+      root,
+    );
+  } else {
+    env = loadEnv(mode, root);
+  }
+
+  return {
+    server: {
+      host: "0.0.0.0", // 监听所有网络接口
+      port: 5173, // 可选:指定端口
+    },
+    base: "./",
+    plugins: [
+      vue(),
+      vueDevTools(),
+      tailwindcss(),
+      AutoImport({
+        resolvers: [ElementPlusResolver()],
+      }),
+      Components({
+        dts: true,
+        resolvers: [ElementPlusResolver(), MotionResolver()],
+      }),
+    ],
+    resolve: {
+      alias: {
+        "@": fileURLToPath(new URL("./src", import.meta.url)),
+        "@components": fileURLToPath(
+          new URL("./src/components", import.meta.url),
+        ),
+        "@assets": fileURLToPath(new URL("./src/assets", import.meta.url)),
+        "@api": fileURLToPath(new URL("./src/api", import.meta.url)),
+        "@utils": fileURLToPath(new URL("./src/utils", import.meta.url)),
+        "@types": fileURLToPath(new URL("./src/types", import.meta.url)),
+        "@stores": fileURLToPath(new URL("./src/stores", import.meta.url)),
+        "@hooks": fileURLToPath(new URL("./src/hooks", import.meta.url)),
+      },
     },
-  },
-});
+  };
+};