feat: Add Dockerfile and Docker-compose

This commit is contained in:
Shu Guang 2025-03-31 21:47:41 +08:00
parent 7148fe0846
commit acdfecc5f6
2 changed files with 34 additions and 27 deletions

View File

@ -1,9 +1,8 @@
<template> <template>
<div class="login-form"> <div class="login-form">
<div class="title"> <div class="title">
<a-avatar src="/logo.png" :size="40" /> <a-avatar src="/logo.png" :size="50" />
<span>竞赛管理系统</span> <span>竞赛管理系统</span>
</div> </div>
<a-form-model <a-form-model
layout="vertical" layout="vertical"
@ -12,7 +11,6 @@
:rules="rules" :rules="rules"
@submit="onSubmit" @submit="onSubmit"
> >
<a-form-model-item ref="sTId" prop="sTId"> <a-form-model-item ref="sTId" prop="sTId">
<a-input v-model="formData.sTId" placeholder="学号/工号"> <a-input v-model="formData.sTId" placeholder="学号/工号">
<a-icon <a-icon
@ -41,42 +39,44 @@
登录 登录
</a-button> </a-button>
</a-form-model> </a-form-model>
</div> </div>
</template> </template>
<script> <script>
import {login} from '@/api/index' import { login } from "@/api/index";
export default { export default {
name: 'Login', name: "Login",
data() { data() {
return { return {
loading: false, loading: false,
svg: '', svg: "",
formData: { formData: {
sTId: '213010127', sTId: "213010127",
password: '0127', password: "0127",
}, },
rules: { rules: {
sTId: { required: true, message: '请输入学号/工号!' }, sTId: { required: true, message: "请输入学号/工号!" },
password: { required: true, message: '请输入密码!' }, password: { required: true, message: "请输入密码!" },
}, },
}; };
}, },
methods: { methods: {
async onSubmit(e) { async onSubmit(e) {
e.preventDefault(); e.preventDefault();
try { try {
this.loading = true; this.loading = true;
await this.$refs.form.validate(); await this.$refs.form.validate();
// //
let formData = { sTId: this.formData.sTId, password: this.formData.password } let formData = {
const res= await login(formData) sTId: this.formData.sTId,
password: this.formData.password,
};
const res = await login(formData);
if (res.code == 200) { if (res.code == 200) {
window.localStorage.setItem("token",res.data)// 使 dispatch action window.localStorage.setItem("token", res.data); // 使 dispatch action
this.$store.dispatch('initUser'); this.$store.dispatch("initUser");
await this.$router.replace({ path: '/' }).catch(e => e); await this.$router.replace({ path: "/" }).catch((e) => e);
this.$message.success(`${timeFix()},欢迎回来`); this.$message.success(`${timeFix()},欢迎回来`);
} else { } else {
this.$message.error(error); this.$message.error(error);
@ -84,7 +84,6 @@ export default {
} catch (e) { } catch (e) {
this.$message.error("登录失败请检查账号或密码" || e); this.$message.error("登录失败请检查账号或密码" || e);
if (!e) return; // if (!e) return; //
} finally { } finally {
this.loading = false; this.loading = false;
} }
@ -95,7 +94,15 @@ export default {
function timeFix() { function timeFix() {
const time = new Date(); const time = new Date();
const hour = time.getHours(); const hour = time.getHours();
return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好'; return hour < 9
? "早上好"
: hour <= 11
? "上午好"
: hour <= 13
? "中午好"
: hour < 20
? "下午好"
: "晚上好";
} }
</script> </script>

View File

@ -4,7 +4,7 @@ import store from '@/store';
// 创建axios实例 // 创建axios实例
const http = axios.create({ const http = axios.create({
baseURL: 'http://js.shuguangwl.com:8887', baseURL: 'http://localhost:8887',
// 设置基础URL // 设置基础URL
}); });