diff --git a/everything-is-suitable-uniapp/src/components/BottomNavigation/BottomNavigation.vue b/everything-is-suitable-uniapp/src/components/BottomNavigation/BottomNavigation.vue
new file mode 100644
index 0000000..19200a7
--- /dev/null
+++ b/everything-is-suitable-uniapp/src/components/BottomNavigation/BottomNavigation.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+ {{ tab.label }}
+
+
+
+
+
+
+
+
diff --git a/everything-is-suitable-uniapp/src/components/Button/Button.vue b/everything-is-suitable-uniapp/src/components/Button/Button.vue
new file mode 100644
index 0000000..2f4cb12
--- /dev/null
+++ b/everything-is-suitable-uniapp/src/components/Button/Button.vue
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/everything-is-suitable-uniapp/src/components/Card/Card.vue b/everything-is-suitable-uniapp/src/components/Card/Card.vue
new file mode 100644
index 0000000..eacdd46
--- /dev/null
+++ b/everything-is-suitable-uniapp/src/components/Card/Card.vue
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/everything-is-suitable-uniapp/src/components/EmptyState/index.vue b/everything-is-suitable-uniapp/src/components/EmptyState/index.vue
index 60ad06b..5e14bd7 100644
--- a/everything-is-suitable-uniapp/src/components/EmptyState/index.vue
+++ b/everything-is-suitable-uniapp/src/components/EmptyState/index.vue
@@ -1,20 +1,23 @@
- {{ title }}
- {{ description }}
+ {{ displayTitle }}
+ {{ displayDescription }}
+
+
diff --git a/everything-is-suitable-uniapp/src/components/SearchConditionItem/index.vue b/everything-is-suitable-uniapp/src/components/SearchConditionItem/index.vue
index f4dccca..ff1bf0a 100644
--- a/everything-is-suitable-uniapp/src/components/SearchConditionItem/index.vue
+++ b/everything-is-suitable-uniapp/src/components/SearchConditionItem/index.vue
@@ -13,7 +13,7 @@
- 事项
+ {{ $t('search.activityItems') }}
- 逻辑运算符
+ {{ $t('search.logicalOperator') }}
- 排除条件
+ {{ $t('search.excludeCondition') }}
@@ -52,6 +52,7 @@
+
+
diff --git a/everything-is-suitable-uniapp/src/components/SearchHistoryPanel/index.vue b/everything-is-suitable-uniapp/src/components/SearchHistoryPanel/index.vue
index 198a30d..b84d7bf 100644
--- a/everything-is-suitable-uniapp/src/components/SearchHistoryPanel/index.vue
+++ b/everything-is-suitable-uniapp/src/components/SearchHistoryPanel/index.vue
@@ -1,17 +1,17 @@
@@ -39,6 +39,7 @@
diff --git a/everything-is-suitable-uniapp/src/components/SearchResultList/index.vue b/everything-is-suitable-uniapp/src/components/SearchResultList/index.vue
index da1508d..acc1c0d 100644
--- a/everything-is-suitable-uniapp/src/components/SearchResultList/index.vue
+++ b/everything-is-suitable-uniapp/src/components/SearchResultList/index.vue
@@ -1,8 +1,8 @@
diff --git a/everything-is-suitable-uniapp/src/components/Select/Select.vue b/everything-is-suitable-uniapp/src/components/Select/Select.vue
index c47a064..da5302e 100644
--- a/everything-is-suitable-uniapp/src/components/Select/Select.vue
+++ b/everything-is-suitable-uniapp/src/components/Select/Select.vue
@@ -23,7 +23,7 @@
:variant="size === 'small' ? 'caption' : 'body'"
class="select-placeholder"
>
- {{ placeholder }}
+ {{ displayPlaceholder }}
import { ref, computed } from 'vue'
+import { useI18n } from 'vue-i18n'
import Typography from '@/components/Typography/Typography.vue'
import Icon from '@/components/Icon/Icon.vue'
@@ -81,12 +82,16 @@ interface Props {
size?: 'small' | 'medium' | 'large'
}
+const { t } = useI18n()
+
const props = withDefaults(defineProps(), {
- placeholder: '请选择',
+ placeholder: undefined,
disabled: false,
size: 'medium'
})
+const displayPlaceholder = computed(() => props.placeholder ?? t('common.pleaseSelect'))
+
const emit = defineEmits<{
(e: 'update:modelValue', value: string | number): void
(e: 'change', value: string | number): void
diff --git a/everything-is-suitable-uniapp/src/components/SortSwitcher/index.vue b/everything-is-suitable-uniapp/src/components/SortSwitcher/index.vue
index 83f5aa1..3c67e34 100644
--- a/everything-is-suitable-uniapp/src/components/SortSwitcher/index.vue
+++ b/everything-is-suitable-uniapp/src/components/SortSwitcher/index.vue
@@ -1,6 +1,6 @@
- 排序
+ {{ $t('search.sort') }}
- 日期
+ {{ $t('search.sortByDate') }}
- 匹配度
+ {{ $t('search.sortByMatch') }}
@@ -33,8 +33,8 @@
@@ -65,6 +65,7 @@
+
+
diff --git a/everything-is-suitable-uniapp/src/locales/de.ts b/everything-is-suitable-uniapp/src/locales/de.ts
index ac53eb6..cc76a2d 100644
--- a/everything-is-suitable-uniapp/src/locales/de.ts
+++ b/everything-is-suitable-uniapp/src/locales/de.ts
@@ -9,6 +9,7 @@ export default {
search: 'Suchen',
male: 'Männlich',
female: 'Weiblich',
+ pleaseSelect: 'Bitte auswählen',
},
nav: {
almanac: 'Almanach',
@@ -45,63 +46,61 @@ export default {
monthly: 'Monatlich',
selectDate: 'Datum auswählen',
selectMonth: 'Monat auswählen',
- overallFortune: 'Gesamtschicksal',
- career: 'Karriere',
- wealth: 'Wohlstand',
- relationship: 'Beziehung',
- health: 'Gesundheit',
- luckyColor: 'Glücksfarbe',
- luckyNumber: 'Glückszahl',
- luckyDirection: 'Glücksrichtung',
- noChart: 'Bitte erstellen Sie zuerst ein Diagramm auf der Zi Wei Dou Shu Seite',
+ overallScore: 'Gesamtschicksal: {score}Pkt',
+ career: 'Karriere: ',
+ wealth: 'Wohlstand: ',
+ relationship: 'Beziehung: ',
+ health: 'Gesundheit: ',
+ luckyColor: 'Glücksfarbe: ',
+ luckyNumber: 'Glückszahl: ',
+ luckyDirection: 'Glücksrichtung: ',
+ noChartHint: 'Bitte erstellen Sie zuerst ein Diagramm auf der Zi Wei Dou Shu Seite',
},
search: {
- conditions: 'Suchbedingungen',
+ searchConditions: 'Suchbedingungen',
addCondition: 'Bedingung hinzufügen',
addConditionHint: 'Bitte fügen Sie mindestens eine Suchbedingung hinzu',
- addConditionEmpty: 'Suchbedingungen hinzufügen',
- days: 'Suchtage',
- dayUnit: 'Tage',
- searchResult: 'Suchergebnisse',
+ searchDays: 'Suchtage',
+ daysUnit: '{count} Tage',
+ searchResults: 'Suchergebnisse',
resultCount: '{count} Ergebnisse',
- matchCount: 'Übereinstimmung: {count}',
+ matchCount: 'Übereinstimmung',
sort: 'Sortieren',
sortByDate: 'Datum',
sortByMatch: 'Übereinstimmung',
- typeSuitable: 'Günstig',
- typeUnsuitable: 'Ungünstig',
+ suitable: 'Günstig',
+ unsuitable: 'Ungünstig',
operatorAnd: 'UND',
operatorOr: 'ODER',
excludeCondition: 'Bedingung ausschließen',
- items: 'Einträge',
- operator: 'Logischer Operator',
- },
- template: {
- title: 'Suchvorlagen',
- searchPlaceholder: 'Vorlagen durchsuchen',
- empty: 'Keine Vorlagen',
- emptyDesc: 'Keine Vorlagen entsprechen den Kriterien',
- all: 'Alle',
- },
- export: {
- title: 'Suchergebnisse exportieren',
- selectFormat: 'Exportformat auswählen',
- selectContent: 'Exportinhalt auswählen',
- date: 'Datum',
- lunarDate: 'Mondkalender-Datum',
- weekday: 'Wochentag',
- matchedItems: 'Übereinstimmende Einträge',
- matchCount: 'Übereinstimmung',
- },
- history: {
- title: 'Suchverlauf',
- clear: 'Verlauf löschen',
- clearConfirm: 'Löschen bestätigen',
- clearConfirmMsg: 'Möchten Sie den gesamten Suchverlauf löschen?',
- empty: 'Kein Suchverlauf',
- emptyDesc: 'Suchbedingungen werden nach der Suche hier angezeigt',
+ activityItems: 'Einträge',
+ logicalOperator: 'Logischer Operator',
+ dateFormat: '{day}.{month}.{year}',
+ searchHistory: 'Suchverlauf',
+ clearHistory: 'Verlauf löschen',
+ noHistoryTitle: 'Kein Suchverlauf',
+ noHistoryDesc: 'Suchbedingungen werden nach der Suche hier angezeigt',
+ confirmClear: 'Löschen bestätigen',
+ confirmClearContent: 'Möchten Sie den gesamten Suchverlauf löschen?',
+ historyConditionDays: '{count} Bedingungen, {days} Tage Bereich',
justNow: 'Gerade eben',
hoursAgo: 'Vor {count} Std.',
daysAgo: 'Vor {count} Tag(en)',
+ searchTemplates: 'Suchvorlagen',
+ noTemplatesTitle: 'Keine Vorlagen',
+ noTemplatesDesc: 'Keine Vorlagen entsprechen den Kriterien',
+ allCategories: 'Alle',
+ },
+ export: {
+ exportResults: 'Ergebnisse exportieren',
+ exportSearchResults: 'Suchergebnisse exportieren',
+ selectFormat: 'Exportformat auswählen',
+ selectContent: 'Exportinhalt auswählen',
+ export: 'Exportieren',
+ contentDate: 'Datum',
+ contentLunarDate: 'Mondkalender-Datum',
+ contentWeekday: 'Wochentag',
+ contentMatchedItems: 'Übereinstimmende Einträge',
+ contentMatchCount: 'Übereinstimmung',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/en.ts b/everything-is-suitable-uniapp/src/locales/en.ts
index 393db04..fb0ceb7 100644
--- a/everything-is-suitable-uniapp/src/locales/en.ts
+++ b/everything-is-suitable-uniapp/src/locales/en.ts
@@ -9,6 +9,7 @@ export default {
search: 'Search',
male: 'Male',
female: 'Female',
+ pleaseSelect: 'Please select',
},
nav: {
almanac: 'Almanac',
@@ -45,63 +46,61 @@ export default {
monthly: 'Monthly',
selectDate: 'Select Date',
selectMonth: 'Select Month',
- overallFortune: 'Overall Fortune',
- career: 'Career',
- wealth: 'Wealth',
- relationship: 'Relationship',
- health: 'Health',
- luckyColor: 'Lucky Color',
- luckyNumber: 'Lucky Number',
- luckyDirection: 'Lucky Direction',
- noChart: 'Please generate a chart on the Zi Wei Dou Shu page first',
+ overallScore: 'Overall Fortune: {score}pts',
+ career: 'Career: ',
+ wealth: 'Wealth: ',
+ relationship: 'Relationship: ',
+ health: 'Health: ',
+ luckyColor: 'Lucky Color: ',
+ luckyNumber: 'Lucky Number: ',
+ luckyDirection: 'Lucky Direction: ',
+ noChartHint: 'Please generate a chart on the Zi Wei Dou Shu page first',
},
search: {
- conditions: 'Search Conditions',
+ searchConditions: 'Search Conditions',
addCondition: 'Add Condition',
addConditionHint: 'Please add at least one search condition',
- addConditionEmpty: 'Add search conditions',
- days: 'Search Days',
- dayUnit: 'days',
- searchResult: 'Search Results',
+ searchDays: 'Search Days',
+ daysUnit: '{count} days',
+ searchResults: 'Search Results',
resultCount: '{count} results',
- matchCount: 'Match: {count}',
+ matchCount: 'Match',
sort: 'Sort',
sortByDate: 'Date',
sortByMatch: 'Match',
- typeSuitable: 'Suitable',
- typeUnsuitable: 'Unsuitable',
+ suitable: 'Suitable',
+ unsuitable: 'Unsuitable',
operatorAnd: 'AND',
operatorOr: 'OR',
excludeCondition: 'Exclude Condition',
- items: 'Items',
- operator: 'Logical Operator',
- },
- template: {
- title: 'Search Templates',
- searchPlaceholder: 'Search templates',
- empty: 'No Templates',
- emptyDesc: 'No templates match the criteria',
- all: 'All',
- },
- export: {
- title: 'Export Search Results',
- selectFormat: 'Select Export Format',
- selectContent: 'Select Export Content',
- date: 'Date',
- lunarDate: 'Lunar Date',
- weekday: 'Weekday',
- matchedItems: 'Matched Items',
- matchCount: 'Match Score',
- },
- history: {
- title: 'Search History',
- clear: 'Clear History',
- clearConfirm: 'Confirm Clear',
- clearConfirmMsg: 'Are you sure you want to clear all search history?',
- empty: 'No Search History',
- emptyDesc: 'Search conditions will appear here after searching',
+ activityItems: 'Items',
+ logicalOperator: 'Logical Operator',
+ dateFormat: '{month}/{day}/{year}',
+ searchHistory: 'Search History',
+ clearHistory: 'Clear History',
+ noHistoryTitle: 'No Search History',
+ noHistoryDesc: 'Search conditions will appear here after searching',
+ confirmClear: 'Confirm Clear',
+ confirmClearContent: 'Are you sure you want to clear all search history?',
+ historyConditionDays: '{count} conditions, {days} days range',
justNow: 'Just now',
hoursAgo: '{count}h ago',
daysAgo: '{count}d ago',
+ searchTemplates: 'Search Templates',
+ noTemplatesTitle: 'No Templates',
+ noTemplatesDesc: 'No templates match the criteria',
+ allCategories: 'All',
+ },
+ export: {
+ exportResults: 'Export Results',
+ exportSearchResults: 'Export Search Results',
+ selectFormat: 'Select Export Format',
+ selectContent: 'Select Export Content',
+ export: 'Export',
+ contentDate: 'Date',
+ contentLunarDate: 'Lunar Date',
+ contentWeekday: 'Weekday',
+ contentMatchedItems: 'Matched Items',
+ contentMatchCount: 'Match Score',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/es.ts b/everything-is-suitable-uniapp/src/locales/es.ts
index 842b02f..1d3e1c1 100644
--- a/everything-is-suitable-uniapp/src/locales/es.ts
+++ b/everything-is-suitable-uniapp/src/locales/es.ts
@@ -9,6 +9,7 @@ export default {
search: 'Buscar',
male: 'Masculino',
female: 'Femenino',
+ pleaseSelect: 'Seleccione',
},
nav: {
almanac: 'Almanaque',
@@ -45,63 +46,61 @@ export default {
monthly: 'Mensual',
selectDate: 'Seleccionar fecha',
selectMonth: 'Seleccionar mes',
- overallFortune: 'Fortuna general',
- career: 'Carrera',
- wealth: 'Riqueza',
- relationship: 'Relación',
- health: 'Salud',
- luckyColor: 'Color de la suerte',
- luckyNumber: 'Número de la suerte',
- luckyDirection: 'Dirección de la suerte',
- noChart: 'Primero genere una carta en la página de Zi Wei Dou Shu',
+ overallScore: 'Fortuna general: {score}pts',
+ career: 'Carrera: ',
+ wealth: 'Riqueza: ',
+ relationship: 'Relación: ',
+ health: 'Salud: ',
+ luckyColor: 'Color de la suerte: ',
+ luckyNumber: 'Número de la suerte: ',
+ luckyDirection: 'Dirección de la suerte: ',
+ noChartHint: 'Primero genere una carta en la página de Zi Wei Dou Shu',
},
search: {
- conditions: 'Condiciones de búsqueda',
+ searchConditions: 'Condiciones de búsqueda',
addCondition: 'Añadir condición',
addConditionHint: 'Añada al menos una condición de búsqueda',
- addConditionEmpty: 'Añadir condiciones de búsqueda',
- days: 'Días de búsqueda',
- dayUnit: 'días',
- searchResult: 'Resultados de búsqueda',
+ searchDays: 'Días de búsqueda',
+ daysUnit: '{count} días',
+ searchResults: 'Resultados de búsqueda',
resultCount: '{count} resultados',
- matchCount: 'Coincidencia: {count}',
+ matchCount: 'Coincidencia',
sort: 'Ordenar',
sortByDate: 'Fecha',
sortByMatch: 'Coincidencia',
- typeSuitable: 'Favorable',
- typeUnsuitable: 'Desfavorable',
+ suitable: 'Favorable',
+ unsuitable: 'Desfavorable',
operatorAnd: 'Y',
operatorOr: 'O',
excludeCondition: 'Excluir condición',
- items: 'Elementos',
- operator: 'Operador lógico',
- },
- template: {
- title: 'Plantillas de búsqueda',
- searchPlaceholder: 'Buscar plantillas',
- empty: 'Sin plantillas',
- emptyDesc: 'No hay plantillas que coincidan con los criterios',
- all: 'Todo',
- },
- export: {
- title: 'Exportar resultados',
- selectFormat: 'Seleccionar formato de exportación',
- selectContent: 'Seleccionar contenido de exportación',
- date: 'Fecha',
- lunarDate: 'Fecha lunar',
- weekday: 'Día de la semana',
- matchedItems: 'Elementos coincidentes',
- matchCount: 'Coincidencia',
- },
- history: {
- title: 'Historial de búsqueda',
- clear: 'Borrar historial',
- clearConfirm: 'Confirmar borrado',
- clearConfirmMsg: '¿Desea borrar todo el historial de búsqueda?',
- empty: 'Sin historial',
- emptyDesc: 'Las condiciones de búsqueda aparecerán aquí después de buscar',
+ activityItems: 'Elementos',
+ logicalOperator: 'Operador lógico',
+ dateFormat: '{day}/{month}/{year}',
+ searchHistory: 'Historial de búsqueda',
+ clearHistory: 'Borrar historial',
+ noHistoryTitle: 'Sin historial',
+ noHistoryDesc: 'Las condiciones de búsqueda aparecerán aquí después de buscar',
+ confirmClear: 'Confirmar borrado',
+ confirmClearContent: '¿Desea borrar todo el historial de búsqueda?',
+ historyConditionDays: '{count} condiciones, {days} días de rango',
justNow: 'Justo ahora',
hoursAgo: 'Hace {count}h',
daysAgo: 'Hace {count}d',
+ searchTemplates: 'Plantillas de búsqueda',
+ noTemplatesTitle: 'Sin plantillas',
+ noTemplatesDesc: 'No hay plantillas que coincidan con los criterios',
+ allCategories: 'Todo',
+ },
+ export: {
+ exportResults: 'Exportar resultados',
+ exportSearchResults: 'Exportar resultados de búsqueda',
+ selectFormat: 'Seleccionar formato de exportación',
+ selectContent: 'Seleccionar contenido de exportación',
+ export: 'Exportar',
+ contentDate: 'Fecha',
+ contentLunarDate: 'Fecha lunar',
+ contentWeekday: 'Día de la semana',
+ contentMatchedItems: 'Elementos coincidentes',
+ contentMatchCount: 'Coincidencia',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/fr.ts b/everything-is-suitable-uniapp/src/locales/fr.ts
index 6225b00..4a5478c 100644
--- a/everything-is-suitable-uniapp/src/locales/fr.ts
+++ b/everything-is-suitable-uniapp/src/locales/fr.ts
@@ -9,6 +9,7 @@ export default {
search: 'Rechercher',
male: 'Homme',
female: 'Femme',
+ pleaseSelect: 'Veuillez sélectionner',
},
nav: {
almanac: 'Almanach',
@@ -45,63 +46,61 @@ export default {
monthly: 'Mensuel',
selectDate: 'Sélectionner la date',
selectMonth: 'Sélectionner le mois',
- overallFortune: 'Destin global',
- career: 'Carrière',
- wealth: 'Richesse',
- relationship: 'Relation',
- health: 'Santé',
- luckyColor: 'Couleur porte-bonheur',
- luckyNumber: 'Numéro chance',
- luckyDirection: 'Direction porte-bonheur',
- noChart: 'Veuillez d\'abord générer un diagramme sur la page Zi Wei Dou Shu',
+ overallScore: 'Destin global : {score}pts',
+ career: 'Carrière : ',
+ wealth: 'Richesse : ',
+ relationship: 'Relation : ',
+ health: 'Santé : ',
+ luckyColor: 'Couleur porte-bonheur : ',
+ luckyNumber: 'Numéro chance : ',
+ luckyDirection: 'Direction porte-bonheur : ',
+ noChartHint: 'Veuillez d\'abord générer un diagramme sur la page Zi Wei Dou Shu',
},
search: {
- conditions: 'Conditions de recherche',
+ searchConditions: 'Conditions de recherche',
addCondition: 'Ajouter une condition',
addConditionHint: 'Veuillez ajouter au moins une condition de recherche',
- addConditionEmpty: 'Ajouter des conditions de recherche',
- days: 'Jours de recherche',
- dayUnit: 'jours',
- searchResult: 'Résultats de recherche',
+ searchDays: 'Jours de recherche',
+ daysUnit: '{count} jours',
+ searchResults: 'Résultats de recherche',
resultCount: '{count} résultats',
- matchCount: 'Correspondance : {count}',
+ matchCount: 'Correspondance',
sort: 'Trier',
sortByDate: 'Date',
sortByMatch: 'Correspondance',
- typeSuitable: 'Favorable',
- typeUnsuitable: 'Défavorable',
+ suitable: 'Favorable',
+ unsuitable: 'Défavorable',
operatorAnd: 'ET',
operatorOr: 'OU',
excludeCondition: 'Exclure la condition',
- items: 'Éléments',
- operator: 'Opérateur logique',
- },
- template: {
- title: 'Modèles de recherche',
- searchPlaceholder: 'Rechercher des modèles',
- empty: 'Aucun modèle',
- emptyDesc: 'Aucun modèle ne correspond aux critères',
- all: 'Tous',
- },
- export: {
- title: 'Exporter les résultats',
- selectFormat: 'Sélectionner le format d\'export',
- selectContent: 'Sélectionner le contenu d\'export',
- date: 'Date',
- lunarDate: 'Date lunaire',
- weekday: 'Jour de la semaine',
- matchedItems: 'Éléments correspondants',
- matchCount: 'Correspondance',
- },
- history: {
- title: 'Historique de recherche',
- clear: 'Effacer l\'historique',
- clearConfirm: 'Confirmer la suppression',
- clearConfirmMsg: 'Voulez-vous effacer tout l\'historique de recherche ?',
- empty: 'Aucun historique',
- emptyDesc: 'Les conditions de recherche apparaîtront ici après la recherche',
+ activityItems: 'Éléments',
+ logicalOperator: 'Opérateur logique',
+ dateFormat: '{day}/{month}/{year}',
+ searchHistory: 'Historique de recherche',
+ clearHistory: 'Effacer l\'historique',
+ noHistoryTitle: 'Aucun historique',
+ noHistoryDesc: 'Les conditions de recherche apparaîtront ici après la recherche',
+ confirmClear: 'Confirmer la suppression',
+ confirmClearContent: 'Voulez-vous effacer tout l\'historique de recherche ?',
+ historyConditionDays: '{count} conditions, {days} jours de plage',
justNow: 'À l\'instant',
hoursAgo: 'Il y a {count}h',
daysAgo: 'Il y a {count}j',
+ searchTemplates: 'Modèles de recherche',
+ noTemplatesTitle: 'Aucun modèle',
+ noTemplatesDesc: 'Aucun modèle ne correspond aux critères',
+ allCategories: 'Tous',
+ },
+ export: {
+ exportResults: 'Exporter les résultats',
+ exportSearchResults: 'Exporter les résultats de recherche',
+ selectFormat: 'Sélectionner le format d\'export',
+ selectContent: 'Sélectionner le contenu d\'export',
+ export: 'Exporter',
+ contentDate: 'Date',
+ contentLunarDate: 'Date lunaire',
+ contentWeekday: 'Jour de la semaine',
+ contentMatchedItems: 'Éléments correspondants',
+ contentMatchCount: 'Correspondance',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/ja.ts b/everything-is-suitable-uniapp/src/locales/ja.ts
index 9dfd8cb..22ff2c0 100644
--- a/everything-is-suitable-uniapp/src/locales/ja.ts
+++ b/everything-is-suitable-uniapp/src/locales/ja.ts
@@ -9,6 +9,7 @@ export default {
search: '検索',
male: '男性',
female: '女性',
+ pleaseSelect: '選択してください',
},
nav: {
almanac: '黄暦',
@@ -45,63 +46,61 @@ export default {
monthly: '月運',
selectDate: '日付を選択',
selectMonth: '月を選択',
- overallFortune: '総合運勢',
- career: '事業',
- wealth: '財運',
- relationship: '恋愛',
- health: '健康',
- luckyColor: 'ラッキーカラー',
- luckyNumber: 'ラッキーナンバー',
- luckyDirection: '吉方位',
- noChart: '先に紫微斗数ページで排盤を完了してください',
+ overallScore: '総合運勢:{score}点',
+ career: '事業:',
+ wealth: '財運:',
+ relationship: '恋愛:',
+ health: '健康:',
+ luckyColor: 'ラッキーカラー:',
+ luckyNumber: 'ラッキーナンバー:',
+ luckyDirection: '吉方位:',
+ noChartHint: '先に紫微斗数ページで排盤を完了してください',
},
search: {
- conditions: '検索条件',
+ searchConditions: '検索条件',
addCondition: '条件を追加',
addConditionHint: '検索条件を少なくとも1つ追加してください',
- addConditionEmpty: '検索条件を追加',
- days: '検索日数',
- dayUnit: '日',
- searchResult: '検索結果',
+ searchDays: '検索日数',
+ daysUnit: '{count}日',
+ searchResults: '検索結果',
resultCount: '{count}件の結果',
- matchCount: '一致度: {count}',
+ matchCount: '一致度',
sort: '並び替え',
sortByDate: '日付',
sortByMatch: '一致度',
- typeSuitable: '宜',
- typeUnsuitable: '忌',
+ suitable: '宜',
+ unsuitable: '忌',
operatorAnd: 'AND',
operatorOr: 'OR',
excludeCondition: '除外条件',
- items: '事項',
- operator: '論理演算子',
- },
- template: {
- title: '検索テンプレート',
- searchPlaceholder: 'テンプレートを検索',
- empty: 'テンプレートなし',
- emptyDesc: '条件に一致するテンプレートがありません',
- all: 'すべて',
- },
- export: {
- title: '検索結果をエクスポート',
- selectFormat: 'エクスポート形式を選択',
- selectContent: 'エクスポート内容を選択',
- date: '日付',
- lunarDate: '旧暦日付',
- weekday: '曜日',
- matchedItems: '一致事項',
- matchCount: '一致度',
- },
- history: {
- title: '検索履歴',
- clear: '履歴をクリア',
- clearConfirm: 'クリアの確認',
- clearConfirmMsg: 'すべての検索履歴をクリアしますか?',
- empty: '検索履歴なし',
- emptyDesc: '検索実行後、条件がここに表示されます',
+ activityItems: '事項',
+ logicalOperator: '論理演算子',
+ dateFormat: '{year}年{month}月{day}日',
+ searchHistory: '検索履歴',
+ clearHistory: '履歴をクリア',
+ noHistoryTitle: '検索履歴なし',
+ noHistoryDesc: '検索実行後、条件がここに表示されます',
+ confirmClear: 'クリアの確認',
+ confirmClearContent: 'すべての検索履歴をクリアしますか?',
+ historyConditionDays: '{count}つの条件、{days}日範囲',
justNow: 'たった今',
hoursAgo: '{count}時間前',
daysAgo: '{count}日前',
+ searchTemplates: '検索テンプレート',
+ noTemplatesTitle: 'テンプレートなし',
+ noTemplatesDesc: '条件に一致するテンプレートがありません',
+ allCategories: 'すべて',
+ },
+ export: {
+ exportResults: '結果をエクスポート',
+ exportSearchResults: '検索結果をエクスポート',
+ selectFormat: 'エクスポート形式を選択',
+ selectContent: 'エクスポート内容を選択',
+ export: 'エクスポート',
+ contentDate: '日付',
+ contentLunarDate: '旧暦日付',
+ contentWeekday: '曜日',
+ contentMatchedItems: '一致事項',
+ contentMatchCount: '一致度',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/ko.ts b/everything-is-suitable-uniapp/src/locales/ko.ts
index c8b7737..61457b0 100644
--- a/everything-is-suitable-uniapp/src/locales/ko.ts
+++ b/everything-is-suitable-uniapp/src/locales/ko.ts
@@ -9,6 +9,7 @@ export default {
search: '검색',
male: '남성',
female: '여성',
+ pleaseSelect: '선택하세요',
},
nav: {
almanac: '황력',
@@ -45,63 +46,61 @@ export default {
monthly: '월운',
selectDate: '날짜 선택',
selectMonth: '월 선택',
- overallFortune: '종합 운세',
- career: '사업',
- wealth: '재운',
- relationship: '연애',
- health: '건강',
- luckyColor: '행운의 색',
- luckyNumber: '행운의 숫자',
- luckyDirection: '행운의 방위',
- noChart: '먼저 자미두수 페이지에서 명반을 생성해 주세요',
+ overallScore: '종합 운세: {score}점',
+ career: '사업: ',
+ wealth: '재운: ',
+ relationship: '연애: ',
+ health: '건강: ',
+ luckyColor: '행운의 색: ',
+ luckyNumber: '행운의 숫자: ',
+ luckyDirection: '행운의 방위: ',
+ noChartHint: '먼저 자미두수 페이지에서 명반을 생성해 주세요',
},
search: {
- conditions: '검색 조건',
+ searchConditions: '검색 조건',
addCondition: '조건 추가',
addConditionHint: '검색 조건을 최소 하나 추가해 주세요',
- addConditionEmpty: '검색 조건 추가',
- days: '검색 일수',
- dayUnit: '일',
- searchResult: '검색 결과',
+ searchDays: '검색 일수',
+ daysUnit: '{count}일',
+ searchResults: '검색 결과',
resultCount: '{count}개 결과',
- matchCount: '일치도: {count}',
+ matchCount: '일치도',
sort: '정렬',
sortByDate: '날짜',
sortByMatch: '일치도',
- typeSuitable: '宜',
- typeUnsuitable: '忌',
+ suitable: '宜',
+ unsuitable: '忌',
operatorAnd: 'AND',
operatorOr: 'OR',
excludeCondition: '제외 조건',
- items: '항목',
- operator: '논리 연산자',
- },
- template: {
- title: '검색 템플릿',
- searchPlaceholder: '템플릿 검색',
- empty: '템플릿 없음',
- emptyDesc: '조건에 맞는 템플릿이 없습니다',
- all: '전체',
- },
- export: {
- title: '검색 결과 내보내기',
- selectFormat: '내보내기 형식 선택',
- selectContent: '내보내기 내용 선택',
- date: '날짜',
- lunarDate: '음력 날짜',
- weekday: '요일',
- matchedItems: '일치 항목',
- matchCount: '일치도',
- },
- history: {
- title: '검색 기록',
- clear: '기록 삭제',
- clearConfirm: '삭제 확인',
- clearConfirmMsg: '모든 검색 기록을 삭제하시겠습니까?',
- empty: '검색 기록 없음',
- emptyDesc: '검색 실행 후 조건이 여기에 표시됩니다',
+ activityItems: '항목',
+ logicalOperator: '논리 연산자',
+ dateFormat: '{year}년 {month}월 {day}일',
+ searchHistory: '검색 기록',
+ clearHistory: '기록 삭제',
+ noHistoryTitle: '검색 기록 없음',
+ noHistoryDesc: '검색 실행 후 조건이 여기에 표시됩니다',
+ confirmClear: '삭제 확인',
+ confirmClearContent: '모든 검색 기록을 삭제하시겠습니까?',
+ historyConditionDays: '{count}개 조건, {days}일 범위',
justNow: '방금',
hoursAgo: '{count}시간 전',
daysAgo: '{count}일 전',
+ searchTemplates: '검색 템플릿',
+ noTemplatesTitle: '템플릿 없음',
+ noTemplatesDesc: '조건에 맞는 템플릿이 없습니다',
+ allCategories: '전체',
+ },
+ export: {
+ exportResults: '결과 내보내기',
+ exportSearchResults: '검색 결과 내보내기',
+ selectFormat: '내보내기 형식 선택',
+ selectContent: '내보내기 내용 선택',
+ export: '내보내기',
+ contentDate: '날짜',
+ contentLunarDate: '음력 날짜',
+ contentWeekday: '요일',
+ contentMatchedItems: '일치 항목',
+ contentMatchCount: '일치도',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/pt.ts b/everything-is-suitable-uniapp/src/locales/pt.ts
index a10dd1e..36d9ba6 100644
--- a/everything-is-suitable-uniapp/src/locales/pt.ts
+++ b/everything-is-suitable-uniapp/src/locales/pt.ts
@@ -9,6 +9,7 @@ export default {
search: 'Pesquisar',
male: 'Masculino',
female: 'Feminino',
+ pleaseSelect: 'Selecione',
},
nav: {
almanac: 'Almanaque',
@@ -45,63 +46,61 @@ export default {
monthly: 'Mensal',
selectDate: 'Selecionar data',
selectMonth: 'Selecionar mês',
- overallFortune: 'Fortuna geral',
- career: 'Carreira',
- wealth: 'Riqueza',
- relationship: 'Relacionamento',
- health: 'Saúde',
- luckyColor: 'Cor da sorte',
- luckyNumber: 'Número da sorte',
- luckyDirection: 'Direção da sorte',
- noChart: 'Primeiro gere uma carta na página Zi Wei Dou Shu',
+ overallScore: 'Fortuna geral: {score}pts',
+ career: 'Carreira: ',
+ wealth: 'Riqueza: ',
+ relationship: 'Relacionamento: ',
+ health: 'Saúde: ',
+ luckyColor: 'Cor da sorte: ',
+ luckyNumber: 'Número da sorte: ',
+ luckyDirection: 'Direção da sorte: ',
+ noChartHint: 'Primeiro gere uma carta na página Zi Wei Dou Shu',
},
search: {
- conditions: 'Condições de pesquisa',
+ searchConditions: 'Condições de pesquisa',
addCondition: 'Adicionar condição',
addConditionHint: 'Adicione pelo menos uma condição de pesquisa',
- addConditionEmpty: 'Adicionar condições de pesquisa',
- days: 'Dias de pesquisa',
- dayUnit: 'dias',
- searchResult: 'Resultados da pesquisa',
+ searchDays: 'Dias de pesquisa',
+ daysUnit: '{count} dias',
+ searchResults: 'Resultados da pesquisa',
resultCount: '{count} resultados',
- matchCount: 'Correspondência: {count}',
+ matchCount: 'Correspondência',
sort: 'Ordenar',
sortByDate: 'Data',
sortByMatch: 'Correspondência',
- typeSuitable: 'Favorável',
- typeUnsuitable: 'Desfavorável',
+ suitable: 'Favorável',
+ unsuitable: 'Desfavorável',
operatorAnd: 'E',
operatorOr: 'OU',
excludeCondition: 'Excluir condição',
- items: 'Itens',
- operator: 'Operador lógico',
- },
- template: {
- title: 'Modelos de pesquisa',
- searchPlaceholder: 'Pesquisar modelos',
- empty: 'Sem modelos',
- emptyDesc: 'Nenhum modelo corresponde aos critérios',
- all: 'Todos',
- },
- export: {
- title: 'Exportar resultados',
- selectFormat: 'Selecionar formato de exportação',
- selectContent: 'Selecionar conteúdo de exportação',
- date: 'Data',
- lunarDate: 'Data lunar',
- weekday: 'Dia da semana',
- matchedItems: 'Itens correspondentes',
- matchCount: 'Correspondência',
- },
- history: {
- title: 'Histórico de pesquisa',
- clear: 'Limpar histórico',
- clearConfirm: 'Confirmar limpeza',
- clearConfirmMsg: 'Deseja limpar todo o histórico de pesquisa?',
- empty: 'Sem histórico',
- emptyDesc: 'As condições de pesquisa aparecerão aqui após a pesquisa',
+ activityItems: 'Itens',
+ logicalOperator: 'Operador lógico',
+ dateFormat: '{day}/{month}/{year}',
+ searchHistory: 'Histórico de pesquisa',
+ clearHistory: 'Limpar histórico',
+ noHistoryTitle: 'Sem histórico',
+ noHistoryDesc: 'As condições de pesquisa aparecerão aqui após a pesquisa',
+ confirmClear: 'Confirmar limpeza',
+ confirmClearContent: 'Deseja limpar todo o histórico de pesquisa?',
+ historyConditionDays: '{count} condições, {days} dias de intervalo',
justNow: 'Agora mesmo',
hoursAgo: 'Há {count}h',
daysAgo: 'Há {count}d',
+ searchTemplates: 'Modelos de pesquisa',
+ noTemplatesTitle: 'Sem modelos',
+ noTemplatesDesc: 'Nenhum modelo corresponde aos critérios',
+ allCategories: 'Todos',
+ },
+ export: {
+ exportResults: 'Exportar resultados',
+ exportSearchResults: 'Exportar resultados de pesquisa',
+ selectFormat: 'Selecionar formato de exportação',
+ selectContent: 'Selecionar conteúdo de exportação',
+ export: 'Exportar',
+ contentDate: 'Data',
+ contentLunarDate: 'Data lunar',
+ contentWeekday: 'Dia da semana',
+ contentMatchedItems: 'Itens correspondentes',
+ contentMatchCount: 'Correspondência',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/zh-CN.ts b/everything-is-suitable-uniapp/src/locales/zh-CN.ts
index bbc4e88..325cdbd 100644
--- a/everything-is-suitable-uniapp/src/locales/zh-CN.ts
+++ b/everything-is-suitable-uniapp/src/locales/zh-CN.ts
@@ -9,6 +9,7 @@ export default {
search: '搜索',
male: '男',
female: '女',
+ pleaseSelect: '请选择',
},
nav: {
almanac: '黄历',
@@ -45,63 +46,61 @@ export default {
monthly: '月运',
selectDate: '选择日期',
selectMonth: '选择月份',
- overallFortune: '综合运势',
- career: '事业',
- wealth: '财运',
- relationship: '感情',
- health: '健康',
- luckyColor: '幸运色',
- luckyNumber: '幸运数字',
- luckyDirection: '幸运方位',
- noChart: '请先在紫微斗数页面完成排盘',
+ overallScore: '综合运势:{score}分',
+ career: '事业:',
+ wealth: '财运:',
+ relationship: '感情:',
+ health: '健康:',
+ luckyColor: '幸运色:',
+ luckyNumber: '幸运数字:',
+ luckyDirection: '幸运方位:',
+ noChartHint: '请先在紫微斗数页面完成排盘',
},
search: {
- conditions: '搜索条件',
+ searchConditions: '搜索条件',
addCondition: '添加条件',
addConditionHint: '请至少添加一个搜索条件',
- addConditionEmpty: '请添加搜索条件',
- days: '搜索天数',
- dayUnit: '天',
- searchResult: '搜索结果',
+ searchDays: '搜索天数',
+ daysUnit: '{count}天',
+ searchResults: '搜索结果',
resultCount: '共{count}条结果',
- matchCount: '匹配度: {count}',
+ matchCount: '匹配度',
sort: '排序',
sortByDate: '日期',
sortByMatch: '匹配度',
- typeSuitable: '宜',
- typeUnsuitable: '忌',
+ suitable: '宜',
+ unsuitable: '忌',
operatorAnd: '与(AND)',
operatorOr: '或(OR)',
excludeCondition: '排除条件',
- items: '事项',
- operator: '逻辑运算符',
- },
- template: {
- title: '搜索模板',
- searchPlaceholder: '搜索模板',
- empty: '暂无模板',
- emptyDesc: '没有找到符合条件的模板',
- all: '全部',
- },
- export: {
- title: '导出搜索结果',
- selectFormat: '选择导出格式',
- selectContent: '选择导出内容',
- date: '日期',
- lunarDate: '农历日期',
- weekday: '星期',
- matchedItems: '匹配事项',
- matchCount: '匹配度',
- },
- history: {
- title: '搜索历史',
- clear: '清除历史',
- clearConfirm: '确认清除',
- clearConfirmMsg: '确定要清除所有搜索历史吗?',
- empty: '暂无搜索历史',
- emptyDesc: '执行搜索后,搜索条件将显示在这里',
+ activityItems: '事项',
+ logicalOperator: '逻辑运算符',
+ dateFormat: '{year}年{month}月{day}日',
+ searchHistory: '搜索历史',
+ clearHistory: '清除历史',
+ noHistoryTitle: '暂无搜索历史',
+ noHistoryDesc: '执行搜索后,搜索条件将显示在这里',
+ confirmClear: '确认清除',
+ confirmClearContent: '确定要清除所有搜索历史吗?',
+ historyConditionDays: '{count}个条件,{days}天范围',
justNow: '刚刚',
hoursAgo: '{count}小时前',
daysAgo: '{count}天前',
+ searchTemplates: '搜索模板',
+ noTemplatesTitle: '暂无模板',
+ noTemplatesDesc: '没有找到符合条件的模板',
+ allCategories: '全部',
+ },
+ export: {
+ exportResults: '导出结果',
+ exportSearchResults: '导出搜索结果',
+ selectFormat: '选择导出格式',
+ selectContent: '选择导出内容',
+ export: '导出',
+ contentDate: '日期',
+ contentLunarDate: '农历日期',
+ contentWeekday: '星期',
+ contentMatchedItems: '匹配事项',
+ contentMatchCount: '匹配度',
},
}
diff --git a/everything-is-suitable-uniapp/src/locales/zh-TW.ts b/everything-is-suitable-uniapp/src/locales/zh-TW.ts
index 5b27a8d..f650d0c 100644
--- a/everything-is-suitable-uniapp/src/locales/zh-TW.ts
+++ b/everything-is-suitable-uniapp/src/locales/zh-TW.ts
@@ -9,6 +9,7 @@ export default {
search: '搜尋',
male: '男',
female: '女',
+ pleaseSelect: '請選擇',
},
nav: {
almanac: '黃曆',
@@ -45,63 +46,61 @@ export default {
monthly: '月運',
selectDate: '選擇日期',
selectMonth: '選擇月份',
- overallFortune: '綜合運勢',
- career: '事業',
- wealth: '財運',
- relationship: '感情',
- health: '健康',
- luckyColor: '幸運色',
- luckyNumber: '幸運數字',
- luckyDirection: '幸運方位',
- noChart: '請先在紫微斗數頁面完成排盤',
+ overallScore: '綜合運勢:{score}分',
+ career: '事業:',
+ wealth: '財運:',
+ relationship: '感情:',
+ health: '健康:',
+ luckyColor: '幸運色:',
+ luckyNumber: '幸運數字:',
+ luckyDirection: '幸運方位:',
+ noChartHint: '請先在紫微斗數頁面完成排盤',
},
search: {
- conditions: '搜尋條件',
+ searchConditions: '搜尋條件',
addCondition: '新增條件',
addConditionHint: '請至少新增一個搜尋條件',
- addConditionEmpty: '請新增搜尋條件',
- days: '搜尋天數',
- dayUnit: '天',
- searchResult: '搜尋結果',
+ searchDays: '搜尋天數',
+ daysUnit: '{count}天',
+ searchResults: '搜尋結果',
resultCount: '共{count}條結果',
- matchCount: '匹配度: {count}',
+ matchCount: '匹配度',
sort: '排序',
sortByDate: '日期',
sortByMatch: '匹配度',
- typeSuitable: '宜',
- typeUnsuitable: '忌',
+ suitable: '宜',
+ unsuitable: '忌',
operatorAnd: '與(AND)',
operatorOr: '或(OR)',
excludeCondition: '排除條件',
- items: '事項',
- operator: '邏輯運算子',
- },
- template: {
- title: '搜尋模板',
- searchPlaceholder: '搜尋模板',
- empty: '暫無模板',
- emptyDesc: '沒有找到符合條件的模板',
- all: '全部',
- },
- export: {
- title: '匯出搜尋結果',
- selectFormat: '選擇匯出格式',
- selectContent: '選擇匯出內容',
- date: '日期',
- lunarDate: '農曆日期',
- weekday: '星期',
- matchedItems: '匹配事項',
- matchCount: '匹配度',
- },
- history: {
- title: '搜尋歷史',
- clear: '清除歷史',
- clearConfirm: '確認清除',
- clearConfirmMsg: '確定要清除所有搜尋歷史嗎?',
- empty: '暫無搜尋歷史',
- emptyDesc: '執行搜尋後,搜尋條件將顯示在這裡',
+ activityItems: '事項',
+ logicalOperator: '邏輯運算子',
+ dateFormat: '{year}年{month}月{day}日',
+ searchHistory: '搜尋歷史',
+ clearHistory: '清除歷史',
+ noHistoryTitle: '暫無搜尋歷史',
+ noHistoryDesc: '執行搜尋後,搜尋條件將顯示在這裡',
+ confirmClear: '確認清除',
+ confirmClearContent: '確定要清除所有搜尋歷史嗎?',
+ historyConditionDays: '{count}個條件,{days}天範圍',
justNow: '剛剛',
hoursAgo: '{count}小時前',
daysAgo: '{count}天前',
+ searchTemplates: '搜尋模板',
+ noTemplatesTitle: '暫無模板',
+ noTemplatesDesc: '沒有找到符合條件的模板',
+ allCategories: '全部',
+ },
+ export: {
+ exportResults: '匯出結果',
+ exportSearchResults: '匯出搜尋結果',
+ selectFormat: '選擇匯出格式',
+ selectContent: '選擇匯出內容',
+ export: '匯出',
+ contentDate: '日期',
+ contentLunarDate: '農曆日期',
+ contentWeekday: '星期',
+ contentMatchedItems: '匹配事項',
+ contentMatchCount: '匹配度',
},
}
diff --git a/everything-is-suitable-uniapp/src/types/search.ts b/everything-is-suitable-uniapp/src/types/search.ts
index bf1f990..02f2260 100644
--- a/everything-is-suitable-uniapp/src/types/search.ts
+++ b/everything-is-suitable-uniapp/src/types/search.ts
@@ -32,17 +32,6 @@ export interface SavedSearchCondition {
createdAt: string
}
-export interface SearchService {
- search(request: SearchRequest): Promise
- saveSearchCondition(name: string, condition: SearchRequest): void
- getSavedSearchConditions(): SavedSearchCondition[]
- deleteSearchCondition(id: string): void
- loadSearchCondition(condition: SearchRequest): void
- saveSearchHistory(request: SearchRequest): void
- getSearchHistory(): any[]
- clearSearchHistory(): void
-}
-
export interface SearchHistoryItem {
id: string
condition: SearchRequest
diff --git a/everything-is-suitable-uniapp/src/utils/errorHandler.ts b/everything-is-suitable-uniapp/src/utils/errorHandler.ts
index c574075..209298d 100644
--- a/everything-is-suitable-uniapp/src/utils/errorHandler.ts
+++ b/everything-is-suitable-uniapp/src/utils/errorHandler.ts
@@ -1,18 +1,31 @@
-import type { ApiError, ErrorType } from './httpClient'
+export enum AppErrorType {
+ CALCULATION_ERROR = 'CALCULATION_ERROR',
+ DATA_ERROR = 'DATA_ERROR',
+ STORAGE_ERROR = 'STORAGE_ERROR',
+ VALIDATION_ERROR = 'VALIDATION_ERROR',
+ UNKNOWN_ERROR = 'UNKNOWN_ERROR'
+}
+
+export interface AppError {
+ type: AppErrorType
+ code: number
+ message: string
+ detail?: any
+}
class ErrorHandler {
- private errorMessages: Record = {
- NETWORK_ERROR: '网络连接失败,请检查网络设置',
- TIMEOUT_ERROR: '请求超时,请稍后重试',
- BUSINESS_ERROR: '操作失败,请稍后重试',
- AUTH_ERROR: '认证失败,请重新登录',
- TOKEN_EXPIRED: '登录已过期,请重新登录',
+ private errorMessages: Record = {
+ CALCULATION_ERROR: '计算出错,请稍后重试',
+ DATA_ERROR: '数据异常,请稍后重试',
+ STORAGE_ERROR: '存储操作失败,请检查设备空间',
+ VALIDATION_ERROR: '输入数据有误,请检查后重试',
UNKNOWN_ERROR: '未知错误,请稍后重试'
}
- handleError(error: ApiError): void {
- this.logError(error)
- this.showErrorMessage(error.message)
+ handleError(error: AppError | Error): void {
+ const appError = this.toAppError(error)
+ this.logError(appError)
+ this.showErrorMessage(appError.message)
}
showErrorMessage(message: string): void {
@@ -31,8 +44,8 @@ class ErrorHandler {
})
}
- logError(error: ApiError): void {
- console.error('[API Error]', {
+ logError(error: AppError): void {
+ console.error('[App Error]', {
type: error.type,
code: error.code,
message: error.message,
@@ -40,20 +53,23 @@ class ErrorHandler {
})
}
- getErrorMessage(error: ApiError): string {
+ getErrorMessage(error: AppError): string {
return this.errorMessages[error.type] || error.message
}
- isAuthError(error: ApiError): boolean {
- return error.type === 'AUTH_ERROR' || error.type === 'TOKEN_EXPIRED'
+ createError(type: AppErrorType, message: string, code: number = 0, detail?: any): AppError {
+ return { type, code, message, detail }
}
- isNetworkError(error: ApiError): boolean {
- return error.type === 'NETWORK_ERROR' || error.type === 'TIMEOUT_ERROR'
- }
-
- isBusinessError(error: ApiError): boolean {
- return error.type === 'BUSINESS_ERROR'
+ private toAppError(error: AppError | Error): AppError {
+ if ('type' in error && 'code' in error) {
+ return error as AppError
+ }
+ return {
+ type: AppErrorType.UNKNOWN_ERROR,
+ code: 0,
+ message: error.message || '未知错误'
+ }
}
}