From bf4340c8fbc34bfa6be24607e1bae88857b11dcf Mon Sep 17 00:00:00 2001
From: hzj <1304805162@qq.com>
Date: Wed, 29 Oct 2025 20:23:58 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E5=BC=95=E5=85=A5=E8=AF=AD=E8=A8=80?=
=?UTF-8?q?=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD):?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.vue | 12 +++-
src/locales/ar.json | 145 +++++++++++++++++++++++++++++++++++++++++++
src/locales/en.json | 147 ++++++++++++++++++++++++++++++++++++++++++--
src/locales/i18n.js | 78 +++++++++++++++++++++++
src/locales/zh.json | 147 ++++++++++++++++++++++++++++++++++++++++++--
src/main.js | 53 ++++++++--------
src/stores/lang.js | 58 +++++++++++++++++
7 files changed, 603 insertions(+), 37 deletions(-)
create mode 100644 src/locales/ar.json
create mode 100644 src/locales/i18n.js
create mode 100644 src/stores/lang.js
diff --git a/src/App.vue b/src/App.vue
index 8c5d4ad..8034e77 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,14 @@
@@ -15,7 +24,8 @@ import { RouterView } from 'vue-router'
box-sizing: border-box;
}
-html, body {
+html,
+body {
margin: 0;
padding: 0;
width: 100%;
diff --git a/src/locales/ar.json b/src/locales/ar.json
new file mode 100644
index 0000000..b5a8b8c
--- /dev/null
+++ b/src/locales/ar.json
@@ -0,0 +1,145 @@
+{
+ "apply_join_team": "تقديم طلب للانضمام إلى الفريق",
+ "apply_reminder": "تذكير قبل التقديم:",
+ "apply_reminder_detail": "أدخل معرف الوكلاء الخاص بك، وستصبح مضيفًا بعد موافقة طلب المضيف. بعد أن تصبح مضيفًا، سيتم تخصيص دخلك إلى وكيلك.",
+ "apply_id": "طلب id:",
+ "enter_agent_id": "يرجى إدخال id الوكيل",
+ "apply": "طلب",
+ "application_help": "مساعدة الطبيق",
+ "application_help_detail": "أدخل id وكالتك وانقر على \"تطبيق\" لإرسال طلبك. بعد نجاح التقديم، يرجى الانتظار بصبر حتى يوافق الوكل على الطلب.",
+ "got_it": "حصلت عليه",
+ "application_records": "سجلات التطبيق",
+ "agency": "وكيل",
+ "pending": "قيد الانتظار",
+ "cancel": "إلغاء",
+ "success": "النجاح",
+ "application_submitted": "تم تقديم التطبيق بنجاح!",
+ "ok": "حسناً",
+ "application_cancelled": "تم إلغاء التطبيق بنجاح!",
+ "warning": "تحذير",
+ "not_authorized": "غير مُصرح به للانضمام",
+ "cancellation_failed": "فشلت الإلغاء",
+ "network_error": "خطأ في الشبكة، يرجى التحقق من اتصالك والمحاولة مرة أخرى",
+ "host_center": "مركز المضيف",
+ "my_account": "حسابي",
+ "my_salary": "راتبي",
+ "personal_salary": "الراتب الشخصي",
+ "history_salary": "سجل الراتب:",
+ "current_salary": "الراتب الحالي:",
+ "todays_task": "مهمة اليوم:",
+ "platform_policy": "سياسة المنصة",
+ "host_type": "نوع المضيف",
+ "minutes": "دقائق",
+ "gift_task": "مهمة الهدية",
+ "target": "الهدف",
+ "salary": "راتب",
+ "time_days": "الوقت (الأيام)",
+ "more": "أكثر",
+ "exchange": "التبديل",
+ "transfer": "تحويل الأموال",
+ "host_salary": "راتب المضيف",
+ "agent_salary": "راتب الوكيل",
+ "total_salary": "إجمالي الراتب",
+ "my_agent": "وكيلي",
+ "leave": "يغادر",
+ "work_report": "سجل الراتب:",
+ "in_progress": "قيد التنفيذ",
+ "pending": "قيد الانتظار",
+ "completed": "مكتمل",
+ "out_of_account": "لا يعلق بالحساب",
+ "salary_details": "تفاصيل الراتب",
+ "monthly_salary": "الراتب الشهري",
+ "total_income": "إجمالي الدخل",
+ "daily_salary": "الراتب اليومي",
+ "income": "الدخل",
+ "time": "الوقت",
+ "help": "مساعدة",
+ "work_report_description": "فيما يلي تقارير العمل لأعضاء الفريق. يمكنك الاطلاع على تفاصيل أكثر عن محتويات العمل من خلال النقر على \"المزيد\".",
+ "status_description": "وصف الحالة:",
+ "status_completed": "(1)انتهت:أنظمة أتمت تقرير التسوية.",
+ "status_pending": "(2)قيد الانتظار: هناك حاليًا نزاع، ولا يمكن للنظام تنفيذ التسوية.",
+ "status_out_of_account": "(3)الرصيد المنتظر الدخول: ينتظر التحقق من النظام",
+ "status_in_progress": "(4)جارٍ التنفيذ: العمل قيد التنفيذ.",
+ "exchange_gold_coins": "تبادل العملات الذهبية",
+ "information": "تفاصيل",
+ "available_salaries": "الرواتب المتاحة",
+ "confirm_exchange": "هل أنت متأكد من أنك تريد استبدال العملات الذهبية؟",
+ "transfer_to_others": "تحويل الأموال لشخص آخر",
+ "search": "بحث",
+ "change": "تغيير",
+ "search_payee_id": "البحث عن id المستلم",
+ "confirm_transfer": "هل أنت متأكد من أنك تريد تحويل النقود الذهبية إلى هذا المستخدم؟",
+ "add": "إضافة",
+ "agency_center": "مركز الوكلاء",
+ "team_bill": "فاتورة الفريق",
+ "chat": "الدردشة",
+ "total": "إجمالي",
+ "team_member": "عضو الفريق",
+ "history_team_income": "سجل دخل الفريق:",
+ "enter_host_id": "يرجى إدخال id المضيف",
+ "confirm_remove_member": "هل أنت متأكد من أنك تريد إزالةالمعرف: 1234567890 من الفريق؟",
+ "invite_members": "دعوة الأعضاء",
+ "invite_download_app": "دعوة المستخدمين لتنزيل Likei",
+ "invited_users_login": "يجب على المستخدمين المدعوين تسجيل الدخول إلى Likei",
+ "join_team_steps": "انا>مركز>طلب الانضمام إلى الفريق",
+ "enter_team_id": "أدخل id الفريق وانقر على إرسال للانضمام",
+ "recharge_agency": "وكيل الشحن",
+ "my_coins": "عملاتي الذهبية",
+ "user": "مستخدم",
+ "search_user": "البحث عن المستخدم",
+ "enter_user_id": "يرجى إدخال id المستخدم",
+ "recharge": "شحن",
+ "enter_transfer_amount": "الرجاء إدخال مبلغ العملات الذهبية المراد تحويلها",
+ "recharge_now": "شحن الآن",
+ "succeed": "ينجح",
+ "seller_records": "سجل البائع",
+ "bd_center": "مركز bd",
+ "total_team_salary": "إجمالي رواتب الفريق:",
+ "last_month": "الشهر الماضي",
+ "this_month": "هذا الشهر",
+ "invite_become_agent": "دعوة المستخدم لتصبح وكيلًا",
+ "invite": "دعوة",
+ "invitation_submitted": "تم تقديم معلومات الدعوة بنجاح",
+ "agent_number": "أعضاء الوكالة",
+ "team_target": "أهداف الفريق",
+ "my": "أنا",
+ "host_count": "عدد المضيف:",
+ "click_here": "انقر هنا",
+ "confirm_user_id": "تأكيد معرف المستخدم",
+ "confirm_add_host": "انقر على التأكيد لإضافة المذيع بنجاح",
+ "bd_work_rules": "قواعد عمل BD",
+ "bd_functionality": "1. سوف نقدم لك وظيفة BD، ويمكنك العثور على هذا الوحدة من خلال \"أنا → مركز BD\".",
+ "bd_goal": "2.هدف BD: إجمالي رواتب جميع الفرق التي تدارها.",
+ "bd_agent_requirements": "3. أضف 2 إلى 10 وكلاء (يختلف العدد حسب الدولة/المنطقة). يجب على كل وكيل إضافة أكثر من 3 وكلاء، وجميع الوكلاء يجب أن يكونوا في حالة نشطة.",
+ "bd_settlement_days": "4. يُحدد 1 و16 كل شهر كأيام تسوية رواتب الفريق. يمكن حساب الدخل المستحصل من التسوية بناءً على رواتب فريق الوكلاء التي يقدمه BD:",
+ "bd_salary_settlement_1": "(1) إذا أضافت BD أكثر من 5 فريقات وكلية مجموع رواتب جميع الفرق وصلت إلى 300 دولار، فسيتم تسوية رواتب BD خلال هذه الفترة وفقًا لـ\"سياسة BD (سياسة رواتب فريقات الوكلاء)\"، حيث ستكون رواتب BD 9 دولار.",
+ "bd_salary_settlement_2": "(2) إذا أضاف البد أكثر من فريق وكالة واحدة وبلغت كمية إعادة الشحن لجميع أعضاء الفريق 500 دولارًا، فسيتم تسوية رواتب البد خلال هذه الفترة وفقًا لـ \"سياسة البد (سياسة إعادة الشحن للفريق الوكيل)\"، وستكون رواتب البد 20 دولارًا.",
+ "bd_salary_settlement_3": "(3) عند تسوية الراتب، يتم حساب سياسةتيْنٍ معًا، ويمثلى أعلى قيمة منها إلى BD.",
+ "bd_salary_settlement_4": "(4) إذا تم تسوية الراتب وفقاً لـ\"سياسة BD (سياسة رواتب فرق الوكلاء)\"، يجب مراعاة عدد فرق الوكلاء. إذا لم يتم تحقيق المعيار المحدد في السياسة، على سبيل المثال: إذا وصل الراتب الفريق إلى 300 دولار أمريكي، ولكن يوجد فقط فريقان وكيلين، فسيتم دفع الراتب فقط من المستوى الأول.",
+ "bd_leader_reward_mechanism": "آلية مكافأة قائد BD:",
+ "bd_leader_team_rewards": "(1) يمكن لقائد BD الذي يجلب BD الحصول على مكافأة بناءً على أرباح الحصول على BD (إذا لم يتم تحقيق إحدى الشروط، فيجب تقديم الجائزة حسب المستوى الذي يتم فيه الانتهاء من كلا المهام. إذا لم يتم تحقيق إحدى المهام في مستوى Level.1، فلن يتم توزيع أي مكافأة):",
+ "bd_leader_coin_agent": "(2) إذا قام قائد BD بفتح وكيل الشحن، سيحصل على مكافأة ذهب بقيمة 20 دولار أمريكي (يشترط لفتح الحساب إيداع مبلغ 500 دولار أمريكي مرة واحدة).",
+ "bd_leader_new_coin_agent": "(3) إذا قام قائد BD بفتح وكيل الشحن، سيحصل على مكافأة ذهب بقيمة 20 دولار أمريكي (يشترط لفتح الحساب إيداع مبلغ 500 دولار أمريكي مرة واحدة).",
+ "bd_leader_requirement": "(4) إذا كنت تريد الحصول على مبلغ المكافأة، فكلما وصلت إلى وقت تسوية الراتب، تحتاج إلى إدخال على الأقل وكيل شحن جديد",
+ "bd_salary_policy": "سياسة BD (سياسة رواتب فريق الوكالة)",
+ "agency_number": "عدد الوكالة",
+ "team_salary": "رواتب الفريق",
+ "bd_recharge_policy": "سياسة BD (سياسة إعادة شحن فريق الوكالة)",
+ "team_recharge": "شحن الفريق",
+ "bd_number": "عدد BD",
+ "basic_salary": "الراتب الأساسي",
+ "reward_amount": "جائزة النشاط",
+
+ "application_record_not_found": "Application record not found",
+ "application_processed_cannot_cancel": "Application has been processed and cannot be canceled",
+ "cancellation_failed_try_again": "Cancellation failed, please try again",
+ "error": "خطأ",
+ "unknown_error": "حدث خطأ غير معروف",
+ "service_unavailable": "الخدمة غير متوفرة",
+ "exchange_not_available": "وظيفة التبادل غير متوفرة",
+ "team_not_found": "الفريق غير موجود",
+ "team_not_exist": "الفريق غير موجود أو تم حلّه",
+ "request_not_acceptable": "الطلب غير مقبول",
+ "something_went_wrong": "حدث خطأ ما، يرجى المحاولة مرة أخرى.",
+ "confirm": "تأكيد"
+}
diff --git a/src/locales/en.json b/src/locales/en.json
index 06d7943..6343102 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1,6 +1,145 @@
{
- "message": {
- "welcome": "Welcome",
- "login": "Login"
- }
+ "apply_join_team": "Apply to join the team",
+ "apply_reminder": "Reminder before application:",
+ "apply_reminder_detail": "Enter the lD of your agent, and you will become the host afterthe host apply is approved. After becoming an hoster,yourincome will be entrusted to your agent",
+ "apply_id": "Apply lD:",
+ "enter_agent_id": "Please enter the agent iD",
+ "apply": "Apply",
+ "application_help": "Application Help",
+ "application_help_detail": "Enter your agency's lD and click Apply to submit your application.After the application is successful, please wait patiently for the agent to pass the application",
+ "got_it": "Got it",
+ "application_records": "Application Records:",
+ "agency": "Agency:",
+ "pending": "Pending",
+ "cancel": "Cancel",
+ "success": "Success",
+ "application_submitted": "Application submitted successfully!",
+ "ok": "OK",
+ "application_cancelled": "Application cancellation successful!",
+ "warning": "Warning",
+ "not_authorized": "Not authorized to join",
+ "cancellation_failed": "Cancellation failed",
+ "network_error": "Network error,please check yourconnection and try again",
+ "host_center": "Host Center",
+ "my_account": "My account",
+ "my_salary": "My salary:",
+ "personal_salary": "Personal Salary",
+ "history_salary": "History salary:",
+ "current_salary": "Current salary:",
+ "todays_task": "Today's task:",
+ "platform_policy": "Platform Policy",
+ "host_type": "Host type",
+ "minutes": "Minutes",
+ "gift_task": "Gift Task",
+ "target": "Target",
+ "salary": "Salary",
+ "time_days": "Time(Days)",
+ "more": "More",
+ "exchange": "Exchange",
+ "transfer": "Transfer",
+ "host_salary": "Host Salary",
+ "agent_salary": "Agent Salary",
+ "total_salary": "Total Salary",
+ "my_agent": "My Agent",
+ "leave": "Leave",
+ "work_report": "Work report:",
+ "in_progress": "In Progress",
+ "pending": "Pending",
+ "completed": "Completed",
+ "out_of_account": "Out of account",
+ "salary_details": "Salary Details",
+ "monthly_salary": "Monthly salary",
+ "total_income": "Total income",
+ "daily_salary": "Daily salary",
+ "income": "Income",
+ "time": "Time",
+ "help": "Help",
+ "work_report_description": "Shown below is the work report of the members \"More\" can view more work detailed.",
+ "status_description": "Status Description:",
+ "status_completed": "(1)Completed: The system has completed thesettlement report.",
+ "status_pending": "(2)Pending: There is currently a dispute, and thesystem cannot perform a settlement.",
+ "status_out_of_account": "(3)Out of account: waiting for system verification",
+ "status_in_progress": "(4)In progress:work now in progress.",
+ "exchange_gold_coins": "Exchange Gold Coins",
+ "information": "Information",
+ "available_salaries": "Available salaries:",
+ "confirm_exchange": "Are you sure you want to exchange coins?",
+ "transfer_to_others": "Transfer to others",
+ "search": "Search",
+ "change": "Change",
+ "search_payee_id": "Search payee's ID",
+ "confirm_transfer": "Are you sure you want to transfer coins to this user?",
+ "add": "Add",
+ "agency_center": "Agency Center",
+ "team_bill": "Team Bill",
+ "chat": "Chat",
+ "total": "Total",
+ "team_member": "Team Member",
+ "history_team_income": "History Team Income:",
+ "enter_host_id": "Please enter the host ID",
+ "confirm_remove_member": "Are you sure you want to remove ID:from the team?",
+ "invite_members": "Invite Members",
+ "invite_download_app": "1、Invite users to download Likei APP.",
+ "invited_users_login": "2、Invited users need to log in to the Likei APP.",
+ "join_team_steps": "3、Me > Host Center >Apply to join the team.",
+ "enter_team_id": "4、Enter the team ID,click send to join.",
+ "recharge_agency": "Recharge agency",
+ "my_coins": "My coins:",
+ "user": "User :",
+ "search_user": "Search user",
+ "enter_user_id": "Please enter the user ID",
+ "recharge": "Recharge :",
+ "enter_transfer_amount": "Please enter the amount of gold coins to transfer.",
+ "recharge_now": "Recharge now",
+ "succeed": "Succeed",
+ "seller_records": "Seller Records",
+ "bd_center": "BD Center",
+ "total_team_salary": "Total team salary:",
+ "last_month": "Last month:",
+ "this_month": "This month:",
+ "invite_become_agent": "Invite user to become agent",
+ "invite": "Invite",
+ "invitation_submitted": "Invitation information submitted successfully!",
+ "agent_number": "Agent number",
+ "team_target": "Team target",
+ "my": "My",
+ "host_count": "Host number:",
+ "click_here": "1.Click here",
+ "confirm_user_id": ".Confirm User lD",
+ "confirm_add_host": ".Click Confirm to successfullyadd the host.",
+ "bd_work_rules": "BD Work Rules",
+ "bd_functionality": "1.We will provide the BD functionality for you and you can find the module through \"Me → BD Center\".",
+ "bd_goal": "2.BD Goal: Total payroll for all teams you manage.",
+ "bd_agent_requirements": "3.Add 2 to 10 Agents (Number varies by country).Each agent must add more than 3 hosts and all hosts must be active.",
+ "bd_settlement_days": "4.The 1st and 16th of each month are the days for team salary settlement. The settlement income can be calculated based on the salary of the agency team brought by BD:",
+ "bd_salary_settlement_1": "(1) If BD adds more than 5 agency teams and the total salary of all teams reaches $300, the BD salary for this period will be settled according to the \"BD Policy (Agency Team Salary Policy)\", and the BD salary will be $9.",
+ "bd_salary_settlement_2": "(2) If BD adds more than 1 agency team and the recharge amount of all team members reaches $500, the BD salary for this period will be settled according to the \"BD Policy (Agency Team Recharge Policy)\", and the BD salary will be $20.",
+ "bd_salary_settlement_3": "(3) When settling salaries, the two policies will be combined and the highest salary will be settled to BD.",
+ "bd_salary_settlement_4": "(4) If wages are settled according to the \"BD Policy (Agency Team Salary Policy)\", the number of agency teams must be considered. If the policy standard is not met.For example:If the team salary reaches $300, but there are only two agency teams, only Level 1 wages will be paid.",
+ "bd_leader_reward_mechanism": "BD Leader Reward Mechanism:",
+ "bd_leader_team_rewards": "(1) The BD Leader receives a reward based on the revenue generated by the BDs they bring onboard. (To claim the reward, all tasks corresponding to the tier must be completed. If any task within the Level.1 tier is not achieved, no reward will be issued.)",
+ "bd_leader_coin_agent": "(2) If the BD Leader personally opens a Gold Coin Agent account (which requires a one-time recharge of $500), they receive a $20 reward.",
+ "bd_leader_new_coin_agent": "(3) If the BD Leader recruits a new recharge agent (account opening requires a one-time recharge of $500)and the new agent uses the BD Leader's invitation code during registration, the BD Leader receives a $20 reward.",
+ "bd_leader_requirement": "(4) If you want to get Reward Amount, you need to bring in at least one new recharge agent for each salary settlement.",
+ "bd_salary_policy": "BD Policy (Agency Team Salary Policy)",
+ "agency_number": "Agency number",
+ "team_salary": "Team salary",
+ "bd_recharge_policy": "BD Policy (Agency Team Recharge Policy)",
+ "team_recharge": "Team recharge",
+ "bd_number": "BD Number",
+ "basic_salary": "Basic Salary",
+ "reward_amount": "Reward Amount",
+
+ "application_record_not_found": "Application record not found",
+ "application_processed_cannot_cancel": "Application has been processed and cannot be canceled",
+ "cancellation_failed_try_again": "Cancellation failed, please try again",
+ "error": "Error",
+ "unknown_error": "An unknown error occurred",
+ "service_unavailable": "Service Unavailable",
+ "exchange_not_available": "Exchange function is not available",
+ "team_not_found": "Team Not Found",
+ "team_not_exist": "The team does not exist or has been disbanded",
+ "request_not_acceptable": "Request Not Acceptable",
+ "something_went_wrong": "Something went wrong, please retry.",
+ "confirm": "Confirm"
}
diff --git a/src/locales/i18n.js b/src/locales/i18n.js
new file mode 100644
index 0000000..434c892
--- /dev/null
+++ b/src/locales/i18n.js
@@ -0,0 +1,78 @@
+import { createI18n } from 'vue-i18n'
+import zh from './zh.json'
+import en from './en.json'
+import ar from './ar.json'
+
+// 语言包
+const messages = { en, ar, zh }
+
+// 默认语言配置
+const defaultLocale = 'en'
+const defaultDirection = 'ltr'
+
+// 创建 i18n 实例(使用默认值)
+const i18n = createI18n({
+ legacy: false,
+ locale: defaultLocale, // 使用默认值,稍后更新
+ fallbackLocale: defaultLocale,
+ messages,
+})
+
+// 设置文档方向
+export const setDocumentDirection = (lang) => {
+ // 定义语言方向映射
+ const languages = {
+ en: 'ltr',
+ zh: 'ltr',
+ ar: 'rtl',
+ }
+
+ const direction = languages[lang] || 'ltr'
+ document.documentElement.setAttribute('dir', direction)
+ document.documentElement.setAttribute('lang', lang)
+}
+
+// 初始化 i18n(在 Pinia 可用后调用)
+export const initI18n = (langStore) => {
+ try {
+ // 设置初始语言
+ if (langStore.selectedLang) {
+ i18n.global.locale.value = langStore.selectedLang.type
+ setDocumentDirection(langStore.selectedLang.type)
+ }
+
+ // 监听语言变化
+ langStore.$subscribe((mutation, state) => {
+ if (state.selectedLang) {
+ i18n.global.locale.value = state.selectedLang.type
+ setDocumentDirection(state.selectedLang.type)
+ }
+ })
+
+ console.log('i18n initialized with language:', langStore.selectedLang?.type)
+ } catch (error) {
+ console.warn('Failed to initialize i18n with store, using defaults:', error)
+ setDocumentDirection(defaultDirection)
+ }
+}
+
+// 切换语言函数
+export const setLocale = (langStore, langType) => {
+ try {
+ const language = langStore.langList.find((item) => item.type === langType)
+
+ if (language) {
+ langStore.setLanguage(language)
+ console.log(`Language changed to: ${language.value}`)
+ } else {
+ console.warn(`Language ${langType} is not supported`)
+ }
+ } catch (error) {
+ console.warn('Store not available when setting locale:', error)
+ // 即使 store 不可用,也更新 i18n
+ i18n.global.locale.value = langType
+ setDocumentDirection(langType === 'ar' ? 'rtl' : 'ltr')
+ }
+}
+
+export default i18n
diff --git a/src/locales/zh.json b/src/locales/zh.json
index f325013..02ffb70 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -1,6 +1,145 @@
{
- "message": {
- "welcome": "欢迎",
- "login": "登录"
- }
+ "apply_join_team": "申请加入团队",
+ "apply_reminder": "申请前提醒",
+ "apply_reminder_detail": "输入你的代理人的ID,在主持人申请获得批准后,你将成为主持人。成为主持人后,你的收入将委托给你的代理人。",
+ "apply_id": "申请ID:",
+ "enter_agent_id": "请输入代理ID",
+ "apply": "申请",
+ "application_help": "应用程序帮助",
+ "application_help_detail": "输入您所在机构的ID,然后点击\"申请\"提交您的申请。申请成功后,请耐心等待该代理通过申请。",
+ "got_it": "知道了",
+ "application_records": "申请记录:",
+ "agency": "主播代理:",
+ "pending": "待处理",
+ "cancel": "取消",
+ "success": "成功",
+ "application_submitted": "申请提交成功",
+ "ok": "好的",
+ "application_cancelled": "申请取消成功",
+ "warning": "警告",
+ "not_authorized": "无权加入",
+ "cancellation_failed": "取消失败",
+ "network_error": "网络错误,请检查您的连接并重试。",
+ "host_center": "主播中心",
+ "my_account": "我的账户",
+ "my_salary": "我的工资",
+ "personal_salary": "个人薪资",
+ "history_salary": "历史薪资:",
+ "current_salary": "当前薪资:",
+ "todays_task": "今日任务:",
+ "platform_policy": "平台政策",
+ "host_type": "主播类型",
+ "minutes": "分钟",
+ "gift_task": "礼物任务",
+ "target": "目标",
+ "salary": "工资",
+ "time_days": "时间(天数)",
+ "more": "更多",
+ "exchange": "兑换",
+ "transfer": "转账",
+ "host_salary": "主播工资",
+ "agent_salary": "代理工资",
+ "total_salary": "总工资",
+ "my_agent": "我的代理",
+ "leave": "离开",
+ "work_report": "工作记录",
+ "in_progress": "进行中",
+ "pending": "待处理",
+ "completed": "已完成",
+ "out_of_account": "与账户无关",
+ "salary_details": "工资明细",
+ "monthly_salary": "月工资",
+ "total_income": "总收入",
+ "daily_salary": "每日工资",
+ "income": "收入",
+ "time": "时间",
+ "help": "帮助",
+ "work_report_description": "以下是成员的工作报告,\"更多\"可以查看更详细的工作内容。",
+ "status_description": "状态说明:",
+ "status_completed": "(1)已完成:系统已完成结算报告。",
+ "status_pending": "(2)待处理:当前存在争议,系统无法进行结算。",
+ "status_out_of_account": "(3)待入账:等待系统验证",
+ "status_in_progress": "(4)进行中:工作正在进行中。",
+ "exchange_gold_coins": "兑换金币",
+ "information": "信息",
+ "available_salaries": "可提供的薪资:",
+ "confirm_exchange": "你确定你要兑换金币吗",
+ "transfer_to_others": "转账给其他人",
+ "search": "搜索",
+ "change": "改变",
+ "search_payee_id": "搜索收款人id",
+ "confirm_transfer": "你确定你要转金币给这个用户?",
+ "add": "添加",
+ "agency_center": "代理中心",
+ "team_bill": "团队账单",
+ "chat": "聊天",
+ "total": "总的",
+ "team_member": "团队成员",
+ "history_team_income": "历史团队收入",
+ "enter_host_id": "请输入主播id",
+ "confirm_remove_member": "您确定要将ID:从团队中移除吗?",
+ "invite_members": "邀请成员",
+ "invite_download_app": "邀请用户下载Likei APP",
+ "invited_users_login": "受邀用户需登录Likei应用程序",
+ "join_team_steps": "我>主播中心>申请加入团队",
+ "enter_team_id": "输入团队ID,点击发送加入。",
+ "recharge_agency": "充值代理",
+ "my_coins": "我的金币",
+ "user": "用户",
+ "search_user": "搜索用户",
+ "enter_user_id": "请输入用户id",
+ "recharge": "充值",
+ "enter_transfer_amount": "请输入要转账的金币数额。",
+ "recharge_now": "现在充值",
+ "succeed": "成功",
+ "seller_records": "卖家记录",
+ "bd_center": "BD中心",
+ "total_team_salary": "团队总工资",
+ "last_month": "上个月",
+ "this_month": "这个月",
+ "invite_become_agent": "邀请用户成为代理",
+ "invite": "邀请",
+ "invitation_submitted": "邀请信息提交成功",
+ "agent_number": "代理成员",
+ "team_target": "团队目标",
+ "my": "我的",
+ "host_count": "主播人数:",
+ "click_here": "点击这里",
+ "confirm_user_id": "确认用户id",
+ "confirm_add_host": "点击确认成功添加主播",
+ "bd_work_rules": "BD 工作规则",
+ "bd_functionality": "1、我们将为您提供 BD 功能,您可以通过\"我 → BD 中心\"找到该模块。",
+ "bd_goal": "2、BD 目标:您管理的所有团队的薪资总额。",
+ "bd_agent_requirements": "3、添加 2 至 10 位代理(数量因国家/地区而异)。每位代理必须添加 3 位以上代理,且所有代理必须处于活跃状态。",
+ "bd_settlement_days": "4、每月 1 日和 16 日为团队薪资结算日。结算收入可根据 BD 带来的代理团队薪资计算:",
+ "bd_salary_settlement_1": "(1)如果 BD 增加 5 个以上代理团队,且所有团队薪资总额达到 300 美元,则该期间的 BD 薪资将根据\"BD 政策(代理团队薪资政策)\"进行结算,BD 薪资为 9 美元。",
+ "bd_salary_settlement_2": "(2)若BD新增1个以上代理团队,且所有团队成员充值金额达到500美金,则该期间BD工资将按照《BD政策(代理团队充值政策)》结算,BD工资为20美金。",
+ "bd_salary_settlement_3": "(3)结算工资时,两种政策合并计算,取最高者结算给BD。",
+ "bd_salary_settlement_4": "(4)若按照《BD政策(代理团队工资政策)》结算工资,需考虑代理团队数量,若未达到政策标准,例如:团队工资达到300美金,但代理团队只有两个,则只支付1级工资。",
+ "bd_leader_reward_mechanism": "BD Leader奖励机制:",
+ "bd_leader_team_rewards": "(1)BD Leader带来BD可根据BD获取收益(如果其中一个条件未达成则按照两个任务都完成的档位发放奖励即可,如果是Level.1档位中的一个任务未达成,则不发放奖励):",
+ "bd_leader_coin_agent": "(2)BD Leader如果本人开设金币代理奖励$20的金币奖励(开设条件需要一次性充值$500)。",
+ "bd_leader_new_coin_agent": "(3)如果BD Leader带来新的金币代理(开设条件需要一次性充值$500),并且填写BD Leader的邀请码,BD Leader可获得$20的金币奖励。",
+ "bd_leader_requirement": "(4)若你想获得奖励金额,每到薪资结算时,你都需要引入至少一名新的充值代理商。",
+ "bd_salary_policy": "BD 政策(代理团队收益政策)",
+ "agency_number": "代理团队数量",
+ "team_salary": "代理团队收益",
+ "bd_recharge_policy": "BD政策(代理团队充值政策)",
+ "team_recharge": "团队充值",
+ "bd_number": "BD数量",
+ "basic_salary": "基础薪资",
+ "reward_amount": "活动奖金",
+
+ "application_record_not_found": "申请记录未找到",
+ "application_processed_cannot_cancel": "申请已被处理,无法取消",
+ "cancellation_failed_try_again": "取消失败,请重试",
+ "error": "错误",
+ "unknown_error": "发生未知错误",
+ "service_unavailable": "服务不可用",
+ "exchange_not_available": "兑换功能不可用",
+ "team_not_found": "团队未找到",
+ "team_not_exist": "团队不存在或已解散",
+ "request_not_acceptable": "请求不可接受",
+ "something_went_wrong": "出现问题,请重试。",
+ "confirm": "确认"
}
diff --git a/src/main.js b/src/main.js
index d73a748..38d5d98 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,43 +1,40 @@
-import './assets/main.css';
-import { logEnvInfo } from './utils/env.js';
-import { versionChecker } from './utils/versionChecker.js';
-import { createPinia } from 'pinia';
-import { createApp } from 'vue';
-import { createI18n } from 'vue-i18n';
-import en from './locales/en.json';
-import zh from './locales/zh.json';
+import './assets/main.css'
+import { logEnvInfo } from './utils/env.js'
+import { versionChecker } from './utils/versionChecker.js'
+import { createPinia } from 'pinia'
+import { createApp } from 'vue'
+import i18n, { initI18n } from './locales/i18n'
-import App from './App.vue';
-import router from './router';
+import App from './App.vue'
+import router from './router'
+import { useLangStore } from '@/stores/lang' // 移动到顶部
// 初始化环境信息
-logEnvInfo();
+logEnvInfo()
// 版本检查
if (versionChecker.checkVersion()) {
- console.log('检测到新版本,正在更新...');
+ console.log('检测到新版本,正在更新...')
// 可以选择显示一个更新提示
// if (confirm('检测到新版本,是否立即更新?')) {
// versionChecker.forceReload()
// }
}
-const i18n = createI18n({
- legacy: false, // 必须关闭 Legacy 模式以兼容 Vue 3
- locale: 'zh', // 默认语言
- messages: {
- en,
- zh,
- },
-});
-
// 初始化权限系统
-console.debug('🔐 Permission system initialized');
-const pinia = createPinia();
-const app = createApp(App);
+console.debug('🔐 Permission system initialized')
+const pinia = createPinia()
+const app = createApp(App)
-app.use(router);
-app.use(pinia);
-app.use(i18n);
+app.use(router)
+app.use(pinia)
-app.mount('#app');
+// 然后初始化 i18n(此时 Pinia 已可用)
+// 获取 langStore 并传递给 initI18n
+const langStore = useLangStore() // 直接使用 import 的函数
+initI18n(langStore)
+
+// 最后使用 i18n
+app.use(i18n)
+
+app.mount('#app')
diff --git a/src/stores/lang.js b/src/stores/lang.js
new file mode 100644
index 0000000..274a9d9
--- /dev/null
+++ b/src/stores/lang.js
@@ -0,0 +1,58 @@
+import { defineStore } from 'pinia'
+import { ref, computed } from 'vue'
+
+export const useLangStore = defineStore('lang', () => {
+ // 状态
+ const langList = ref([
+ {
+ type: 'en',
+ value: 'English',
+ dir: 'ltr',
+ },
+ {
+ type: 'ar',
+ value: 'اللغة العربية',
+ dir: 'rtl',
+ },
+ ])
+
+ const selectedLang = ref(langList.value[0])
+
+ // Getter
+ const currentLanguage = computed(() => selectedLang.value)
+ const availableLanguages = computed(() => langList.value)
+
+ // Action
+ const setLanguage = (lang) => {
+ selectedLang.value = lang
+ localStorage.setItem('preferred-language', lang.type)
+ }
+
+ // 初始化语言
+ const initLanguage = () => {
+ const savedLang = localStorage.getItem('preferred-language')
+ if (savedLang) {
+ const lang = langList.value.find((item) => item.type === savedLang)
+ if (lang) {
+ setLanguage(lang)
+ return
+ }
+ }
+
+ // 根据浏览器语言自动检测
+ const browserLang = navigator.language.split('-')[0]
+ const detectedLang = langList.value.find((item) => item.type === browserLang)
+ if (detectedLang) {
+ setLanguage(detectedLang)
+ }
+ }
+
+ return {
+ selectedLang,
+ langList,
+ currentLanguage,
+ availableLanguages,
+ setLanguage,
+ initLanguage,
+ }
+})