diff --git a/app.vue b/app.vue index f19ff5a..3784797 100644 --- a/app.vue +++ b/app.vue @@ -2,6 +2,23 @@ - +
+ +
+ + \ No newline at end of file diff --git a/components/Card.vue b/components/Card.vue index 846d334..1bc6bd8 100644 --- a/components/Card.vue +++ b/components/Card.vue @@ -92,7 +92,7 @@
- شروع دوره - {{props.course.satisfactionLevel}} + {{props.course.averageRating}}
@@ -141,9 +141,7 @@ \ No newline at end of file diff --git a/components/product-page/course-details/Course-status.vue b/components/product-page/course-details/Course-status.vue index 1410178..a36dd7a 100644 --- a/components/product-page/course-details/Course-status.vue +++ b/components/product-page/course-details/Course-status.vue @@ -61,8 +61,9 @@ class="mt-[3vw] md:mt-[0.7vw] h-[2.051vw] md:h-[0.521vw] rounded-[2vw] md:rounded-[0.521vw]" >
@@ -74,6 +75,8 @@ \ No newline at end of file diff --git a/components/product-page/course-details/Header.vue b/components/product-page/course-details/Header.vue index 9e7f790..e24fe37 100644 --- a/components/product-page/course-details/Header.vue +++ b/components/product-page/course-details/Header.vue @@ -1,201 +1,215 @@ \ No newline at end of file diff --git a/components/product-page/course-details/Headlines.vue b/components/product-page/course-details/Headlines.vue index b8872cd..dace78c 100644 --- a/components/product-page/course-details/Headlines.vue +++ b/components/product-page/course-details/Headlines.vue @@ -18,18 +18,21 @@ >
-
-
+
- 1 + {{ props.props.courseHeadlines.indexOf(headline)+1 }} -

HTML چیست؟

+

{{ headline.headline }}

- -
-
- - 1 - -

HTML چیست؟

-
- - -
+
-
-
- - 1 - -

HTML چیست؟

-
- -
- - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/pages/account/tickets.vue b/pages/account/tickets.vue index 7e8e501..fa6bb84 100644 --- a/pages/account/tickets.vue +++ b/pages/account/tickets.vue @@ -17,20 +17,28 @@
    -
  • -

    + + +

    + class="basis-2/6 text-[3.59vw] md:text-[0.938vw] text-[#383E43]"> {{ ticket.subject }}

    -

    - {{ ticket.createdAt }} + + +

    + {{item[2]}} / {{item[1]}} / {{item[0]}}

    -
    + + +
    + +
@@ -79,6 +79,35 @@ diff --git a/pages/terms-conditions/index.vue b/pages/terms-conditions/index.vue index 2163d24..b9b91e6 100644 --- a/pages/terms-conditions/index.vue +++ b/pages/terms-conditions/index.vue @@ -269,4 +269,11 @@
- \ No newline at end of file + + + + + \ No newline at end of file diff --git a/server/api/comments/sendcomment.js b/server/api/comments/sendcomment.js new file mode 100644 index 0000000..0df3869 --- /dev/null +++ b/server/api/comments/sendcomment.js @@ -0,0 +1,25 @@ +export default defineEventHandler(async (event) => { + const { public: { apiBase } } = useRuntimeConfig(); + const token = getCookie(event, 'token'); + const body = await readBody(event); + const query = getQuery(event); + console.log('c s',body); + console.log(query); + + try { + const data = await $fetch(`${apiBase}/course/${query.id}/comment`, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Authorization': `Bearer ${token}` + }, + body + }); + console.log('ser com', data); + return data; + } catch (error) { + + return error; + } + +}) \ No newline at end of file diff --git a/server/api/course.js b/server/api/course.js index a397958..9932f3b 100644 --- a/server/api/course.js +++ b/server/api/course.js @@ -6,8 +6,9 @@ export default defineEventHandler(async (event) => { let page = query.hasOwnProperty('page') ? `page=${query.page}` : ''; // let sortBy = query.hasOwnProperty('sortBy') ? `price=${query.price}` : ''; let price = query.hasOwnProperty('price') ? `price=${query.price}` : ''; + let name = query.hasOwnProperty('name') ? `name=${query.name}` : ''; try { - const data = await $fetch(`${apiBase}/course?${category}&${page}&pageSize=2&${price}`, { + const data = await $fetch(`${apiBase}/course?${category}&${page}&pageSize=2&${price}&${name}`, { method: 'GET', headers: { 'Accept': 'application/json', @@ -17,7 +18,6 @@ export default defineEventHandler(async (event) => { }); return data; } catch (error) { - console.log('err :', error); return error; } diff --git a/server/api/courseHeadlines.js b/server/api/courseHeadlines.js new file mode 100644 index 0000000..b407851 --- /dev/null +++ b/server/api/courseHeadlines.js @@ -0,0 +1,24 @@ +export default defineEventHandler(async (event) => { + const { public: { apiBase } } = useRuntimeConfig(); + + const query = getQuery(event); + + + // let page = query.hasOwnProperty('page') ? `page=${query.page}` : ''; +// // let sortBy = query.hasOwnProperty('sortBy') ? `price=${query.price}` : ''; +// let price = query.hasOwnProperty('price') ? `price=${query.price}` : ''; + try { + const courseHeadline = await $fetch(`${apiBase}/courseHeadline?courseId=${query.id}`, { + method: 'GET', + headers: { + 'Accept': 'application/json', + 'content-type': 'application/json' + } + }); + console.log(courseHeadline); + return courseHeadline; + } catch (error) { + return error; + } + +}); \ No newline at end of file diff --git a/server/api/uploader.post.js b/server/api/uploader.post.js new file mode 100644 index 0000000..42478ed --- /dev/null +++ b/server/api/uploader.post.js @@ -0,0 +1,34 @@ +export default defineEventHandler(async (event) => { + const { public: { apiBase } } = useRuntimeConfig(); + const token = getCookie(event, 'token'); + const body = await readBody(event); + console.log(body); + try { + const data = await $fetch(`${apiBase}/uploader`, { + method: 'POST', + headers: { + // 'Accept': 'multipart/form-data', + 'Content-Type': 'multipart/form-data', + 'Authorization': `Bearer ${token}` + }, + body: { + file: body.file, + directoryName: body.directoryName + } + }); + console.log('uploader data', data); + return data; + } catch (error) { + console.log(error.data); + // if (error.statusCode == 401) { + // setCookie(event, 'token', '', { + // httpOnly: true, + // secure: true, + // maxAge: new Date(0), + // path: '/' + // }) + // } + return error; + } + +}) \ No newline at end of file diff --git a/server/api/user/add.post.js b/server/api/user/add.post.js new file mode 100644 index 0000000..f1cca68 --- /dev/null +++ b/server/api/user/add.post.js @@ -0,0 +1,21 @@ +export default defineEventHandler(async (event) => { + const { public: { apiBase } } = useRuntimeConfig(); + const token = getCookie(event, 'token'); + const body = await readBody(event); + console.log(body); + try { + const data = await $fetch(`${apiBase}/user/add`, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Authorization': `Bearer ${token}` + }, + body + }); + return data; + } catch (error) { + + return error; + } + +}) \ No newline at end of file diff --git a/server/api/user/balance.get.js b/server/api/user/balance.get.js new file mode 100644 index 0000000..8f1461d --- /dev/null +++ b/server/api/user/balance.get.js @@ -0,0 +1,19 @@ +export default defineEventHandler(async (event) => { + const { public: { apiBase } } = useRuntimeConfig(); + const token = getCookie(event, 'token'); + try { + const data = await $fetch(`${apiBase}/user/balance`, { + method: 'GET', + headers: { + 'Accept': 'application/json', + 'Authorization': `Bearer ${token}` + }, + }); + + return data; + } catch (error) { + + return error; + } + +}) \ No newline at end of file diff --git a/utils/jalali.js b/utils/jalali.js new file mode 100644 index 0000000..6d4e09f --- /dev/null +++ b/utils/jalali.js @@ -0,0 +1,32 @@ +function gregorian_to_jalali(gy, gm, gd) { + + var g_d_m, jy, jm, jd, gy2, days; + g_d_m = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; + gy2 = gm > 2 ? gy + 1 : gy; + days = + 355666 + + 365 * gy + + ~~((gy2 + 3) / 4) - + ~~((gy2 + 99) / 100) + + ~~((gy2 + 399) / 400) + + gd + + g_d_m[gm - 1]; + jy = -1595 + 33 * ~~(days / 12053); + days %= 12053; + jy += 4 * ~~(days / 1461); + days %= 1461; + if (days > 365) { + jy += ~~((days - 1) / 365); + days = (days - 1) % 365; + } + if (days < 186) { + jm = 1 + ~~(days / 31); + jd = 1 + (days % 31); + } else { + jm = 7 + ~~((days - 186) / 30); + jd = 1 + ((days - 186) % 30); + } + return [jy, jm, jd]; + } + + export {gregorian_to_jalali} \ No newline at end of file