diff --git a/webUI/src/components/forms/Hdatepicker.vue b/webUI/src/components/forms/Hdatepicker.vue index 1e4874a..7a214bc 100644 --- a/webUI/src/components/forms/Hdatepicker.vue +++ b/webUI/src/components/forms/Hdatepicker.vue @@ -1,9 +1,9 @@ @@ -14,7 +14,7 @@ import moment from 'jalali-moment'; export default { props: { - value: { + modelValue: { type: String, default: '', }, @@ -29,42 +29,52 @@ export default { }, data() { return { - displayDate: '', // تاریخ به فرمت شمسی + displayDate: this.modelValue, // مقداردهی اولیه از prop pickerActive: false, // کنترل باز شدن تقویم minDatePersian: '', // تاریخ شروع سال مالی (شمسی برای پکیج) maxDatePersian: '', // تاریخ پایان سال مالی (شمسی برای پکیج) + uniqueId: '', // شناسه یکتا برای هر نمونه + isInitialized: false, // فلگ برای کنترل مقداردهی اولیه }; }, + created() { + // ایجاد شناسه یکتا برای هر نمونه از کامپوننت + this.uniqueId = Math.random().toString(36).substring(2, 15); + }, watch: { - displayDate(newVal) { - if (newVal) { - this.$emit('input', newVal); // ارسال تاریخ شمسی به والد - } else { - this.$emit('input', ''); + displayDate(newVal, oldVal) { + if (newVal !== oldVal) { + this.$emit('update:modelValue', newVal); } }, - value(newVal) { - if (newVal) { - this.displayDate = newVal; - } else { - this.displayDate = ''; + modelValue: { + immediate: true, + handler(newVal) { + if (newVal && newVal !== this.displayDate) { + this.displayDate = newVal; + } } - }, + } }, async mounted() { await this.fetchYearData(); - if (!this.value && this.displayDate) { - this.$emit('input', this.displayDate); - } }, methods: { async fetchYearData() { - - axios.get('/api/year/get').then((response) => { - this.minDatePersian = response.data.start; // فرمت YYYY/MM/DD شمسی - this.maxDatePersian = response.data.end; // فرمت YYYY/MM/DD شمسی - this.displayDate = response.data.now; // تاریخ جاری شمسی - }); + try { + const response = await axios.get('/api/year/get'); + this.minDatePersian = response.data.start; + this.maxDatePersian = response.data.end; + + // فقط اگر مقدار اولیه نداریم، از تاریخ جاری استفاده کنیم + if (!this.modelValue && !this.isInitialized) { + this.displayDate = response.data.now; + this.$emit('update:modelValue', response.data.now); + this.isInitialized = true; + } + } catch (error) { + console.error('خطا در دریافت اطلاعات سال:', error); + } }, updateDateFromInput(value) { // بررسی و اعتبارسنجی تاریخ وارد شده توسط کاربر diff --git a/webUI/src/views/acc/component/rec.vue b/webUI/src/views/acc/component/rec.vue index 66a0c95..c631b38 100644 --- a/webUI/src/views/acc/component/rec.vue +++ b/webUI/src/views/acc/component/rec.vue @@ -1,11 +1,5 @@ + + mdi-pencil + ویرایش + آرشیو @@ -166,10 +169,11 @@ export default defineComponent({ - - mdi-arrow-down-circle - دریافت‌ها - + + @@ -315,23 +319,33 @@ export default defineComponent({ - - - - mdi-arrow-down-circle - دریافت‌ها - - - - - - بازگشت - - - \ No newline at end of file diff --git a/webUI/src/views/user/login.vue b/webUI/src/views/user/login.vue index 4967152..9b781a9 100644 --- a/webUI/src/views/user/login.vue +++ b/webUI/src/views/user/login.vue @@ -77,7 +77,7 @@ export default { loading: false, captchaLoading: false, dialog: false, - siteName:'', + siteName: '', showCaptcha: false, errorMsg: self.$t('login.input_fail'), captchaImage: '', @@ -155,20 +155,21 @@ export default { const response = await axios.post("/api/user/login", userData, { withCredentials: true, }); - if (response.data.Success === true) { + if (response.data.Success == true) { this.setTokenAndRedirect(response); } - } catch (error) { - const errorData = (error as any).response?.data || {}; - this.errorMsg = errorData.error || this.$t('login.input_fail'); - this.dialog = true; - - if (errorData.captcha_required) { + if (response.data?.data?.captcha_required == true) { this.showCaptcha = true; await this.loadCaptcha(); } else { this.showCaptcha = false; } + } catch (error) { + const errorData = (error as any).response?.data || {}; + this.showCaptcha = true; + await this.loadCaptcha(); + this.errorMsg = errorData.message || errorData.error || this.$t('login.input_fail'); + this.dialog = true; } finally { this.loading = false; } @@ -190,7 +191,7 @@ export default { mounted() { // کپچا در ابتدا نمایش داده نمی‌شه }, - async created(){ + async created() { this.siteName = await getSiteName(); }, };