add default images

This commit is contained in:
Hesabix 2025-03-21 20:09:28 +00:00
parent 9ea0f2092b
commit f870a52b5d
6 changed files with 54 additions and 43 deletions

2
.gitignore vendored
View file

@ -1,5 +1,5 @@
hesabixArchive/
hesabixBackup/ hesabixBackup/
backup/ backup/
.idea/ .idea/

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -0,0 +1 @@
<?php

View file

@ -0,0 +1 @@
<?php

View file

@ -6,39 +6,42 @@ export default defineComponent({
name: "notifications_btn", name: "notifications_btn",
data: () => ({ data: () => ({
items: [], items: [],
timeoutId: null as number | null, // برای ذخیره ID تایمر
}), }),
components: { components: {},
},
mounted() { mounted() {
this.loadData(); this.loadData();
}, },
beforeUnmount() {
// پاک کردن تایمر هنگام تخریب کامپوننت
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
},
methods: { methods: {
jump(item) { jump(item) {
axios.post('/api/notifications/read/' + item.id).then((response) => { axios.post('/api/notifications/read/' + item.id).then((response) => {
if (item.url.startsWith('http')) { if (item.url.startsWith('http')) {
window.location.href = item.url; window.location.href = item.url;
} } else {
else {
this.$router.push(item.url); this.$router.push(item.url);
} }
});
})
}, },
loadData() { loadData() {
axios.post('/api/notifications/list/new').then((response) => { axios.post('/api/notifications/list/new').then((response) => {
if (response.data.length != 0) { if (response.data.length != 0) {
this.items = response.data; this.items = response.data;
} } else {
else {
this.items = []; this.items = [];
} }
}).finally(() => {
// تنظیم تایمر جدید و ذخیره ID آن
this.timeoutId = setTimeout(this.loadData, 10000);
}); });
setTimeout(this.loadData, 10000);
} }
} }
});
})
</script> </script>
<template> <template>
@ -71,7 +74,6 @@ export default defineComponent({
prepend-icon="mdi-eye" /> prepend-icon="mdi-eye" />
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-menu> </v-menu>
</template> </template>

View file

@ -3,37 +3,45 @@ import axios from "axios";
export default { export default {
name: "icon", name: "icon",
data: ()=>{return{ data: () => {
return {
items: undefined, items: undefined,
}}, timeoutId: null, // برای ذخیره ID تایمر
};
},
created() { created() {
this.loadData() this.loadData();
},
beforeDestroy() { // یا destroyed بسته به نسخه Vue
// پاک کردن تایمر هنگام تخریب کامپوننت
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
}, },
methods: { methods: {
jump(item) { jump(item) {
axios.post('/api/notifications/read/' + item.id).then((response) => { axios.post('/api/notifications/read/' + item.id).then((response) => {
if (item.url.startsWith('http')) { if (item.url.startsWith('http')) {
window.location.href = item.url; window.location.href = item.url;
} } else {
else{
this.$router.push(item.url); this.$router.push(item.url);
} }
});
})
}, },
loadData() { loadData() {
axios.post('/api/notifications/list/new').then((response) => { axios.post('/api/notifications/list/new').then((response) => {
if (response.data.length !== 0) { if (response.data.length !== 0) {
this.items = response.data; this.items = response.data;
} } else {
else{
this.items = undefined; this.items = undefined;
} }
}).finally(() => {
// تنظیم تایمر جدید و ذخیره ID آن
this.timeoutId = setTimeout(this.loadData, 10000);
}); });
setTimeout(this.loadData, 10000); },
} },
} };
}
</script> </script>
<template> <template>
@ -74,5 +82,4 @@ export default {
</template> </template>
<style scoped> <style scoped>
</style> </style>