From e910d252aade96ae6c515a209775b79eaad049a0 Mon Sep 17 00:00:00 2001 From: puri-ph4tt Date: Fri, 16 Feb 2024 17:27:58 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87?= =?UTF-8?q?=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2=20(support)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/support/api.support.ts | 28 +- .../00_support/components/ChatMessage.vue | 2 +- .../00_support/components/FormChat.vue | 23 +- src/modules/00_support/store/Main.ts | 431 +++++++++--------- src/modules/00_support/views/MainPage.vue | 1 + 5 files changed, 260 insertions(+), 225 deletions(-) diff --git a/src/api/support/api.support.ts b/src/api/support/api.support.ts index 68025dd..eb10a0b 100644 --- a/src/api/support/api.support.ts +++ b/src/api/support/api.support.ts @@ -1,19 +1,25 @@ -import env from "../index" +import env from "../index"; -const support = `${env.API_URL_SUPPORT}` +const support = `${env.API_URL_SUPPORT}`; export default { - supportMessageStatus: (id: string) => `${support}/issue/${id}/message-status`, + supportMessageStatus: (id: string) => `${support}/issue/${id}/message-status`, - supportMessage: (id: string, pageSize: number = 999, page: number = 1) => `${support}/issue/${id}/message?pageSize=${pageSize}&page=${page}`, + supportMessage: (id: string, pageSize: number = 999, page: number = 1) => + `${support}/issue/${id}/message?pageSize=${pageSize}&page=${page}`, - supportIssueUserId: (userId: string) => `${support}/issue?userId=${userId}`, + supportIssueUserId: (userId: string) => `${support}/issue?userId=${userId}`, - supportIssue: (pageSize: number = 999, page: number = 1) => `${support}/issue?pageSize=${pageSize}&page=${page}`, + supportIssue: (pageSize: number = 999, page: number = 1) => + `${support}/issue?pageSize=${pageSize}&page=${page}`, - supportSearchIssue: (search: string, pageSize: number = 999, page: number = 1) => `${support}/issue?pageSize=${pageSize}&page=${page}&search=${search}`, + supportSearchIssue: ( + search: string, + pageSize: number = 999, + page: number = 1 + ) => `${support}/issue?pageSize=${pageSize}&page=${page}&search=${search}`, - supportIssueCategory: `${support}/issue-category`, - supportNewIssue: `${support}/issue`, - supportSocket: `${support}`, -} + supportIssueCategory: `${support}/issue-category`, + supportNewIssue: `${support}/issue`, + supportSocket: `${new URL(support).origin}`, +}; diff --git a/src/modules/00_support/components/ChatMessage.vue b/src/modules/00_support/components/ChatMessage.vue index d415a54..6697a63 100644 --- a/src/modules/00_support/components/ChatMessage.vue +++ b/src/modules/00_support/components/ChatMessage.vue @@ -10,7 +10,7 @@ function dateChat(timestamp: string) { const diff = moment().diff(parsedTimestamp); if (diff < 86400000) { - const formattedDate = parsedTimestamp.format("HH:mm:") + " น."; + const formattedDate = parsedTimestamp.format("HH:mm") + " น."; return formattedDate; } else { const beYear = parsedTimestamp.year() + 543; diff --git a/src/modules/00_support/components/FormChat.vue b/src/modules/00_support/components/FormChat.vue index faef73f..b2a698d 100644 --- a/src/modules/00_support/components/FormChat.vue +++ b/src/modules/00_support/components/FormChat.vue @@ -2,10 +2,12 @@ import { ref } from "vue"; import { storeToRefs } from "pinia"; import { useSupportStore } from "@/modules/00_support/store/Main"; +import { useCounterMixin } from "@/stores/mixin"; import ChatMessage from "@/modules/00_support/components/ChatMessage.vue"; const store = useSupportStore(); const content = ref(""); +const { date2Thai } = useCounterMixin(); const { scrollContainer } = storeToRefs(store); function getOnlineStatus(option: "icon" | "status") { @@ -13,6 +15,11 @@ function getOnlineStatus(option: "icon" | "status") { if (option === "icon") return isAdmin ? "green" : "grey"; if (option === "status") return isAdmin ? "ออนไลน์" : "ออฟไลน์"; } + +const thaiOptions: Intl.DateTimeFormatOptions = { + hour: "2-digit", + minute: "2-digit", +};