+
+
+
+ เวลาปัจจุบัน
+
+
+
+
+
{{ date2Thai(dateNow) }}
+
{{ timeNoew }}
+
+
+
+
+
+
+
+
+ {{ year + 543 }}
+
+
+ {{ parseInt(value + 543) }}
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
- {{ year + 543 }}
-
-
- {{ parseInt(value + 543) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ กรุณาเลือก
-
-
- กรุณาเลือก
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/PopUp.vue b/src/components/PopUp.vue
index 0d0cc37..feba530 100644
--- a/src/components/PopUp.vue
+++ b/src/components/PopUp.vue
@@ -41,7 +41,7 @@ watch(
-
+
((await getToken()) ? true : false);
+const authenticated = async () => ((await getToken()) ? true : false)
async function setAuthen(r: AuthResponse) {
- await setCookie(ACCESS_TOKEN, r.access_token, r.expires_in);
- window.location.href = "/";
+ await setCookie(ACCESS_TOKEN, r.access_token, r.expires_in)
+ window.location.href = '/'
}
async function logout() {
- await deleteCookie(ACCESS_TOKEN);
- window.location.href = "/login";
+ await deleteCookie(ACCESS_TOKEN)
+ window.location.href = '/login'
}
async function getToken() {
- return getCookie(ACCESS_TOKEN);
+ return getCookie(ACCESS_TOKEN)
}
// 2024-08-29T02:55:13.000Z
function setCookie(name: string, value: any, time: number) {
- let expires = "";
+ let expires = ''
if (time) {
- const date = new Date();
- date.setTime(date.getTime() + time * 1000);
+ const date = new Date()
+ date.setTime(date.getTime() + time * 1000)
// date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
- expires = "; expires=" + date.toUTCString();
+ expires = '; expires=' + date.toUTCString()
}
- document.cookie = name + "=" + (value || "") + expires + "; path=/";
+ document.cookie = name + '=' + (value || '') + expires + '; path=/'
}
function getCookie(name: string) {
- const nameEQ = name + "=";
- const ca = document.cookie.split(";");
+ const nameEQ = name + '='
+ const ca = document.cookie.split(';')
for (let i = 0; i < ca.length; i++) {
- let c = ca[i];
- while (c.charAt(0) == " ") c = c.substring(1, c.length);
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
+ let c = ca[i]
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length)
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length)
}
- return null;
+ return null
}
function deleteCookie(name: string) {
- document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
+ document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`
}
async function tokenParsed() {
- const token = await getCookie(ACCESS_TOKEN);
+ const token = await getCookie(ACCESS_TOKEN)
if (!token) {
- return null;
+ return null
}
- const base64Url = token.split(".")[1];
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
+ const base64Url = token.split('.')[1]
+ const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
const jsonPayload = decodeURIComponent(
window
.atob(base64)
- .split("")
+ .split('')
.map(function (c) {
- return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
})
- .join("")
- );
+ .join('')
+ )
- return JSON.parse(jsonPayload);
+ return JSON.parse(jsonPayload)
}
-export { getToken, authenticated, logout, setAuthen, tokenParsed };
+export { getToken, authenticated, logout, setAuthen, tokenParsed }
diff --git a/src/plugins/filters.ts b/src/plugins/filters.ts
index d5f1d75..04d9354 100644
--- a/src/plugins/filters.ts
+++ b/src/plugins/filters.ts
@@ -3,20 +3,18 @@
* - ไฟล์นี้จะไว้เก็บฟังก์ชันง่าย ๆ พวก Helper Functions ทั้งหลาย
*/
-
const filters = {
-
- /**
- * ฟังก์ชัน compactNumber ใช้แปลงตัวเลขยาว ๆ ให้กลายเป็นเลขสั้น ๆ แบบที่พวก Social Media ชอบใช้กัน เช่น 1,000 แปลงเป็น 1K หรือ 1,000,000 แปลงเป็น 1M
- * วิธีใช้ : {{ $filters.compactNumber(value) }}
- *
- * @param val รับค่าพารามิเตอร์เป็นตัวแปรชนิดตัวเลข
- * @returns คืนค่าเป็นตัวเลขที่แปลงค่าแล้ว
- */
- compactNumber (val: number) {
- const formatter = Intl.NumberFormat('en', { notation: 'compact'})
- return formatter.format(val)
- }
+ /**
+ * ฟังก์ชัน compactNumber ใช้แปลงตัวเลขยาว ๆ ให้กลายเป็นเลขสั้น ๆ แบบที่พวก Social Media ชอบใช้กัน เช่น 1,000 แปลงเป็น 1K หรือ 1,000,000 แปลงเป็น 1M
+ * วิธีใช้ : {{ $filters.compactNumber(value) }}
+ *
+ * @param val รับค่าพารามิเตอร์เป็นตัวแปรชนิดตัวเลข
+ * @returns คืนค่าเป็นตัวเลขที่แปลงค่าแล้ว
+ */
+ compactNumber(val: number) {
+ const formatter = Intl.NumberFormat('en', { notation: 'compact' })
+ return formatter.format(val)
+ },
}
-export default filters;
\ No newline at end of file
+export default filters
diff --git a/src/views/ErrorNotFoundPage.vue b/src/views/ErrorNotFoundPage.vue
index 1be87ac..4768349 100644
--- a/src/views/ErrorNotFoundPage.vue
+++ b/src/views/ErrorNotFoundPage.vue
@@ -1,9 +1,9 @@
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index ec75625..67a4714 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -384,7 +384,7 @@ onMounted(async () => {
v-model="model"
:options="options"
prefix="ระบุสถานที่ :"
- :rules="[(val) => !!val || 'กรุณาระบุสถานที่']"
+ :rules="[(val:string) => !!val || 'กรุณาระบุสถานที่']"
lazy-rules
@update:model-value="selectLocation()"
hide-bottom-space
@@ -401,7 +401,7 @@ onMounted(async () => {
outlined
v-model="useLocation"
label="ระบุสถานที่"
- :rules="[(val) => !!val || 'กรุณาระบุสถานที่']"
+ :rules="[(val:string) => !!val || 'กรุณาระบุสถานที่']"
lazy-rules
/>
@@ -470,9 +470,7 @@ onMounted(async () => {
{{ date2Thai(Thai) }}