From e69022b6ae5ecfa53f2f2c6a96873e3634aeb671 Mon Sep 17 00:00:00 2001
From: Arth <65160206@go.buu.ac.th>
Date: Thu, 27 Mar 2025 18:25:16 +0700
Subject: [PATCH] fix image login

---
 Dockerfile                           |  17 ++++++++++++++---
 npm                                  |   0
 {src/assets => public/img}/human.png | Bin
 src/views/LoginView.vue              |  27 +++++++++------------------
 vite.config.ts                       |   7 ++-----
 5 files changed, 25 insertions(+), 26 deletions(-)
 create mode 100644 npm
 rename {src/assets => public/img}/human.png (100%)

diff --git a/Dockerfile b/Dockerfile
index cccbb4a..2c0fcb4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,19 +1,30 @@
-# Build stage
+# 👉 Build stage
 FROM node:18 AS builder
+
 WORKDIR /app
 
+# ติดตั้ง dependencies
 COPY package*.json ./
 RUN npm install
 
+# คัดลอก source code ทั้งหมด
 COPY . .
+
+# สร้าง production build
 RUN npm run build
 
-# Production stage
+# 👉 Production stage
 FROM nginx:stable-alpine
+
+# คัดลอกไฟล์ที่ build แล้ว ไปยัง nginx
 COPY --from=builder /app/dist /usr/share/nginx/html
 
-# copy nginx config if needed (optional)
+# คัดลอก public folder เข้าไปด้วย (เผื่อมีรูปหรือ static อื่นๆ)
+COPY public /usr/share/nginx/html
+
+# 🔧 (ถ้ามี custom nginx config)
 # COPY nginx.conf /etc/nginx/nginx.conf
 
 EXPOSE 80
+
 CMD ["nginx", "-g", "daemon off;"]
diff --git a/npm b/npm
new file mode 100644
index 0000000..e69de29
diff --git a/src/assets/human.png b/public/img/human.png
similarity index 100%
rename from src/assets/human.png
rename to public/img/human.png
diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue
index 78ef34f..97cfb9d 100644
--- a/src/views/LoginView.vue
+++ b/src/views/LoginView.vue
@@ -29,26 +29,15 @@ const onSubmit = async () => {
 
       <!-- Login Form -->
       <form>
-        <v-img src="\src\assets\human.png" height="100"></v-img>
+        <v-img src="./img/human.png" height="100"></v-img>
         <br />
         <v-form ref="refForm" v-model="form" @submit.prevent="onSubmit">
-          <v-text-field
-            v-model="email"
-            :rules="[required]"
-            density="compact"
-            placeholder="User"
-            prepend-inner-icon="mdi-account"
-          ></v-text-field>
-          <v-text-field
-            v-model="password"
-            :append-inner-icon="visible ? 'mdi-eye-off' : 'mdi-eye'"
-            :type="visible ? 'text' : 'password'"
-            density="compact"
-            placeholder="Enter your password"
-            prepend-inner-icon="mdi-lock-outline"
-            :rules="[(v) => !!v || 'Field is required']"
-            @click:append-inner="visible = !visible"
-          ></v-text-field>
+          <v-text-field v-model="email" :rules="[required]" density="compact" placeholder="User"
+            prepend-inner-icon="mdi-account"></v-text-field>
+          <v-text-field v-model="password" :append-inner-icon="visible ? 'mdi-eye-off' : 'mdi-eye'"
+            :type="visible ? 'text' : 'password'" density="compact" placeholder="Enter your password"
+            prepend-inner-icon="mdi-lock-outline" :rules="[(v) => !!v || 'Field is required']"
+            @click:append-inner="visible = !visible"></v-text-field>
 
           <br />
 
@@ -275,6 +264,7 @@ input[type='text']::placeholder {
 .underlineHover:hover:after {
   width: 100%;
 }
+
 *:focus {
   outline: none;
 }
@@ -286,5 +276,6 @@ input[type='text']::placeholder {
 * {
   box-sizing: border-box;
 }
+
 /* text field */
 </style>
diff --git a/vite.config.ts b/vite.config.ts
index 36c6187..6f051d9 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,15 +1,12 @@
 import { fileURLToPath, URL } from 'node:url'
-
 import { defineConfig } from 'vite'
 import vue from '@vitejs/plugin-vue'
 import vueJsx from '@vitejs/plugin-vue-jsx'
 
 // https://vitejs.dev/config/
 export default defineConfig({
-  plugins: [
-    vue(),
-    vueJsx(),
-  ],
+  base: './', // ← เพิ่มบรรทัดนี้
+  plugins: [vue(), vueJsx()],
   resolve: {
     alias: {
       '@': fileURLToPath(new URL('./src', import.meta.url))
-- 
GitLab