Compare commits
2 Commits
93ff29d6e5
...
a71d2694c2
| Author | SHA1 | Date |
|---|---|---|
|
|
a71d2694c2 | |
|
|
b59cff9e08 |
|
|
@ -6,7 +6,9 @@
|
|||
role="button"
|
||||
class="w-6 h-6 rounded-full overflow-hidden shadow-lg image-fit zoom-in scale-110"
|
||||
>
|
||||
<img alt="flag" :src="`/src/assets/images/flags/${selectedLang}.png`" />
|
||||
<!-- <img alt="flag" :src="`/src/assets/images/flags/${selectedLang}.png`" /> -->
|
||||
<img alt="flag" :src="getSrc" />
|
||||
<!-- <img alt="flag" :src="require(`@/assets/images/flags/${selectedLang}.png`)" /> -->
|
||||
</DropdownToggle>
|
||||
|
||||
<DropdownMenu class="pt-2">
|
||||
|
|
@ -62,16 +64,43 @@ const languages = [
|
|||
},
|
||||
];
|
||||
|
||||
// const imageAssets = import.meta.globEager(
|
||||
// `/src/assets/images/flags/*.{jpg,jpeg,png,svg}`
|
||||
// );
|
||||
|
||||
// const imageAssets = import.meta.globEager(
|
||||
// `/src/assets/images/flags/*.{jpg,jpeg,png,svg}`
|
||||
// );
|
||||
|
||||
const imageAssets = import.meta.globEager(
|
||||
`/src/assets/images/flags/*.{jpg,jpeg,png,svg}`
|
||||
);
|
||||
|
||||
// const imageUrl = new URL(`/src/assets/images/flags/${selectedLang}.png`, import.meta.url).href
|
||||
|
||||
const onLanguageChanged = (val) => {
|
||||
selectedLang.value = val;
|
||||
i18n.global.locale = val;
|
||||
localStorage.setItem(SELECTED_LANG, val);
|
||||
};
|
||||
|
||||
const getSrc = () => {
|
||||
// console.log("get src");
|
||||
// const path = "/src/assets/images/flags/tm.png";
|
||||
// const modules = import.meta.globEager("/src/assets/images/flags/*.{jpg,jpeg,png,svg}");
|
||||
// return modules[path].default;
|
||||
return imageAssets["/src/assets/images/flags/tm.png"].default;
|
||||
};
|
||||
|
||||
// const getImage = () => {
|
||||
// return new URL(`/src/assets/images/flags/tm.png`, import.meta.url).href
|
||||
// }
|
||||
|
||||
onBeforeMount(() => {
|
||||
const lang = localStorage.getItem(SELECTED_LANG);
|
||||
|
||||
if (lang) selectedLang.value = lang;
|
||||
else selectedLang.value = "tm";
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@ const helpers = {
|
|||
formatDate(date, format) {
|
||||
return dayjs(date).format(format);
|
||||
},
|
||||
changeDateFormat(date) {
|
||||
const dates = date.split(".");
|
||||
const day = dates[0];
|
||||
const month = dates[1];
|
||||
const year = dates[2];
|
||||
return year + "-" + month + "-" + day;
|
||||
},
|
||||
capitalizeFirstLetter(string) {
|
||||
if (string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
|
|
|
|||
|
|
@ -347,14 +347,9 @@ const onCountryChange = (value) => {
|
|||
const onRegister = async () => {
|
||||
console.log("formData.account_date: ", formData.date_of_birth);
|
||||
|
||||
const dates = formData.date_of_birth.split(".");
|
||||
const day = dates[0];
|
||||
const month = dates[1];
|
||||
const year = dates[2];
|
||||
formData.date_of_birth = $h.changeDateFormat(formData.date_of_birth);
|
||||
|
||||
formData.date_of_birth = year + "-" + month + "-" + day;
|
||||
|
||||
console.log("formData: ", formData.value);
|
||||
console.log("formData: ", formData);
|
||||
|
||||
validate.value.$touch();
|
||||
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ import { fetchWrapper } from "@/api";
|
|||
import { useRoute } from "vue-router";
|
||||
import router from "@/router";
|
||||
import _ from "lodash";
|
||||
import { helper as $h } from "@/utils/helper";
|
||||
|
||||
const baseUrl = `${import.meta.env.VITE_API_URL}/api`;
|
||||
|
||||
|
|
@ -353,13 +354,13 @@ watch(date, (currentValue, oldValue) => {
|
|||
});
|
||||
|
||||
const onRegister = async () => {
|
||||
console.log("formData.account_date: ", formData.account_date);
|
||||
formData.registration_date = $h.changeDateFormat(formData.registration_date);
|
||||
|
||||
validate.value.$touch();
|
||||
|
||||
if (validate.value.$invalid) return;
|
||||
|
||||
console.log("onRegister");
|
||||
console.log("onRegister: ", formData);
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
|
@ -393,6 +394,7 @@ onMounted(() => {
|
|||
if (params) {
|
||||
localStorage.setItem("profile", JSON.stringify(params));
|
||||
Object.assign(formData, params);
|
||||
date.value = $h.formatDate(formData.registration_date, "DD.MM.YYYY");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue