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

View file

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