Procházet zdrojové kódy

流程门户多语言

yanghao před 1 týdnem
rodič
revize
2c42dfa54c
6 změnil soubory, kde provedl 72 přidání a 35 odebrání
  1. binární
      src/assets/bg.mp4
  2. 12 2
      src/i18n/lang/en.json
  3. 12 2
      src/i18n/lang/ru.json
  4. 12 2
      src/i18n/lang/zh.json
  5. 34 27
      src/views/flow/index.vue
  6. 2 2
      src/views/login.vue

binární
src/assets/bg.mp4


+ 12 - 2
src/i18n/lang/en.json

@@ -11,7 +11,8 @@
     "noNews": "No news available",
     "loginTip": "Please scan the QR code with DingTalk to login",
     "refresh": "Refresh",
-    "normal": "Normal"
+    "normal": "Normal",
+    "dot":"."
   },
   "nav": {
     "title": "Smart Operation Platform",
@@ -29,7 +30,16 @@
     "palceholder": "Please enter the task name to search",
     "todo":"My Pending",
     "done":"My Completed",
-     "createPerson": "Create Person"
+     "createPerson": "Create Person",
+    "todoTip": "Pending Tasks",
+    "doneTip": "Completed Tasks",
+    "morning": "Good morning",
+     "afternoon": "Good afternoon",
+     "night": "Good night",
+      "today": "Today is",
+     "you":"You have",
+     "flows":"flows to complete",
+      "search": "Search flows"
   },
    "home": {
     "red":"Red-headed Docs",

+ 12 - 2
src/i18n/lang/ru.json

@@ -11,7 +11,8 @@
     "noNews": "Нет новостей",
     "loginTip": "Войдите по QR DingTalk",
     "refresh": "Обновить",
-    "normal": "Ок"
+    "normal": "Ок",
+    "dot":"."
   },
   "nav": {
     "title": "Платформа бизнеса",
@@ -29,7 +30,16 @@
     "palceholder": "Поиск процессов/приложений",
     "todo": "Мои задачи",
     "done": "Выполнено",
-    "createPerson": "Автор"
+    "createPerson": "Автор",
+    "todoTip": "Текущие задачи",
+    "doneTip": "Завершенные задачи",
+    "morning": "Утро",
+     "afternoon": "Добрыйдень",
+     "night": "Ночь",
+      "today": "Како́е сегодня",
+     "you":"вы есть",
+     "flows":"процессов ожидают обработки",
+      "search": "Поиск"
   },
   "home": {
     "red": "Приказы",

+ 12 - 2
src/i18n/lang/zh.json

@@ -11,7 +11,8 @@
     "noNews": "暂无新闻",
     "loginTip": "请使用钉钉扫描二维码登录",
     "refresh": "刷新",
-    "normal": "正常"
+    "normal": "正常",
+    "dot":"。"
   },
   "nav": {
     "title": "智慧经营平台",
@@ -29,7 +30,16 @@
     "palceholder": "搜索应用、流程",
     "todo":"我的待办",
     "done":"我的已办",
-    "createPerson": "创建人"
+    "createPerson": "创建人",
+    "todoTip": "待处理的流程",
+    "doneTip": "已完成的流程",
+     "morning": "早上好",
+     "afternoon": "下午好",
+     "night": "晚上好",
+     "today": "今天是",
+     "you":"您有",
+     "flows":"条流程待处理",
+    "search": "搜索流程名称"
   },
   "home": {
     "red":"红头文件",

+ 34 - 27
src/views/flow/index.vue

@@ -13,8 +13,9 @@
             {{ getGreeting() }},{{ userStore.getUser.nickname }}
           </h1>
           <p class="hero-desc text-var(--text-secondary)!">
-            今天是 {{ new Date().toLocaleDateString() }}。您有
-            {{ stats[0].number }}条流程待处理。
+            {{ $t("flow.today") }} {{ new Date().toLocaleDateString()
+            }}{{ $t("common.dot") }} {{ $t("flow.you") }} {{ stats[0].number }}
+            {{ $t("flow.flows") }}{{ $t("common.dot") }}
           </p>
         </div>
       </section>
@@ -62,9 +63,11 @@
                     v-if="item.title === '我的待办'"
                     class="text-[#6b6f99] !text-sm"
                   >
-                    待处理的流程
+                    {{ $t("flow.todoTip") }}
+                  </p>
+                  <p v-else class="text-[#6b6f99] !text-sm">
+                    {{ $t("flow.doneTip") }}
                   </p>
-                  <p v-else class="text-[#6b6f99] !text-sm">已完成的流程</p>
                 </div>
               </div>
             </template>
@@ -74,7 +77,7 @@
                 v-for="(task, idx) in getDetailList(index)"
                 :key="idx"
                 class="detail-item"
-                @click="handleDetailClick(task, item.title)"
+                @click="handleDetailClick(task, item.type)"
               >
                 <span class="detail-name">{{ task.name }}</span>
                 <span class="detail-val">{{ task.value }}</span>
@@ -96,7 +99,7 @@
             v-model.trim="searchKeyword"
             type="text"
             class="search-field"
-            placeholder="搜索流程名称"
+            :placeholder="t('flow.search')"
           />
         </div>
         <span v-if="searchKeyword" class="search-meta">
@@ -233,12 +236,15 @@ import { useUserStore } from "@/stores/useUserStore";
 import { useThemeStore } from "@/stores/useThemeStore";
 import { getAccessToken } from "@/utils/auth";
 import { useRouter } from "vue-router";
+import { useI18n } from "@/i18n";
 import * as dd from "dingtalk-jsapi";
 const router = useRouter();
 import { ElLoading, ElMessage } from "element-plus";
 const userStore = useUserStore();
 const themeStore = useThemeStore();
 
+const { t } = useI18n();
+
 // 1. 定义 Ref
 const tabsContainerRef = ref(null);
 const isLeftDisabled = ref(true);
@@ -286,9 +292,9 @@ const currentBanner = computed(() => {
 
 const getGreeting = () => {
   const hour = new Date().getHours();
-  if (hour < 12) return "早上好";
-  if (hour < 18) return "下午好";
-  return "晚上好";
+  if (hour < 12) return t("flow.morning");
+  if (hour < 18) return t("flow.afternoon");
+  return t("flow.night");
 };
 
 const getDetailList = (index) => {
@@ -546,13 +552,12 @@ const go = async (item) => {
   }
 };
 
-const handleDetailClick = (task, categoryTitle) => {
-  console.log(`点击了 ${categoryTitle} 中的 ${task.name}: ${task.value}`);
+const handleDetailClick = (task, type) => {
   let ua2 = navigator.userAgent.toLowerCase();
   let isMobile = ua2.indexOf("dingtalk") > -1;
 
   if (isMobile) {
-    if (task.name === "OA" && categoryTitle === "我的待办") {
+    if (task.name === "OA" && type === "todo") {
       // router.push({
       //   path: "/mobile-todo-list",
       //   query: { type: task.name.toLowerCase() },
@@ -564,7 +569,7 @@ const handleDetailClick = (task, categoryTitle) => {
       });
     }
 
-    if (task.name === "OA" && categoryTitle === "已办事项") {
+    if (task.name === "OA" && type === "done") {
       // router.push({
       //   path: "/oa-done-list",
       //   query: { type: task.name.toLowerCase() },
@@ -576,28 +581,28 @@ const handleDetailClick = (task, categoryTitle) => {
       });
     }
 
-    if (task.name === "CRM" && categoryTitle === "我的待办") {
+    if (task.name === "CRM" && type === "todo") {
       router.push({
         path: "/mobile-crm-todo-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "CRM" && categoryTitle === "已办事项") {
+    if (task.name === "CRM" && type === "done") {
       router.push({
         path: "/crm-done-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "SRM" && categoryTitle === "我的待办") {
+    if (task.name === "SRM" && type === "todo") {
       router.push({
         path: "/mobile-srm-todo-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "SRM" && categoryTitle === "已办事项") {
+    if (task.name === "SRM" && type === "done") {
       router.push({
         path: "/srm-done-list",
         query: { type: task.name.toLowerCase() },
@@ -605,49 +610,49 @@ const handleDetailClick = (task, categoryTitle) => {
     }
   } else {
     // 示例:根据类型跳转
-    if (task.name === "OA" && categoryTitle === "我的待办") {
+    if (task.name === "OA" && type === "todo") {
       router.push({
         path: "/todo-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "OA" && categoryTitle === "已办事项") {
+    if (task.name === "OA" && type === "done") {
       router.push({
         path: "/oa-done-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "CRM" && categoryTitle === "我的待办") {
+    if (task.name === "CRM" && type === "todo") {
       router.push({
         path: "/crm-todo-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "CRM" && categoryTitle === "已办事项") {
+    if (task.name === "CRM" && type === "done") {
       router.push({
         path: "/crm-done-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "SRM" && categoryTitle === "我的待办") {
+    if (task.name === "SRM" && type === "todo") {
       router.push({
         path: "/srm-todo-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "SRM" && categoryTitle === "已办事项") {
+    if (task.name === "SRM" && type === "done") {
       router.push({
         path: "/srm-done-list",
         query: { type: task.name.toLowerCase() },
       });
     }
 
-    if (task.name === "EHR" && categoryTitle === "我的待办") {
+    if (task.name === "EHR" && type === "todo") {
       router.push({
         path: "/ehr-todo-list",
         query: { type: task.name.toLowerCase() },
@@ -662,18 +667,20 @@ let srmTasks = ref([]);
 let ehrTasks = ref([]);
 const statsLoading = ref(true);
 
-const stats = ref([
+const stats = computed(() => [
   {
     icon: "mdi:clock-outline",
-    title: "我的待办",
+    title: t("flow.todo"),
     number: 0,
+    type: "todo",
     extra: "+2 今日",
     bgcolor: "#fff7ed",
     color: "#f59e0b",
   },
   {
     icon: "mdi:check-circle-outline",
-    title: "已办事项",
+    title: t("flow.done"),
+    type: "done",
     number: 0,
     bgcolor: "#eff6ff",
     color: "#2563eb",

+ 2 - 2
src/views/login.vue

@@ -23,7 +23,7 @@
         </h1>
 
         <!-- 用户名密码登陆 -->
-        <!-- <div>
+        <div>
           <el-form
             :model="form"
             :rules="rules"
@@ -64,7 +64,7 @@
               >
             </div>
           </div>
-        </div> -->
+        </div>
 
         <!-- 钉钉登陆 -->
         <div class="text-center">