From bbec5b802d6eaa94427236f3eab32a87ea614b0d Mon Sep 17 00:00:00 2001 From: adonis Date: Tue, 30 Jun 2026 22:19:27 +0330 Subject: [PATCH] fix bugs --- .htaccess | 14 ++++++ src/components/BasicPacks/BasicInput.vue | 31 +++++++----- .../BasicPriceInput/src/BasicPriceInput.vue | 5 +- src/store/settingsStore.ts | 5 ++ src/utils/inputRules.ts | 5 +- src/utils/persianDigits.ts | 29 +++++++++++ .../gold/desktop/styles/desktop-gold.less | 48 ++++++++++++++++++- src/views/base/gold/index.vue | 39 ++++++++++++--- .../base/products/components/DealProduct.vue | 12 +---- src/views/login/components/Register.vue | 16 +++++-- .../components/DesktopRegisterForm.vue | 14 ++++-- 11 files changed, 178 insertions(+), 40 deletions(-) create mode 100644 .htaccess create mode 100644 src/utils/persianDigits.ts diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..1b6a42d --- /dev/null +++ b/.htaccess @@ -0,0 +1,14 @@ + + + Options -MultiViews -Indexes + + + # Handle Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + #RewriteBase / + RewriteRule ^ /index.html [L] + + + + diff --git a/src/components/BasicPacks/BasicInput.vue b/src/components/BasicPacks/BasicInput.vue index 9012c27..3afadee 100644 --- a/src/components/BasicPacks/BasicInput.vue +++ b/src/components/BasicPacks/BasicInput.vue @@ -36,6 +36,7 @@ import {usePrefix} from "@/utils/usePrefix"; import {computed} from "vue"; import {usePrice} from "@/utils/usePrice"; +import {persianToEnglishDigits, shouldNormalizeInputDigits} from '@/utils/persianDigits'; //Props interface Prop { @@ -59,9 +60,7 @@ const addonTextColor = computed(() => props.addonTextColor) //emits const localValue = computed({ set(value) { - props.type === 'price' - ? emits('update:value', value?.toString().replaceAll(',', '')) - : emits('update:value', value) + emits('update:value', normalizeValue(value)) }, get() { return props.type === 'price' @@ -75,16 +74,26 @@ const props = withDefaults(defineProps(), { }) const emits = defineEmits(['update:value', 'onchange']) -const handlerChange = (e: any) => { - props.type === 'price' - ? emits('update:value', e.target.value?.toString().replaceAll(',', '')) - : emits('update:value', e.target.value) - props.type === 'price' - ? emits('onchange', e.target.value?.toString().replaceAll(',', '')) - : emits('onchange', e.target.value) +function normalizeValue(value: unknown) { + if (value == null || value === '') { + return value + } + + let normalized = String(value) + if (shouldNormalizeInputDigits(props)) { + normalized = persianToEnglishDigits(normalized) + } + if (props.type === 'price') { + normalized = normalized.replaceAll(',', '') + } + return normalized } -//css style +const handlerChange = (e: any) => { + const normalized = normalizeValue(e.target.value) + emits('update:value', normalized) + emits('onchange', normalized) +} const {prefixCls} = usePrefix('input') diff --git a/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue b/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue index d9e2f48..12e5d50 100644 --- a/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue +++ b/src/components/BasicPacks/BasicPriceInput/src/BasicPriceInput.vue @@ -1,5 +1,5 @@