fixed faq bugs

This commit is contained in:
HAM!DREZA
2024-07-02 18:19:51 +03:30
parent a8e723ddf0
commit d2f71b6b14
21 changed files with 205 additions and 307 deletions
+4 -6
View File
@@ -133,7 +133,7 @@
<p
class="text-[3.59vw] md:text-[1.055vw] font-[600] text-[#383E43]"
>
{{ tickets?.data.value.length }}
{{ tickets?.data.value.result.length }}
تیکت
</p>
<p
@@ -361,8 +361,8 @@
<div class="flex justify-center items-center flex-col mt-[1.823vw]">
<img
v-if="profileImage"
:src="profileImage"
v-if="authUser.avatarMedia"
:src="authUser.avatarMedia"
class="h-[27.949vw] md:h-[7.24vw] w-[27.949vw] md:w-[7.24vw] rounded-full"
alt=""
/>
@@ -518,10 +518,8 @@
<script setup>
const profileImage = useState('profileImage')
const tickets = await useFetch("/api/ticket/getTickets");
console.log('tick',tickets.data);
const lastTickets = tickets?.data?.value.slice(-2);
const lastTickets = tickets?.data?.value.result.slice(-2);
const myCourses = await useFetch("/api/auth/me");
const lastCourses = myCourses.data?.value.course.slice(-2);
const balance = await useFetch("/api/user/balance");
+8 -15
View File
@@ -2,8 +2,8 @@
<div class="flex justify-between flex-col text-[#383E43]">
<div class="relative">
<img
v-if="profileImage"
:src="profileImage"
v-if="authUser.avatarMedia"
:src="authUser.avatarMedia"
class="w-[40.256vw] md:w-[8.177vw] h-[40.256vw] md:h-[8.177vw] rounded-[50%]"
alt="profile"
/>
@@ -153,8 +153,6 @@
<script setup>
const profileName = useState('profileName')
const profileImage = useState('profileImage')
import { useToast } from "vue-toastification";
const toast = useToast();
const { authUser } = useAuth();
@@ -162,11 +160,7 @@ const loading = ref(false);
const {data, refresh} = await useFetch('/api/auth/me')
const edit = async (formData) => {
if (formData.name !== authUser.value.name) {
profileName.value = formData.name
}
authUser.value.name = formData.name
try {
loading.value = true;
await $fetch("/api/user/update", {
@@ -184,27 +178,26 @@ const edit = async (formData) => {
};
//const token = getCookie(event, 'token');
async function changePhoto(val) {
const formData = new FormData();
formData.append("directoryName", "test");
formData.append("directoryName", "profileImage");
formData.append("file", val.target.files[0]);
const data = await useFetch("/api/uploader", {
method: "POST",
body: formData,
});
if (data.data.value.url) {
console.log('done');
await $fetch("/api/user/update", {
method: "PUT",
body: {
avatarMedia: data.data.value.url
},
});
profileImage.value = data.data.value.url
authUser.value.avatarMedia = data.data.value.url
// profileImage.value = data.data.value.url
toast.success('تصویر پروفایل تغییر کرد')
refresh()
}
}
+9 -8
View File
@@ -17,7 +17,7 @@
<div class="flex flex-col flex-col-reverse pb-[10vw]">
<ul
class="space-y-[2vw] md:space-y-[0.5vw] mt-[0.5vw] border-b"
v-for="ticket in tickets"
v-for="ticket in tickets.result"
:key="ticket.id"
>
@@ -118,7 +118,7 @@
<div class="flex flex-col flex-col-reverse pb-[10vw]">
<ul
class="space-y-[2vw] md:space-y-[0.5vw] mt-[0.5vw] border-b"
v-for="ticket in tickets"
v-for="ticket in tickets.result"
:key="ticket.id"
v-show="ticket.status === 'active'"
>
@@ -212,7 +212,7 @@
<div class="flex flex-col flex-col-reverse pb-[10vw]">
<ul
class="space-y-[2vw] md:space-y-[0.5vw] mt-[0.5vw] border-b"
v-for="ticket in tickets"
v-for="ticket in tickets.result"
:key="ticket.id"
v-show="ticket.status !== 'active'"
>
@@ -383,7 +383,7 @@ const month = ref([])
const year = ref([])
const shamsi = ref([])
tickets.value.map(item =>{
tickets.value.result.map(item =>{
item = new Date(item.createdAt)
year.value.push(item.getFullYear())
month.value.push(item.getMonth() + 1)
@@ -442,13 +442,14 @@ const openTicket = async (data) => {
}
}
const {data: single, refresh: reload} = await useFetch("/api/ticket/id", {
method: "POST",
body: {
method: 'POST',
query: {
id: data,
},
});
ticketMessages.value.push(single.value);
reload()
loading.value = false;
};
const sendMessage = async (data, reload) => {
@@ -464,7 +465,7 @@ const sendMessage = async (data, reload) => {
});
content.value = "";
toast.success("تیکت جدید با موفقیت ثبت")
openTicket().reload()
openTicket().reload()
};