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

View File

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