-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
177 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# 构建阶段 | ||
|
||
# 使用 bun 镜像作为构建基础镜像 | ||
FROM oven/bun:alpine AS build | ||
|
||
# 设置目录为 /app | ||
WORKDIR /app | ||
|
||
# 将 package 文件复制到镜像中 | ||
COPY package*.json ./ | ||
|
||
# 安装依赖 | ||
RUN bun install | ||
|
||
# 复制所有源代码到镜像中 | ||
COPY . . | ||
|
||
# 构建 Vue 项目 | ||
RUN bun run build | ||
|
||
# 运行阶段 | ||
|
||
# 使用 nginx 镜像作为运行时基础镜像 | ||
FROM nginx:alpine | ||
|
||
# 从构建阶段的镜像中复制构建好的静态文件到 nginx 的默认静态文件目录中 | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
# 复制自定义的 Nginx 配置文件到 Nginx 的配置目录 | ||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
|
||
# 暴露 80 端口 | ||
EXPOSE 80 | ||
|
||
# 启动 Nginx 并保持在前台运行 | ||
CMD [ "nginx", "-g", "daemon off;" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
user nginx; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
#gzip on; | ||
|
||
server { | ||
listen 80; | ||
server_name weilai.team www.weilai.team; | ||
|
||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,109 @@ | ||
<script setup lang="ts"> | ||
import { Button } from '@/components/ui/button' | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from '@/components/ui/dialog' | ||
import { Input } from '@/components/ui/input' | ||
import { Label } from '@/components/ui/label' | ||
import GetPin from './GetPin.vue' | ||
import UseLogin from '@/composables/UseLogin' | ||
import { ref } from 'vue' | ||
import { useLoginStore } from '@/store/useLoginStore' | ||
const email = ref('') | ||
const code = ref('') | ||
const password = ref('') | ||
const passwordAgin = ref('') | ||
const { useGetCode, useResetPassword } = UseLogin() | ||
const loginStore = useLoginStore() | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from "@/components/ui/dialog"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import UseLogin from "@/composables/UseLogin"; | ||
import { ref } from "vue"; | ||
import { useLoginStore } from "@/store/useLoginStore"; | ||
const email = ref(""); | ||
const code = ref(""); | ||
const password = ref(""); | ||
const passwordAgin = ref(""); | ||
const { useGetCode, useResetPassword } = UseLogin(); | ||
const loginStore = useLoginStore(); | ||
loginStore.isGetCode() | ||
loginStore.isGetCode(); | ||
const getCode = (email: string) => { | ||
useGetCode(email) | ||
} | ||
useGetCode(email); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<Dialog> | ||
<DialogTrigger as-child> | ||
<Button variant="outline" style="border: none;"> | ||
忘记密码 | ||
<Dialog> | ||
<DialogTrigger as-child> | ||
<Button variant="outline" style="border: none"> 忘记密码 </Button> | ||
</DialogTrigger> | ||
<DialogContent class="sm:max-w-[425px]"> | ||
<DialogHeader> | ||
<DialogTitle>找回密码</DialogTitle> | ||
<DialogDescription> 忘记密码?输入邮箱找回密码吧。 </DialogDescription> | ||
</DialogHeader> | ||
<div class="grid gap-4 py-4"> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="name" class="text-right"> 邮箱 </Label> | ||
<Input | ||
id="name" | ||
type="email" | ||
placeholder="请输入邮箱" | ||
class="col-span-3" | ||
v-model="email" | ||
/> | ||
</div> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="username" class="text-right"> 验证码 </Label> | ||
<div class="flex w-full max-w-sm items-center gap-1.5"> | ||
<Input | ||
id="code" | ||
placeholder="请输入验证码" | ||
style="width: 170px" | ||
v-model="code" | ||
/> | ||
<Button | ||
v-if="!loginStore.isRequesting" | ||
type="submit" | ||
@click="getCode(email)" | ||
> | ||
获取验证码 | ||
</Button> | ||
</DialogTrigger> | ||
<DialogContent class="sm:max-w-[425px]"> | ||
<DialogHeader> | ||
<DialogTitle>找回密码</DialogTitle> | ||
<DialogDescription> | ||
忘记密码?输入邮箱找回密码吧。 | ||
</DialogDescription> | ||
</DialogHeader> | ||
<div class="grid gap-4 py-4"> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="name" class="text-right"> | ||
邮箱 | ||
</Label> | ||
<Input id="name" type="email" placeholder="请输入邮箱" class="col-span-3" v-model="email" /> | ||
</div> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="username" class="text-right"> | ||
验证码 | ||
</Label> | ||
<div class="flex w-full max-w-sm items-center gap-1.5"> | ||
<Input id="code" placeholder="请输入验证码" style="width: 170px;" v-model="code" /> | ||
<Button v-if="!loginStore.isRequesting" type="submit" @click="getCode(email)"> | ||
获取验证码 | ||
</Button> | ||
<Button v-if="loginStore.isRequesting" disabled>{{ loginStore.countdown }}s后重新发送</Button> | ||
</div> | ||
</div> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="username" class="text-right"> | ||
密码 | ||
</Label> | ||
<Input id="password" type="password" placeholder="请输入密码" class="col-span-3" | ||
v-model="passwordAgin" /> | ||
</div> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="username" class="text-right"> | ||
确认密码 | ||
</Label> | ||
<Input id="password" type="password" placeholder="请再次输入密码" class="col-span-3" v-model="password" /> | ||
</div> | ||
</div> | ||
<DialogFooter> | ||
<Button type="submit" @click="useResetPassword(email, code, password, passwordAgin)"> | ||
确认 | ||
</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
<Button v-if="loginStore.isRequesting" disabled | ||
>{{ loginStore.countdown }}s后重新发送</Button | ||
> | ||
</div> | ||
</div> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="username" class="text-right"> 密码 </Label> | ||
<Input | ||
id="password" | ||
type="password" | ||
placeholder="请输入密码" | ||
class="col-span-3" | ||
v-model="passwordAgin" | ||
/> | ||
</div> | ||
<div class="grid grid-cols-4 items-center gap-4"> | ||
<Label for="username" class="text-right"> 确认密码 </Label> | ||
<Input | ||
id="password" | ||
type="password" | ||
placeholder="请再次输入密码" | ||
class="col-span-3" | ||
v-model="password" | ||
/> | ||
</div> | ||
</div> | ||
<DialogFooter> | ||
<Button | ||
type="submit" | ||
@click="useResetPassword(email, code, password, passwordAgin)" | ||
> | ||
确认 | ||
</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
</template> | ||
<style> | ||
#radix-vue-dialog-content-v-0 { | ||
background-color: #fff; | ||
background-color: #fff; | ||
} | ||
</style> | ||
</style> |